Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
Spawn Settings
Goto page 1, 2  Next
 
Post new topic   Reply to topic Printable version
 View previous topic  Turf Settings Post :: Post Equivalent template.sss?  View next topic  
Author Message
Guest



Offline

PostPosted: Sun Nov 14, 2010 9:39 pm    Post subject: Spawn Settings Reply to topic Reply with quote

I was trying to create spawn areas for more then the teams in the settings, and failed. Is it possible to do it?

I noticed that freq 6 and 7 read from freq's 2-3... and I haven't told it to do that any where, so I thought that was very odd..

Also, here is what I put in arena.conf

Code: Show/Hide

Spawn:Team0-Radius = 15

Spawn:Team0-X = 512

Spawn:Team0-Y = 512

Spawn:Team1-Radius = 15

Spawn:Team1-X = 512

Spawn:Team1-Y = 512

Spawn:Team2-Radius = 0

Spawn:Team2-X = 367

Spawn:Team2-Y = 735

Spawn:Team3-Radius = 0

Spawn:Team3-X = 656

Spawn:Team3-Y = 735

Spawn:Team4-Radius = 5

Spawn:Team4-X = 143

Spawn:Team4-Y = 543

Spawn:Team5-Radius = 5

Spawn:Team5-X = 304

Spawn:Team5-Y = 543

Spawn:Team6-Radius = 5

Spawn:Team6-X = 719

Spawn:Team6-Y = 543

Spawn:Team7-Radius = 5

Spawn:Team7-X = 880

Spawn:Team7-Y = 543

Spawn:Team8-Radius = 5

Spawn:Team8-X = 111

Spawn:Team8-Y = 927

Spawn:Team9-Radius = 5

Spawn:Team9-X = 464

Spawn:Team9-Y = 927

Spawn:Team10-Radius = 5

Spawn:Team10-X = 559

Spawn:Team10-Y = 927

Spawn:Team11-Radius = 5

Spawn:Team11-X = 912

Spawn:Team11-Y = 927
Back to top
Guest



Offline

PostPosted: Sun Nov 14, 2010 9:50 pm    Post subject: Reply to topic Reply with quote

Okay, so... I really don't understand this at all.. Freq spawns or odd, all spawn in the center but,
2, 3
6, 7
10, 11
14, 15
18, 19
22, 23
ect.. ect...
Back to top
Dr Brain
Flip-flopping like a wind surfer


Age:32
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Sun Nov 14, 2010 10:20 pm    Post subject: Reply to topic Reply with quote

You can only specify 0-3, unfortunately. After that, it wraps around. I think you can get it to wrap earlier by leaving the later ones blank.

EDIT: you can still achieve that functionality, but it involves either a custom module or custom bot. Just have it warp the player when they spawn.
_________________
Hyperspace Owner

Smong> so long as 99% deaths feel lame it will always be hyperspace to me
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
Guest



Offline

PostPosted: Sun Nov 14, 2010 11:08 pm    Post subject: Reply to topic Reply with quote

Thats what I was afraid of!!

But, it seems like a very simple module that I could probably even do myself.

I'll start working on it then ask for help if it fails, which I'm guess it will because I am not a coder tongue.gif

Here goes nothing...
Back to top
Guest



Offline

PostPosted: Sun Nov 14, 2010 11:27 pm    Post subject: Reply to topic Reply with quote

Something like this??

Code: Show/Hide

from asss import *


game = get_interface(I_GAME)

def cb_shipchange(p, newship, oldship, newfreq, oldfreq):
   if newship != SHIP_SPEC:
      if newfreq >= 2:
         game.WarpTo(p, x, y)
      else:
         game.WarpTo(p, 512, 512)
Back to top
Samapico
No, these DO NOT look like penises, ok?


Age:32
Gender:Gender:Male
Joined: May 08 2003
Posts: 1252
Location: Montreal, Canada
Offline

PostPosted: Sun Nov 14, 2010 11:59 pm    Post subject: Reply to topic Reply with quote

best way would be to send custom client settings to the players, depending on their freq... so each player has a Spawn:Team0-X and Spawn:Team0-Y setting that makes them spawn somewhere.

Not sure how to do that in python, though.

For your code, you'd also have to watch the playeraction callbacks (respawns, enter-arena, etc)... and the players would still see themselves warp at <designated spawn area> before being warped to your custom x/y location
_________________
DCME co-developer
17th Parallel Head Sysop
Subspace: The Future
Back to top
View users profile Send private message Add User to Ignore List
Guest



Offline

