| 
		
	
		| KikoKuruma   Junior Member
 
 Posts: 23
 Threads: 5
 Joined: Jun 2011
 Reputation: 
0
 | 
			| Need Some Scripting Help Please! 
 
				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?
 
				
(This post was last modified: 06-25-2011, 07:52 PM by KikoKuruma.)
 |  |  
	| 06-25-2011, 07:17 PM |  |  
	
		| Paulpolska   Member
 
 Posts: 144
 Threads: 29
 Joined: Jun 2011
 Reputation: 
0
 | 
			| RE: Need Some Scripting Help Please! 
 
				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 |  |  
	
		| KikoKuruma   Junior Member
 
 Posts: 23
 Threads: 5
 Joined: Jun 2011
 Reputation: 
0
 | 
			| RE: Need Some Scripting Help Please! 
 
				 (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@& )
			 
				
(This post was last modified: 06-25-2011, 07:27 PM by KikoKuruma.)
 |  |  
	| 06-25-2011, 07:27 PM |  |  
	
		| Paulpolska   Member
 
 Posts: 144
 Threads: 29
 Joined: Jun 2011
 Reputation: 
0
 | 
			| RE: Need Some Scripting Help Please! 
 
				So, check it
			 
 |  |  
	| 06-25-2011, 07:30 PM |  |  
	
		| Kyle   Posting Freak
 
 Posts: 911
 Threads: 36
 Joined: Sep 2010
 Reputation: 
7
 | 
			| RE: Need Some Scripting Help Please! 
 
				I believe it is better to put the timers into 1 function, but I hope I don't confuse you. :/ 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.   
 |  |  
	| 06-25-2011, 07:33 PM |  |  
	
		| Paulpolska   Member
 
 Posts: 144
 Threads: 29
 Joined: Jun 2011
 Reputation: 
0
 | 
			| RE: Need Some Scripting Help Please! 
 
				You missed , " , on StartPlayerLookAt ;p. Your code is not readable for me. I use simply codes.
 
 
 |  |  
	| 06-25-2011, 07:40 PM |  |  
	
		| Kyle   Posting Freak
 
 Posts: 911
 Threads: 36
 Joined: Sep 2010
 Reputation: 
7
 | 
			| RE: Need Some Scripting Help Please! 
 
				 (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.
   
 |  |  
	| 06-25-2011, 07:44 PM |  |  
	
		| KikoKuruma   Junior Member
 
 Posts: 23
 Threads: 5
 Joined: Jun 2011
 Reputation: 
0
 | 
			| RE: Need Some Scripting Help Please! 
 
				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.
 
				
(This post was last modified: 06-25-2011, 07:49 PM by KikoKuruma.)
 |  |  
	| 06-25-2011, 07:47 PM |  |  |