(06-13-2011, 08:38 PM)xtron Wrote: Oh sorry Kyle :S. Forgot about yours. .
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;
}
}