Frictional Games Forum (read-only)
Monster walking paths - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: Monster walking paths (/thread-7573.html)

Pages: 1 2


RE: Monster walking paths - Kyle - 04-23-2011

(04-23-2011, 02:53 AM)Shoop Wrote: What did I do wrong?
Code:
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.


RE: Monster walking paths - laser50 - 04-23-2011

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


RE: Monster walking paths - MrBigzy - 04-23-2011

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.