The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.24-0ubuntu0.18.04.17 (Linux)
File Line Function
/showthread.php 906 errorHandler->error



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
Making an enemy 'exit' like in the map Daniel's Room. (Solved!)
Mina Darsh Offline
Member

Posts: 227
Threads: 24
Joined: Sep 2010
Reputation: 0
#1
Making an enemy 'exit' like in the map Daniel's Room. (Solved!)

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?
(This post was last modified: 04-16-2011, 05:22 PM by Mina Darsh.)
04-15-2011, 06:55 PM
Find


Messages In This Thread
Making an enemy 'exit' like in the map Daniel's Room. (Solved!) - by Mina Darsh - 04-15-2011, 06:55 PM



Users browsing this thread: 1 Guest(s)