Server Help

ASSS Questions - Powerballs

Anonymous - Mon Jan 17, 2005 1:36 am
Post subject: Powerballs
currently in the ASSS setts, you can set the powerball location, but you can only set it to 1 spawn, what happens if i want to set 1 ball at a spawn, and another ball at a different spawn?

<-currently writing a module for powerballs because i cant figure it out icon_sad.gif
Smong - Mon Jan 17, 2005 5:06 am
Post subject:
Here is some stuff from src/balls.h that should help you figure it out on your own:
Code: Show/Hide
/* called when a player scores a goal */
#define CB_GOAL "goal"
typedef void (*GoalFunc)(Arena *arena, Player *p, int bid, int x, int y);
/* pycb: arena, player, int, int, int */

struct BallData
{
   /* pytype: struct, struct BallData, balldata */
   int state; /* the state of this ball */
   int x, y, xspeed, yspeed; /* the coordinates of the ball */
   Player *carrier; /* the player that is carrying or last touched the ball */
   int freq; /* freq of carrier */
   ticks_t time; /* the time that the ball was last fired (will be 0 for
                  * balls being held). for BALL_WAITING, this time is the
                  * time when the ball will be re-spawned. */
};

   void (*PlaceBall)(Arena *arena, int bid, struct BallData *newpos);
   /* sets the parameters of the ball to those in the given BallData
    * struct */
   /* pyint: arena, int, balldata -> void */

You'll probably want to place the balls when the arena gets created and after a goal. You can use CB_ARENAACTION and CB_GOAL for this.

You may have to use a timer to move the ball, when I made golf I found that the server crashes if you move balls around too soon after an event.

If ball was a variable, you would be interested in changing ball.x and ball.y. I believe the coordinates are in pixels. bid or ball id starts at 0 and goes up to 7.

Getting the current ticks could be a problem, an oversight in pymod? Also I don't know too much py, but I reckon you could initialise the ball data with a tuple.
Quote:
ball.state = BALL_ONMAP
ball.x = 512 * 16
ball.y = 512 * 16
ball.carrier = None
ball.freq = -1
ball.time = ???

# same as(?)
ball = ( BALL_ONMAP, 512 * 16, 512 * 16, None, -1, 0 )

balls.PlaceBall(arena, bid, ball)

Anonymous - Mon Jan 17, 2005 11:34 am
Post subject:
well, grel said it probably wont be possible, so meh...lol close this if you would like
Dr Brain - Mon Jan 17, 2005 3:02 pm
Post subject:
It's not possible with the standard modules and probably wont be.

I've never let that stop me with my development of zones, and nor should it stop anyone else.
stag shot - Tue Jan 18, 2005 2:00 am
Post subject:
Well, it's been a looooong time since I dug through the balls module...But a quick look indicated you'd have to intercept at

void SpawnBall(Arena *arena, int bid)

Perhaps add custom code to check arena name or something...And of course the settings would be hardcoded, unless you wanna add new settings! It's dirty, but doable.

stag
Grelminar - Tue Jan 18, 2005 3:45 am
Post subject:
There's a much easier way than the ugly stuff all you people are suggesting: just make the spawnx, y, and radius values in the arena data in the balls module arrays, 4 elements long. then add code to read extra settings Soccer:Spawn{X,Y,Radius}{1,2,3}. Then do the same thing that cont does with the freq spawn settings: if only one is set, use it for all balls. If two are set, use 0 for the even balls and 1 for the odds. If four are set, do it mod 4.

This probably won't be enough to create your game, but it's a start, and it might be useful for others anyway.
All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group