 |
Server Help Community forums for Subgame, ASSS, and bots
|
Author |
Message |
Chambahs Guest
Offline
|
Posted: 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  |
|
Back to top |
|
 |
Smong Server Help Squatter

Joined: 1043048991 Posts: 0x91E Offline
|
Posted: 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:
/* 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)
|
|
|
Back to top |
|
 |
Chambahs Guest
Offline
|
Posted: 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 |
|
Back to top |
|
 |
Dr Brain Flip-flopping like a wind surfer

Age:39 Gender: Joined: Dec 01 2002 Posts: 3502 Location: Hyperspace Offline
|
Posted: 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. _________________ Hyperspace Owner
Smong> so long as 99% deaths feel lame it will always be hyperspace to me |
|
Back to top |
|
 |
stag shot Newbie
Joined: Jan 18 2005 Posts: 10 Offline
|
Posted: 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 |
|
Back to top |
|
 |
Grelminar Creator of Asss
Joined: Feb 26 2003 Posts: 378 Offline
|
Posted: 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. |
|
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: 33 page(s) served in previous 5 minutes.
|