[SOLVED]Checkpoint problem... - FlawlessHappiness - 09-23-2012
I'm having a problem with checkpoints...
First the player "Falls to death", like they did in the real game.
Then the player spawns, and a cutscene small cutscene is playing. After that the player dies again, and the i want him to spawn another place, but instead he spawns in the same place, and the cutscene restarts...
Here is the script:
Spoiler below!
void OnStart()
{
SetLocalVarInt("FallToMentalState", 0);
AddEntityCollideCallback("Player", "AreaFallDeath", "CollideFallDeath", false, 1);
AddEntityCollideCallback("Player", "AreaFall", "Fall", true, 1);
}
/////////////////
//FALL TO DEATH//
void CollideFallDeath(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("fallaaaaaah", "11_fall", "Player", 0, false);
FadeOut(1);
AddTimer("death1", 0.5f, "TimerFallDeath");
AddTimer("death2", 1, "TimerFallDeath");
}
void TimerFallDeath(string &in asTimer)
{
if(asTimer == "death1"){
PlaySoundAtEntity("bump1", "player_bodyfall", "Player", 0, false);
return;
}
if(GetLocalVarInt("FallToMentalState") == 0)
{
SetLocalVarInt("FallToMentalState", 1);
CheckPoint("", "MentalState", "MentalStateFunction", "DeathHints", "Ouch");
DisableDeathStartSound();
AddPlayerHealth(-200);
PlaySoundAtEntity("pain", "player_falldamage_max", "Player", 0, false);
PlaySoundAtEntity("bump2", "player_bodyfall", "Player", 0, false);
return;
}
CheckPoint("", "PlayerStartArea_2", "", "DeathHints", "Ouch");
DisableDeathStartSound();
AddPlayerHealth(-200);
PlaySoundAtEntity("pain", "player_falldamage_max", "Player", 0, false);
PlaySoundAtEntity("bump2", "player_bodyfall", "Player", 0, false);
}
//FALL TO DEATH END//
/////////////////////
////////////
//THE FALL//
void Fall(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "scare_wind.snt", "Player", 0, false);
AddDebugMessage("CollideFall", false);
AddPlayerBodyForce(0, 20000, -20000, false);
}
void Slow(string &in asParent, string &in asChild, int alState)
{
if(alState == 1)
{
SetPlayerMoveSpeedMul(0.5f);
SetPlayerRunSpeedMul(0.5f);
}
if(alState == -1)
{
SetPlayerMoveSpeedMul(1);
SetPlayerRunSpeedMul(1);
}
}
void MentalStateFunction(string &in asName, int alCount)
{
SetPlayerMoveSpeedMul(0.5f);
SetPlayerRunSpeedMul(0.5f);
FadeImageTrailTo(2, 1);
SetRadialBlurStartDist(0.1);
FadeRadialBlurTo(0.05, 0.025);
StartPlayerLookAt("SimonScreamsLookAt", 2, 2, "");
AddTimer("SimonScreams_1", 3, "SimonScreams");
CheckPoint("", "AreaWakeUp", "", "DeathHints", "Simon");
}
void SimonScreams(string &in asTimer)
{
if(asTimer == "SimonScreams_1")
{
AddEffectVoice("voice_simonscream_1.ogg", "", "Voice", "voice_simonscream_1", false, "", 0, 0);
AddTimer("SimonScreams_2", 6, "SimonScreams");
}
if(asTimer == "SimonScreams_2")
{
AddEffectVoice("voice_simonscream_2.ogg", "", "Voice", "voice_simonscream_2", false, "", 0, 0);
AddTimer("SimonScreams_3", 7, "SimonScreams");
}
if(asTimer == "SimonScreams_3")
{
AddEffectVoice("voice_simonscream_3.ogg", "", "Voice", "voice_simonscream_3", false, "", 0, 0);
AddTimer("SimonScreams_4", 7, "SimonScreams");
}
if(asTimer == "SimonScreams_4")
{
AddEffectVoice("voice_simonscream_4.ogg", "", "Voice", "voice_simonscream_4", false, "", 0, 0);
AddTimer("SimonScreams_5", 6, "SimonScreams");
}
if(asTimer == "SimonScreams_5")
{
AddEffectVoice("voice_simonscream_5.ogg", "", "Voice", "voice_simonscream_5", false, "", 0, 0);
AddTimer("SimonScreams_6", 7, "SimonScreams");
}
if(asTimer == "SimonScreams_6")
{
AddEffectVoice("voice_simonscream_6.ogg", "", "Voice", "voice_simonscream_6", false, "", 0, 0);
AddTimer("SimonScreams_7", 8, "SimonScreams");
}
if(asTimer == "SimonScreams_7")
{
AddEffectVoice("voice_simonscream_7.ogg", "", "Voice", "voice_simonscream_7", false, "", 0, 0);
AddTimer("SimonScreams_8", 6, "SimonScreams");
}
if(asTimer == "SimonScreams_8")
{
AddEffectVoice("voice_simonscream_8.ogg", "", "Voice", "voice_simonscream_8", false, "", 0, 0);
AddTimer("End", 5, "SimonScreams");
}
if(asTimer == "End")
{
FadeImageTrailTo(0, 1);
FadeRadialBlurTo(0, 0.025);
SetPlayerHealth(0);
}
}
//THE FALL END//
////////////////
Can anybody help me out here? What am i doing wrong?
RE: Checkpoint problem... - Your Computer - 09-23-2012
Checkpoint names need to be unique.
RE: Checkpoint problem... - FlawlessHappiness - 09-23-2012
You mean i have to write a new asName for it to work?
RE: Checkpoint problem... - Vic7im - 09-25-2012
Wait.
You die, you respawn in A, you walk a little bit, cutscene plays, you die (again), you would like to respawn in B but instead you respawn in A?
Is that what you want to accomplish?
RE: Checkpoint problem... - FlawlessHappiness - 09-25-2012
That was what happened yea But it's solved anyway. I thougt dying 2 times was too much, so instead i used fade-teleport