Additional problem: Could anyone possibly tell me what's wrong with this script? It's a different level from the other one. There are 00_woodshop and 01_house in terms of levels. When the player enters an area in 01_house, it's supposed to do what's in this script, but it just crashes instead. Is it not possible to check and see if a VarInt from another level is true? My first attempt was an 'if... else' using "HasItem" and checking for the lantern, but that also crashed. What am I doing wrong?
void OnStart()
{
AddEntityCollideCallback("Player", "needlantern", "lantern_warn", true, 1);
}
void lantern_warn(string &in asParent, string &in asChild, int alState)
{
if (GetLocalVarInt("HasLantern") == 1)
{
PlaySoundAtEntity("scare_dog", "scare_animal_squeal2.snt", "needlantern", 0, true);
AddTimer("dogreact", 0.5f, "scaredgasp2");
}
else
{
PlaySoundAtEntity("scare_dog", "scare_animal_squeal2.snt", "needlantern", 0, true);
SetPlayerCrouching(true);
AddTimer("dogreact", 0.5f, "scaredgasp2");
SetMessage("house", "TooDark", 0);
AddQuest("questtext2","questtext2");
}
}
void scaredgasp2(string &in asTimer)
{
PlayMusic("react_scare3",false,100.0f,0.0f,1,false);
GiveSanityDamage(10.0f,true);
GiveHint("sanity", "Hints", "Sanity", 0);
}
I have a callback on the lantern in the other level's script that sets "HasLantern" to 1 when it's picked up.