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
scripts having effects in two levels
Streetboat Offline
Posting Freak

Posts: 1,099
Threads: 40
Joined: Mar 2011
Reputation: 56
#2
RE: scripts having effects in two levels

You gotta use Global Variables for that. What you do is, when you pull the lever in the first level, it calls the function 'SetGlobalVarInt', and then in the other level, in the 'OnEnter' section of your .hps file, you'll have an if statement stating that 'if (GetGlobalVarInt("name of var") == 1)' then it runs the script changing the state of whatever you wanted it to do. Here's what it would look like as an example.
Quote:(First lever script)
OnStart()
{
SetEntityConnectionStateChangeCallback("Lever", "LeverFunc");
}
void roomlever(string &in asEntity, int alState)
{
if(alState == 1)
{
SetLeverStuckState("Lever", 1, true);
SetLeverInteractionDisablesStuck("Lever", true);
AddGlobalVarInt("LeverVar", 1);
}
}

(Second level .hps file)
OnEnter()
{
if (GetGlobalVarInt("LeverVar") == 1)
{
(Put whatever script you would want the lever to run in this area)
}
}


And there you have it!

[Image: signature-2.png]
(This post was last modified: 05-06-2012, 06:44 PM by Streetboat.)
05-06-2012, 06:42 PM
Find


Messages In This Thread
RE: scripts having effects in two levels - by Streetboat - 05-06-2012, 06:42 PM



Users browsing this thread: 1 Guest(s)