Author |
Message |
xsp0rtsfanx Seasoned Helper

Age:36 Gender: Joined: Dec 27 2004 Posts: 168 Location: California Offline
|
|
Back to top |
|
 |
tcsoccerman Server Help Squatter
Age:33 Gender: Joined: Jan 15 2007 Posts: 694 Location: Atlantis Offline
|
Posted: Sun Apr 15, 2007 7:54 pm Post subject: |
 |
|
|
|
can you get more in depth. is it if they go in an area, they get warped. is it spawn location, is it a command. etc. |
|
Back to top |
|
 |
Mine GO BOOM Hunch Hunch What What

Age:41 Gender: Joined: Aug 01 2002 Posts: 3615 Location: Las Vegas Offline
|
Posted: Sun Apr 15, 2007 8:00 pm Post subject: Re: Warping different frequencies different places in python |
 |
|
|
|
xsp0rtsfanx wrote: | game.WarpTo(p.arena, 376, 512) |
Why is your target p.arena and not just p? |
|
Back to top |
|
 |
xsp0rtsfanx Seasoned Helper

Age:36 Gender: Joined: Dec 27 2004 Posts: 168 Location: California Offline
|
Posted: Sun Apr 15, 2007 8:03 pm Post subject: |
 |
|
|
|
i figured it out.. and if its not p.arena i get an error. Now i have another question. I have placeball in my code.. and when i use one command to start the game i warp the players and then the ball is placed. the error i get is "TypeError: arg is not a 'balldata' " |
|
Back to top |
|
 |
tcsoccerman Server Help Squatter
Age:33 Gender: Joined: Jan 15 2007 Posts: 694 Location: Atlantis Offline
|
Posted: Sun Apr 15, 2007 8:07 pm Post subject: |
 |
|
|
|
one of the arguements is not part of balldata, which i'm guessing means there is not the right number of arguements, or not the right variable/arguement |
|
Back to top |
|
 |
xsp0rtsfanx Seasoned Helper

Age:36 Gender: Joined: Dec 27 2004 Posts: 168 Location: California Offline
|
|
Back to top |
|
 |
BDwinsAlt Agurus's Posse

Age:34 Gender: Joined: Jun 16 2003 Posts: 1145 Location: Alabama Offline
|
|
Back to top |
|
 |
xsp0rtsfanx Seasoned Helper

Age:36 Gender: Joined: Dec 27 2004 Posts: 168 Location: California Offline
|
Posted: Sun Apr 15, 2007 11:28 pm Post subject: |
 |
|
|
|
so use that for where i wanna put it? like if i have it put to 3 different spots i just run back to that same definition to get there? also i'm getting door errors on one command.. it says cfg is not a valid thing. its cfg.SetInt(stuff in here) and cfg = get_interface(I_CONFIG) up top right..?
i dont wanna make it a command.. i want to place the ball after a certain team scores a point to a certain location and another when the other scores |
|
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: Mon Apr 16, 2007 1:53 am Post subject: |
 |
|
|
|
If you're still trying to warp entire frequencies, let me show you how I do it in C:
pd->Lock(); // Lock, necessary when cycling through players
FOR_EACH_PLAYER_P(tempPlayer, zData, playerKey) // Cycles through each player, I use this to set playerdata and warp.
{
zData->died = FALSE;
if (tempPlayer->p_freq == 0) // If human...
{
t.u.p = tempPlayer;
game->WarpTo (&t, eData->humanSpawnX, eData->humanSpawnY); // Warp to human spawn.
}
else if (tempPlayer->p_freq == 1) // Repeat for Zombies.
{
t.u.p = tempPlayer;
game->WarpTo (&t, eData->zombieSpawnX, eData->zombieSpawnY);
}
}
pd->Unlock(); // End cycle and lock |
You don't have to use FOR_EACH_PLAYER_P, though, since you're not using playerdata, FOR_EACH_PLAYER will be fine. Basically, the idea is to cycle through all the players, check their freq, and warp them accordingly. I thought there would be a better way to do it, but this is the best I could come up with(well, D1 actually sent me this code).
But also, the first parameter in WarpTo is a Target, which is why you can use an arena, I guess, but that's going to warp the whole arena. The critical part of the code I showed you was "t.u.p = tempPlayer". You just use whatever player you pass into FOR_EACH_PLAYER, and put it into t.u.p. I never actually even figured out what t.u.p was, but it works for me. This shouldn't be too hard to convert to python. Hope this helps. |
|
Back to top |
|
 |
Smong Server Help Squatter

Joined: 1043048991 Posts: 0x91E Offline
|
Posted: Mon Apr 16, 2007 4:55 am Post subject: |
 |
|
|
|
Python is a little different when it comes to using Target. To warp an entire freq you can do:
game.WarpTo((arena, freq), x, y) | It's only worth using a loop to warp freqs if you're also doing other things inside the loop like setting player data.
If you didn't manage to adapt BD's code you can paste this function into your code to easily move a ball.
# xy are in tiles
# bid is ball id (0-7, depends how many balls are in the arena)
def move_ball(arena, bid, x, y):
bd = balldata()
bd.state = BALL_ONMAP
bd.x = x * 16
bd.y = y * 16
bd.xspeed = bd.yspeed= 0
bd.carrier = None
bd.freq = -1
bd.time = current_ticks()
balls.PlaceBall(arena, bid, bd) |
Make sure you are using enough parameters in your SetInt call. _________________ ss news  |
|
Back to top |
|
 |
BDwinsAlt Agurus's Posse

Age:34 Gender: Joined: Jun 16 2003 Posts: 1145 Location: Alabama Offline
|
Posted: Mon Apr 16, 2007 7:33 pm Post subject: |
 |
|
|
|
All you have to do is modify the x and y location of the ball. Use an if statement to see where it needs to go. |
|
Back to top |
|
 |
|