05-02-2011, 04:25 PM
Does anyone know how pathnodes work, or have an instruction video on them? I'm trying to make my monster follow a certain path, but I don't know how to make it follow the pathnodes I have placed.
(05-02-2011, 04:31 PM)Roenlond Wrote: [ -> ]void zombieactive (string &in asParent , string &in asChild , int alState)
{
SetEntityActive("zombiee", true);
AddEnemyPatrolNode("zombiee", "zombiee2", 2, "");
AddEnemyPatrolNode("zombiee", "zombiee3", 0, "");
}
Once the function zombieactive is called, my monster called "zombiee" will be set to active and start walking to the pathnode "zombiee2", wait two seconds then move to the pathnode "zombiee3".
(05-02-2011, 04:48 PM)Karai16 Wrote: [ -> ](05-02-2011, 04:31 PM)Roenlond Wrote: [ -> ]void zombieactive (string &in asParent , string &in asChild , int alState)
{
SetEntityActive("zombiee", true);
AddEnemyPatrolNode("zombiee", "zombiee2", 2, "");
AddEnemyPatrolNode("zombiee", "zombiee3", 0, "");
}
Once the function zombieactive is called, my monster called "zombiee" will be set to active and start walking to the pathnode "zombiee2", wait two seconds then move to the pathnode "zombiee3".
Okay, it works, but now there's another problem. The monster doesn't despawn after following the path, how do I do that?
(05-02-2011, 04:50 PM)Anxt Wrote: [ -> ](05-02-2011, 04:48 PM)Karai16 Wrote: [ -> ](05-02-2011, 04:31 PM)Roenlond Wrote: [ -> ]void zombieactive (string &in asParent , string &in asChild , int alState)
{
SetEntityActive("zombiee", true);
AddEnemyPatrolNode("zombiee", "zombiee2", 2, "");
AddEnemyPatrolNode("zombiee", "zombiee3", 0, "");
}
Once the function zombieactive is called, my monster called "zombiee" will be set to active and start walking to the pathnode "zombiee2", wait two seconds then move to the pathnode "zombiee3".
Okay, it works, but now there's another problem. The monster doesn't despawn after following the path, how do I do that?
Add another area for the monster to collide with. Then create a new function that is called when the monster enters it, which will SetEntityActive("monster", false);. You can also use FadeEnemyToSmoke if you want, I tend to use the latter because if the player is looking at the monster, it disappears like it was a hallucination rather than just vanishing instantly.
void OnStart()
{
SetEntityPlayerInteractCallback("TowerKey", "Activatebrute", true);
AddEntityCollideCallback("servant_brute_1", "ScriptArea_1", "DespawnBrute", true, 1);
}
void Activatebrute(string &in asEntity)
{
SetEntityActive("servant_brute_1", true);
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_1", 1, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_3", 3, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_4", 3, "");
}
void DespawnBrute(string &in asEntity)
{
FadeEnemyToSmoke("servant_brute_1", false);
}
(05-02-2011, 06:22 PM)Karai16 Wrote: [ -> ]right now this is my code, it works, except for the FadeEnemyToSmoke part. When the brute collides with the scriptarea, it doesn't disappear, and keeps on patrolling along the path.Code:void OnStart()
{
SetEntityPlayerInteractCallback("TowerKey", "Activatebrute", true);
AddEntityCollideCallback("servant_brute_1", "ScriptArea_1", "DespawnBrute", true, 1);
}
void Activatebrute(string &in asEntity)
{
SetEntityActive("servant_brute_1", true);
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_1", 1, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_3", 3, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_4", 3, "");
}
void DespawnBrute(string &in asEntity)
{
FadeEnemyToSmoke("servant_brute_1", false);
}
void DespawnBrute(string &in asParent , string &in asChild , int alState)
{
FadeEnemyToSmoke("servant_brute_1", false);
}