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
Maps change other maps
lllDash Offline
Member

Posts: 108
Threads: 12
Joined: Apr 2012
Reputation: 3
#1
Maps change other maps

I've built a puzzle that is situated in "Level_4" that is meant to make a static entity non-static in "Level_2". I've looked for some examples in custom stories and even "dark descent" script files to hopefully understand how to do it but it's hard to find an example if i don't know what it looks like. I've even gone through http://wiki.frictionalgames.com/hpl2/amn...ons#global
help please? Rolleyes


PS I know how to make an entity static. I just need an example of how to make it affect entities in other maps.
05-14-2012, 01:34 AM
Find
Putmalk Offline
Senior Member

Posts: 290
Threads: 13
Joined: Apr 2012
Reputation: 15
#2
RE: Maps change other maps

SetGlobalVarInt function should do the trick.

Set the variable in level_4, and in level_2, do a check:

if(GetGlobalVarInt("variable") == 1)
{
//do stuff
}

05-14-2012, 02:23 AM
Find
FragdaddyXXL Offline
Member

Posts: 136
Threads: 20
Joined: Apr 2012
Reputation: 7
#3
RE: Maps change other maps

And you'll need to set up a global.hps file in your maps folder.

Here's an example of what's in mine at the moment:

////////////////////////////
// Run at the start of the game.
void OnGameStart()
{
    SetGlobalVarInt("lockdown", 0); //0: lockdown is ON  || 1: Lockdown is OFF
}

Now you can get the global variable from any .hps file in your custom story.

Dark Seclusion Here
05-15-2012, 12:40 AM
Find
lllDash Offline
Member

Posts: 108
Threads: 12
Joined: Apr 2012
Reputation: 3
#4
RE: Maps change other maps

(05-15-2012, 12:40 AM)FragdaddyXXL Wrote: And you'll need to set up a global.hps file in your maps folder.

Here's an example of what's in mine at the moment:

////////////////////////////
// Run at the start of the game.
void OnGameStart()
{
    SetGlobalVarInt("lockdown", 0); //0: lockdown is ON  || 1: Lockdown is OFF
}

Now you can get the global variable from any .hps file in your custom story.
OH! Big Grin I get it now. thanks guys. let me guess, global.hps must be placed in the main folder of the CS, right?
05-17-2012, 03:11 PM
Find
Putmalk Offline
Senior Member

Posts: 290
Threads: 13
Joined: Apr 2012
Reputation: 15
#5
RE: Maps change other maps

Yeah, you can just check how Frictional did it and emulate it...it should be outside the maps folder IIRC.

Do you really need the global.hps though? I don't think I used one when I made my global variables in the past....

05-17-2012, 03:33 PM
Find
lllDash Offline
Member

Posts: 108
Threads: 12
Joined: Apr 2012
Reputation: 3
#6
RE: Maps change other maps

(05-17-2012, 03:33 PM)Putmalk Wrote: Yeah, you can just check how Frictional did it and emulate it...it should be outside the maps folder IIRC.

Do you really need the global.hps though? I don't think I used one when I made my global variables in the past....
Well then...that would mean there are 2 different ways of doing it, can you show me an example of what you would put in "level1" (the level that triggers) and what you would put in "level2"? (the level that is triggered by "level1")
05-18-2012, 05:58 PM
Find
FragdaddyXXL Offline
Member

Posts: 136
Threads: 20
Joined: Apr 2012
Reputation: 7
#7
RE: Maps change other maps

Say you have a lever in level 2 that opens a door in level 1.

Level 1:
Quote: In the OnEnter() function, check your global variable with an if-else statement to see if it has changed from it's initial value.
void OnEnter()
{
    CheckPoint("WaveChpt", "PlayerStartArea_FromLevel2", "ResetWave", "", "");
    AddTimer("SanityTimer", 0.5f, "UpdateSanity"); //Set up a timer on entry.
    int temp = GetGlobalVarInt("lockdown");
    if(temp == 1)
    {        
        AddEntityCollideCallback("Player", "ScriptArea_FinalWave", "FinalWave", true, 1);
        AddTimer("TriggerBrute2", 4.0f, "SpawnBrute");        
    }
    
}

Now, in level 2, set the lever to change the global variable from 0 to 1.

void StopLockdown(string &in asEntity, int alState)
{
    
    if(alState <= -0.9)
    {
        PlaySoundAtEntity("", "unlock_door.snt", "Player", 0, false);        
        StartScreenShake(0.1f, 6.0f, 1.0f, 1.4f);        
        PlaySoundAtEntity("", "21_alex_low_freq_rumble2.snt", "Player", 0, false);        
        SetMessage("Messages", "SwitchMessage", 9);
        SetGlobalVarInt("lockdown", 1);        
    }    
    
}

(Ripped this straight from one of my CSs, so sorry about the extra code Tongue)

Dark Seclusion Here
(This post was last modified: 05-18-2012, 08:35 PM by FragdaddyXXL.)
05-18-2012, 08:34 PM
Find
lllDash Offline
Member

Posts: 108
Threads: 12
Joined: Apr 2012
Reputation: 3
#8
RE: Maps change other maps

Thanks for that. I'll give it a try.
05-18-2012, 11:42 PM
Find
lllDash Offline
Member

Posts: 108
Threads: 12
Joined: Apr 2012
Reputation: 3
#9
RE: Maps change other maps

I've only tested it now and.....IT WORKS! thanks for the help guys. [Image: biggrin.gif] And thank you FragdaddyXXL for showing me all 3 examples of your script.
(This post was last modified: 05-20-2012, 12:16 AM by lllDash.)
05-20-2012, 12:15 AM
Find
FragdaddyXXL Offline
Member

Posts: 136
Threads: 20
Joined: Apr 2012
Reputation: 7
#10
RE: Maps change other maps

No problem! Big Grin Glad it helped.

Dark Seclusion Here
05-20-2012, 01:58 AM
Find




Users browsing this thread: 3 Guest(s)