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
Getting a player's position?

 
Post new topic   Reply to topic Printable version
 View previous topic  SoccerGoal event not detected Post :: Post teleporting tiles is lagged  View next topic  
Author Message
tansey
Novice


Joined: Nov 03 2004
Posts: 53
Offline

PostPosted: Wed Nov 03, 2004 1:03 pm    Post subject: Getting a player's position? Reply to topic Reply with quote

In mervbot, how do I get a player's current coords. I.e. I'm trying to make it so that when player A dies, he's instantly warped to player B's location.

--tansey
Back to top
View users profile Send private message Add User to Ignore List
CypherJF
I gargle nitroglycerin


Gender:Gender:Male
Joined: Aug 14 2003
Posts: 2582
Location: USA
Offline

PostPosted: Wed Nov 03, 2004 1:41 pm    Post subject: Reply to topic Reply with quote

Assuming p is a Player object.

p.tile->x
p.tile->y

isn't it?
_________________
Performance is often the art of cheating carefully. - James Gosling
Back to top
View users profile Send private message Add User to Ignore List
50% Packetloss
Server Help Squatter


Age:40
Gender:Gender:Male
Joined: Sep 09 2003
Posts: 561
Location: Santa Clarita, California
Offline

PostPosted: Wed Nov 03, 2004 7:21 pm    Post subject: Reply to topic Reply with quote

yah, the tile location is kept in the Vector p->tile then you index into it with .x and .y. If you want the lvz coord (or pixel location) of the player its p->pos with .x and .y at the end if you want to get those values from the Vector class. So if you want to warp someone to a tile you use p->tile.x and p->tile.y
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Wed Nov 03, 2004 8:01 pm    Post subject: Reply to topic Reply with quote

That was kinda confusing, 50%.
_________________
This help is informational only. No representation is made or warranty given as to its content. User assumes all risk of use. Cyan~Fire assumes no responsibility for any loss or delay resulting from such use.
Wise men STILL seek Him.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
50% Packetloss
Server Help Squatter


Age:40
Gender:Gender:Male
Joined: Sep 09 2003
Posts: 561
Location: Santa Clarita, California
Offline

PostPosted: Wed Nov 03, 2004 11:59 pm    Post subject: Reply to topic Reply with quote

my bad

char buffer[100];
_snprintf(buffer,100,"*warpto %i %i",p->tile.x,p->tile.y);

then send it, you wont need a 100 char buffer though. I havent written code in a few months so I cant remember function names
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address
Bak
?ls -s
0 in


Age:26
Gender:Gender:Male
Joined: Jun 11 2004
Posts: 1826
Location: USA
Offline

PostPosted: Fri Nov 05, 2004 1:19 am    Post subject: Reply to topic Reply with quote

sendPrivate(p,"*warpto " + (String)otherP->tile.x + " " + (String)otherP->tile.y);
Back to top
View users profile Send private message Add User to Ignore List AIM Address
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Fri Nov 05, 2004 6:30 am    Post subject: Reply to topic Reply with quote

Your code is like, ew.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
CypherJF
I gargle nitroglycerin


Gender:Gender:Male
Joined: Aug 14 2003
Posts: 2582
Location: USA
Offline

PostPosted: Fri Nov 05, 2004 8:51 am    Post subject: Reply to topic Reply with quote

lol
Back to top
View users profile Send private message Add User to Ignore List
tansey
Novice


Joined: Nov 03 2004
Posts: 53
Offline

PostPosted: Mon Nov 08, 2004 3:28 pm    Post subject: Reply to topic Reply with quote

For some reason, it's not working. This is my playermove:
Quote:

case EVENT_PlayerMove:
{
Player *p = (Player*)event.p[0];
if( gameInProgress && (p->name == capts[0].captain->name || p->name == capts[1].captain->name))
{
sendPublic( (String)p->name + " at " + (String)(p->tile.x) + " " + (String)(p->tile.y ));
/*if( p->tile.y > 427 )
{
sendPublic( "*arena You are not allowed to leave the castle " + (String)p->name );
}*/

}
}
break;


I noticed that the commented part didn't seem to work, and tried having the bot just output players' coords when they moved, and it appears to output really strange numbers. Does anyone have an idea of what's going wrong here?

EDIT:

Update-- I think the coords are a little lagged somehow. If the player sits there, it will initially output coords that are 50-100 lower than the actual, but if he hovers there it will slowly catch up and stabilize at the actual coords. Any ideas?
Back to top
View users profile Send private message Add User to Ignore List
Mr Ekted
Movie Geek


Gender:Gender:Male
Joined: Feb 09 2004
Posts: 1379
Offline

PostPosted: Mon Nov 08, 2004 5:08 pm    Post subject: Reply to topic Reply with quote

Player position packets are only send every 100ms. The client extrapolates each player's "actual" position using the time synchornization, the x/y, and the dx,dy. The raw position you get in each packet will always be player->server + server->bot milliseconds behind the actual position.
_________________
4,691 irradiated haggis!
Back to top
View users profile Send private message Add User to Ignore List
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Mon Nov 08, 2004 7:08 pm    Post subject: Reply to topic Reply with quote

Try using a char array as a string and sprintf(). Look it up in the MSDN library.

Also, as a recommendation, just compare the player pointers instead of their names. Player pointers remain the same as long as the play stays in the arena.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
50% Packetloss
Server Help Squatter


Age:40
Gender:Gender:Male
Joined: Sep 09 2003
Posts: 561
Location: Santa Clarita, California
Offline

PostPosted: Mon Nov 08, 2004 8:01 pm    Post subject: Reply to topic Reply with quote

Inorder to recieve position packets from all the players, the bot spectates them 1 by 1 according to the last position that it recorded them at. You can reproduce the same thing with continuum by pressing the arrow keys and following a person, any person outside your radar range you will not receive position packets from. So the bot must move every position-delay (its in the settings .cfg) to hover over the player to get thier new coords. If you want the bot to just look at 1 positon then the best method is to tell(makeFlying(true)); i believe, id have to check the source code, then you can change me->pos to set the bot in a new position. If you look at the mervbot source code you can see how catid keeps track of the player the bot is spectating over and records the last time the bot recieved position packets from that player.

And yah, because data is stored in a linklist which's address is passed to the DLL, you can just store data with a pointer. But remember to set that pointer to NULL when the player leaves the arena or youll be pointing to deleted memory.

I strongly frown upon the use of the String class. It works but its slow compared to just doing it by hand or using sprintf().


BTW, did any of you see Tara Reid's breast-slip? The doctor that works on those things needs to die, just awful. Huge pancake nipples icon_sad.gif. I can link you if you want.
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address
D1st0rt
Miss Directed Wannabe


Age:37
Gender:Gender:Male
Joined: Aug 31 2003
Posts: 2247
Location: Blacksburg, VA
Offline

PostPosted: Tue Nov 09, 2004 4:40 pm    Post subject: Reply to topic Reply with quote

From what I've heard, the scars will go away in around 6 months
_________________

Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> Bot 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: 406 page(s) served in previous 5 minutes.

phpBB Created this page in 0.581377 seconds : 38 queries executed (94.8%): GZIP compression disabled