PostPosted: Sun Nov 14, 2010 11:59 pm    Post subject: Reply to topic Reply with quote

Okay, so what did I do wrong!?

Code: Show/Hide

from asss import *


game = get_interface(I_GAME)

def shipfreqchange(p, newship, oldship, newfreq, oldfreq):
   if newship != SHIP_SPEC:
      if newfreq >= 2:
         game.WarpTo(p, 367, 735)
      if newfreq >= 3:
         game.WarpTo(p, 656, 735)
      if newfreq >= 4:
         game.WarpTo(p, 143, 543)
      if newfreq >= 5:
         game.WarpTo(p, 304, 543)
      if newfreq >= 6:
         game.WarpTo(p, 719, 543)
      if newfreq >= 7:
         game.WarpTo(p, 880, 543)
      if newfreq >= 8:
         game.WarpTo(p, 111, 927)
      if newfreq >= 9:
         game.WarpTo(p, 464, 927)
      if newfreq >= 10:
         game.WarpTo(p, 559, 927)
      if newfreq >= 11:
         game.WarpTo(p, 912, 927)
      else:
         game.WarpTo(p, 512, 512)

def mm_attach(arena):
   arena.cwarp_ref1 = reg_callback(CB_SHIPFREQCHANGE, shipfreqchange, arena)

def mm_detach(arena):
   arena.cwarp_ref1 = None
Back to top
Guest



Offline

PostPosted: Mon Nov 15, 2010 1:03 am    Post subject: Reply to topic Reply with quote

Oh yeah, didn't think about spawning...

Code: Show/Hide

from asss import *


game = get_interface(I_GAME)

def SPAWN(p, SPAWN_AFTERDEATH, SPAWN_SHIPRESET, SPAWN_SHIPCHANGE, SPAWN_INITIAL):
   pass

def shipfreqchange(p, newship, oldship, newfreq, oldfreq):
   if newship != SHIP_SPEC:
      if newfreq >= 2:
         game.WarpTo(p, 367, 735)
      if newfreq >= 3:
         game.WarpTo(p, 656, 735)
      if newfreq >= 4:
         game.WarpTo(p, 143, 543)
      if newfreq >= 5:
         game.WarpTo(p, 304, 543)
      if newfreq >= 6:
         game.WarpTo(p, 719, 543)
      if newfreq >= 7:
         game.WarpTo(p, 880, 543)
      if newfreq >= 8:
         game.WarpTo(p, 111, 927)
      if newfreq >= 9:
         game.WarpTo(p, 464, 927)
      if newfreq >= 10:
         game.WarpTo(p, 559, 927)
      if newfreq >= 11:
         game.WarpTo(p, 912, 927)
      else:
         game.WarpTo(p, 512, 512)


def mm_attach(arena):
   arena.cwarp_ref1 = reg_callback(CB_SPAWN, shipfreqchange, arena)
   arena.cwarp_ref2 = reg_callback(CB_SHIPFREQCHANGE, shipfreqchange, arena)

def mm_detach(arena):
   arena.cwarp_ref1 = None
   arena.cwarp_ref2 = None
Back to top
Arnk Kilo Dylie
Seasoned Helper


Age:31
Gender:Gender:Male
Joined: Jul 14 2006
Posts: 108
Offline

PostPosted: Mon Nov 15, 2010 1:38 am    Post subject: Reply to topic Reply with quote

not sure what you're trying to do with your spawn callback there but it only takes one parameter which you then use boolean operators on to sort out the type of spawn

probably just along the lines of
Code: Show/Hide

def spawncb(p, type):
  if type & asss.SPAWN_AFTERDEATH > 0 or type & asss.SPAWN_SHIPCHANGE:
    thoseWarpThings


note in your last code you assigned the shipfreqchange callback function to the cb_spawn callback, probably should avoid that

if you're concerned about people getting warped from somewhere else and interfering in the small meantime, designate an out-of-play spawn box somewhere for all freqs.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Guest



Offline

PostPosted: Mon Nov 15, 2010 3:15 am    Post subject: Reply to topic Reply with quote

Okay, well I still need help, but I got the structure

Code: Show/Hide

from asss import *

##SPAWN POINTS##
spawn_points=[(356,735),(656,735),(143,543),(304,543),(719,543),(880,543),(111,927),(464,927),(559,927),(912,927)]

chat = get_interface(I_CHAT)
game = get_interface(I_GAME)

