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
Monster walking paths
Shoop Offline
Junior Member

Posts: 36
Threads: 10
Joined: Feb 2011
Reputation: 0
#1
Monster walking paths

You guys are probably bitch at me, but how do you get the monsters to move? I made it spawn but it only moves if it sees me, otherwise it just stands there. Not only that, but it never leaves it will stay there until I let it kill me. Please help me. Smile
04-23-2011, 02:05 AM
Find
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#2
RE: Monster walking paths

Don't worry, I'm here to help you. Smile

On the side bar in the editor there is a button called "Areas" and there will be a drop box once you click it. Towards the bottom if it is "PathNode". Click it and place it next to your monster that shows what way it goes. So make a path with them, about a meter apart from each PathNode. Now you have to script.

The script line looks like this:
AddEnemyPatrolNode(string& asName, string& asNodeName, float afWaitTime, string& asAnimation);

For example, if my monster is called "Monster01" and the PathNode is called "PathNodeArea_1" and I want the monster to wait between nodes for 5 seconds I would do:

AddEnemyPatrolNode("Monster01", "PathNodeArea_1", 5, "");
AddEnemyPatrolNode("Monster01", "PathNodeArea_2", 5, "");

This would make the monster wait 5 seconds, then go to path node 1, then wait 5 seconds at path node 1 and then move on to path node 2. By the way, the last slot of the script line ("string& asAnimation") can be left blank.

Congratulations, you were just helped by a 13-year-old. Big Grin

(This post was last modified: 04-23-2011, 02:26 AM by Kyle.)
04-23-2011, 02:24 AM
Find
Shoop Offline
Junior Member

Posts: 36
Threads: 10
Joined: Feb 2011
Reputation: 0
#3
RE: Monster walking paths

Thank you good sir, but at this path node 2 is that far away from the player? and will that make him vanish or do I gotta do a collide callback then a void entity false thing?
04-23-2011, 02:33 AM
Find
Hunter of Shadows Offline
Senior Member

Posts: 745
Threads: 21
Joined: Apr 2011
Reputation: 11
#4
RE: Monster walking paths

Quote:You guys are probably bitch at me

The community here is very nice, you have nothing to fear, I have yet to meet one troll or flamer etc etc.
04-23-2011, 02:37 AM
Website Find
Shoop Offline
Junior Member

Posts: 36
Threads: 10
Joined: Feb 2011
Reputation: 0
#5
RE: Monster walking paths

I have been called a noob and told to learn scripting and stop bugging the forums once before. I know this a very nice community, probably the best one.

Does this work?
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_86", "5", "");
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_99", "5", "");
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_52", "5", "");
AddEntityCollideCallback("servant_grunt_2" , "MonsterDie" , "MonsterDie1" , true , 1);
}

void MonsterDie1(string &in asParent , string &in asChild , int alState)
{
  SetEntityActive("servant_grunt_2" , false);
}
In better posistions of course, but would that make him leave and die.
(This post was last modified: 04-23-2011, 02:46 AM by Shoop.)
04-23-2011, 02:39 AM
Find
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#6
RE: Monster walking paths

(04-23-2011, 02:33 AM)Shoop Wrote: Thank you good sir, but at this path node 2 is that far away from the player? and will that make him vanish or do I gotta do a collide callback then a void entity false thing?

