Frictional Games Forum (read-only)

Full Version: Activating a ScriptArea in one map from a different map
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I wouldn't have an idea how to do this:
Activate a ScriptArea in one map from a different map.



I know how to use a key in a different map from the one it originates from. Sooo, that's basically my question. Sorry, completely clueless on this one Huh
You have to set up global variables as well as make a global.hps to make it work.
As Statyk said, you will need to use global variables. Create a file called "global.hps" and put it in your maps folder. Then write this in the file:
PHP Code:
void OnGameStart()
{
    
SetGlobalVarInt("EventHappened"0);

(you can name the variable anything you want)

Then once the event happens in the other map and you want to activate the script area, write
Code:
AddGlobalVarInt("EventHappened", 1);

In the script for the map with the script area, write this (make sure you write it in the OnEnter function):
PHP Code:
void OnEnter()
{
    if(
GetGlobalVarInt("EventHappened") == 1) {
        
SetEntityActive("ScriptAreaNameHere"true);
    }