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
Urgently need help, loop monster path.
Mojake Offline
Junior Member

Posts: 7
Threads: 6
Joined: Mar 2012
Reputation: 0
#1
Urgently need help, loop monster path.

I read the wiki on pathnodes but I really don't understand it. I'm still pretty new to scripting.

I have 4 pathnodes that a monster follows, then I want it to follow; 5,6,7,8 in a continuous loop but I really can't get my head around it.

void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_1",
for (int i = 1; i <11; i++)
{
int x = i;
if (i == 1)
{
x = 2;
}
if (i = 10)
{
x = 4;
}
if (i != 1 || i != 10)
{
x = 0;
}
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_"+i, x, "");
}
}
That's what the wiki says about pathnodes but I don't understand what values stand for and how to manipulate them to suit me. Would really appreciate some help here, it's been bugging me for 2 hours Sad
03-17-2012, 11:34 AM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#2
RE: Urgently need help, loop monster path.

When you add a path node to a monster it will be placed in the monster's "memory," and it will head to each path node in its "memory" in the order they were added. You don't need to make such a complicated loop like that for the monster to patrol.

Tutorials: From Noob to Pro
(This post was last modified: 03-17-2012, 11:54 AM by Your Computer.)
03-17-2012, 11:54 AM
Website Find
Equil Offline
Member

Posts: 94
Threads: 8
Joined: Sep 2010
Reputation: 0
#3
RE: Urgently need help, loop monster path.

    for(int i=0;i<5;i++) {
        if(i == 5) {
            i = 0;
            }
        
        AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_"+i, 0.0f, "");
        }

This works if you want him to go in a continuous loop. Just change add 1 to i< for however nodes you want him to loop. i.e, you wanted 4 nodes, so I put i<5. That's just the way I do it though, since I usually start i at 0. However, this way he will still eventually dissapear if the player hides from him, i'm not too sure how to stop that myself.
03-17-2012, 12:15 PM
Find




Users browsing this thread: 1 Guest(s)