![]() |
[HELP] How to make NPCs stop chasing after a certain point.
Hi,
I've finally managed to make NPCs aggro correctly, and finished my Project Gondor, it works perfectly. Thank you all for your support. However, I have a very last issue, people get NPCs to chase them and bring them to spawn point, since their AI has no movement at all (wanted to make them stand still) they don't go back to their original positions. So I was wondering, is it possible to make an NPC chase you until a certain point and after that make it come back to its original position? If that is so, can you gimme a hand here? Thank you for your help and attention. Best regards, Mike Philippe. |
Check those two :
func[InstantRandomTeleportInMyTerritory] func[InMyTerritory] |
This is not a solution for what you asked, read down
They may get stuck while trying to come back (I don't know) but try to add this to your gondor class nasc code Code:
EventHandler NO_DESIRE()Code:
handler 0 29 // NO_DESIREOK, read now xD edit: Ok, at first I did not read correctly what you wanted. What I've put up here only solves the problem once the gondor guard has nothing to (i.e. the char he was attacking too bsoed). I guess a good solution would be using the func[InMyTerritory] this way: Code:
if (myself->InMyTerritory(myself.sm)) |
I answered PyroMaker in IRC with a lot more simplier answer :D
[20:31:07] <Bloodust> if distance from current position is higher than something, move to spawn point ? [20:33:09] <Bloodust> is that possible ? |
You can check this way if (myself->InMyTerritory(myself.sm) == 0)
Code:
func_call 184615156 // func[InMyTerritory]Code:
if (myself->InMyTerritory(myself.sm) == 0)Code:
if (myself->InMyTerritory(attacker) == 0) |
This should work:
It checks every 5 seconds if it's in his territory... Remember that the territory is defined in npcpos, so if you've done a little territory for each npc you'll have to change it to the area you want it to be their territory! nasc Code:
/***************************************************************************Code:
class 1 gondor : whatever |
| All times are GMT. The time now is 16:24. |