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


Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need help on a script ;) [solved!]
NaxEla Offline
Senior Member

Posts: 415
Threads: 5
Joined: Dec 2012
Reputation: 28
#4
RE: Need help on a script ;)

Create a script area around the door and make sure that it has ItemInteraction enabled. I named the area ScriptArea_1 in the script. You'll also need the change the entry name for the message.
PHP Code: (Select All)
////////////////////////////
// Run first time starting map
void OnStart()
{
    
SetLocalVarInt("CellarDoorOpen"0);
    
    
AddUseItemCallback("""Cellar_Key""ScriptArea_1""OpenCellarDoor1"true);
    
SetEntityPlayerInteractCallback("ScriptArea_1""EnterCellar"false);


void OpenCellarDoor1(string &in asItemstring &in asEntity)
{
    
AddLocalVarInt("CellarDoorOpen"1);
    
PlaySoundAtEntity("""unlock_door""CellarDoor1"0false);
    
RemoveItem("Cellar_Key");
}

void EnterCellar(string &in asEntity)
{
    if(
GetLocalVarInt("CellarDoorOpen") != 1) {
        
SetMessage("Messages""EntryName"0);
        return;
    }
    
    
TeleportPlayer("InCellar");
    
SetMessage("Messages""EnteringTheCellar"5.0);
}

void LeaveCellar(string &in asEntity)
{
    
TeleportPlayer("OutCellar");
}

////////////////////////////
// Run when entering map
void OnEnter()
{    
    
AutoSave();
}

////////////////////////////
// Run when leaving map
void OnLeave()
{



In Ruins [WIP]
04-13-2013, 05:34 PM
Find


Messages In This Thread
RE: Need help on a script ;) - by Tiger - 04-13-2013, 04:23 PM
RE: Need help on a script ;) - by NaxEla - 04-13-2013, 05:34 PM



Users browsing this thread: 1 Guest(s)