Frictional Games Forum (read-only)
Activating a ScriptArea in one map from a different map - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Activating a ScriptArea in one map from a different map (/thread-20915.html)



Activating a ScriptArea in one map from a different map - Cyphermur9t - 03-25-2013

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


RE: Activating a ScriptArea in one map from a different map - Statyk - 03-25-2013

You have to set up global variables as well as make a global.hps to make it work.


RE: Activating a ScriptArea in one map from a different map - NaxEla - 03-25-2013

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);
    }