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
Script Help How to make something happen in the after doing something in another level.
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#4
RE: How to make something happen in the after doing something in another level.

Yes, I recommend reading up on some of the variables linked above. You will need at least some understanding of how they work. In some practical work, you'd use the script called
SetGlobalVarInt(string& asName, int alVal);
or related ones. This one creates a variable you can use within a level, but which can also be read from other levels. This means you can change the value in one level, then check for the value in another level and it will get the most recent change.

So in this case you'd want to change the value when you trigger what needs to be done in that one map, then when you return to your other map, you use an if statement within OnEnter(). Make it compare with the value you set in the other map using the GetGlobalVarInt(string& asName); function.

For example in map A you pull a lever. The callback for the lever uses
SetGlobalVarInt("Lever", 1);
When you return to map B, OnEnter() has
if(GetGlobalVarInt("Lever") == 1) UnlockDoor();
or something similar.

(02-14-2014, 03:19 PM)JustAnotherPlayer Wrote: You can only use Global Variables in the Global.hps, a seperate hps file than the rest. No need to pair it with a map, just an hps file.

You can actually use them in the level .hps files as well.

(This post was last modified: 02-14-2014, 03:26 PM by Mudbill.)
02-14-2014, 03:24 PM
Find


Messages In This Thread
RE: How to make something happen in the after doing something in another level. - by Mudbill - 02-14-2014, 03:24 PM



Users browsing this thread: 1 Guest(s)