Frictional Games Forum (read-only)
AddTimer failure - 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: AddTimer failure (/thread-16543.html)



AddTimer failure - ApeCake - 06-27-2012

Alright, so, I wanted the player to look at two things when he enters a script area (in this case, the script area is called lookatelevator). This is my code, however, things don't seem to work out too well.

void OnStart()
{
AddEntityCollideCallback("Player", "lookatelevator", "lookatelevatorandrodpipes", true, 1);
}

void lookatelevatorandrodpipes(string &in asParent, string &in asChild, int alState)
{
SetPlayerActive(false);
AddTimer("lookatpipes1", 0.5, "lookatrodpuzzle");
AddTimer("lookatpipes2", 2.5, "lookatrodpuzzle");
AddTimer("lookatpipes3", 5.5, "lookatrodpuzzle");
}


void lookatrodpuzzle(string &in asTimer)
{
string x = asTimer;
if (x == "lookatpipes1")
{
StartPlayerLookAt("rodpipe1", 5, 4, "");
}
else if (x == "lookatpipes2")
{
StartPlayerLookAt("lookatthedamnpipe2daniel", 5, 4, "");
}
else if (x == "lookatpipes3")
{
StopPlayerLookAt();
SetPlayerActive(true);
}
}

The weird thing is, it totally ignores lookatpipes1 and lookatpipes2. How do I fix this? I think it has something to do with interfering with another AddTimer I already have in my .hps file... that is my only guess.

And yes, I have checked if the names of the entities are the same in the script.


RE: AddTimer failure - Cruzore - 06-27-2012

I included your code in a test map and named 2 barrels the names you got for your startplayerlookat, and a script area named as the area of your collide callback, and i can confirm that this code is definitely working. Something must be within your map. Doublecheck the names again.


RE: AddTimer failure - ApeCake - 06-28-2012

Alright, I managed to get it working. The rodpipe1 and the other one were static_objects and not entities; I think that was the wrong part. So I put a script area right behind both of them and called them those names and it pretty much worked after that.