Frictional Games Forum (read-only)
Simple help with scripting? - 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: Simple help with scripting? (/thread-8172.html)



Simple help with scripting? - KenOfAllTrades - 05-22-2011

Okay so I've been searching the forum, and I've found a lot of useful scripts. So far I've been able to spawn a monster when I walk to a certain spot, but I don't know how to make it go to a path node.

I've found some lines I can't find again on how to make it instantly spot my location or go to the path node, but I don't know HOW to add them. I've tried a lot of different things. My problem is just that I don't know how to ADD stuff to the OnStart part.

////////////////////////////
// Run when entering map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}

////////////////////////////
// Run first time starting map
void OnStart()
{
AddEntityCollideCallback("Player" , "MonsterArea" , "MonsterFunc1" , true , 1);
}
void MonsterFunc1(string &in asParent , string &in asChild , int alState)
{
SetEntityActive("Monsterguy" , true);
}
ShowEnemyPlayerPosition("Monsterguy");
}

If I want my monster to go to "Path01", EXACTLY what do I have to add where? Can anyone write me a modified version of this script that would make him head for "Path01"? And maybe try to explain how it works? Help is VERY much appreciated


RE: Simple help with scripting? - Kyle - 05-22-2011

Here, try this:

Code:
void OnStart()
{
     AddEntityCollideCallback("Player", "MonsterArea", "MonsterFunc1", true, 1);
}
void MonsterFunc1(string &in asParent, string &in asChild, int alState)
{
     SetEntityActive("Monsterguy", true);
     AddEnemyPatrolNode("Monsterguy", "Path01", 0, "");
}



RE: Simple help with scripting? - KenOfAllTrades - 05-22-2011

Thank you SO MUCH!! It worked now, and I learned A LOT about how scripting works in a flash!!