Frictional Games Forum (read-only)
Need Some Scripting Help Please! - 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: Need Some Scripting Help Please! (/thread-8790.html)



Need Some Scripting Help Please! - KikoKuruma - 06-25-2011

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?


RE: Need Some Scripting Help Please! - Paulpolska - 06-25-2011

I think that times must be descript as for example "5.0f" not "5f". Add void OnLeave ;]. This is only my suggestion.


RE: Need Some Scripting Help Please! - KikoKuruma - 06-25-2011

(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@& )


RE: Need Some Scripting Help Please! - Paulpolska - 06-25-2011

So, check it


RE: Need Some Scripting Help Please! - Kyle - 06-25-2011

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


RE: Need Some Scripting Help Please! - Paulpolska - 06-25-2011

You missed , " , on StartPlayerLookAt ;p. Your code is not readable for me. I use simply codes.




RE: Need Some Scripting Help Please! - Kyle - 06-25-2011

(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


RE: Need Some Scripting Help Please! - KikoKuruma - 06-25-2011

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.