Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Resetting level upon death
Damascus Offline
Senior Member

Posts: 646
Threads: 118
Joined: Mar 2012
Reputation: 29
#6
RE: Resetting level upon death

Alright, facing a new problem on this. The level successfully resets so long as all my timers have finished running, but if the player dies while the timer is still running, it keeps going and blocks the player from advancing. It's a timer sequence, so I wonder if that has something to do with it.

Spoiler below!
void CheckPointActive(string &in asParent, string &in asChild, int alState)
{
CheckPoint ("", "PlayerStartArea_1", "reset", "Ch01Misc", "run");
}

void reset(string &in asName, int alCount)
{
SetPropActiveAndFade("slime_6way_3", false, 1.0f); //disable slime
SetPropActiveAndFade("slime_anim_wall_3", false, 1.0f);
SetPropActiveAndFade("slime_pile_2", false, 1.0f);
SetEntityActive("AreaGuardianKill_lump_2", false); // disable kill area
FadeLightTo("PointLight_2", 0.0f, 0.0f, 0.0f, 0.0f, -1, 1); // disable guardian light
[REPEAT ABOUT A MILLION TIMES]
RemoveEntityCollideCallback("Player", "AreaStartGuardian"); // resetting callbacks
AddEntityCollideCallback("Player", "AreaStartGuardian", "CollideStartGuardian", true, 1);
[ALSO REPEAT A BUNCH]
RemoveTimer("TimerGuardian"); // end timers
RemoveTimer("TimerGuardian2");
RemoveTimer("TimerGuardian3");
RemoveTimer("RestartMusic");
RemoveTimer("CollapseTimer");
SetLocalVarInt("GuardianStep", 0); // reset timer vars
SetLocalVarInt("GuardianStep2", 0);
SetSwingDoorClosed("prison_section_1", true, false); // close all opened doors
SetSwingDoorClosed("cellar_wood01_4", true, false);
SetSwingDoorClosed("cellar_wood01_2", true, false);
}

void CollideStartGuardian(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("SlimeLoopOnPlayer","25_slime_loop.snt", "Player", 2, false);
AddTimer("TimerGuardian", 0, "TimerGuardian");
}

void CollideStartGuardian2(string &in asParent, string &in asChild, int alState)
{
AddTimer("TimerGuardian2", 0, "TimerGuardian2");
}

void TimerGuardian(string &in asTimer)
{
AddLocalVarInt("GuardianStep", 1);
float fEventSpeed = 1.6f;

switch(GetLocalVarInt("GuardianStep")) {
case 1:
SetPropActiveAndFade("slime_6way_3", true, 1.0f);
SetPropActiveAndFade("slime_anim_wall_3", true, 1.0f);
SetPropActiveAndFade("slime_pile_2", true, 1.0f);
SetEntityActive("AreaGuardianKill_lump_2", true);
FadeLightTo("PointLight_2", 0.8f, 0.0f, 0.0f, 0.0f, -1, 1);
StartScreenShake(0.1f, RandFloat(0.15f,0.6f), 0, 0.1);
CreateParticleSystemAtEntity("","ps_guardian_appear_explosion.ps", "AreaGuardianEffectsFloor_lump_2", false);
CreateParticleSystemAtEntity("","ps_guardian_appear_explosion.ps", "AreaGuardianEffectsLWall_lump_2", false);
CreateParticleSystemAtEntity("","ps_guardian_appear_explosion.ps", "AreaGuardianEffectsRWall_lump_2", false);
PlaySoundAtEntity("", "25_guardian_slime_appear.snt", "AreaGuardianKill_lump_2", 0, false);
break;
[GOD IN HEAVEN, MORE REPETITION]
}
if(GetLocalVarInt("GuardianStep") < 27) AddTimer("guardian", fEventSpeed, "TimerGuardian");
}

void TimerGuardian2(string &in asTimer)
{
AddLocalVarInt("GuardianStep2", 1);
float fEventSpeed = 1.0f;

switch(GetLocalVarInt("GuardianStep2")) {
case 1:
CreateParticleSystemAtEntity("","ps_break_cavein.ps", "AreaGuardianCavein", false);
StartScreenShake(0.1f, RandFloat(0.15f,0.6f), 0, 0.1);
PlaySoundAtEntity("", "explosion_rock_large.snt", "AreaGuardianCavein", 0, false);
break;
[BOLLY, ANOTHER ROUND OF CASES MY FRIEND]
}
if(GetLocalVarInt("GuardianStep2") < 11) AddTimer("guardian2", fEventSpeed, "TimerGuardian2");
}

So yeah, that's everything. Like I said, if the two sequenced timers have stopped running, everything resets the way it should and runs again properly when I go through the level a second time. However, if the player dies while the sequences are still going, they are still going when the level resets too.

(This post was last modified: 03-31-2012, 08:58 PM by Damascus.)
03-31-2012, 08:56 PM
Find


Messages In This Thread
Resetting level upon death - by Damascus - 03-28-2012, 03:40 AM
RE: Resetting level upon death - by Your Computer - 03-28-2012, 04:24 AM
RE: Resetting level upon death - by Damascus - 03-28-2012, 04:28 AM
RE: Resetting level upon death - by Your Computer - 03-28-2012, 04:30 AM
RE: Resetting level upon death - by Damascus - 03-28-2012, 04:40 AM
RE: Resetting level upon death - by Damascus - 03-31-2012, 08:56 PM



Users browsing this thread: 1 Guest(s)