| 
		
	
		| Greven   Member
 
 Posts: 106
 Threads: 13
 Joined: May 2011
 Reputation: 
3
 | 
			| Removing a Timer 
 
				Hi there, 
Ive been trying and trying but I cant get this to work.
 
I created a timer on OnEnter called GiantStep. And then in the GiantStep Func i added a timer that goes to GiantStep Func again (in other words a loop) Now I want this timer to be removed when the person picks up an item but the RemoveTimer doesnt work. 
So here's my .hps
 void OnEnter(){
 AddTimer("", 2, "GiantStep");
 }
 
 void GiantStep(string &in asTimer)
 {
 PlaySoundAtEntity("", "enemy_hallucination_disappear.snt", "hanging_lantern_ceiling_3", 0.0f, true);
 AddPropImpulse("key_tomb_1", 0, 0, -2, "World");
 AddTimer("", 4, "GiantStep");
 StartScreenShake(0.05f, 0.3f,0.2f, 0.1f);
 }
 
 void Scream(string &in asEntity) // When the item is picked up
 {
 PlaySoundAtEntity("", "guardian_distant3.snt", "hanging_lantern_ceiling_3", 0.0f, true);
 StartScreenShake(0.1f, 2.0f,0.2f, 1.5.0f);
 AddTimer("", 0.1, "StopGiantStep");
 }
 void StopGiantStep(string &in asTimer)
 {
 RemoveTimer("GiantStep");
 }
 [WIP] Recidivus 
 |  |  
	| 06-02-2011, 07:41 PM |  |  
	
		| Khyrpa   Senior Member
 
 Posts: 638
 Threads: 10
 Joined: Apr 2011
 Reputation: 
24
 | 
			| RE: Removing a Timer 
 
				you must use the string& asName to check what timer to end... So change it like this:
 AddTimer("thishere", 4, "GiantStep");
 
 RemoveTimer("thishere");
 |  |  
	| 06-02-2011, 08:08 PM |  |  
	
		| Hardarm   Posting Freak
 
 Posts: 891
 Threads: 39
 Joined: Apr 2011
 Reputation: 
43
 | 
			| RE: Removing a Timer 
 
				 (06-02-2011, 07:41 PM)Greven Wrote:  Hi there,
 Ive been trying and trying but I cant get this to work.
 
 I created a timer on OnEnter called GiantStep. And then in the GiantStep Func i added a timer that goes to GiantStep Func again (in other words a loop) Now I want this timer to be removed when the person picks up an item but the RemoveTimer doesnt work.
 So here's my .hps
 
 void OnEnter(){
 AddTimer("", 2, "GiantStep");
 }
 
 void GiantStep(string &in asTimer)
 {
 PlaySoundAtEntity("", "enemy_hallucination_disappear.snt", "hanging_lantern_ceiling_3", 0.0f, true);
 AddPropImpulse("key_tomb_1", 0, 0, -2, "World");
 AddTimer("", 4, "GiantStep");
 StartScreenShake(0.05f, 0.3f,0.2f, 0.1f);
 }
 
 void Scream(string &in asEntity) // When the item is picked up
 {
 PlaySoundAtEntity("", "guardian_distant3.snt", "hanging_lantern_ceiling_3", 0.0f, true);
 StartScreenShake(0.1f, 2.0f,0.2f, 1.5.0f);
 AddTimer("", 0.1, "StopGiantStep");
 }
 void StopGiantStep(string &in asTimer)
 {
 RemoveTimer("GiantStep");
 }
 
I think because your timer doesn't have a proper name ^^
 Quote:AddTimer("", 0.1, "StopGiantStep"); 
Try to set, between those empty quote brackets, "GiantStep", and then try again    
Try and tell me if it works =)
			 
				
(This post was last modified: 06-02-2011, 08:09 PM by Hardarm.)
 |  |  
	| 06-02-2011, 08:09 PM |  |  
	
		| Greven   Member
 
 Posts: 106
 Threads: 13
 Joined: May 2011
 Reputation: 
3
 | 
			| RE: Removing a Timer 
 
				Yeah it works just fine    Thank you guys ^^
			
 [WIP] Recidivus 
 |  |  
	| 06-02-2011, 08:42 PM |  |  
	
		| Kyle   Posting Freak
 
 Posts: 911
 Threads: 36
 Joined: Sep 2010
 Reputation: 
7
 | 
			| RE: Removing a Timer 
 
				Hmm... That's a quick way to do it. I was thinking along the lines of using local variable integers. :/
			 
 |  |  
	| 06-02-2011, 09:35 PM |  |  |