Frictional Games Forum (read-only)
[SCRIPT] Triggers not resetting - 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: [SCRIPT] Triggers not resetting (/thread-14623.html)



Triggers not resetting - JetlinerX - 04-08-2012

I KNOW there is a similar topic below, but I dont want to hijack his since he is still getting help.

Whats wrong with my script, that is making the areas not reactivate?

My Checkpoint

CheckPoint ("Check1", "BridgeDeathRespawn", "BridgeDeath", "DeathHints", "StayLow");

My Function:


void BridgeDeath(string &in asName, int alCount)
{
SetEntityActive("SprintDisable", true);
SetEntityActive("SprintEnable", true);
SetEntityActive("StandKill", true);
}




RE: Triggers not resetting - Apjjm - 04-08-2012

Going to need more information. Can you post up the full script?


RE: Triggers not resetting - JetlinerX - 04-08-2012

Sure thing!

Code:
void OnEnter ()
{
        AddEntityCollideCallback("Player", "Wakeupscript", "Wakeupscript", true, 1);
        AddEntityCollideCallback("Player", "Levelchange_1", "Levelchange", true, 1);
        AddEntityCollideCallback("Player", "NoScare", "NoScare", true, 1);
        AddEntityCollideCallback("Player", "SprintDisable", "NoSprint", true, 1);
        AddEntityCollideCallback("Player", "SprintEnable", "Sprint", true, 1);
        AddEntityCollideCallback("Player", "StandKill", "KillStand", true, 1);
}
void Wakeupscript(string &in asParent, string &in asChild, int alState)
{
        SetLanternDisabled(true);
        SetPlayerActive(false);
        SetPlayerCrouching(true);
        FadeOut(1.0f);
        PlayMusic("Map1Ambiance.ogg", true, 100, 1, 0, false);
        FadePlayerRollTo(50, 33, 33);
        AddTimer("", 10, "Rollback");
        SetPlayerSanity(10);
        SetPlayerMoveSpeedMul(0.5);
        SetPlayerLookSpeedMul(0.5);
}
void Rollback(string &in asTimer)
{
        SetPlayerActive(true);
        FadeIn(10.0f);
        FadePlayerRollTo(0, 33, 33);
        CheckPoint ("Check1", "BridgeDeathRespawn", "BridgeDeath", "DeathHints", "StayLow");
}
void Levelchange(string &in asParent, string &in asChild, int alState)
{
        FadeOut(1.0f);
        AddTimer("", 1.0f, "Change");
}
void Change(string &in asTimer)
{
        ChangeMap("map02.map", "PlayerStartArea_1", "", "");
}
void NoScare(string &in asParent, string &in asChild, int alState)
{
        PlaySoundAtEntity("", "03_no.snt", "Levelchange_1", 0, true);
        StartPlayerLookAt("Levelchange_1", 2, 2, "");
        AddTimer("", 5, "Away");
}
void Away(string &in asTimer)
{
        StopPlayerLookAt();
}
void NoSprint(string &in asParent, string &in asChild, int alState)
{
        SetPlayerRunSpeedMul(0);
}
void Sprint(string &in asParent, string &in asChild, int alState)
{
        SetPlayerRunSpeedMul(1);
        GiveSanityBoost();
}
void KillStand(string &in asParent, string &in asChild, int alState)
{
        SetPlayerHealth(0);
}
void BridgeDeath(string &in asName, int alCount)
{
        SetEntityActive("SprintDisable", true);
        SetEntityActive("SprintEnable", true);
        SetEntityActive("StandKill", true);
}
void OnLeave ()
{
}



RE: Triggers not resetting - Apjjm - 04-08-2012

It appears you are deleting your callbacks on collision instead of de-activating the areas - so you will need to re-add them. Your checkpoint function should look as follows:

Code:
void BridgeDeath(string &in asName, int alCount)
{
        AddEntityCollideCallback("Player", "SprintDisable", "NoSprint", true, 1);
        AddEntityCollideCallback("Player", "SprintEnable", "Sprint", true, 1);
        AddEntityCollideCallback("Player", "StandKill", "KillStand", true, 1);
}

Also note that adding your callbacks in OnEnter will mean they are added every time the map is entered. OnStart is usually a better place for adding the initial callbacks.

Edit: Forum formatting Tongue


RE: Triggers not resetting - JetlinerX - 04-08-2012

Opp, silly me. I knew areas dont get deleted, they just have to be recalled. DERRPPP. Sorry to waste your time. + rep.