• Specify "Who" in OnOtherKilled
    2 replies, posted
In a nextbot, if i want my bot to respond to different NPCs dying, is there a convenient way within OnOtherKilled? If i wanted my bot to say something like "Ally is down, fall back" if one of its kind is killed, but i want it to say "Enemy is down" if an enemy has been killed, is it possible to do so conveniently?
You could use local ent = ents.FindInSphere( Vector origin, number radius ) and then use something like ent:GetClass() because there isn't any arguments to OnOtherKilled I think.
The bots can run code when they themselves die right? Create your own handler for this. Edit OnKilled in your bots to call all other nextbots, as bot:OnOtherKilled(self). Then edit each bot's OnOtherKilled to include the argument. [editline]9th October 2014[/editline] If the dead NPC entity is invalid by the time the other bots need to reference it, pass the class (self:GetClass()) instead of just self. You can use the different entity names to determine who is an ally. If the bots are of the same class, send their team value you will have assigned them.
Sorry, you need to Log In to post a reply to this thread.