Frictional Games Forum (read-only)
[SCRIPT] RemoveTimer problem - 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 - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: [SCRIPT] RemoveTimer problem (/thread-17096.html)



RemoveTimer problem - Steve - 07-19-2012

Okay basically what I have is this.
you just ran into a new map (door) and a "monster" was chasing you so okay here is the deal.
the monster is again following, it is breaking a door while you run away from it. at a moment you see a valve if you spin it, a safety vert opens(the one with the skull). but after you are on the other side of the safety vert. you touch an area.
I want that when you touch the area the last timer that gives you 100 damage and kills you stops.
so I tried RemoveTimer but that doens't work here is my code I hope you guys see or know what's wrong.
PHP Code:
////////////////////////////
// Run first time starting map
void OnStart()
{
 
InteractConnectPropWithMoveObject("wheeltodoor2""valve_iron_1""safety_normal_vert_1"truefalse0);
 
SetEntityInteractionDisabled("level_hub_1"true);
 
Anter();
 
PlaySoundAtEntity("cat""react_breath_loop.snt""soundarea"0false); 
 
AddEntityCollideCallback("Player""ScriptArea_4""breakvalve"true1);
}
void Anter()
{
 
SetPlayerActive(false);
 
StartPlayerLookAt("ScriptArea_1"2.0f2.0f"");
 
AddTimer("scare_timer"1.0f"scarestart");
}
void scarestart(string &in asTimer)
{
 
StopPlayerLookAt();
 
StartPlayerLookAt("ScriptArea_2"2.0f2.0f"");
 
AddTimer("scere_timer"1.0f"scerestert");
}
void scerestert(string &in asTimer)
{
 
StopPlayerLookAt();
 
StartPlayerLookAt("ScriptArea_3"2.0f2.0f"");
 
AddTimer("score_timer"1.0f"scorestert");
}
void scorestert(string &in asTimer)
{
 
StopPlayerLookAt();
 
StartPlayerLookAt("AreaPushDownBar"2.0f2.0f"");
 
AddTimer("scire_timer"1.0f"scirestert");
}
void scirestert(string &in asTimer)
{
 
StopPlayerLookAt();
 
SetPlayerActive(true);
 
SetEntityPlayerInteractCallback("door_barricade_1""Baric"true);
 
StopSound("cat"2);
 
AddTimer(""15.0f"begin");
}
void Baric(string &in asEntity)
{
 
SetSwingDoorClosed("door_barricade_1"truetrue); 
 
AddTimer(""0.5f"Timer_LockBarricade");
}
void Timer_LockBarricade(string &in asTimer)
{
 
SetEntityInteractionDisabled("door_barricade_1"true);
 
SetEntityActive("door_barricade_1"false);
 
SetEntityActive("door_barricade_locked_1"true);
 
PlaySoundAtEntity("""lock_door.snt""Area_BarricadeLockDust"0.0ffalse);
 
CreateParticleSystemAtEntity("""ps_hit_dirt.ps""Area_BarricadeLockDust"false);
 
CreateParticleSystemAtEntity("""ps_hit_metal.ps""Area_BarricadeLockDust"false);
void begin(string &in asTimer)

 
CheckPoint ("RunCheckpoint""PlayerStartArea_3""""RunAway""Running");
 
PlaySoundAtEntity("""guardian_ontop.snt""level_hub_1"0.0ffalse);
 
AddTimer(""1.6f"TimerDeorPound");
 
SetMessage("Messages""escape"0);
 
PlayMusic("search_brute.ogg"true500.5ftrue);
}
 
void TimerDeorPound(stringasTimer)
{
 
PlaySoundAtEntity("puund""hit_wood""ScriptArea_3"0false);
 
PlaySoundAtEntity("terror""ui_terror_meter.snt""Player"0false);
 
CreateParticleSystemAtEntity("puund_dust""ps_hit_wood""ScriptArea_3"false);
 
AddTimer("timer02"1.5f"StopLeok");
}
void StopLeok(stringasTimer)
{
 
PlaySoundAtEntity("puund""hit_wood""ScriptArea_3"0false);
 
CreateParticleSystemAtEntity("puund_dust""ps_hit_wood""ScriptArea_3"false);
 
AddTimer("timer03"1.4f"StopLaok");
}
void StopLaok(stringasTimer)
{
 
PlaySoundAtEntity("puund""hit_wood""ScriptArea_3"0false);
 
CreateParticleSystemAtEntity("puund_dust""ps_hit_wood""ScriptArea_3"false);
 
AddTimer("timer04"1.3f"StopLiok");
}
void StopLiok(stringasTimer)
{
 
PlaySoundAtEntity("puund""hit_wood""ScriptArea_3"0false);
 
CreateParticleSystemAtEntity("puund_dust""ps_hit_wood""ScriptArea_3"false);
 
AddTimer("timer05"1.2f"StopLuok");
}
void StopLuok(stringasTimer)
{
 
PlaySoundAtEntity("puund""hit_wood""ScriptArea_3"0false);
 
CreateParticleSystemAtEntity("puund_dust""ps_hit_wood""ScriptArea_3"false);
 
AddTimer("timer06"1.1f"StopLpok");
}
void StopLpok(stringasTimer)
{
 
PlaySoundAtEntity("puund""hit_wood""ScriptArea_3"0false);
 
CreateParticleSystemAtEntity("puund_dust""ps_hit_wood""ScriptArea_3"false);
 
AddTimer("timer07"1.0f"StopLtok");
}
void StopLtok(stringasTimer)
{
 
PlaySoundAtEntity("puund""hit_wood""ScriptArea_3"0false);
 
CreateParticleSystemAtEntity("puund_dust""ps_hit_wood""ScriptArea_3"false);
 
AddTimer("timer08"0.9f"StopLqok");
}
void StopLqok(stringasTimer)
{
 
PlaySoundAtEntity("puund""hit_wood""ScriptArea_3"0false);
 
CreateParticleSystemAtEntity("puund_dust""ps_hit_wood""ScriptArea_3"false);
 
AddTimer("timer09"0.8f"StopLkok");
}
void StopLkok(stringasTimer)
{
 
PlaySoundAtEntity("puund""hit_wood""ScriptArea_3"0false);
 
CreateParticleSystemAtEntity("puund_dust""ps_hit_wood""ScriptArea_3"false);
 
AddTimer("timer10"0.7f"StopLyok");
}
void StopLyok(stringasTimer)
{
 
PlaySoundAtEntity("puund""hit_wood""ScriptArea_3"0false);
 
CreateParticleSystemAtEntity("puund_dust","ps_hit_wood""ScriptArea_3"false);
 
AddTimer("timer11"0.6f"StopLhok");
}
void StopLhok(stringasTimer)
{
 
PlaySoundAtEntity("puund""hit_wood""ScriptArea_3"0false);
 
CreateParticleSystemAtEntity("puund_dust""ps_hit_wood""ScriptArea_3"false);
 
AddTimer("timer12"0.5f"StopLsok");
}
void StopLsok(stringasTimer)
{
 
PlaySoundAtEntity("puund""hit_wood""ScriptArea_3"0false);
 
CreateParticleSystemAtEntity("puund_dust""ps_hit_wood""ScriptArea_3"false);
 
AddTimer("timer13"0.4f"StopLbok");
}
void StopLbok(stringasTimer)
{
 
PlaySoundAtEntity("puund""hit_wood""ScriptArea_3"0false);
 
CreateParticleSystemAtEntity("puund_dust""ps_hit_wood""ScriptArea_3"false);
 
AddTimer("timer14"0.3f"StopLgok");
}
void StopLgok(stringasTimer)
{
 
PlaySoundAtEntity("puund""hit_wood""ScriptArea_3"0false);
 
CreateParticleSystemAtEntity("puund_dust""ps_hit_wood""ScriptArea_3"false);
 
AddTimer("timer15"0.2f"StopLxok");
}
void StopLxok(stringasTimer)
{
 
PlaySoundAtEntity("puund""hit_wood""ScriptArea_3"0false);
 
CreateParticleSystemAtEntity("puund_dust""ps_hit_wood""ScriptArea_3"false);
 
AddTimer("timer16"0.1f"StopLwok");
}
void StopLwok(stringasTimer)
{
 
PlaySoundAtEntity("puund""hit_wood""ScriptArea_3"0false);
 
PlaySoundAtEntity("puund""25_guardian_activated.snt""ScriptArea_3"0false);
 
CreateParticleSystemAtEntity("puund_dust""ps_hit_wood""ScriptArea_3"false);
 
AddTimer("timer17"1.0f"daad");
}
void daad(stringasTimer)
{
 
CreateParticleSystemAtEntity("pind_dust""ps_dust_falling_hole""DA1"false);
 
CreateParticleSystemAtEntity("p9ind_dust""ps_dust_falling_hole""DA2"false);
 
CreateParticleSystemAtEntity("pi5nd_dust""ps_dust_falling_hole""DA2_1"false);
 
CreateParticleSystemAtEntity("pin2d_dust""ps_dust_falling_hole""DA2_2"false);
 
CreateParticleSystemAtEntity("pind1_dust""ps_dust_falling_hole""DA2_3"false);
 
CreateParticleSystemAtEntity("pind_4dust""ps_dust_falling_hole""DA2_4"false);
 
CreateParticleSystemAtEntity("pind_d4ust""ps_dust_falling_hole""DA2_5"false);
 
CreateParticleSystemAtEntity("pind_du7st""ps_dust_falling_hole""DA2_6"false);
 
CreateParticleSystemAtEntity("pind_dus3t""ps_dust_falling_hole""DA2_7"false);
 
CreateParticleSystemAtEntity("pind_dust""ps_dust_falling_hole""DA2_8"false);
 
CreateParticleSystemAtEntity("8pind_dust""ps_dust_falling_hole""DA2_9"false);
 
CreateParticleSystemAtEntity("p5ind_dust""ps_dust_falling_hole""DA2_10"false);
 
CreateParticleSystemAtEntity("pind_dust""ps_cave_monster_scream""ScriptArea_5"false);
 
PlaySoundAtEntity("papo""explosion_rock_large.snt""level_hub_1"0false);
 
SetPropHealth("level_hub_1"0);
 
SetPropHealth("door_barricade_locked_1"0);
 
CreateParticleSystemAtEntity("stuff","ps_break_wood","ScriptArea_3"false);
 
CreateParticleSystemAtEntity("stufo","ps_break_wood","ScriptArea_3"false);
 
CreateParticleSystemAtEntity("stufi","ps_break_wood","ScriptArea_3"false);
 
AddTimer("timerdie"2.5f"dead");
 
}
void lookatvalve(stringasTimer)

 
RemoveTimer("timerdie");
 
StopPlayerLookAt();
 
StartPlayerLookAt("rock_lock_static_1"2.0f2.0f"");
 
AddTimer("timer21"0.5f"lookatrock");
 
AddTimer("timer22"0.5f"rockbreak1");
}
void dead(stringasTimer)
{
 
PlaySoundAtEntity("puund""attack_claw_hit.snt""Player"0false);
 
GivePlayerDamage(100"Slash"truetrue);
}
void breakvalve(string &in asParentstring &in asChildint alState)

 
SetPlayerCrouching(false);
 
SetPlayerActive(false);
 
StartPlayerLookAt("valve_iron_rusty_breakable_1"2.0f2.0f"");
 
AddTimer("timer20"1.0f"lookatvalve");
}
void rockbreak1(stringasTimer)
{
 
SetEntityActive("rock_lock_static_1"false);
 
SetEntityActive("rock_lock_static_2"true);
 
AddTimer(""0.001f"rockbreak2");
}
void rockbreak2(stringasTimer)
{
 
SetEntityActive("rock_lock_static_2"false);
 
SetEntityActive("rock_lock_static_3"true);
 
AddTimer(""0.001f"rockbreak3");
}
void rockbreak3(stringasTimer)
{
 
SetEntityActive("rock_lock_static_3"false);
 
SetEntityActive("rock_lock_static_4"true);
 
AddTimer(""0.001f"rockbreak4");
}
void rockbreak4(stringasTimer)
{
 
SetEntityActive("rock_lock_static_4"false);
 
SetEntityActive("rock_lock_static_5"true);
 
AddTimer(""0.001f"rockbreak5");
}
void rockbreak5(stringasTimer)
{
 
SetEntityActive("rock_lock_static_5"false);
 
SetEntityActive("rock_lock_static_6"true);
 
AddTimer(""0.001f"rockbreak6");
}
void rockbreak6(stringasTimer)
{
 
SetEntityActive("rock_lock_static_6"false);
 
SetEntityActive("rock_lock_static_7"true);
 
SetPropHealth("valve_iron_rusty_breakable_1"0);
 
CreateParticleSystemAtEntity("stufp","ps_break_pottery","valve_iron_rusty_breakable_1"false);
 
SetPlayerActive(true);
 
AddTimer(""0.001f"rockbreak8");
}
void lookatrock(stringasTimer)
{
 
StopPlayerLookAt();
 
StartPlayerLookAt("valve_iron_rusty_breakable_1"1.0f1.0f"");
 
AddTimer(""1.0f"rockbreak7");
}
void rockbreak7(stringasTimer)
{
 
StopPlayerLookAt();
}
void rockbreak8(stringasTimer)
{
 
SetEntityActive("rock_lock_static_7"false);
 
SetEntityActive("rock_small_moveable"true);
 
AddTimer(""0.01f"rockbreak9");
}
void rockbreak9(stringasTimer)
{
 
AddPropImpulse("valve_iron_rusty_breakable_1"00, -0.5f"world");

I couldn't get the php to show normaly so the "}" and void's are "glued" togheter.

I just put down here the entire code so You can see everything.


RE: RemoveTimer problem - Steve - 07-19-2012

Nevermind I fixed it with a strange little trick I just thought of.
I made an area with an door in it the door is inactive when the last timer plays the door goes active and when the door touches the area you'll die.
but when you enter the area after de vert the area from the door goes inactive Big Grin