Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
AddTimer failure
ApeCake Offline
Member

Posts: 116
Threads: 20
Joined: Jun 2012
Reputation: 4
#1
AddTimer failure

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.
(This post was last modified: 06-28-2012, 02:23 PM by ApeCake.)
06-27-2012, 10:34 PM
Find
Cruzore Offline
Senior Member

Posts: 301
Threads: 2
Joined: Jun 2012
Reputation: 37
#2
RE: AddTimer failure

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.
(This post was last modified: 06-27-2012, 11:43 PM by Cruzore.)
06-27-2012, 11:43 PM
Find
ApeCake Offline
Member

Posts: 116
Threads: 20
Joined: Jun 2012
Reputation: 4
#3
RE: AddTimer failure

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.
06-28-2012, 02:23 PM
Find




Users browsing this thread: 2 Guest(s)