Frictional Games Forum (read-only)
After player Died restart Map HeLpiE Help - 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: After player Died restart Map HeLpiE Help (/thread-7462.html)



After player Died restart Map HeLpiE Help - vanjavk - 04-18-2011

Okey I was wondering is it possible to make when player dies for map just map to restart, i mean with all scripts, so like restarting game but not to restart game from first map,
hope you understand what i'm saying,
also if that's not possible i don't know how to make player when dies to spawn on different location Big Grin


so when PLAYER DIES restart Map not whole thing,
OR (if that's not possible)
To make when player dies spawn on different position


RE: After player Died restart Map HeLpiE Help - nkmol - 04-18-2011

i think when you use ,
void ChangeMap(string& asMapName, string& asStartPos, string& asStartSound, string& asEndSound);
it will restart the current map whith all the scripts, not 100% sure.

u could use like :

Code:
if (GetPlayerHealth == 0)
    {
        ChangeMap(string& asMapName, string& asStartPos, string& asStartSound, string& asEndSound);
    }

try to experiment whith this Wink


RE: After player Died restart Map HeLpiE Help - vanjavk - 04-18-2011

(04-18-2011, 05:54 PM)nkmol Wrote: i think when you use ,
void ChangeMap(string& asMapName, string& asStartPos, string& asStartSound, string& asEndSound);
it will restart the current map whith all the scripts, not 100% sure.

u could use like :

Code:
if (GetPlayerHealth == 0)
    {
        ChangeMap(string& asMapName, string& asStartPos, string& asStartSound, string& asEndSound);
    }

try to experiment whith this Wink
Thanks for resposnse but i got error on line 32 1 (line when If starts) errror with If like it can't start with if?
(i never worked with IF before Big Grin)


RE: After player Died restart Map HeLpiE Help - Dalroc - 04-18-2011

Post your script mate Smile


RE: After player Died restart Map HeLpiE Help - vanjavk - 04-19-2011

(04-18-2011, 10:51 PM)Dalroc Wrote: Post your script mate Smile

Code:
this is some of code..
void OnStart()
{
    AddEntityCollideCallback("Player", "OpenCloseTrigger1", "CollideOpenCloseTrigger1", true, 0);
    AddEntityCollideCallback("Player", "AreaIForgot", "CollideAreaIForgot", true, 1);;
    AddUseItemCallback("useexit", "key_tomb_rusty_5", "prison_1", "UseKey",true);
    AddEntityCollideCallback("Player", "AreaIForgot1", "CollideAreaIForgot1", true, 1);
    AddEntityCollideCallback("Player", "AreaIForgot2", "CollideAreaIForgot2", true, 1);
    AddEntityCollideCallback("Player", "AreaIForgot3", "CollideAreaIForgot3", true, 1);
    AddEntityCollideCallback("Player", "AreaIForgot4", "CollideAreaIForgot4", true, 1);
    AddEntityCollideCallback("Player", "AreaIForgot6", "CollideAreaIForgot6", true, 1);
    AddEntityCollideCallback("Player", "AreaIForgot5", "CollideAreaIForgot5", true, 1);
    AddEntityCollideCallback("Player", "AreaKnife", "CollideAreaKnife", true, 1);
    AddEntityCollideCallback("Player", "fallingtele", "Teleport", false, 1);
    AddEntityCollideCallback("Player", "aghagh", "Teleport", false, 1);
    AddEntityCollideCallback("Player", "Creak", "CollideAreaCreak", false, 1);
    AddEntityCollideCallback("Player", "AreaGiveMeTheKnifeAndKillTheMonster", "CollideAreaAreaGiveMeTheKnifeAndKillTheMonster", true, 1);
    AddEntityCollideCallback("Player", "OutCreak", "CollideAreaOutCreak", false, -1);
    AddEntityCollideCallback("servant_grunt_1", "kinfeer_1", "KillGrunt", true, 1);

}
//killing monster
void KillGrunt(string &in asParent, string &in asChild, int alState)
{
    FadeEnemyToSmoke(asParent, true);
}
void aghagh(string &in asTimer)
{
SetMessage("Message", "Text1", 0);
GiveSanityBoost ();
}

if (GetPlayerHealth == 0)
    {
        ChangeMap("DUNGEON", "PlayerStartArea_1", "", "");
    }


// wood creak
void CollideAreaCreak(string &in asParent, string &in asChild, int alState)
{
    AddEffectVoice("creak.ogg", "creak.ogg", "Voice", "creak", false, "", 0, 0);
}
...



RE: After player Died restart Map HeLpiE Help - Rownbear - 04-19-2011

Hmm i've tried playing around with the GetPlayerHealth(); but I can't get it to work either


RE: After player Died restart Map HeLpiE Help - Dalroc - 04-19-2011

You have to have the If condition inside of a function.

EDIT: Also, I suggest you use better names for your functions than "aghagh" or it will just get messy whe nyou start getting a lot of functions.


RE: After player Died restart Map HeLpiE Help - vanjavk - 04-19-2011

(04-19-2011, 01:02 PM)Dalroc Wrote: You have to have the If condition inside of a function.

EDIT: Also, I suggest you use better names for your functions than "aghagh" or it will just get messy whe nyou start getting a lot of functions.

uhm how exactly, sorry but i never worked with IF before so i don't know how to set it Sad(

btw that's the only messy name in whole story xD


RE: After player Died restart Map HeLpiE Help - nkmol - 04-19-2011

it is the same as a normal command, you could see it as a command in command for now Tongue
you need the,
void callback
{
//scripting stuff
if//your if script
{
//script for the if
}
}

as an example, in one of my maps i made a simple if script Wink
Code:
void OnEnter()
{
    SetEntityConnectionStateChangeCallback("lever_small01_1", "LeverChange");
}

void LeverChange(string &in EntityName, int alState)
{
    AddDebugMessage("lever_small01_1" + "'s current state: " + alState, false);
    
    if (alState == -1)
    {
        PlaySoundAtEntity("Elec_light", "27_tunnel_elec.snt", "chandelier_simple_short_1", 0.5f, false);
        SetLightVisible("PointLight_2", true);
        SetLampLit("chandelier_simple_short_1", true, true);
    }
}

AND DON'T COPY THIS! xD
this is for a lever script, that will set some electric light on Tongue

if you get a error, first think about what could be the problem and when you can't solve it, ask it here. But first think by yourself (A)


RE: After player Died restart Map HeLpiE Help - vanjavk - 04-19-2011

thankssss Smile