Radical Batz 
 
 
		
			Posting Freak 
			
			
			
 
			
	Posts: 953 
	Threads: 145 
	Joined: Dec 2013
	
 Reputation: 
25
		
	 | 
	
		
			
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  void CleanContainer(string &in asEntityName, string &in asType) {     AddPlayerSanity(2);     PlayMusic("02_puzzle.ogg", false, 0.7f, 0.5f, 9, false);     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  void CheapScare(string &in asParent, string &in asChild, int 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 asEntity, string &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  | 
	
		
	 | 
 
 
	
		
		PutraenusAlivius 
 
 
		
			Posting Freak 
			
			
			
 
			
	Posts: 4,713 
	Threads: 75 
	Joined: Dec 2012
	
 Reputation: 
119
		
	 | 
	
		
			
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." 
			
		 |  
	 
 | 
 
	| 04-06-2014, 02:37 PM  | 
	
		
	 | 
 
 
	
		
		Romulator 
 
 
		
			Not Tech Support ;-) 
			
			
			
 
			
	Posts: 3,628 
	Threads: 63 
	Joined: Jan 2013
	
 Reputation: 
195
		
	 | 
	
		
			
RE: Help with global var ints. 
			 
			
				^Would recommend adding that to the wiki one day   
			 
			
			
 
Discord: Romulator#0001
![[Image: 3f6f01a904.png]](https://puu.sh/zOxJg/3f6f01a904.png)  
			
		 |  
	 
 | 
 
	| 04-06-2014, 02:41 PM  | 
	
		
	 | 
 
 
	
		
		daortir 
 
 
		
			Senior Member 
			
			
			
 
			
	Posts: 422 
	Threads: 9 
	Joined: Sep 2013
	
 Reputation: 
18
		
	 | 
	
		
			
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  | 
	
		
	 | 
 
 
	
		
		Neelke 
 
 
		
			Senior Member 
			
			
			
 
			
	Posts: 668 
	Threads: 82 
	Joined: Apr 2013
	
 Reputation: 
26
		
	 | 
	
		
			
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  | 
	
		
	 | 
 
 
	
		
		PutraenusAlivius 
 
 
		
			Posting Freak 
			
			
			
 
			
	Posts: 4,713 
	Threads: 75 
	Joined: Dec 2012
	
 Reputation: 
119
		
	 | 
	
		
			
RE: Help with global var ints. 
			 
			
				edit: oh sorry wio incorrect thread
			 
			
			
 
"Veni, vidi, vici." 
"I came, I saw, I conquered." 
			
		 |  
	 
 | 
 
	| 04-06-2014, 03:35 PM  | 
	
		
	 | 
 
 
	
		
		Mudbill 
 
 
		
			Muderator 
			
			
			
 
			
	Posts: 3,881 
	Threads: 59 
	Joined: Apr 2013
	
 Reputation: 
179
		
	 | 
	
		
			
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  | 
	
		
	 | 
 
 
	
		
		Radical Batz 
 
 
		
			Posting Freak 
			
			
			
 
			
	Posts: 953 
	Threads: 145 
	Joined: Dec 2013
	
 Reputation: 
25
		
	 | 
	
		
			
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  | 
	
		
	 | 
 
 
	
		
		Mudbill 
 
 
		
			Muderator 
			
			
			
 
			
	Posts: 3,881 
	Threads: 59 
	Joined: Apr 2013
	
 Reputation: 
179
		
	 | 
	
		
			
RE: Help with global var ints. 
			 
			
				Try putting the check in OnEnter. 
void OnEnter() {     if(GetGlobalVarInt("GotJarofAcid")==1)     {         SetEntityActive("AreaCheapScare", true);         SetGlobalVarInt("GotJarofAcid", 0);     } } 
 
  
			 
			
			
 
			
		 |  
	 
 | 
 
	| 04-06-2014, 11:06 PM  | 
	
		
	 | 
 
 
	 
 |