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
#1
Resetting level upon death

I placed a Checkpoint at the beginning of one of my maps, expecting the level to be reset to what it was when you crossed it on the event of your death. The checkpoint works like I assume it should (the death hint shows), but the level is just as it was when the player dies. Which is a huge problem because the player's path is blocked continually as he progresses through the level.

How can i get everything to be reset when the player spawns?

(This post was last modified: 04-01-2012, 08:12 PM by Damascus.)
03-28-2012, 03:40 AM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#2
RE: Resetting level upon death

When you placed the checkpoint, didn't you make use of its callback feature? It does not sound like you did.

Tutorials: From Noob to Pro
03-28-2012, 04:24 AM
Website Find
Damascus Offline
Senior Member

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

I didn't because I don't know what to put under it to make the map reset.

Callback syntax: void MyFunc(string &in asName, int alCount)


Count is 0 on the first checkpoint load!


I see this on the scripts page but don't know what I'm supposed to actually put there.

CheckPoint ("", "PlayerStartArea_1", "reset", "DeathHint", "run");

void reset("?????", 0)
{
?????
}

(This post was last modified: 03-28-2012, 04:32 AM by Damascus.)
03-28-2012, 04:28 AM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#4
RE: Resetting level upon death

(03-28-2012, 04:28 AM)Damascus Wrote: or do I have to go through undoing every single thing that's changed in the map?

Pretty much.

Tutorials: From Noob to Pro
03-28-2012, 04:30 AM
Website Find
Damascus Offline
Senior Member

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

(NEVER MIND, I'M DUMB)

Well it took an absolute novel's worth of additional scripting but I was able to have everything in the level reset, except for entities that have been moved by the player. Thanks for your help!

(This post was last modified: 03-28-2012, 05:31 AM by Damascus.)
03-28-2012, 04:40 AM
Find
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




Users browsing this thread: 1 Guest(s)