 |
Server Help Community forums for Subgame, ASSS, and bots
|
Author |
Message |
tcsoccerman Server Help Squatter
Age:33 Gender: Joined: Jan 15 2007 Posts: 694 Location: Atlantis Offline
|
Posted: Wed Apr 11, 2007 9:37 pm Post subject: limit ships |
 |
|
|
|
I know ut has something like this, but a module that doesn't allow you to enter ship 8 but "ESC" "8". also, a module that has team0 as 1-4, and team1 as 5-7(not ship . possible. ty. |
|
Back to top |
|
 |
Animate Dreams Gotta buy them all! (Consumer whore)

Age:37 Gender: Joined: May 01 2004 Posts: 821 Location: Middle Tennessee Offline
|
Posted: Wed Apr 11, 2007 9:43 pm Post subject: |
 |
|
|
|
You'll have to use the ShipChange callback:
mm->RegCallback(CB_SHIPCHANGE, ShipChange, arena);
Then just do something like:
local void ShipChange(Player *p, int newship, int newfreq)
{
if (newship == SHIP_SHARK;)
game->SetShip(p, SHIP_SPEC;
}
That's a bit of a dirty way to do it(for example, specced players probably won't end up on spec freq), but it should do what you want. If you want to check a player's freq, just use if (p->p_freq == 0). I'm sure you can work out the rest of it on your own. |
|
Back to top |
|
 |
Chambahs Power attack

Joined: Jun 19 2005 Posts: 820 Offline
|
Posted: Wed Apr 11, 2007 9:46 pm Post subject: |
 |
|
|
|
# wpn by Chambahs and Smong
# shark is grunt ship
# apr 11 2005 Chambahs
# apr 13 2005 Smong
# apr 15 2005 smong (bot kill bug fixed)
# jun 19 2005 smong (bigref fix)
from asss import *
chat = get_interface(I_CHAT)
game = get_interface(I_GAME)
mapdata = get_interface(I_MAPDATA)
wpn_bigref = [ None ]
wpn_bigref_count = [ 0 ]
# a list of regions and ships that they are
regions = [ ("minigun", SHIP_WARBIRD), \
("flak", SHIP_JAVELIN), \
("bio", SHIP_WEASEL), \
("rocket", SHIP_LEVIATHAN), \
("sniper", SHIP_TERRIER), \
("shock", SHIP_SPIDER), \
("tank", SHIP_LANCASTER) ]
# the default ship
defaultship = SHIP_SHARK
def make_region_timer(initial, interval):
def region_timer():
changeset = []
# for each player
def for_each(p):
# don't bother on non-wpn arenas
try:
if not p.arena.wpn_cb1: return
except: pass
# sanity checks
if p.arena and p.status == S_PLAYING and \
is_human(p) and p.ship < SHIP_SPEC:
# check regions
x = p.position[0] / 16
y = p.position[1] / 16
for rname, ship in regions:
if p.ship != ship:
rgn = mapdata.FindRegionByName(p.arena, rname)
if rgn != None and mapdata.Contains(rgn, x, y):
change = ( p, ship, x, y )
changeset.append(change)
break
for_each_player(for_each)
# change their ship outside for each player loop
for p, ship, x, y in changeset:
game.SetShip(p, ship)
game.WarpTo(p, x, y)
return 1
return set_timer(region_timer, initial, interval)
def kill(arena, killer, killed, bty, flags, pts, green):
if not is_human(killed) or killed.ship >= SHIP_SPEC:
pass
elif killed.ship != SHIP_SHARK:
game.SetShip(killed, SHIP_SHARK)
return pts, green
# freqman interface (broken?)
def InitialFreq(p, ship, freq):
ship, freq = p.arena.wpn_oldfm.InitialFreq(p, ship, freq)
if ship != SHIP_SPEC:
ship = defaultship
return ship, freq
def ShipChange(p, ship, freq):
if ship != SHIP_SPEC:
ship = defaultship
return ship, freq
def FreqChange(p, ship, freq):
if ship != SHIP_SPEC:
ship = defaultship
return ship, freq
myfm = (InitialFreq, ShipChange, FreqChange)
def mm_attach(arena):
arena.wpn_cb1 = reg_callback(CB_KILL, kill, arena)
#arena.wpn_oldfm = get_interface(I_FREQMAN, arena)
#arena.wpn_myfm = reg_interface(I_FREQMAN, myfm, arena)
# make one timer only
if wpn_bigref[0] == None:
wpn_bigref[0] = make_region_timer(500, 100)
wpn_bigref_count[0] += 1
def mm_detach(arena):
for attr in ['cb1', 'oldfm', 'myfm']:
try: delattr(arena, 'wpn_' + attr)
except: pass
wpn_bigref_count[0] -= 1
if wpn_bigref_count[0] <= 0:
wpn_bigref[0] = None
|
Thats our module, you can pick out what everything does. |
|
Back to top |
|
 |
Smong Server Help Squatter

Joined: 1043048991 Posts: 0x91E Offline
|
Posted: Thu Apr 12, 2007 2:56 pm Post subject: |
 |
|
|
|
Ehhh, I posted an updated version of my fm_shiplimits module to my website just a few days ago, here asss-fm_shiplimits-1.2.zip. Does exactly what you want. _________________ ss news  |
|
Back to top |
|
 |
tcsoccerman Server Help Squatter
Age:33 Gender: Joined: Jan 15 2007 Posts: 694 Location: Atlantis Offline
|
Posted: Thu Apr 12, 2007 6:10 pm Post subject: |
 |
|
|
|
Nice, now what if i am also using you're region triggers module, and have a ShipReset region, does that still work? |
|
Back to top |
|
 |
Smong Server Help Squatter

Joined: 1043048991 Posts: 0x91E Offline
|
Posted: Thu Apr 12, 2007 6:20 pm Post subject: |
 |
|
|
|
Should be fine. The ShipReset region is like messaging someone *shipreset, it doesn't change their ship just resets their bounty and items. |
|
Back to top |
|
 |
tcsoccerman Server Help Squatter
Age:33 Gender: Joined: Jan 15 2007 Posts: 694 Location: Atlantis Offline
|
Posted: Thu Apr 12, 2007 6:57 pm Post subject: |
 |
|
|
|
ohhhhhh. what does a ship change then? that would be nice. ty. |
|
Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
Software by php BB © php BB Group Server Load: 173 page(s) served in previous 5 minutes.
|