(07-27-2012, 03:43 PM)andyrockin123 Wrote: The script looks fine and should work properly. Make sure:
-the new script file you pasted it into is an actual c++ script file and not just a .txt file
-the .map and .hps files are named exactly the same
-the .map and .hps files are in the same folder
-both the lever and door names in the .hps file are exactly the same as in the level editor.
it is a c++ script file, and i have other scripts that works fine in the same map and the lever and door names are excatly the same in both level editor and the .hps file
I can upload the entire script. There might be something i missed
////////////////////
//Run first time entering map
void OnStart()
{
AddEntityCollideCallback("Player", "StartMusicArea", "StartMusic", true, 1);
AddUseItemCallback("", "RustyKey", "metal_1", "UsedKeyOnDoor", true);
SetEntityPlayerInteractCallback("ScareCabinet", "RoarScare", true);
SetEntityConnectionStateChangeCallback("bro_lever", "UnLockDoor");
AddEntityCollideCallback("Player", "DeadBroArea", "BroStare", true, 1);
}
void StartMusic(string &in asParent, string &in asChild, int alState)
{
PlayMusic("ambience_haunting", true, 1, 2, 1, true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("metal_1", false, true);
PlaySoundAtEntity("", "unlock_door", "metal_1", 0, false);
RemoveItem("RustyKey");
}
void RoarScare(string &in asEntity)
{
PlaySoundAtEntity("", "brute/enabled", "castle_1", 0, false);
}
void UnLockDoor(string &in asEntity, int level_state)
{
if (level_state == 1)
{
SetSwingDoorLocked("castle_1", false, true);
PlaySoundAtEntity("", "ui_sanity_gain", "Player", 0, false);
GiveSanityBoost();
}
}
void BroStare(string &in asParent, string &in asChild, int alState)
{
StartPlayerLookAt("grunt_body_part2_1", 1, 10, "");
SetPlayerActive(false);
AddTimer("player_stare", 2, "Stare");
GiveSanityDamage(50, true);
}
void Stare(string &in asTimer)
{
SetPlayerActive(true);
StopPlayerLookAt();
}
////////////////////
//Run when entering map
void OnEnter()
{
}
////////////////////
//Run when leaving map
void OnLeave()
{
}