Frictional Games Forum (read-only)
Changing map if you die. - 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: Changing map if you die. (/thread-17358.html)



Changing map if you die. - onv - 07-30-2012

Hello.

I'm making a custom story where i'm in a nightmare , and i wanna know if it's possible to make the map change (waking up Tongue ) if you die.

Help would be appreciated , thanks.


RE: Changing map if you die. - Adny - 07-30-2012

Here's a timer that checks the player's health every 0.2 seconds (this is smallest time to loop without having an effect on performance); if the player's health reaches 0, the map will change:


void OnStart()
{
AddTimer("dead", 0.2f, "Check_Dead");
}

void Check_Dead(string &in asTimer)
{
AddTimer("dead", 0.2f, "Check_Dead");

if(GetPlayerHealth() == 0.0f)
{
ChangeMap("NAME_OF_MAP", "NAME_OF_START_POSITION", "", "");
RemoveTimer(asTimer);
}
}

Hope that helped!


RE: Changing map if you die. - Your Computer - 07-30-2012

Or you can just set a check point and use the checkpoint callback to call ChangeMap.


RE: Changing map if you die. - onv - 07-30-2012

kk , Thanks for your help , i did Your Computer's method :>