Frictional Games Forum (read-only)
Removing a Timer - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: Removing a Timer (/thread-8412.html)



Removing a Timer - Greven - 06-02-2011

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
Code:
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");
}



RE: Removing a Timer - Khyrpa - 06-02-2011

you must use the string& asName to check what timer to end... So change it like this:

AddTimer("thishere", 4, "GiantStep");

RemoveTimer("thishere");


RE: Removing a Timer - Hardarm - 06-02-2011

(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
Code:
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 Smile

Try and tell me if it works =)



RE: Removing a Timer - Greven - 06-02-2011

Yeah it works just fine Smile Thank you guys ^^


RE: Removing a Timer - Kyle - 06-02-2011

Hmm... That's a quick way to do it. I was thinking along the lines of using local variable integers. :/