Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need help with script involving making trees appear/disappear
Statyk Offline
Schrödinger's Mod

Posts: 4,390
Threads: 72
Joined: Sep 2011
Reputation: 241
#6
RE: Need help with script involving making trees appear/disappear

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);
}
09-03-2012, 06:59 PM
Find


Messages In This Thread
RE: Need help with script involving making trees appear/disappear - by Statyk - 09-03-2012, 06:59 PM



Users browsing this thread: 1 Guest(s)