05-25-2012, 01:06 PM
I have a problem:
When I walk into Script6 (area) enemy6 spawns into cabinet, but doesnt get out. It looks like this:
My script:
Also I have the cabinet locked until you walk in to the area.
When I walk into Script6 (area) enemy6 spawns into cabinet, but doesnt get out. It looks like this:
My script:
PHP Code:
////////////////////////////
// Run when entering map
void OnEnter()
{
SetLanternDisabled(false);
SetEntityCallbackFunc("tinderbox", "OnPickup");
AddEntityCollideCallback("Player", "script1", "SetMessage1", true, 1);
AddEntityCollideCallback("Player", "script3", "easterown", true, 1);
AddEntityCollideCallback("Player", "script5", "collideenemy4", true, 1);
AddEntityCollideCallback("Player", "script6", "collideenemy6", true, 1);
AddEntityCollideCallback("Player", "Check1area", "check1", true, 1);
AddEntityCollideCallback("Player", "Check2area", "check2", true, 1);
SetEntityPlayerInteractCallback("door2", "Collide", true);
SetEntityConnectionStateChangeCallback("lever", "func_shelf");
AddEntityCollideCallback("Player", "startenemy5", "collideenemy5", true, 1);
}
void collideenemy6(string &in asParent, string &in asChild, int alState)
{
ClearEnemyPatrolNodes("enemy6");
SetEntityActive("enemy6", true);
SetSwingDoorLocked("cabinet", false, true);
AddTimer("timer123", 0.7f, "startenemy6");
StartPlayerLookAt("cabinet", 3, 4, "StopPlayerLookAt");
AddEnemyPatrolNode("enemy6", "PathNodeArea_6", 0, "");
}
void startenemy6(string &in asTimer)
{
ClearEnemyPatrolNodes("enemy6");
SetEntityActive("enemy6", true);
ShowEnemyPlayerPosition("enemy6");
AddEntityCollideCallback("enemy6", "noticeenemy6", "notenemy6", true, 1);
}
void collideenemy4(string &in asParent, string &in asChild, int alState)
{
ClearEnemyPatrolNodes("enemy4");
SetEntityActive("enemy4", true);
AddEnemyPatrolNode("enemy4", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("enemy4", "PathNodeArea_3", 0, "");
AddEntityCollideCallback("enemy4", "fadeenemy4", "Fadeenemy4", true, 1);
}
void collideenemy5(string &in asParent, string &in asChild, int alState)
{
ClearEnemyPatrolNodes("enemy5");
SetEntityActive("enemy5", true);
AddEnemyPatrolNode("enemy5", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("enemy5", "PathNodeArea_5", 0, "");
AddEntityCollideCallback("enemy5", "fadeenemy5", "Fadeenemy5", true, 1);
}
void Fadeenemy5(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("enemy5", false);
}
void Fadeenemy4(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("enemy4", false);
}
void Collide(string &in asEntity)
{
SetEntityPlayerInteractCallback("door1", "Collide2", true);
}
void Collide2(string &in asEntity)
{
// ClearEnemyPatrolNodes("enemy2");
// SetEntityActive("enemy2", true);
AddEnemyPatrolNode("enemy2", "PathNodeArea_1", 0, "");
AddEntityCollideCallback("enemy2", "script4", "Collideenemy2", true, 1);
}
void Collideenemy2(string &in asParent, string &in asChild, int alState)
{
SetPropHealth("door2", 50);
ShowEnemyPlayerPosition("enemy2");
}
void check1(string &in asParent, string &in asChild, int alState)
{
CheckPoint ("Check1", "Check1", "CheckPoint01", "Misc", "DeathHint2");
}
void check2(string &in asParent, string &in asChild, int alState)
{
CheckPoint ("Check2", "Check1", "CheckPoint01", "Misc", "DeathHint1");
}
void CheckPoint01(string &in asName, int alCount)
{
SetPlayerHealth(RandFloat(80,90));
SetPlayerSanity(RandFloat(40,60));
SetPlayerMoveSpeedMul(1);
SetPlayerRunSpeedMul(1);
SetPlayerCrouching(false);
}
void easterown(string &in asParent, string &in asChild, int alState)
{
AddTimer("eastern", 3.0f, "easterr");
}
void easterr(string &in asTimer)
{
SetEntityActive("enemy3", true);
ShowEnemyPlayerPosition("enemy3");
StartPlayerLookAt("enemy3", 3, 4, "StopPlayerLookAt");
AddTimer("sanitytimer", 0.5f, "sanitydamage");
SetPlayerHealth(50);
SetPlayerMoveSpeedMul(0);
SetPlayerRunSpeedMul(0);
SetDeathHint("Misc", "DeathHint1");
}
void sanitydamage(string &in asTimer)
{
GiveSanityDamage(100, true);
PlaySoundAtEntity("react", "react_scare.snt", "Player", 0.0f, false);
SetPlayerCrouching(true);
}
void func_shelf(string &in asEntity, int alState)
{
if (alState == 1)
{
SetMoveObjectState("shelf",1.0f);
PlaySoundAtEntity("", "quest_completed.snt", "shelf_move_1", 0, false);
return;
}
}
void SetMessage1(string& asTextCategory, string& asTextEntry, float afTime)
{
SetMessage("Sergej", "Mutter1", 0);
}
void OnPickup(string &in asItem, string &in asEntity)
{
SetLanternDisabled(false);
RemoveItem("tinderbox");
SetMessage("Sergej", "Mutter2", 0);
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}
Also I have the cabinet locked until you walk in to the area.