Frictional Games Forum (read-only)
Setting new spawn point? - 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 (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: Setting new spawn point? (/thread-6453.html)



Setting new spawn point? - Crunchygoblin - 02-01-2011

How do I change what player start the player will spawn at after he dies?


RE: Setting new spawn point? - Tanshaydar - 02-02-2011

Tried to use CheckPoints?


RE: Setting new spawn point? - Crunchygoblin - 02-02-2011

Not sure how to use them, I looked at the game scripting, but its too complicated.


RE: Setting new spawn point? - Tanshaydar - 02-02-2011

You can place a PlayerStart_Area and make it current checkpoint via functions. Place another one and make it current after a specific happening.


RE: Setting new spawn point? - Crunchygoblin - 02-02-2011

Problem is, I don't know the scripting to do that. Anyone the scripting?


RE: Setting new spawn point? - Phoroneus - 02-02-2011

(02-02-2011, 02:08 AM)Crunchygoblin Wrote: Problem is, I don't know the scripting to do that. Anyone the scripting?

Here's the code lifted from "16_cistern_entrance.hps" (with the movable ladder):
Code:
/////////////////////////
//Upstairs checkpoint when completing ladder
void CollideAreaPlayerUp(string &in asParent, string &in asChild, int alState)
{
    CheckPoint("cp_up", "PlayerStartArea_2", "", "Hints", "DeathFall");
}

And here's the syntax with explanations:
Code:
void  CheckPoint(string& asName,string& asStartPos ,string& asCallback, string &asDeathHintCat, string &asDeathHintEntry);
void = Use this only if "CheckPoint" is the callback name and the function is not called within some other function, otherwise delete it (as you can see, it is gone in the example).
CheckPoint = This function.
string &asName = Checkpoint's name ("cp_up" in the example).
string &asStartPos = New start position ("PlayerStartArea_2" in the example).
string &asCallback = A function to be called when the checkpoint loads (for death counts, used to give more explicit or obvious hints when players are struggling - not used in example).
string &asDeathHintCat = Category name of the death hint that will be shown before player respawns at new checkpoint ("Hints" in the example).
string &asDeathHintEntry = Entry name of the death hint that will be shown before player respawns at new checkpoint ("DeathFall" in the example).

The function mentioned in "string &asCallback" must be given the following syntax to work:
Code:
void MyFunc(string &in asName, int alCount)
Where:
MyFunc = Function name. Change this to whatever you want.
string &in asName = The name of the death counter for this checkpoint.
int alCount = An integer (whole number, i.e. 1, 2, 3...) apparently representing the number of times the player has respawned at this checkpoint. It will be set to 0 upon first respawn, and increments by 1 thereafter.