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 Help with global var ints.
Radical Batz Offline
Posting Freak

Posts: 953
Threads: 145
Joined: Dec 2013
Reputation: 25
#1
Help with global var ints.

Hey guys this is my first time using globalvarints and I am just confused of how to sue them or when, So in this particular map, you pickup a jar of acid and in that function I made this
PHP Code: (Select All)
void CleanContainer(string &in asEntityNamestring &in asType)
{
    
AddPlayerSanity(2);
    
PlayMusic("02_puzzle.ogg"false0.7f0.5f9false);
    
SetEntityActive("AreaSpawn"true); 
    
SetGlobalVarInt("GotJarofAcid"1);    


Now when that happened a script box is supposed to be active now in another map since I made this in that code for the other map
PHP Code: (Select All)
void CheapScare(string &in asParentstring &in asChildint alState)
{
    
//If you got the jar of acid
 
if(GetGlobalVarInt("GotJarofAcid")==1)
 {
     
SetEntityActive("AreaCheapScare"true);
 }
 
SetGlobalVarInt("GotJarofAcid"1);
}

//A function when looking at the Suitor
void SanityDamage(string &in asEntitystring &in asType)
{
SetEntityActive("enemy_suitor_1"true);
 
FadeEnemyToSmoke("enemy_suitor_1"true);


But it still doesn't work do you guys know what's the problem here or am i just stupid cause this is my first time using globalvarints and I might not do a good job at it! so eyah, am I supposed to put something onstart?

IDK tell em down in the comments, thnx.

04-06-2014, 02:25 PM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#2
RE: Help with global var ints.

GlobalVarInt can only be used in a seperate hps called global.hps.

EDIT:
Here's my tutorial on GlobalVar.

"Veni, vidi, vici."
"I came, I saw, I conquered."
(This post was last modified: 04-06-2014, 02:39 PM by PutraenusAlivius.)
04-06-2014, 02:37 PM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#3
RE: Help with global var ints.

^Would recommend adding that to the wiki one day Smile

Discord: Romulator#0001
[Image: 3f6f01a904.png]
04-06-2014, 02:41 PM
Find
daortir Offline
Senior Member

Posts: 422
Threads: 9
Joined: Sep 2013
Reputation: 18
#4
RE: Help with global var ints.

Dude there is no need for a global.hps to use global variables ^^. Your tutoral is good otherwise but there is absolutely no need to decare global variables in a global.hps file. You can perfectly create them in a classic .hps file, and reuse them from any other file.

(This post was last modified: 04-06-2014, 02:49 PM by daortir.)
04-06-2014, 02:49 PM
Find
Neelke Offline
Senior Member

Posts: 668
Threads: 82
Joined: Apr 2013
Reputation: 26
#5
RE: Help with global var ints.

^^

Global variables can be used throughout several maps and can be accessed by several script files.

void SetGlobalVarInt(string& asName, int alVal);
void AddGlobalVarInt(string& asName, int alVal);
int GetGlobalVarInt(string& asName);

void SetGlobalVarFloat(string& asName, float afVal);
void AddGlobalVarFloat(string& asName, float afVal);
float GetGlobalVarFloat(string& asName);

void SetGlobalVarString(string& asName, const string& asVal);
void AddGlobalVarString(string& asName, string& asVal);
string& GetGlobalVarString(string& asName);

Derp.
04-06-2014, 02:58 PM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#6
RE: Help with global var ints.

edit: oh sorry wio incorrect thread

"Veni, vidi, vici."
"I came, I saw, I conquered."
(This post was last modified: 04-07-2014, 02:16 AM by PutraenusAlivius.)
04-06-2014, 03:35 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#7
RE: Help with global var ints.

(04-06-2014, 03:35 PM)SomethingRidiculous Wrote: When a white man gets all racist they get discrimination, but IF a black man gets all racist they get compliments!

Sorry, what? Is that some sort of example?
I mean, I agree, but I don't see how it has any relevance here.

04-06-2014, 05:44 PM
Find
Radical Batz Offline
Posting Freak

Posts: 953
Threads: 145
Joined: Dec 2013
Reputation: 25
#8
RE: Help with global var ints.

um guys thanks for the replies and everything but I seem not to get it working!

04-06-2014, 09:10 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#9
RE: Help with global var ints.

Try putting the check in OnEnter.

PHP Code: (Select All)
void OnEnter()
{
    if(
GetGlobalVarInt("GotJarofAcid")==1)
    {
        
SetEntityActive("AreaCheapScare"true);
        
SetGlobalVarInt("GotJarofAcid"0);
    }


04-06-2014, 11:06 PM
Find




Users browsing this thread: 1 Guest(s)