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
Kyle Offline
Posting Freak

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

(04-23-2011, 02:53 AM)Shoop Wrote: 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);
}

If you did do something wrong, what does the error report say?
(04-23-2011, 03:25 AM)palistov Wrote: 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?

If you create a loop then the monster will repeat the same thing over and over again, but I don't know how to create a loop. So no, you can't make a monster walk around forever in circles without a loop.

(This post was last modified: 04-23-2011, 03:57 AM by Kyle.)
04-23-2011, 03:55 AM
Find
laser50 Offline
Member

Posts: 242
Threads: 22
Joined: Apr 2011
Reputation: 0
#12
RE: Monster walking paths

(04-23-2011, 03:25 AM)palistov Wrote: 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?

Same Question here.
04-23-2011, 10:24 AM
Find
MrBigzy Offline
Senior Member

Posts: 616
Threads: 18
Joined: Mar 2011
Reputation: 8
#13
RE: Monster walking paths

They only follow whatever nodes you tell them to go to, so if you want them to walk around a room for a definite amount of time you could do something like:

switch(GruntNodes){
case 1:
AddEnemyPatrolNode(...
break;
case 2:
AddEnemyPatrolNode(...
break;
...

And go from there. I would say to do this over a while or if loop because those loops would add all of the nodes at once and make the last node overwrite the previous ones.
04-23-2011, 02:47 PM
Find




Users browsing this thread: 1 Guest(s)