Heya, basically trying to make an enemy patrol into the room the Player is once the player enters an area, and when the player finishes his patrol he 'should' exit the room, here's what I've made so far with my not so vast knowledge on scripting:
////////////////////////////
// Run first time starting map
void OnStart()
{
{
PlayMusic("02_amb_safe", true, 0.7, 0, 1, false);
AddEntityCollideCallback("Player" , "ScriptArea_1" , "MonsterFunc1" , true , 1);
AddEntityCollideCallback("mister_moody", "AreaGruntCheckedRoom", "CollideAreaGruntCheckedRoom", true, -1);
AddEntityCollideCallback("mister_moody", "GruntLeave", "GoPoof", false, 0);
}
}
////////////////////////////
// Rawr! Scary monster comin'!
void MonsterFunc1(string &in asParent , string &in asChild , int alState)
{
SetEntityActive("mister_moody" , true);
PlayMusic("dan_grunt", false, 0.8, 0, 0, false);
AddEnemyPatrolNode("mister_moody", "PathNodeArea_1", 3, "");
AddEnemyPatrolNode("mister_moody", "PathNodeArea_2", 0, "");
}
////////////////////////////
//Make Mister Moody leave.
void CollideAreaGruntCheckedRoom(string &in asParent, string &in asChild, int alState)
{
GiveEnemyExitPath();
}
void GiveEnemyExitPath()
{
ClearEnemyPatrolNodes("mister_moody");
AddEnemyPatrolNode("mister_moody", "PathNodeArea_3", 0, "");
}
void GoPoof()
{
SetEntityActive("mister_moody" , false);
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}
//02_amb_safe
Now the enemy should leave but somehow when he enters the area named GruntLeave, nothing happens... (His animation only seems to bug a bit...) Can anyone help me, and also explain what exactly might have gone wrong?