Frictional Games Forum (read-only)
how can i change what the map is like when he dies? - 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: how can i change what the map is like when he dies? (/thread-20450.html)



how can i change what the map is like when he dies? - tonitoni1998 - 02-22-2013

i want the player to respawn at a point of the map, and the map is supposed to look the same as before. and everything happens again etc. do i need "CreateDataCache" for this? i already have an idea of it, but im not sure though.


RE: how can i change what the map is like when he dies? - OriginalUsername - 02-22-2013

(02-22-2013, 06:09 PM)tonitoni1998 Wrote: i want the player to respawn at a point of the map, and the map is supposed to look the same as before. and everything happens again etc. do i need "CreateDataCache" for this? i already have an idea of it, but im not sure though.

You could try this stuff out before you post a thread..

I would make a copy of the map and load him in there, it's maybe not the best way but it works.


RE: how can i change what the map is like when he dies? - Statyk - 02-22-2013

You need to create a checkpoint before the place the player will die at and in that checkpoint function, there is a callback feature (labelled "DEATHMAP" in my example). Give it a function to load the new map. When the player dies, it will call that checkpoint and will load the new map.

Example:
Code:
void OnStart()
{
    AddEntityCollideCallback("Player", "CPArea", "checkpoint1_func", true, 1); //area the player walks into to create the checkpoint
}

void checkpoint1_func(string &in asparent, string &in aschild, int alstate)
{
    CheckPoint("checkpoint1", "PlayerStartArea_1", "DEATHMAP", "DeathHintCategory", "DeathHintEntry"); //checkpoint with callback for new map
}

void DEATHMAP(string &in asname, int alcount)
{
    ChangeMap("MapName", "PlayerStartPos", "StartSound", "EndSound"); //loading new map upon death
}

Use Ctrl+F to find the functions here so you can get a better understanding of the strings and whatnot:
http://wiki.frictionalgames.com/hpl2/amnesia/script_functions


RE: how can i change what the map is like when he dies? - tonitoni1998 - 02-23-2013

(02-22-2013, 08:15 PM)Statyk Wrote: You need to create a checkpoint before the place the player will die at and in that checkpoint function, there is a callback feature (labelled "DEATHMAP" in my example). Give it a function to load the new map. When the player dies, it will call that checkpoint and will load the new map.

Example:
Code:
void OnStart()
{
    AddEntityCollideCallback("Player", "CPArea", "checkpoint1_func", true, 1); //area the player walks into to create the checkpoint
}

void checkpoint1_func(string &in asparent, string &in aschild, int alstate)
{
    CheckPoint("checkpoint1", "PlayerStartArea_1", "DEATHMAP", "DeathHintCategory", "DeathHintEntry"); //checkpoint with callback for new map
}

void DEATHMAP(string &in asname, int alcount)
{
    ChangeMap("MapName", "PlayerStartPos", "StartSound", "EndSound"); //loading new map upon death
}

Use Ctrl+F to find the functions here so you can get a better understanding of the strings and whatnot:
http://wiki.frictionalgames.com/hpl2/amnesia/script_functions

thanks that was what i am looking for Smile