![]() |
NPC Despawn after enter new area?
It is possible that a NPC despawn when it enter a new area or arrive a special coordinate/place?
|
sure,
for example when u use a MoveTo or WayPoints u can check when it arrives and issue a Despawn() or when it comes near some coordinates what exactly do u need / want to do? |
it would be nice when u can post here an example for the ai code I already searched in the ai.obj for an example (like an npc that already has the ai) but i didn't found anything
|
EventHandler OUT_OF_TERRITORY()
{ Despawn(); } that was hard |
here are some example NASC scripts
despawn when leaving own territory: [php:1:9f40e1ee71]. EventHandler OUT_OF_TERRITORY() { Despawn(); } [/php:1:9f40e1ee71] ok, and now two variants that will disappear on last waypoint both examples have to use the warrior_patrol as superclass immediate despawn on last waypoint: [php:1:9f40e1ee71]. EventHandler MOVE_TO_WAYPOINT_FINISHED(way_point_index, next_way_point_index) { if (next_way_point_index == 0) Despawn(); super; } [/php:1:9f40e1ee71] despawn after the waypoint-delay on last waypoint: [php:1:9f40e1ee71]. EventHandler TIMER_FIRED_EX(timer_id) { if (timer_id == 100001 && myself.i_ai1 == 0) Despawn(); super; } [/php:1:9f40e1ee71] |
thanks :)
|
another little question
it is possible to define parameters for waypoints direct in the ai code? like something class guard_patrol : guard { parameter: string WayPointsType WayPoints = "5443;2432;-300"; string WayPointDelaysType WayPointDelays = "5sec"; i know this is not working ^^ but I hope u know what i mean and you can help me |
i know what u mean,
but i guess that this will not work try it ^^ have not tried this before, because i use the same ai for multiple monsters and i need to set the (different) waypoints for each of them, so defining them inside the ai was not really useful for me ;) |
Quote:
You could define an "standard territory control" on super class, and then you have to define territory on AI for each class that "inherits" that super class. It can be done, but it's a tedious work, because you have to make sure that all inherited classes have their own territory and waypoints, because if they dont, the moment they summon, if they aren't in the "superclass" defined territory, it will spawn and despawn in less than a second. I think is posible. Oso |
| All times are GMT. The time now is 21:42. |