Blockland Forums > Suggestions & Requests
Bot StopFollowPlayer Event
Pages: (1/1)
Menderman:
What I want to do, is have a bot that kind of acts like Barney in Half-Life 1. You can tell the bot to follow you, and tell the bot to stop. So far, I have the bot following the player with the FollowPlayer event, but I can't figure out how to make the bot stop AND still be able to shoot. The only way I figured out to make the bot stop following, is to set SetBotPowered to off. However, that just turns the bot completely off.
Basically, what I want is an event that does the opposite of the FollowPlayer event.
phflack:
looks like it uses
--- Code: ---%bot.hFollowType
%bot.hKeepFollowing
%bot.hFollowingNoDamage
--- End code ---
and in the looping following code
--- Code: ---if(%obj.hFollowingNoDamage == 0 && %obj.hFollowType != 1 && %obj.hFollowType != 2)
return;
--- End code ---
so i suspect can just set all 3 values to 0 and hope it stops following?
--- Code: ---function AIPlayer::stopFollowPlayer(%bot)
{
%bot.hFollowType = 0;
%bot.hKeepFollowing = 0;
%bot.hFollowingNoDamage = 0;
}
registerOutputEvent(Bot, "StopFollowPlayer", 1);
--- End code ---
will test if i did the event syntax correctly in a bit, hopefully that works though if you put it in a server.cs in a folder in addons alongside a description.txt
Menderman:
--- Quote from: phflack on April 28, 2019, 03:42:23 AM ---
--- Code: ---function AIPlayer::stopFollowPlayer(%bot)
{
%bot.hFollowType = 0;
%bot.hKeepFollowing = 0;
%bot.hFollowingNoDamage = 0;
}
registerOutputEvent(Bot, "StopFollowPlayer", 1);
--- End code ---
--- End quote ---
I ended up doing this, and it appears to only work when the bot is focused and kills another bot. I think you're on the right track though.
BlockAlpha:
I have a different question:
could it be possible to make a script that does that the bots won't be too close to the player they follow?
phflack:
for stopping bots, i'm guessing the bot is being told to follow the player somehow then, instead of the loop being needed
in which case i guess could have a dummy bot/player and tell the bot to follow that instead for a bit, or follow itself?
--- Quote from: BlockAlpha on May 02, 2019, 03:32:20 PM ---I have a different question:
could it be possible to make a script that does that the bots won't be too close to the player they follow?
--- End quote ---
should be possible, even if not simple/straightforward/easy
Pages: (1/1)