Danny Boy 
 
 
		
			Posting Freak 
			
			
			
 
			
	Posts: 2,718 
	Threads: 85 
	Joined: Mar 2011
	
 Reputation: 
81
		
	 | 
	
		
			
[Solved]Help i don't know how to use Timers 
			 
			
				Help i don't know how to use Timers! 
CreateTimer(std:  tring asName, float afTime, std:  tring asCallback, bool abGlobal); i know this is the code but i simply do not know what:
 
asName... i have to give a name to the timer? or what this name is for?
 
asCallback... what is this?
 
abGlobal... its to put true or false right?
 
please help
			  
			
			
			
				
(This post was last modified: 03-18-2011, 12:18 AM by Danny Boy.)
 
				
			 
		 |  
	 
 | 
 
	| 03-16-2011, 10:56 PM  | 
	
		
	 | 
 
 
	
		
		Viperdream 
 
 
		
			Member 
			
			
			
 
			
	Posts: 124 
	Threads: 16 
	Joined: Jan 2011
	
 Reputation: 
0
		
	 | 
	
		
			
RE: Help i don't know how to use Timers 
			 
			
				Example: 
I want a timer that activates when I enter the map
 
This is what I do:
 void MonsterSpawnTimer(string &in asTimer)  
//No need to put anything between the "()", put stuff between {} to let stuff happen 
{ 
SetEntityActive("bigassmonster", true);  
} 
And then, because I want it from the start, I do this: 
void OnStart() 
{ 
AddTimer("Monster", 10.0f, "MonsterSpawnTimer");   
} 
//The "Monster" is just a name, you can name it anything you want 
//The "10.0f" means 10seconds. Float stands for float. 
//"MonsterSpawnTimer" is the Timer I'm referring to.
 
If you still don't understand it, check this out:
 http://wiki.frictionalgames.com/hpl2/tut...t_beginner
			 
			
			
 
			
				
(This post was last modified: 03-16-2011, 11:15 PM by Viperdream.)
 
				
			 
		 |  
	 
 | 
 
	| 03-16-2011, 11:14 PM  | 
	
		
	 | 
 
 
	
		
		Danny Boy 
 
 
		
			Posting Freak 
			
			
			
 
			
	Posts: 2,718 
	Threads: 85 
	Joined: Mar 2011
	
 Reputation: 
81
		
	 | 
	
		
			
RE: Help i don't know how to use Timers 
			 
			
				well that does not work =/ 
 
i wanted to the player wend enters a area the door closes in a noise and creapy way, so the player looks behind him to see what happned... i wanted a timer to to make him stop looking at the door... and wend i have put the timer he does not look at the door eny more =/ what is the prob? 
 
here is the code if it helps: 
 
void OnStart() 
{ 
AddEntityCollideCallback("Player", "ScaryAreaone", "CollideScaryArea", true, 1); 
} 
void CollideScaryArea(string &in asParent, string &in asChild, int alState) 
{ 
	SetSwingDoorLocked("SuperDoor", true, true); 
	PlaySoundAtEntity("", "break_wood", "SuperDoor",0,false); 
	PlaySoundAtEntity("", "react_pant", "Player",0,false); 
	PlayGuiSound("insanity_monster_roar01.ogg", 1.0f); 
	GiveSanityDamage(25, true); 
	StartPlayerLookAt("SuperDoor", 7, 6, ""); 
	AddTimer("Peek a Boo", 02.0f, "CollideScaryArea"); 
		{ 
		StopPlayerLookAt(); 
		} 
	 
}
			 
			
			
			
		 |  
	 
 | 
 
	| 03-17-2011, 12:28 AM  | 
	
		
	 | 
 
 
	
		
		Viperdream 
 
 
		
			Member 
			
			
			
 
			
	Posts: 124 
	Threads: 16 
	Joined: Jan 2011
	
 Reputation: 
0
		
	 | 
	
		
			
RE: Help i don't know how to use Timers 
			 
			
				void CollideScaryArea(string &in asParent, string &in asChild, int alState) 
{ 
    SetSwingDoorLocked("SuperDoor", true, true); 
    PlaySoundAtEntity("", "break_wood", "SuperDoor",0,false); 
    PlaySoundAtEntity("", "react_pant", "Player",0,false); 
    PlayGuiSound("insanity_monster_roar01.ogg", 1.0f); 
    GiveSanityDamage(25, true); 
    StartPlayerLookAt("SuperDoor", 7, 6, ""); 
        AddTimer("Boo", 0.2f, "PeekaBooTimer"); //This only links to "PeekaBooTimer" 
}     
void PeekaBooTimer(string &in asTimer)  
//Put the stuff you want done in a seperate place, away from OnStart or any other stuff with void in front of it. 
{ 
StopPlayerLookAt(); 
}
 See what I did there? Don't put the stuff you want to get done in the AddTimer, since that only links to the timer you created.
			  
			
			
 
			
				
(This post was last modified: 03-17-2011, 12:41 AM by Viperdream.)
 
				
			 
		 |  
	 
 | 
 
	| 03-17-2011, 12:39 AM  | 
	
		
	 | 
 
 
	
		
		Danny Boy 
 
 
		
			Posting Freak 
			
			
			
 
			
	Posts: 2,718 
	Threads: 85 
	Joined: Mar 2011
	
 Reputation: 
81
		
	 | 
	
		
			
RE: Help i don't know how to use Timers 
			 
			
				Hey its works now thank you very much!   
			 
			
			
			
		 |  
	 
 | 
 
	| 03-18-2011, 12:18 AM  | 
	
		
	 | 
 
 
	 
 |