Frictional Games Forum (read-only)

Full Version: Need Some Scripting Help Please!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey guys, im trying to script an event where after you start the map, a timer waits an amount of time, before opening a door, and making you look at it. i can script the doors and stuff just fine, but im having the most trouble with timers and getting the player to look at the door.

Here's my script.
------------------------------------------------
void OnStart()
{
AddTimer("", 5f, "Event1");
}

////////////////////////////
// This is the first event to lead the player out of the First room
void Event1(string &in asTimer)
{
GiveSanityDamage(20, true);
StartPlayerLookAt("Door1", 3, 5, "Effects1");
Addtimer("", 2f, "Door1un");
Addtimer("", 5f, "Normal1start");
}
void Door1un(string &in asTimer)
{

}
void Normal1start(string &in asTimer)
{

}
----------------------------------------------------
So im trying to use timers to pace out certain events, the first one to start the whole cycle, the second one to unlock and open the door, and to make some visual effects happen, and the third one to stop forcing the player to look at the door. i also dont quite understand the part of the StartPlayerLookAt function where it needs a call back...
Can anyone Help?
I think that times must be descript as for example "5.0f" not "5f". Add void OnLeave ;]. This is only my suggestion.
(06-25-2011, 07:21 PM)Paulpolska Wrote: [ -> ]I think that times must be descript as for example "5.0f" not "5f". Add void OnLeave ;]. This is only my suggestion.

No, that didnt seem to change anything, maybe it would help to say that the game is giving me the error No Matching Signatures to 'Addtimer(string@&,const float, string@& )
So, check it
I believe it is better to put the timers into 1 function, but I hope I don't confuse you. :/

Code:
void OnStart()
{
     AddTimer("T1", 5, "TimerFunction");
     AddTimer("T2", 7, "TimerFunction");
     AddTimer("T3", 10, "TimerFunction");
}
void TimerFunction(string &in asTimer)
{
     string x = asTimer;
     if (x == "T1")
     {
          GiveSanityDamage(20, true);
          StartPlayerLookAt("Door1:, 3, 5, "");
          return;
     }
     else if (x == "T2")
     {
          StopPlayerLookAt();
          return;
     }
     else if (x == "T3")
     {
          
          return;
     }
}

By the way, you don't need a "void OnEnter()" or a "void OnLeave()". I hope this helps. Smile
You missed , " , on StartPlayerLookAt ;p. Your code is not readable for me. I use simply codes.

(06-25-2011, 07:40 PM)Paulpolska Wrote: [ -> ]You missed , " , on StartPlayerLookAt ;p. Your code is not readable for me. I use simply codes.

Lol, I was typing so fast I accidently put a colon instead of a quotation.

Tongue
Well, i cut the last two timers and simple added a parallel one to stop the look at event when it was up 2 seconds later.

And it works!, thank you everyone, this is a great and helpful community.