Frictional Games Forum (read-only)
[CHAOS] Half of the script is firing, but not... - 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: [CHAOS] Half of the script is firing, but not... (/thread-14834.html)



Half of the script is firing, but not... - JetlinerX - 04-16-2012

So I have a huge scare here, and I have been trying to troubleshoot it for hours. I have added debug messages to all the timers, and everything is firing off. Yet, they are not taking the action they should be in game. The whole script for the map is 230 lines of code, so I dont want to post it all, but if it helps, here is the scare part of it. Tell me if you can spot anything. I am willing to upload the script somewhere if need be.

The Collide Scripts at the top look like:

Code:
        AddEntityCollideCallback("Player", "DogAttackArea", "DogAttack", true, 1);
        AddEntityCollideCallback("Player", "Stopdawalk", "StopWalking", true, 1);

And the functions down below look like:

Code:
//------------------------------------------------------------------------------------------------//
void DogAttack(string &in asParent, string &in asChild, int alState)
{
        PlaySoundAtEntity("", "wolf1.snt", "GrowlTarget1", 0, false);
        SetEntityActive("Stopdawalk", true);
        SetPlayerActive(false);
        AddTimer("", 2.0f, "NextGrowl");
        AddDebugMessage("Start Script Fired.", false);
}
//------------------------------------------------------------------------------------------------//
void NextGrowl(string &in asTimer)
{
        PlaySoundAtEntity("", "wolf2.snt", "GrowlTarget2", 0, false);
        AddTimer("", 2.0f, "ThridGrowl");
        AddDebugMessage("Sound and Start Timer Fired", false);
}
//------------------------------------------------------------------------------------------------//
void ThridGrowl(string &in asTimer)
{
        PlaySoundAtEntity("", "wolf2.snt", "Lookat", 0, false);
        AddTimer("", 0.5f, "TheLook");
        AddDebugMessage("Next Timer Fired", false);
}
//------------------------------------------------------------------------------------------------//
void TheLook(string &in asTimer)
{
        StartPlayerLookAt("Lookat", 1, 1, "");
        AddTimer("", 4.0f, "TheWalk");
        AddDebugMessage("Look at Timer Fired", false);
}
//------------------------------------------------------------------------------------------------//
void TheWalk(string &in asTimer)
{
        SetPlayerMoveSpeedMul(0.2);
        AddTimer("", 2.3f, "Walk");
        PlaySoundAtEntity("", "Heartbeatslow.snt", "Player", 0, false);
        AddDebugMessage("Walk Timer Fired", false);
}
//------------------------------------------------------------------------------------------------//
void Walk(string &in asTimer)
{
        MovePlayerForward(5.0f);
        AddTimer("", 0.1f, "restart_walk");    
        AddDebugMessage("You're walking", false);
}
//------------------------------------------------------------------------------------------------//
void restart_walk(string &in asTimer)
{
        AddTimer("restarter", 0, "atwalkto");
}
//------------------------------------------------------------------------------------------------//
void atwalkto(string &in asTimer)
{
        MovePlayerForward(10.0f);
        AddTimer("looper", 0.1f, "restart_walk");
}
//------------------------------------------------------------------------------------------------//
void StopWalking(string &in asParent, string &in asChild, int alState)
{
        RemoveTimer("looper");
        RemoveTimer("restarter");
        MovePlayerForward(0.0f);
        SetPlayerMoveSpeedMul(1);
        AddTimer("", 2.0, "Attack");
        AddDebugMessage("You Stopped Walking", false);
}
//------------------------------------------------------------------------------------------------//
void Attack(string &in asTimer)
{
        StartPlayerLookAt("DogAttack", 10, 10, "");
        PlaySoundAtEntity("", "barkgrowl.snt", "Player", 0, false);
        SetEntityActive("DogAttack", false);
        AddDebugMessage("Dog Attacking Now.", false);
}
//------------------------------------------------------------------------------------------------//



RE: Half of the script is firing, but not... - Cranky Old Man - 04-16-2012

When you vaguely say "they are not taking the action they should be in game", are you talking about animations for new imported models? Have you gotten these models to work in Amnesia before?
Edit: "ThridGrowl" should probably be "ThirdGrowl" but as you have spelled it wrong at both places, that shouldn't cause an error. Cool, though.


RE: Half of the script is firing, but not... - JetlinerX - 04-16-2012

Meaning the player gets set to inactive, and just stands there, while the debug messages say they are firing the scripts, the player is not moving, sounds are not playing etc.

EDIT: Looks like the only script that seems to be working is the forced walk. The MovePlayerForward script is the only one that is working. But the sounds dont play, and the player does not look at the entities he/she is supposed to.

EDIT 2: Heartbeat sound is working aswell.
*RAGE FACE*

Players cant look at Static Objects, nor can sounds play off of them!!!!!!!!!!!!!!!!!!

Figured it all out. Never mind this topic. Thanks all.