Server Help

Bot Questions - locking ship type with mervbot...

Anonymous - Wed Jul 09, 2003 6:54 pm
Post subject: locking ship type with mervbot...
hi, i want merv to check ship type and lock it (as the shipcheck dll does, but i unless i can get the source for this its not much use to me because i'm adding additional functionality icon_smile.gif )
currently i'm using the handleSetTeamAndShip function, and when it detects a ship change to a ship other than the one i wanted for that particular player, it private messages them with "*setship ship#". hell, i even tried a directed *setship 1 and that didnt work, so i know its not the syntax..the if structures created do in fact trigger, as evidenced by another private message sent right before the setship...i'm guessing the problem is that because their ship was just set, it cant be set again immediately, so the command is ignored by the client, as its still in the process of changing ship the first time <which of course is what triggered the attemped change back in the first place.> i've just been editing merv source for all of my changes, but for those of you more familiar with the dll export syntax, the handleSetTeamAndShip function calls makePlayerSpec, makePlayerTeam, and makePlayerShip, respectively, depending obviously on whether freq was changed, ship was changed to spec, or ship was changed to anything else. i'm thinking i may just have to wait some period of time before i send the setship, and that really wouldnt be a problem to do, but is there another way that's less of a kludge (if that's eeven the problem.) ? any input or advice would be appreciated.
Doggeti - Thu Jul 10, 2003 7:38 am
Post subject:
Why don't you use botInfo::gotEvent(BotEvent &event) in spawn.cpp? In the switch part of this funtion are all events that might happen. For your problem just look for case EVENT_PlayerShip:
There you get a pointer (*p) to the player class of the player who changed the ship, the number of his old ship and of his old team. With p->ship you have access to new shiptype of the player. You should have no problems using sendPrivate(p, "*setship #"); there.
Anonymous - Thu Jul 10, 2003 9:40 pm
Post subject: fixed
ehh writing dlls just isnt my thing, rather go straight to the source tongue.gif
i got it to work fine, it was very strange, i guess its something with messages not being sent reliably..when i send the setship before the notification that it had triggered, i had no problems. heh, go figure. i guess i'll just have to look into sending it reliably. funny thing was i took the trouble to use an std::map<Uint16,Uint32> to store each player ident and timer values <one for each shipreset>, waited 100 milliseconds, then sent the command...that worked fine so i said oh i'll lower the lapse on the timer, set it to 20 ms, fine, 5 ms, fine, took it out entirely and just put the *setship in that function and it worked. ah ha.
Doggeti - Fri Jul 11, 2003 5:38 am
Post subject:
I prefer dll's. It's easier for me and it's more flexibel.
Anonymous - Mon Jul 14, 2003 2:15 am
Post subject: well..
easier, perhaps, but definitely not as flexible as editing source itself.
Doggeti - Mon Jul 14, 2003 6:15 am
Post subject:
With flexibel i meant in game. You can load and unload the plugins when you want.
All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group