Server Help

ASSS Questions - Fake player positions

tcsoccerman - 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:

Code: Show/Hide
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...
Bak - 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
Code: Show/Hide
pos->x = td->x;
pos->y = td->y;


to
Code: Show/Hide
pos->x = 512 * 16;
pos->y = 512 * 16;
and look near the center of the map
Dr Brain - 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.
tcsoccerman - 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.
tcsoccerman - 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?
Samapico - Sat May 03, 2008 5:18 pm
Post subject:
I looked... but not knowing anything about ASSS I didn't find anything tongue.gif
The timer thing gets executed how often?
tcsoccerman - 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.
Bak - Sat May 03, 2008 5:50 pm
Post subject:
smong?

http://wiki.minegoboom.com/index.php/Writing_Modules_In_C#Adding_Timers
tcsoccerman - 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"):

Code: Show/Hide
[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.
Smong - Thu May 08, 2008 6:17 pm
Post subject:
I don't know about your other problems but Timer() is supposed to return 1.
tcsoccerman - 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.
All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group