Bah. I suppose so. I just renamed things from my post to here. Though thanks on the light, I missed that.
There are going to be some functions that are EntityInteractCallback through the editor.
///////////////////
void OnStart()
{
AddUseItemCallback("", "Lockpick", "StudyDoor", "UnlockStudy", true);
AddUseItemCallback("", "Lockpick", "Chest", "UnlockChest", false);
SetLeverStuckState("Chest", -1, true);
SetLocalVarInt("HasShirt", 0);
SetLocalVarInt("HasGem", 0);
PlayMusic("20_amb.ogg", true, 1, 5, 1, true);
}
void UnlockStudy(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("StudyDoor", false, true);
PlaySoundAtEntity("", "unlock_door", "StudyDoor", 0, false);
SetMessage("ScreenText", "BrokenPick", 5);
}
void UnlockChest(string &in asItem, string &in asEntity)
{
SetLeverStuckState("MedChest", 0, true);
PlaySoundAtEntity("", "unlock_door", "Chest", 0, false);
}
void WearShirt(string &in asEntity)
{
SetEntityActive("Shirt", false);
PlaySoundAtEntity("", "pick_generic", "Shirt", 0, false);
AddLocalVarInt("HasShirt", 1);
}
void BedroomDoorStatus(string &in asEntity)
{
if (GetLocalVarInt("HasShirt") == 1) && (GetLocalVarInt("HasGem") == 1)
{
SetSwingDoorLocked("BedroomDoor", false);
}
if (GetLocalVarInt("HasShirt") == 1) && (GetLocalVarInt("HasGem" == 0))
{
SetMessage("OblivScreenText", "ShirtNoGem", 5);
}
if (GetLocalVarInt("HasShirt") == 0) && (GetLocalVarInt("HasGem" == 1))
{
SetMessage("OblivScreenText", "GemNoShirt", 5);
}
}
void GemPickup(string &in asEntity)
{
StartEffectFlash(0.5, 1, 0.5);
PlaySoundAtEntity("", "insanity_imageflash.snt", "Player", 0, false);
StopMusic(0, 1);
PlayMusic("03_amb.ogg", true, 1, 3, 0, true);
AddLocalVarInt("HasGem", 1);
}
void Gem2Pickup(string &in asEntity)
{
AddEntityCollideCallback("Player", "FallBody", "Corpsefall", 1, true);
StartEffectFlash(0.5, 1, 0.5);
PlaySoundAtEntity("", "insanity_imageflash.snt", "Player", 0, false);
StopMusic(0, 0);
PlayMusic("17_amb.ogg", true, 1, 3, 1, true);
}
void Corpsefall(string &in asParent, string &in asChild, int alState)
{
StartScreenShake(0.3, 5, 2, 1);
PlaySoundAtEntity("", "21_intro_scream.snt", "Player", 0, false);
SetEntityActive("corpse_male_*", true);
GiveSanityDamage(25, true);
/////////////////////////////////
//Creates other effects outside the room.
SetEntityActive("mansion_3", false);
SetEntityActive("mansion_off_hinges_1", true);
SetEntityActive("Slime*", true);
SetLightVisible("StatueEye*", true);
AddEntityCollideCallback("Player", "DisableLight", "StatueEyeRemove", 1, true);
}
void Daddy(string &in asEntity)
{
SetMessage("ScreenText", "Father", 4);
GiveSanityDamage(90, true);
StopMusic(0, 1);
PlayMusic("ui_terror_meter.ogg", true, 3, 1, 2, true);
AddTimer("closet1", 4, "ClosetScare");
AddTimer("closet2", 6, "ClosetScare");
AddTimer("closet3", 8, "ClosetScare");
AddTimer("closet4", 10, "ClosetScare");
SetEntityActive("Painting*", false);
SetEntityActive("Map*", false);
SetEntityActive("MechSketch*", false);
SetEntityActive("InsanePainting*", true);
SetEntityActive("Rust*", true);
SetEntityActive("mansion_2", false);
SetEntityActive("PrisonExit", true);
}
void ClosetScare(string &in asTimer)
{
if(timer == "closet1")
{
PlaySoundAtEntity("", "scare_slam_door.snt", "cabinet_nice_2", 0, false);
CreateParticleSystemAtEntity("", "ps_dust_impact.ps", "DustArea", false);
AddBodyForce("cabinet_nice_2_leftdoor", 0, 0, -1, "world");
AddBodyForce("cabinet_nice_2_rightdoor", 0, 0, -1, "world");
StartPlayerLookAt("DustArea", 1, 1, "");
}
if(timer == "closet2")
{
PlaySoundAtEntity("", "scare_slam_door.snt", "cabinet_nice_2", 0, false);
CreateParticleSystemAtEntity("", "ps_dust_impact.ps", "DustArea", false);
AddBodyForce("cabinet_nice_2_leftdoor", 0, 0, -1, "world");
AddBodyForce("cabinet_nice_2_rightdoor", 0, 0, -1, "world");
StopPlayerLookAt();
}
if(timer == "closet3")
{
PlaySoundAtEntity("", "scare_slam_door.snt", "cabinet_nice_2", 0, false);
CreateParticleSystemAtEntity("", "ps_dust_impact.ps", "DustArea", false);
AddBodyForce("cabinet_nice_2_leftdoor", 0, 0, -1, "world");
AddBodyForce("cabinet_nice_2_rightdoor", 0, 0, -1, "world");
}
if (timer == "closet4")
{
PlaySoundAtEntity("", "break_wood.snt", "DustArea", 0, false);
CreateParticleSystemAtEntity("", "ps_dust_break_25.ps", "DustArea", false);
SetSwingDoorLocked("cabinet_nice_2*", false, false);
AddBodyForce("cabinet_nice_2_leftdoor", 0, 0, -1, "world");
AddBodyForce("cabinet_nice_2_rightdoor", 0, 0, -1, "world");
AddEntityCollideCallback("Player", "EndLightArea", "EndLight", 1, true);
}
}
void StatueEyeRemove(string &in asParent, string &in asChild, int alState)
{
SetLightVisible("StatueEye*", false);
}
void EndLight(string &in asParent, string &in asChild, int alState)
{
SetLightVisible("HallLight", true);
}