Frictional Games Forum (read-only)

Full Version: how can i change what the map is like when he dies?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.
(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.
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/amn..._functions
(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/amn..._functions

thanks that was what i am looking for Smile