Go to the Entity tab of the garden_gate and put in the PlayerInteractCallback, "interactgate_func" (no quotations) and change your script to this. As well, make sure the internal name of the gate IS "garden_gate":
void OnStart()
{
GiveItemFromFile("lantern", "lantern.ent");
SetPlayerLampOil(50.0f);
AddUseItemCallback("", "gate_key", "garden_gate", "unlock_garden_gate", true);
AddEntityCollideCallback("Player", "lantern_message", "lantern_message", true, 1);
}
///GATE DOOR FUNCTIONS~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void interactgate_func(string &in asEntity)
{
if(GetSwingDoorLocked("garden_gate") == true)
{
SetMessage("Messages", "locked", 3);
AddTimer("", 4, "tree_func"); //Adjust the time here accordingly
}
}
void tree_func(string &in asTimer)
{
PlaySoundAtEntity("", "15_prisoner_scream.snt", "gate_key", 0, false);
GiveSanityDamage(10.0f, true);
SetEntityActive("tree_door_1", false);
SetEntityActive("tree_door_2", false);
SetEntityActive("tree_door_3", true);
SetEntityActive("tree_door_4", true);
}
///GATE DOOR FUNCTIONS~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void lantern_message(string &in asChild, string &in asParent, int alState)
{
SetMessage("Messages", "lantern_message", 0);
}
void unlock_garden_gate(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "unlock_door", asEntity, 0, false);
RemoveItem(asItem);
}