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.
Radical Batz Offline
Posting Freak

Posts: 953
Threads: 145
Joined: Dec 2013
Reputation: 25
#1
How to make something happen in the after doing something in another level.

This may be hard to explain but I'll tell you in detail.

I have this door in a map which is a gate and it's locked, so you go in this level door/other map. and when you finished puzzle in that map and return to the old map, then something has happened. The door has been opened.

What I'm trying to say is, How do you make something happen in a map when you did something in another map. uuuuuuh this is hard to explain. I am trying to make something happen in the level where everything is safe and the door is locked but when you have solved a puzzle or did anything in another level then when you enter the old map again some thing appears and the door is unlocked.

Very similar when you finished the puzzle in the machine room. elevator doors open and the shadow starts appearing, only when you finished the puzzle in the other level. There I hope you understand what I'm trying to say.

So pls tell me what's that code to do that or what I'm supposed to do plss. thanks Big Grin
(This post was last modified: 02-14-2014, 03:02 PM by Radical Batz.)
02-14-2014, 02:59 PM
Find
Unearthlybrutal Offline
Posting Freak

Posts: 775
Threads: 12
Joined: May 2011
Reputation: 26
#2
RE: How to make something happen in the after doing something in another level.

Use global variables.
More info

When Life No Longer Exists
Full-conversion mod
02-14-2014, 03:08 PM
Website Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#3
RE: How to make something happen in the after doing something in another level.

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.

"Veni, vidi, vici."
"I came, I saw, I conquered."
02-14-2014, 03:19 PM
Find
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
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#5
RE: How to make something happen in the after doing something in another level.

(02-14-2014, 03:24 PM)Mudbill Wrote:
(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.

My whole life is a lie.

"Veni, vidi, vici."
"I came, I saw, I conquered."
(This post was last modified: 02-14-2014, 04:23 PM by PutraenusAlivius.)
02-14-2014, 04:22 PM
Find




Users browsing this thread: 2 Guest(s)