vargatom Posted July 9 Share Posted July 9 Good Evening! I would like to solve in a script that when an Axis player or a bot picks up the objective, compare every bot and players position (who hold an objective) distance to a Vector3 point position. After that, it is also necessary, when he throws the object, which Axis bot is closest to the objective. foreach(bot in BotTable) { if( GetEntTeam(ent) == TEAM.AXIS && GetEntFlags( ent, ENTFLAG.CARRYINGGOAL ) ) { if(DistanceBetween(b.GetGameEntity(player), Vector3(-1824, 2115, 4)) <= 100 ) { Util.MapDebugPrint("<= 100"); } else { Util.MapDebugPrint("> 100"); } } } In this exampleI got following error message: Quote expecting param 0 gameentity or int param. got null Quote ENTFLAG.CARRYINGGOAL works only in triggerregions? Quote Link to comment Share on other sites More sharing options...
Moderators palota Posted July 11 Moderators Share Posted July 11 for ( i = 0; i < 64; i += 1 ) { if ( EntityIsValid(i) && GetEntFlags(i, ENTFLAG.CARRYINGGOAL) ){ d = DistanceBetween(i, Vector3(-1824, 2115, 4)); Util.MapDebugPrint("Distance " + d); } } vargatom 1 Quote Link to comment Share on other sites More sharing options...
vargatom Posted July 12 Author Share Posted July 12 It works nicely. Thank you very much palota! When there's a short amount of time between dropping the object and picking it up, maybe it's counting the dead player as well? Quote Link to comment Share on other sites More sharing options...
Moderators palota Posted July 13 Moderators Share Posted July 13 It does not count dead players because dead players cannot carry anything. But you can get distance to a dropped object from a FLAGRETURN goal. foreach(g in Util.GoalTable("FLAGRETURN.*")) { d = DistanceBetween(g, Vec3(-1824, 2115, 4)); Util.MapDebugPrint("Distance " + d); } vargatom 1 Quote Link to comment Share on other sites More sharing options...
vargatom Posted July 13 Author Share Posted July 13 "FLAGRETURN.* generated is not where player have dropped object? Is distance? " Quote Link to comment Share on other sites More sharing options...
Moderators palota Posted July 13 Moderators Share Posted July 13 foreach(g in Util.GoalTable("FLAGRETURN.*")) { Util.MapDebugPrint("Position " + g.GetPosition()); } vargatom 1 Quote Link to comment Share on other sites More sharing options...
vargatom Posted July 14 Author Share Posted July 14 Scripts that return some data or value are always very useful. I'm sorry that the content of the old forum was lost because it was a treasure trove, but in my case it is necessary that when a player drop the object, a query from the bot table is run for the current position and name of the bots. The name would be necessary for the test. After that, a comparison between the position of the bots and the original position of the pick-up object (pick-up point) Then the bots with the two smallest values execute the bot.ExecCommand("kill"); command. Quote Link to comment Share on other sites More sharing options...
Moderators palota Posted July 15 Moderators Share Posted July 15 Which map is it ? Why do you want to kill bots ? Quote Link to comment Share on other sites More sharing options...
vargatom Posted July 15 Author Share Posted July 15 This map is Warbell. And the bots have to die so you don't have to wait until they get back to the object because they spawn there. So it's fastest to kill themselves and start from where The Death of Book is. Quote Link to comment Share on other sites More sharing options...
Moderators palota Posted July 16 Moderators Share Posted July 16 First of all bots should wait for respawn. You can use function bot.GetReinforceTime() and sleep until 1 second before respawn. Then you should check if the book is at its original location and nobody is carrying it. Then you kill bots that have bot.GetMapGoalName()=="FLAG_book". Quote Link to comment Share on other sites More sharing options...
vargatom Posted July 16 Author Share Posted July 16 You're right. The delay is important, we don't have to kill the bots immediately, because there will be a player who doesn't escort the object, but waits for the person carrying it to die and he be the first to pick it up at the FLAG_book goal. Crouch there on the table in the Secret Room. What do you mean delay bots respawn for 1 second? Why is bot.GetReinforceTime() needed? If Map.BookReturned = true; it means object is in original place. Quote Link to comment Share on other sites More sharing options...
Moderators palota Posted July 17 Moderators Share Posted July 17 GetReinforceTime() is needed to kill a bot just before respawn, so that the bot is actually not dead. I've already done it and committed it to SVN repository. Quote Link to comment Share on other sites More sharing options...
vargatom Posted July 17 Author Share Posted July 17 I have tested warbell.gm file but unfortunately the botToKill.ExecCommand("kill"); executed by allies only. Can it be solved that the enginer who covers the planted dinamyte does not have to die? Quote Link to comment Share on other sites More sharing options...
Moderators palota Posted July 18 Moderators Share Posted July 18 The chosen botToKill is never an engineer because botToKill has goal FLAG, but engineer has goal PLANT. vargatom 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.