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


Thread Rating:
  • 2 Vote(s) - 2.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
3buttons then a bookshelf opens
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#7
RE: 3buttons then a bookshelf opens

(06-13-2011, 08:38 PM)xtron Wrote: Oh sorry Kyle :S. Forgot about yours. Sad.

But Kyle...since your so kind you can maybe give me a start on how to set the script up?.

I tried to understand both your and Nye's script but didn't made it :/.

To set it up, first you need to keep track of whether the player pushes the buttons. So you need a local variable which can be used within the whole script.

SetLocalVarInt("Var01", 0);

The name of it is "Var01" and it's value is 0.

Now we need to change it's value when the player interacts with each button.

So we add interactions for each button.

For button 1 which will be called "Button_1":

SetEntityPlayerInteractCallback("Button_1", "Func_1", true);

For button 2 which will be called "Button_2":

SetEntityPlayerInteractCallback("Button_2", "Func_2", true);

For button 3 which will be called "Button_3":

SetEntityPlayerInteractCallback("Button_3", "Func_3", true);


So now we have a function for each individual button.
Functions: "Func_1", "Func_2", and "Func_3". Buttons: "Button_1", "Button_2", and "Button_3".

We can simplify it to where you only need 1 function. Lets just call it "Func_1". This is what it'll look like:

void Func_1(string &in asEntity)
{
AddLocalVarInt("Var01", 1);
}

Now in the void OnStart() function, we need to call another function. Lets call it "FuncOpen".

Now inside of that function, we need to check and see if the variable is equal to 3. Let me represent it by this:

Buttons Pressed By Player = Var01 = 3 ---> 3 = BookShelf Slides Open

So most of the script should look like this:

void OnStart()
{
     SetLocalVarInt("Var01", 0);
     SetEntityPlayerInteractCallback("Button_1", "Func_1", true);
     SetEntityPlayerInteractCallback("Button_2", "Func_1", true);
     SetEntityPlayerInteractCallback("Button_3", "Func_1", true);
     FuncOpen();
}
void Func_1(string &in asEntity)
{
     AddLocalVarInt("Var01", 1);
     SetEntityInteractionDisabled(asEntity, true);
}
void FuncOpen()
{
     if (GetLocalVarInt("Var01") == 3)
     {
          // However the bookshelf opens...
          return;
     }
}

06-13-2011, 08:58 PM
Find


Messages In This Thread
3buttons then a bookshelf opens - by xtron - 06-13-2011, 03:28 PM
RE: 3buttons then a bookshelf opens - by Kyle - 06-13-2011, 08:03 PM
RE: 3buttons then a bookshelf opens - by xtron - 06-13-2011, 08:13 PM
RE: 3buttons then a bookshelf opens - by Kyle - 06-13-2011, 08:28 PM
RE: 3buttons then a bookshelf opens - by xtron - 06-13-2011, 08:38 PM
RE: 3buttons then a bookshelf opens - by Kyle - 06-13-2011, 08:58 PM
RE: 3buttons then a bookshelf opens - by xtron - 06-14-2011, 02:58 PM
RE: 3buttons then a bookshelf opens - by Apjjm - 06-15-2011, 03:31 PM
RE: 3buttons then a bookshelf opens - by xtron - 06-15-2011, 06:39 PM
RE: 3buttons then a bookshelf opens - by Kyle - 06-15-2011, 07:39 PM



Users browsing this thread: 1 Guest(s)