| 
		
	
		| zergling50   Member
 
 Posts: 74
 Threads: 9
 Joined: Jul 2012
 Reputation: 
1
 | 
			| Timer Not Working 
 
				I have a scare set up where your locked in a room with a grunt for a short period of time. Once the timer finishes the grunt is supposed to disappear in a flash of light and the door to the room unlocks. The only problem is that the timer is not responding and I have no idea why. Heres the code in question:
 void RoomScare(string &in asParent, string &in asChild, int alState)
 {
 SetPlayerActive(false);
 AddPropImpulse("mansion_7", 0, 0, -50, "world");
 SetSwingDoorLocked("mansion_7", true, true);
 GiveSanityDamage(1, true);
 SetPlayerActive(true);
 AddTimer("roomscarefinish", 5.0f, "RoomScareFinish");
 SetEntityActive("servant_grunt_3", true);
 AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_30", 1.0f, "idle");
 AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_31", 1.0f, "idle");
 AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_32", 1.0f, "idle");
 AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_33", 1.0f, "idle");
 AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_34", 1.0f, "idle");
 AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_35", 1.0f, "idle");
 AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_36", 1.0f, "idle");
 }
 
 void RoomScareFinish()
 {
 GiveSanityBoostSmall();
 StartEffectFlash(0.3f, 1.0f, 1.0f);
 SetSwingDoorLocked("mansion_7", false, true);
 SetEntityActive("servant_grunt_3", false);
 }
 |  |  
	| 06-17-2013, 12:12 AM |  |  
	
		| PutraenusAlivius   Posting Freak
 
 Posts: 4,713
 Threads: 75
 Joined: Dec 2012
 Reputation: 
119
 | 
			| RE: Timer Not Working 
 
				void RoomScare(string &in asParent, string &in asChild, int alState){
 SetPlayerActive(false);
 AddPropImpulse("mansion_7", 0, 0, -50, "world");
 SetSwingDoorLocked("mansion_7", true, true);
 GiveSanityDamage(1, true);
 SetPlayerActive(true);
 AddTimer("roomscarefinish", 5.0f, "RoomScareFinish");
 SetEntityActive("servant_grunt_3", true);
 AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_30", 1.0f, "idle");
 AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_31", 1.0f, "idle");
 AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_32", 1.0f, "idle");
 AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_33", 1.0f, "idle");
 AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_34", 1.0f, "idle");
 AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_35", 1.0f, "idle");
 AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_36", 1.0f, "idle");
 }
 
 void RoomScareFinish(string &in asTimer) //Wrong callback syntax. You have () which is not recognizable as the callback syntax for the AddTimer.
 {
 GiveSanityBoostSmall();
 StartEffectFlash(0.3f, 1.0f, 1.0f);
 SetSwingDoorLocked("mansion_7", false, true);
 SetEntityActive("servant_grunt_3", false);
 }
Fixed it.
			 
 "Veni, vidi, vici.""I came, I saw, I conquered."
 |  |  
	| 06-17-2013, 12:45 AM |  |  |