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
Warping different frequencies different places in python

 
Post new topic   Reply to topic Printable version
 View previous topic  Massive Spec Post :: Post bombs are useless ...bad  View next topic  
Author Message
xsp0rtsfanx
Seasoned Helper


Age:36
Gender:Gender:Male
Joined: Dec 27 2004
Posts: 168
Location: California
Offline

PostPosted: Sun Apr 15, 2007 7:39 pm    Post subject: Warping different frequencies different places in python Reply to topic Reply with quote

I've tried a few things and I figured that the code below would work, but it isn't. Could someone help me out here? icon_smile.gif

Code: Show/Hide

if p.freq == 0:
   game.WarpTo(p.arena, 376, 512)
elif p.freq == 1:
   game.WarpTo(p.arena, 640, 512)
Back to top
View users profile Send private message Add User to Ignore List MSN Messenger
tcsoccerman
Server Help Squatter


Age:33
Gender:Gender:Male
Joined: Jan 15 2007
Posts: 694
Location: Atlantis
Offline

PostPosted: Sun Apr 15, 2007 7:54 pm    Post subject: Reply to topic Reply with quote

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
View users profile Send private message Add User to Ignore List Send email AIM Address
Mine GO BOOM
Hunch Hunch
What What
Hunch Hunch<br>What What


Age:41
Gender:Gender:Male
Joined: Aug 01 2002
Posts: 3615
Location: Las Vegas
Offline

PostPosted: Sun Apr 15, 2007 8:00 pm    Post subject: Re: Warping different frequencies different places in python Reply to topic Reply with quote

xsp0rtsfanx wrote:
game.WarpTo(p.arena, 376, 512)

Why is your target p.arena and not just p?
Back to top
View users profile Send private message Add User to Ignore List Send email
xsp0rtsfanx
Seasoned Helper


Age:36
Gender:Gender:Male
Joined: Dec 27 2004
Posts: 168
Location: California
Offline

PostPosted: Sun Apr 15, 2007 8:03 pm    Post subject: Reply to topic Reply with quote

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
View users profile Send private message Add User to Ignore List MSN Messenger
tcsoccerman
Server Help Squatter


Age:33
Gender:Gender:Male
Joined: Jan 15 2007
Posts: 694
Location: Atlantis
Offline

PostPosted: Sun Apr 15, 2007 8:07 pm    Post subject: Reply to topic Reply with quote

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
View users profile Send private message Add User to Ignore List Send email AIM Address
xsp0rtsfanx
Seasoned Helper


Age:36
Gender:Gender:Male
Joined: Dec 27 2004
Posts: 168
Location: California
Offline

PostPosted: Sun Apr 15, 2007 8:17 pm    Post subject: Reply to topic Reply with quote

Code: Show/Hide
balls.PlaceBall(arena, 512, 512)


thats the code. I had it at p.arena and removed arena. neither worked.
Back to top
View users profile Send private message Add User to Ignore List MSN Messenger
BDwinsAlt
Agurus's Posse


Age:34
Gender:Gender:Male
Joined: Jun 16 2003
Posts: 1145
Location: Alabama
Offline

PostPosted: Sun Apr 15, 2007 11:22 pm    Post subject: Reply to topic Reply with quote

Does this help?

Code: Show/Hide

def c_centerball(cmd, params, p, targ):

    bd = balldata()

    bd.state = BALL_ONMAP

    bd.x = bd.y = 8200

    bd.xspeed = bd.yspeed = 0

    bd.carrier = None

    bd.time = current_ticks()

    ball.PlaceBall(p.arena, 0, bd)

    chat.SendMessage(p, "Ball centered.")
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address Yahoo Messenger MSN Messenger
xsp0rtsfanx
Seasoned Helper


Age:36
Gender:Gender:Male
Joined: Dec 27 2004
Posts: 168
Location: California
Offline

PostPosted: Sun Apr 15, 2007 11:28 pm    Post subject: Reply to topic Reply with quote

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
View users profile Send private message Add User to Ignore List MSN Messenger
Animate Dreams
Gotta buy them all!
(Consumer whore)


Age:37
Gender:Gender:Male
Joined: May 01 2004
Posts: 821
Location: Middle Tennessee
Offline

PostPosted: Mon Apr 16, 2007 1:53 am    Post subject: Reply to topic Reply with quote

If you're still trying to warp entire frequencies, let me show you how I do it in C:

Code: Show/Hide
    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
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address MSN Messenger
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Mon Apr 16, 2007 4:55 am    Post subject: Reply to topic Reply with quote

Python is a little different when it comes to using Target. To warp an entire freq you can do:
Code: Show/Hide
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.
Code: Show/Hide
# 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
View users profile Send private message Add User to Ignore List Visit posters website MSN Messenger
BDwinsAlt
Agurus's Posse


Age:34
Gender:Gender:Male
Joined: Jun 16 2003
Posts: 1145
Location: Alabama
Offline

PostPosted: Mon Apr 16, 2007 7:33 pm    Post subject: Reply to topic Reply with quote

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
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> ASSS Questions All times are GMT - 5 Hours
Page 1 of 1

 
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: 16 page(s) served in previous 5 minutes.

phpBB Created this page in 0.432527 seconds : 35 queries executed (92.6%): GZIP compression disabled