def cb_spawn(player, reason):
   if reason == SPAWN_INITIAL or reason == SPAWN_AFTERDEATH:
      chat.SendArenaMessage(arena, "Would be warping")
      game.WarpTo(p, spawn_points[p.freq][2], spawn_points[p.freq][3], spawn_points[p.freq][4], spawn_points[p.freq][5], spawn_points[p.freq][6], spawn_points[p.freq][7], spawn_points[p.freq][8], spawn_points[p.freq][9], spawn_points[p.freq][10], spawn_points[p.freq][11])


def mm_attach(arena):
   arena.cwarps_ref1 = reg_callback(CB_SPAWN, cb_spawn, arena)

def mm_detach(arena):
   arena.cwarp_ref1 = None
Back to top
Samapico
No, these DO NOT look like penises, ok?


Age:32
Gender:Gender:Male
Joined: May 08 2003
Posts: 1252
Location: Montreal, Canada
Offline

PostPosted: Mon Nov 15, 2010 9:23 am    Post subject: Reply to topic Reply with quote

The 'reason' callback parameter is a bitwise mask of many 'reasons'... example, SPAWN_INITIAL could be 1, SPAWN_FREQCHANGE could be 2, and SPAWN_SHIPCHANGE could be 4

If someone spawns because of a combination of these factors, (i.e. both ship and freq changed, somehow) the reason is the addition of both reasons (or 'reasonA OR reason B')

In C, you'd do it like: if (reason & SPAWN_INITIAL || reason & SPAWN_whatever)

Also........... I believe you'd have to warp the player whatever the reason is. So that 'if' is probably not needed.

And you haven't said what's not working in your code... does it compile? does it warp you somewhere but not the right place? Please be more specific... You don't go to the garage and say 'here's my car, fix it', do you? tongue.gif

EDIT: nevermind, I skipped a couple of posts, Arnk already said that (and it doesn't seem as if you read it icon_confused.gif )


Edit2: your warpto call makes no sense...

Your array has 10 elements (spawn_points[0] through spawn_points[9])
each of these elements consist of 2 values (x and y))
Not sure if warpto takes x and y, or if it takes a pair of values, but either way, you want to use spawn_points[p.freq] (or even spawn_points[p.freq % 10] so if someone is on freq 12, it uses the spawn for freq 2 instead of crashing the whole thing... % is modulo in C, not sure in python)
Back to top
View users profile Send private message Add User to Ignore List
Dr Brain
Flip-flopping like a wind surfer


Age:32
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Mon Nov 15, 2010 9:36 am    Post subject: Reply to topic Reply with quote

That last bit of code looks pretty good to me, except for the WarpTo call. That's way too many parameters. Based on your spawn_points definition, I think you want game.WarpTo(p, spawn_points[p.freq][0], spawn_points[p.freq][1])

You should also put a check in to make sure that p.freq is less than the length of spawn_points, with perhaps a default spawn location. This is just good error checking.

NOTE: I have not written any ASSS python modules, so there may be other issues that I'm overlooking.
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
Arnk Kilo Dylie
Seasoned Helper


Age:31
Gender:Gender:Male
Joined: Jul 14 2006
Posts: 108
Offline

PostPosted: Mon Nov 15, 2010 12:41 pm    Post subject: Reply to topic Reply with quote

The main advantage of the reason being a bitfield is that you can treat shipresets (great for a module that needs to prize prox/shrap/whatever to a ship), and true respawns differently.

For example, SPAWN_SHIPRESET traps instances where you need to prize someone prox/shrap/whatever, but only SPAWN_SHIPCHANGE and possibly SPAWN_AFTERDEATH would you desire warping someone to a spawn location. SPAWN_INITIAL is there if you only need to something when the person enters the game after leaving spec. There's no SPAWN_FREQCHANGE. It's just a convenience thing that you can use CB_SPAWN for handling shipchanges if you don't care terribly about what the old ship was.

Edit: Even though that made sense to me it looks like the actual code I implemented is different. SPAWN_SHIPRESET apparently only refers to explicit shipresets. It works out though, any time CB_SPAWN is called the person has had their ship IMPLICITLY reset, and it would be redundant to include that as a reason to check, and you would want to take care of prizes if you had prize-on-spawn.

The real reason it's a bitfield is that your ship could be reset when you're already dead thus you'd get a SPAWN_AFTERDEATH at the same time as SPAWN_SHIPRESET, same with SPAWN_SHIPCHANGE. SPAWN_INITIAL can be triggered when leaving spec but will also trigger if you enter the arena out of spec--so it's there in case you need to worry about that possibility but for warping people on spawn you also want to trap SPAWN_SHIPCHANGE.


