Author |
Message |
tcsoccerman Server Help Squatter
Age:33 Gender: Joined: Jan 15 2007 Posts: 694 Location: Atlantis Offline
|
Posted: Fri May 02, 2008 10:58 pm Post subject: Fake player positions |
 |
|
|
|
I'm having trouble with fake players. I can create the fake player, which shows up on the player list but i can never see it. Here is the code:
int InitializeTurrets(Arena *arena)
{
adata *ad = P_ARENA_DATA(arena, adkey);
int i;
for(i = 0;i < ad->turret_count;i++)
{
TurretData *td = &(ad->turrets[i]);
Player *fp;
char s[16];
snprintf(s, 16, "Team%d:Turret%d", td->team, i);
td->FakePlayer = fp = fake->CreateFakePlayer(s,arena,td->ship,td->team);
struct C2SPosition *pos;
lm->Log(L_INFO,"<%s> Check 1","complex_turret");
pos = &td->pos;
pos->type = C2S_POSITION;
pos->x = td->x;
pos->y = td->y;
pos->rotation = 0;
pos->xspeed = pos->yspeed = 0;
pos->status = 0;
pos->bounty = 0;
pos->energy = pos->extra.energy = 1000;
lm->Log(L_INFO,"<%s> Check 2","complex_turret");
//lets get config here
/*td->weapon = W_PROXBOMB;
pos->weapon.type = 0;
pos->weapon.level = 0;
pos->weapon.shraplevel = 0;
pos->weapon.shrap = 0;
pos->weapon.alternate = 0;*/
lm->Log(L_INFO,"<%s> Created Turret %d","complex_turret",i);
game->FakePosition(td->FakePlayer, &td->pos, 22);
}
lm->Log(L_INFO,"<%s> Initialized turrets","complex_turret");
} |
also when i do "sizeof(pos)" for arg 3 in game->FakePosition, it gives a bad packet error in game len=4.
so i need to fix the pos packet to make it "good" and imagely show the player on screen...
|
|
Back to top |
|
 |
Bak ?ls -s 0 in

Age:26 Gender: Joined: Jun 11 2004 Posts: 1826 Location: USA Offline
|
Posted: Sat May 03, 2008 3:49 am Post subject: |
 |
|
|
|
sizeof(struct C2SPosition*) is 4
sizeof(struct C2SPosition) is 22
pos is a struct C2SPosition*... do sizeof(struct C2SPosition) instead
try changing
pos->x = td->x;
pos->y = td->y; |
to pos->x = 512 * 16;
pos->y = 512 * 16; | and look near the center of the map _________________ SubSpace Discretion: A Third Generation SubSpace Client
|
|
Back to top |
|
 |
Dr Brain Flip-flopping like a wind surfer

Age:39 Gender: Joined: Dec 01 2002 Posts: 3502 Location: Hyperspace Offline
|
Posted: Sat May 03, 2008 11:24 am Post subject: |
 |
|
|
|
You need to call FakePosition in a loop, otherwise you'll only ever get 1 packet. If you load the module on arena start up, you'll never get a chance to see the turret. _________________ Hyperspace Owner
Smong> so long as 99% deaths feel lame it will always be hyperspace to me
|
|
Back to top |
|
 |
tcsoccerman Server Help Squatter
Age:33 Gender: Joined: Jan 15 2007 Posts: 694 Location: Atlantis Offline
|
Posted: Sat May 03, 2008 11:47 am Post subject: |
 |
|
|
|
Smong: That must be the problem, i was using tiles not pixels :/. td->x and td->y equaled 512.
Dr. Brain:Yes i will do a loop, but i wasn't aware that you need to keep sending packets inorder for it to stay visible. Thank You.
|
|
Back to top |
|
 |
tcsoccerman Server Help Squatter
Age:33 Gender: Joined: Jan 15 2007 Posts: 694 Location: Atlantis Offline
|
Posted: Sat May 03, 2008 12:31 pm Post subject: |
 |
|
|
|
Hmmmm...
There seems to be trouble with it, as the players still aren't showing up.
Anybody care to look?
complex_turret.c - 8.14 KB
File downloaded or viewed 26 time(s)
|
|
Back to top |
|
 |
Samapico No, these DO NOT look like penises, ok?

Joined: May 08 2003 Posts: 1252 Offline
|
Posted: Sat May 03, 2008 5:18 pm Post subject: |
 |
|
|
|
I looked... but not knowing anything about ASSS I didn't find anything
The timer thing gets executed how often? _________________ (Insert a bunch of dead links here)
|
|
Back to top |
|
 |
tcsoccerman Server Help Squatter
Age:33 Gender: Joined: Jan 15 2007 Posts: 694 Location: Atlantis Offline
|
Posted: Sat May 03, 2008 5:24 pm Post subject: |
 |
|
|
|
I'm not sure. All i know is autoturret.c uses the same method, so probably enough :/.
Did you try compiling it? I get warnings when i try to compile it and it is referring to game->FakePosition...arguement 2 i think, which is a big deal.
|
|
Back to top |
|
 |
Bak ?ls -s 0 in

Age:26 Gender: Joined: Jun 11 2004 Posts: 1826 Location: USA Offline
|
|
Back to top |
|
 |
tcsoccerman Server Help Squatter
Age:33 Gender: Joined: Jan 15 2007 Posts: 694 Location: Atlantis Offline
|
Posted: Sat May 03, 2008 7:26 pm Post subject: |
 |
|
|
|
Before you posted i actually switched to timers. Initally i had timers, then switched to the callback since that's what autoturret.c had. as i said, i had already switched back again to timers.
i've gotten at least one of the fake players to display. here's the deal.
only the last turret is displayed.
for instance if i have this config file ("complex_turret.conf"):
[Main]
TurretCount=4
[Turret0]
Region=4
Team=0
Ship=1
Coordinates=512,512
[Turret1]
Region=4
Team=1
Ship=2
Coordinates=530,512
[Turret2]
Region=4
Team=0
Ship=3
Coordinates=530,530
[Turret3]
Region=4
Team=1
Ship=4
Coordinates=512,530 |
only Turret3 is displayed. They are always on freq 0, for some reason as well. if ship 4 is spider, than the ship is right, otherwise wrong. allthough they don't show up, the other 3 (turrets 0-2) are displayed in the player listbox but never are visible. when i attach to them, a turret green circle shows up where i was and nothing else.
New file
complex_turret.c - 7.98 KB
File downloaded or viewed 33 time(s)
|
|
Back to top |
|
 |
Smong Server Help Squatter

Joined: 1043048991 Posts: 0x91E Offline
|
Posted: Thu May 08, 2008 6:17 pm Post subject: |
 |
|
|
|
I don't know about your other problems but Timer() is supposed to return 1. _________________ ss news
|
|
Back to top |
|
 |
tcsoccerman Server Help Squatter
Age:33 Gender: Joined: Jan 15 2007 Posts: 694 Location: Atlantis Offline
|
Posted: Thu Jul 24, 2008 6:26 pm Post subject: |
 |
|
|
|
The problem was that the position struct declared in struct turretdata was a pointer ( or had a * infront of the variable declaration) when it wasn't an array or pointer. it's working now.
|
|
Back to top |
|
 |
|