It doesn't matter if the path node is far away from the player or not, it depends what you want. Once the path nodes stop from going into the game, then it dissapears. For example:
void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_1", "SpawnMonsterFunction", true, 1);
}
void SpawnMonsterFunction(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Monster", true);
AddEnemyPatrolNode("Monster", "PathNodeArea_1", 2, "");
AddEnemyPatrolNode("Monster", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("Monster", "PathNodeArea_3", 20, "");
AddEnemyPatrolNode("Monster", "PathNodeArea_4", 2, "");
}
The example script causes the Monster to spawn once the player collides with an area. Then the monster goes to path node 1 and waits there for 2 seconds. Then it moves to path node 2 and then goes to path node 3 without stopping. Then when it gets to path node 3, it stays where it is for 20 seconds. When 20 seconds past, it goes to path node 4 and from there waits for 2 seconds. Then it turns to dust and dissapears because it is the end of it's path. If the player is detected by the monster, it will move off it it's path and follow you. If it loses you, it doesn't look for you because it is not part of it's path.

04-23-2011, 02:47 AM
Find
Shoop Offline
Junior Member

Posts: 36
Threads: 10
Joined: Feb 2011
Reputation: 0
#7
RE: Monster walking paths

(04-23-2011, 02:47 AM)Kyle Wrote:
(04-23-2011, 02:33 AM)Shoop Wrote: Thank you good sir, but at this path node 2 is that far away from the player? and will that make him vanish or do I gotta do a collide callback then a void entity false thing?

It doesn't matter if the path node is far away from the player or not, it depends what you want. Once the path nodes stop from going into the game, then it dissapears. For example:
void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_1", "SpawnMonsterFunction", true, 1);
}
void SpawnMonsterFunction(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Monster", true);
AddEnemyPatrolNode("Monster", "PathNodeArea_1", 2, "");
AddEnemyPatrolNode("Monster", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("Monster", "PathNodeArea_3", 20, "");
AddEnemyPatrolNode("Monster", "PathNodeArea_4", 2, "");
}
The example script causes the Monster to spawn once the player collides with an area. Then the monster goes to path node 1 and waits there for 2 seconds. Then it moves to path node 2 and then goes to path node 3 without stopping. Then when it gets to path node 3, it stays where it is for 20 seconds. When 20 seconds past, it goes to path node 4 and from there waits for 2 seconds. Then it turns to dust and dissapears because it is the end of it's path. If the player is detected by the monster, it will move off it it's path and follow you. If it loses you, it doesn't look for you because it is not part of it's path.

If it cannot find you after chasing you, does it go back on course or will it just stand there? Will it destroy doors in its way too? Also, look above and check mine please.
(This post was last modified: 04-23-2011, 02:51 AM by Shoop.)
04-23-2011, 02:50 AM
Find
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#8
RE: Monster walking paths

It will go back onto it's course.

04-23-2011, 02:51 AM
Find
Shoop Offline
Junior Member

Posts: 36
Threads: 10
Joined: Feb 2011
Reputation: 0
#9
RE: Monster walking paths

What did I do wrong?
void OnStart()
{
AddUseItemCallback("", "key1", "castle_1", "UsedKeyOnDoor", true);
AddUseItemCallback("", "key2", "metal_1", "UsedKeyOnDoor2", true);
AddUseItemCallback("", "key3", "castle_3", "UsedKeyOnDoor3", true);
AddUseItemCallback("", "key4", "castle_6", "UsedKeyOnDoor4", true);
AddEntityCollideCallback("Player" , "ScriptArea_1" , "MonsterFunc1" , true , 1);
AddEntityCollideCallback("Player" , "ScriptArea_3" , "MonsterFunc2" , true , 1);
AddEntityCollideCallback("Player", "ScriptArea_2", "ChangeMap", true, 1);
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_86", "1", "");
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_99", "10", "");
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_52", "5", "");
AddEntityCollideCallback("servant_grunt_2" , "MonsterDie" , "MonsterDie1" , true , 1);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_66", "1", "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_63", "8", "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_82", "5", "");
AddEntityCollideCallback("servant_grunt_1" , "MonsterDie2" , "MonsterDie2" , true , 1);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("castle_1", false, true);
PlaySoundAtEntity("", "unlock_door", "castle_1", 0, false);
RemoveItem("key1");
}

void UsedKeyOnDoor2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("metal_1", false, true);
PlaySoundAtEntity("", "unlock_door", "metal_1", 0, false);
RemoveItem("key2");
}

void UsedKeyOnDoor3(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("castle_3", false, true);
PlaySoundAtEntity("", "unlock_door", "castle_3", 0, false);
RemoveItem("key3");
}

void UsedKeyOnDoor4(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("castle_6", false, true);
PlaySoundAtEntity("", "unlock_door", "castle_6", 0, false);
RemoveItem("key4");
}

void MonsterFunc1(string &in asParent , string &in asChild , int alState)
{
  SetEntityActive("servant_grunt_1" , true);
}

void MonsterDie1(string &in asParent , string &in asChild , int alState)
{
  SetEntityActive("servant_grunt_2" , false);
}

void MonsterDie2(string &in asParent , string &in asChild , int alState)
{
  SetEntityActive("servant_grunt_1" , false);
}

void MonsterFunc2(string &in asParent , string &in asChild , int alState)
{
  SetEntityActive("servant_grunt_2" , true);
}

void ChangeMap(string &in asParent, string &in asChild, int alState)
{
  ChangeMap("Level2.map", "PlayerStartArea_1", "break_stairs", "water_lurker_eat");
}

void OpenDoor(string &in asParent, string &in asChild, int alState)
{
AddEntityCollideCallback("Player", "ScriptArea_4", "metal_1", true, 1);
}
(This post was last modified: 04-23-2011, 03:05 AM by Shoop.)
04-23-2011, 02:53 AM
Find
palistov Offline
Posting Freak

Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation: 57
#10
RE: Monster walking paths

Do patrol nodes create a loop? Or will I have to re-add them if I want a monster to say, walk in a circle around a large room indefinitely?

04-23-2011, 03:25 AM
Find




Users browsing this thread: 2 Guest(s)