PDA

View Full Version : NPC Despawn after enter new area?


alysia
04.04.2006, 02:10
It is possible that a NPC despawn when it enter a new area or arrive a special coordinate/place?

Xellos
04.04.2006, 05:53
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?

alysia
05.04.2006, 10:23
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

hamidouch
05.04.2006, 13:23
EventHandler OUT_OF_TERRITORY()
{
Despawn();
}


that was hard

Xellos
05.04.2006, 13:30
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]

alysia
05.04.2006, 14:33
thanks :)

alysia
06.04.2006, 19:11
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

Xellos
06.04.2006, 20:21
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 ;)

Osito2Dancer
07.04.2006, 19:20
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 ;)}
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