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
#6
RE: Need help on a script ;) [not solved!]

That's strange :\ When I tested it, it worked perfectly

Here's the exact script I used to test it. I also made it so that the text will only show up the first time the player enters the cellar. You'll need to change the names teleport areas and .lang entries.
PHP Code: (Select All)
////////////////////////////
// Run first time starting map
void OnStart()
{
    
SetLocalVarInt("CellarDoorOpen"0);
    
SetLocalVarInt("FirstTimeCellar"1);
    
    
AddUseItemCallback("""Cellar_Key""ScriptArea_1""OpenCellarDoor1"true);
    
SetEntityPlayerInteractCallback("ScriptArea_1""EnterCellar"false);
    
SetEntityPlayerInteractCallback("ScriptArea_2""LeaveCellar"false);


void OpenCellarDoor1(string &in asItemstring &in asEntity)
{
    
SetLocalVarInt("CellarDoorOpen"1);
    
PlaySoundAtEntity("""unlock_door"asEntity0false);
    
RemoveItem(asItem);
}

void EnterCellar(string &in asEntity)
{
    if(
GetLocalVarInt("CellarDoorOpen") != 1) {
        
SetMessage("Messages""DoorLocked"0);
        return;
    }
    
    
TeleportPlayer("InsideCellar");
    
    if(
GetLocalVarInt("FirstTimeCellar") == 1) {
        
SetMessage("Messages""EnteringTheCellar"0);
        
SetLocalVarInt("FirstTimeCellar"0);
    }
}

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

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

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



In Ruins [WIP]
04-13-2013, 10:44 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
RE: Need help on a script ;) [not solved!] - by NaxEla - 04-13-2013, 10:44 PM



Users browsing this thread: 1 Guest(s)