Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PathNodes [SOLVED]
Karai16 Offline
Member

Posts: 164
Threads: 24
Joined: Apr 2011
Reputation: 0
#1
PathNodes [SOLVED]

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.

Custom stories:
Her Games (100% Complete)
Her Games, All Bugs Fixed (100% Complete)
(This post was last modified: 05-02-2011, 08:47 PM by Karai16.)
05-02-2011, 04:25 PM
Find
Roenlond Offline
Senior Member

Posts: 331
Threads: 3
Joined: Apr 2011
Reputation: 0
#2
RE: PathNodes

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".
(This post was last modified: 05-02-2011, 04:31 PM by Roenlond.)
05-02-2011, 04:31 PM
Find
Karai16 Offline
Member

Posts: 164
Threads: 24
Joined: Apr 2011
Reputation: 0
#3
RE: PathNodes

(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?

Custom stories:
Her Games (100% Complete)
Her Games, All Bugs Fixed (100% Complete)
05-02-2011, 04:48 PM
Find
Anxt Offline
Senior Member

Posts: 588
Threads: 12
Joined: Mar 2011
Reputation: 10
#4
RE: PathNodes

To elaborate a bit further on what Roenlond said, the first entry is the name of the monster. The second is the name of the path node area, which I tend to leave as their default but if you choose to rename it that is also fine. The third entry is the amount of time in seconds the monster will stand still at the path node area once reaching it. The fourth is for an animation you want it to play while being stopped, but I have not seen many people do it, since in general the player will avoid looking at the monster.

But at any rate, yes, what Roenlond said is completely true and it will work, provided you alter the names to your own.
(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.

(This post was last modified: 05-02-2011, 04:52 PM by Anxt.)
05-02-2011, 04:50 PM
Find
Roenlond Offline
Senior Member

Posts: 331
Threads: 3
Joined: Apr 2011
Reputation: 0
#5
RE: PathNodes

(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.

Precisely. I tend to use FadeEnemyToSmoke as well since it gives a much better looking disappearance. You typically use "Player" as the entity that should collide with a scriptarea, but in this case you will need to remember to change it to whatever you have named your monster.
05-02-2011, 05:14 PM
Find
Karai16 Offline
Member

Posts: 164
Threads: 24
Joined: Apr 2011
Reputation: 0
#6
RE: PathNodes

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);
}
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.

Custom stories:
Her Games (100% Complete)
Her Games, All Bugs Fixed (100% Complete)
05-02-2011, 06:22 PM
Find
Linus Ågren Offline
Senior Member

Posts: 309
Threads: 58
Joined: Jan 2011
Reputation: 5
#7
RE: PathNodes

EntityCollideCallbacks needs to be like:
void Func(string &in asParent, string &in asChild, int alState)

Creator of The Dark Treasure.
05-02-2011, 06:30 PM
Website Find
Roenlond Offline
Senior Member

Posts: 331
Threads: 3
Joined: Apr 2011
Reputation: 0
#8
RE: PathNodes

(05-02-2011, 06:22 PM)Karai16 Wrote:
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);
}
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.

void DespawnBrute(string &in asParent , string &in asChild , int alState)
{
FadeEnemyToSmoke("servant_brute_1", false);
}

Try that.
05-02-2011, 06:53 PM
Find
Karai16 Offline
Member

Posts: 164
Threads: 24
Joined: Apr 2011
Reputation: 0
#9
RE: PathNodes

Thank y'all alot! I got it working. Now there's only one more thing I need to get working before I can finish my little testing map.!

Custom stories:
Her Games (100% Complete)
Her Games, All Bugs Fixed (100% Complete)
05-02-2011, 08:38 PM
Find




Users browsing this thread: 2 Guest(s)