Edit 2: I cannot stress enough you do not want to use == when comparing against CB_SPAWN reason unless you know what you are doing-- reason == SPAWN_AFTERDEATH means it will trap after the person died but not if they got shipchanged or shipreset in the middle of the respawn process.

For simply warping people to a spawn location it is probably actually sufficient to use "if reason & SPAWN_SHIPRESET == 0:" because you'd want any type of spawn to be caught EXCEPT for a shipreset which classically forces their ship to stay where it was.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Samapico
No, these DO NOT look like penises, ok?


Age:32
Gender:Gender:Male
Joined: May 08 2003
Posts: 1252
Location: Montreal, Canada
Offline

PostPosted: Mon Nov 15, 2010 12:59 pm    Post subject: Reply to topic Reply with quote

Yeah, my example was bad and I didn't have the actual possible values in front of me... And I remembered about the shipreset after posting... so yeah, you do need that if (but he's doin it wrong tongue.gif )
Back to top
View users profile Send private message Add User to Ignore List
Cheese
Wow Cheese is so helpful!


Joined: Mar 18 2007
Posts: 1012
Offline

PostPosted: Mon Nov 15, 2010 2:35 pm    Post subject: Reply to topic Reply with quote

Samapico wrote:
best way would be to send custom client settings to the players, depending on their freq... so each player has a Spawn:Team0-X and Spawn:Team0-Y setting that makes them spawn somewhere.


why did we ignore this?
_________________
SSC Distension Owner
SSCU Trench Wars Developer
Back to top
View users profile Send private message Add User to Ignore List Visit posters website AIM Address
Guest



Offline

PostPosted: Mon Nov 15, 2010 2:59 pm    Post subject: Reply to topic Reply with quote

How would I check to see if a player warped? I see the only thing in game.h is WarpTo nothing to check if the player warped..

The problem I am having is the freqs still get looped, so if you are on freq 6 and warp, you go to freq 2's redirected warping area..

What Can I do??

Code: Show/Hide


from asss import *

##SPAWN POINTS##
spawn_points=[(356,735),(656,735),(143,543),(304,543),(719,543),(880,543),(111,927),(464,927),(559,927),(912,927)]

chat = get_interface(I_CHAT)
game = get_interface(I_GAME)
cfg = get_interface(I_CONFIG)

class cwarps():
   def __init__(self, arena):
      ###self.callback1=reg_callback(CB_SPAWN, self.cb_spawn, arena)
      self.callback1=reg_callback("spawn", self.cb_spawn, arena)
      self.callback2=reg_callback(CB_GLOBALCONFIGCHANGED, self.cb_readsettings, arena)
      self.arena=arena
      self.spawn_points=spawn_points
      self.cb_readsettings()
   def remref(self):
      self.callback1=None
      self.callback2=None

   def cb_spawn(self, p, reason):
      #if reason & int(SPAWN_INITIAL) or reason & int(SPAWN_AFTERDEATH):
      if reason & int(SPAWN_INITIAL) or reason & int(SPAWN_AFTERDEATH) or reason & int(SPAWN_SHIPCHANGE):
         #chat.SendMessage(p, "Would be warping")
         #game.WarpTo(p, spawn_points[p.freq][0], spawn_points[p.freq][1])
         freq = p.freq%len(self.spawn_points)
         game.WarpTo(p, self.spawn_points[freq][0], self.spawn_points[freq][1])
         
   def cb_readsettings(self):
      i=0
      self.spawn_points=[]
      while True:
         x=cfg.GetInt(self.arena.cfg, "Spawn", "Team%s-X" % (i), 0)
         y=cfg.GetInt(self.arena.cfg, "Spawn", "Team%s-Y" % (i), 0)
         if not x or not y:
            return #setting doesn't exsists, guess we reached end of line
         self.spawn_points.append((x, y))
         i+=1

def mm_attach(arena):
   arena.cwarps_ref = cwarps(arena)

def mm_detach(arena):
   arena.cwarps_ref.remref()
   arena.cwarps_ref = None
Back to top
Dr Brain
Flip-flopping like a wind surfer


Age:32
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Mon Nov 15, 2010 5:04 pm    Post subject: Reply to topic Reply with quote

Well, the only complication I see is that you're using the same settings that Continuum receives. You might try using a different setting inside your module, and removing the Spawn:* settings from your arena. Then see if that works like you expect.
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
Samapico
No, these DO NOT look like penises, ok?


Age:32
Gender:Gender:Male
Joined: May 08 2003
Posts: 1252
Location: Montreal, Canada
Offline

