I tried adding an 'OnPickup' function to the script... now the game just crashes and gives me an expected data type error. Ya never know, it might be stupidly obvious.
void OnStart()
{
AddUseItemCallback("crowbar.ent", "crowbar", "mansion_1", "unlockdoor", false);
SetSwingDoorLocked("mansion_1", true, true);
SetSwingDoorLocked("cabinet", true, true);
AddUseItemCallback("key_tomb.ent", "keycloset", "cabinet", "unlockcloset", false);
SetEntityActive("thunderarea", false);
SetEntityCallbackFunc("", "pickupcrowbar");
}
//To unlock the closet door, grab the key and click on the door.///
void unlockcloset(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("cabinet", false, true);
PlaySoundAtEntity("locker", "07_pick_lock.ogg", "Player", 0.1f, true);
}
//To unlock the mansion door, grab the crowbar and click the door.///
void unlockdoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlayMusic("the_patronus_light.ogg", true, 1.0, 1.0, 1, false);
PlaySoundAtEntity("lock", "07_pick_lock.ogg", "Player", 0.1f, true);
}
//Before you walk to the mansion door to unlock it, thunder will crash when you walk into the area.//
void pickupcrowbar("crowbar", "OnPickup")
{
SetEntityActive("thunderarea", true);
AddEntityCollideCallback("Player", "thunderarea", "lookatwindow", true, 1);
}
void lookatwindow(string &in asParent, string &in asChild, int alState)
{
StartPlayerLookAt("windowblue", 1.0f, 1.0f, "timer");
PlaySoundAtEntity("", "thunder_crash01.ogg", "windowblue", 2.0f, true);
}
void timer()
{
StopPlayerLookAt();
}