| 
		
	
		| afroduckie   Junior Member
 
 Posts: 35
 Threads: 12
 Joined: Jan 2013
 Reputation: 
0
 | 
			| Script help for level door 
 
				This is the script for a locked level door. the key you need is level_4_key.It is supposed to activate a grunt when the door is unlocked (as a scare).
 
 void UseKey(string &in asItem, string &in asEntity)
 {
 AddUseItemCallback("", "level_4_key", "level4", "UsedKeyOnDoor", true);
 }
 
 void UsedKeyOnDoor(string &in asItem, string &in asEntity)
 {
 SetLevelDoorLocked("level4", true);
 PlaySoundAtEntity("", "unlock_door", "level4", 0, false);
 RemoveItem("level_4_key");
 SetEntityActive("servant_grunt", true);
 }
 
 Where did I go wrong?
 |  |  
	| 02-10-2013, 02:21 AM |  |  
	
		| NaxEla   Senior Member
 
 Posts: 415
 Threads: 5
 Joined: Dec 2012
 Reputation: 
28
 | 
			| RE: Script help for level door 
 
				Put AddUseItemCallback("", "level_4_key", "level4", "UsedKeyOnDoor", true);
in your OnStart function.
 
Like this:
 void OnStart(){
 AddUseItemCallback("", "level_4_key", "level4", "UsedKeyOnDoor", true);
 }
 
 
				
(This post was last modified: 02-10-2013, 02:32 AM by NaxEla.)
 |  |  
	| 02-10-2013, 02:31 AM |  |  
	
		| No Author   Posting Freak
 
 Posts: 962
 Threads: 10
 Joined: Jun 2012
 Reputation: 
13
 | 
			| RE: Script help for level door 
 
				I thought unlocking level doors use a different script.
 EDIT : Never mind.
 
 
				
(This post was last modified: 02-10-2013, 02:44 AM by No Author.)
 |  |  
	| 02-10-2013, 02:39 AM |  |  
	
		| NaxEla   Senior Member
 
 Posts: 415
 Threads: 5
 Joined: Dec 2012
 Reputation: 
28
 | 
			| RE: Script help for level door 
 
				Oh, I also just realized: In this line of your code:  SetLevelDoorLocked("level4", true);
 you are actually making the door locked. By change true  to false , it will unlock it.
 
@No Author 
Swing doors use SetSwingDoorLocked, and level doors use SetLevelDoorLocked. So, yes, they do use slightly different functions.
			
 |  |  
	| 02-10-2013, 02:43 AM |  |  
	
		| No Author   Posting Freak
 
 Posts: 962
 Threads: 10
 Joined: Jun 2012
 Reputation: 
13
 | 
			| RE: Script help for level door 
 
				 (02-10-2013, 02:43 AM)NaxEla Wrote:  Oh, I also just realized: In this line of your code: you are actually making the door locked. By change true to false, it will unlock it.SetLevelDoorLocked("level4", true);
 @No Author
 Swing doors use SetSwingDoorLocked, and level doors use SetLevelDoorLocked. So, yes, they do use slightly different functions.
 
Lol. I didn't read it clearly in the first place.  
I really need to improve my reading.
			 
 |  |  
	| 02-10-2013, 02:56 AM |  |  
	
		| afroduckie   Junior Member
 
 Posts: 35
 Threads: 12
 Joined: Jan 2013
 Reputation: 
0
 | 
			| RE: Script help for level door 
 
				 (02-10-2013, 02:56 AM)No Author Wrote:   (02-10-2013, 02:43 AM)NaxEla Wrote:  Oh, I also just realized: In this line of your code: you are actually making the door locked. By change true to false, it will unlock it.SetLevelDoorLocked("level4", true);
 @No Author
 Swing doors use SetSwingDoorLocked, and level doors use SetLevelDoorLocked. So, yes, they do use slightly different functions.
 Lol. I didn't read it clearly in the first place.
 I really need to improve my reading.
 
I did notice that. Thanks for pointing it out.
			 |  |  
	| 02-10-2013, 03:00 AM |  |  |