PostPosted: Mon Nov 15, 2010 5:16 pm    Post subject: Reply to topic Reply with quote

Your settings are probably not read correctly, which means every player use the standard spawn:team0 to spawn:team3 settings, which means it still loops every 4 freqs.

Add some debugging in there, check if your settings are read correctly, verify the length of your spawn_points list after cb_readsettings... then check if you do call the .warpto function... etc.
Back to top
View users profile Send private message Add User to Ignore List
Guest



Offline

PostPosted: Mon Nov 15, 2010 6:16 pm    Post subject: Reply to topic Reply with quote

@ Brain

I'll try

@ Sama

It does read correctly, What I am saying is;

All the warps are going to the proper place, freqs go to the right setting, its when you press insert that it goes to the loop, because the Spawn callback only checks INTIAL / SHIPCHANGE / AFTERDEATH

If there was a callback on warps, I could check if a player that is on a certain freq warps (presses insert or prized warp) and set them back to the proper location.
Back to top
Samapico
No, these DO NOT look like penises, ok?


Age:32
Gender:Gender:Male
Joined: May 08 2003
Posts: 1252
Location: Montreal, Canada
Offline

PostPosted: Mon Nov 15, 2010 6:41 pm    Post subject: Reply to topic Reply with quote

Indeed, you can't check for people warping...



which is why:
Samapico wrote:
best way would be to send custom client settings to the players, depending on their freq... so each player has a Spawn:Team0-X and Spawn:Team0-Y setting that makes them spawn somewhere.



Or, the 'hack-it' way would be:
1) Spawn:Team0-X/Y set to, say, 10,10 (or some other unused area of the map... put a small box in there, with a safety zone, preferably.
2) Delete the Spawn:Team1, Team2, and Team3 settings so everyone spawns (or warps to) that dummy area by default
3) Use your own settings instead of Spawn:... , like CustomSpawn:Team0-X/Y, etc. so they don't interfere with Spawn:Team#..., like Brain suggested

4) Check for people in the dummy area and warp them to their respective custom spawn area.
For that, either:
a) Put a Region there, and watch for the enter region callback
OR
b) Watch the playermove callback, and check for player being in a rectangular area

Doing this will also avoid players from, say, freq 6 spawning in freq 2's spawn and staying there until the module warps them to the right place (which should be pretty fast, but it's still can be annoying).
This way, this brief spawn period will occur in a dummy safety zone for everyone instead.
Back to top
View users profile Send private message Add User to Ignore List
Cheese
Wow Cheese is so helpful!


Joined: Mar 18 2007
Posts: 1012
Offline

PostPosted: Tue Nov 16, 2010 7:10 pm    Post subject: Reply to topic Reply with quote

hack:
to detect warping, check player status for flash and no cloak
Back to top
View users profile Send private message Add User to Ignore List Visit posters website AIM Address
Arnk Kilo Dylie
Seasoned Helper


Age:31
Gender:Gender:Male
Joined: Jul 14 2006
Posts: 108
Offline

PostPosted: Wed Nov 17, 2010 12:35 pm    Post subject: Reply to topic Reply with quote

hope you don't have portals either then
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Cheese
Wow Cheese is so helpful!


Joined: Mar 18 2007
Posts: 1012
Offline

PostPosted: Wed Nov 17, 2010 1:24 pm    Post subject: Reply to topic Reply with quote

portals are warping, correct
Back to top
View users profile Send private message Add User to Ignore List Visit posters website AIM Address
Arnk Kilo Dylie
Seasoned Helper


Age:31
Gender:Gender:Male
Joined: Jul 14 2006
Posts: 108
Offline

PostPosted: Thu Nov 18, 2010 1:07 am    Post subject: Reply to topic Reply with quote

yep but not the kind of warp where you want to apply a spawn warpto on them. incidentally when you UNCLOAK you wouldn't have the cloak bit set anyway pretty sure.

of course there's a way to figure out if you used a portal but it is neither pretty nor precise
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Samapico
No, these DO NOT look like penises, ok?


Age:32
Gender:Gender:Male
Joined: May 08 2003
Posts: 1252
Location: Montreal, Canada
Offline

PostPosted: Thu Nov 18, 2010 9:08 am    Post subject: Reply to topic Reply with quote

Soooo.... back to the solution of sending custom client settings to each player then?
Back to top
View users profile Send private message Add User to Ignore List
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> ASSS Questions All times are GMT - 5 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
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
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 189 page(s) served in previous 5 minutes.

phpBB Created this page in 0.140127 seconds : 49 queries executed (54.5%): GZIP compression disabled