Jump to content

ENTFLAG.CARRYINGGOAL


Recommended Posts

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?

 

Link to comment
Share on other sites

  • Moderators

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);
}

 

Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • Moderators

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".

Link to comment
Share on other sites

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.
Link to comment
Share on other sites

  • Moderators

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...