PutraenusAlivius 
 
 
		
			Posting Freak 
			
			
			
 
			
	Posts: 4,713 
	Threads: 75 
	Joined: Dec 2012
	
 Reputation: 
119
		
	 | 
	
		
			
RE: Scripting Problem 
			 
			
				 (05-20-2013, 10:01 PM)Bridge Wrote:  Did you see what Tomato Cat said? You're calling a function that doesn't exist. 
 
AddUseItemCallback("", "Key2", "Door2", "UsedKeyOnDoor", true);
  
Should be: 
 
AddUseItemCallback("", "Key2", "Door2", "UsedKeyonDoor", true);
  
No, it shouldn't. Another function already exists! 
Here's how it should be.
 void OnStart() 
{ 
AddUseItemCallback("", "Key", "Mansion_door", "UsedKeyonDoor", true); 
AddUseItemCallback("", "Key2", "Door2", "UsedKeyOnDoor", true); 
} 
 
void UsedKeyonDoor(string &in asItem, string &in asEntity) 
{ 
SetSwingDoorLocked("Mansion_door", false, true); 
PlaySoundAtEntity("", "unlock_door", "Mansion", 0, false); 
RemoveItem("Key"); 
} 
 
void UsedKeyOnDoor(string &in asItem, string &in asEntity) 
{ 
SetSwingDoorLocked("Door2", false, true); 
PlaySoundAtEntity("", "unlock_door", "Door2", 0, false); 
RemoveItem("Key2"); 
}
  
			 
			
			
 
"Veni, vidi, vici." 
"I came, I saw, I conquered." 
			
		 |  
	 
 | 
 
	| 05-21-2013, 02:24 AM  | 
	
		
	 | 
 
 
	
		
		Bonehead 
 
 
		
			Member 
			
			
			
 
			
	Posts: 50 
	Threads: 12 
	Joined: Apr 2013
	
 Reputation: 
1
		
	 | 
	
		
			
RE: Scripting Problem 
			 
			
				Also are you saying that the door is NOT locked? Make sure the "Locked" Box is checked in the level editor when you select the door under the entity tab.
			 
			
			
			
		 |  
	 
 | 
 
	| 05-21-2013, 02:27 AM  | 
	
		
	 | 
 
 
	
		
		amnesiaplayer321 
 
 
		
			Junior Member 
			
			
			
 
			
	Posts: 31 
	Threads: 4 
	Joined: May 2013
	
 Reputation: 
0
		
	 | 
	
		
			
RE: Scripting Problem 
			 
			
				Thanks to all of you it got fixed after JustAnotherPlayer's script.
			 
			
			
			
		 |  
	 
 | 
 
	| 05-21-2013, 04:07 AM  | 
	
		
	 | 
 
 
	
		
		Tomato Cat 
 
 
		
			Senior Member 
			
			
			
 
			
	Posts: 287 
	Threads: 2 
	Joined: Sep 2012
	
 Reputation: 
20
		
	 | 
	
		
			
RE: Scripting Problem 
			 
			
				What was ultimately the problem? 
 
Also, I don't recommend giving your functions names that are difficult to distinguish from one another. 
 
Use something like "UsedKeyOnDoor" & "UsedKeyOnDoor2" rather than "UsedKeyOnDoor" and "UsedKeyonDoor".
			 
			
			
			
				
(This post was last modified: 05-21-2013, 06:05 AM by Tomato Cat.)
 
				
			 
		 |  
	 
 | 
 
	| 05-21-2013, 05:55 AM  | 
	
		
	 | 
 
 
	
		
		Your Computer 
 
 
		
			SCAN ME! 
			
			
			
 
			
	Posts: 3,456 
	Threads: 32 
	Joined: Jul 2011
	
 Reputation: 
235
		
	 | 
	
		
			
RE: Scripting Problem 
			 
			
				 (05-21-2013, 05:55 AM)Tomato Cat Wrote:  Use something like "UsedKeyOnDoor" & "UsedKeyOnDoor2" rather than "UsedKeyOnDoor" and "UsedKeyonDoor". 
Or he should learn about parameters and have only one function handle every key-door combination.
			  
			
			
 
			
		 |  
	 
 | 
 
	| 05-21-2013, 11:48 AM  | 
	
		
	 | 
 
 
	
		
		amnesiaplayer321 
 
 
		
			Junior Member 
			
			
			
 
			
	Posts: 31 
	Threads: 4 
	Joined: May 2013
	
 Reputation: 
0
		
	 | 
	
		
			
RE: Scripting Problem 
			 
			
				Thanks all about you,now i know about parameters and how to get doors locked.I am creating one now.
			 
			
			
			
		 |  
	 
 | 
 
	| 05-21-2013, 01:04 PM  | 
	
		
	 | 
 
 
	
		
		Tomato Cat 
 
 
		
			Senior Member 
			
			
			
 
			
	Posts: 287 
	Threads: 2 
	Joined: Sep 2012
	
 Reputation: 
20
		
	 | 
	
		
			
RE: Scripting Problem 
			 
			
				 (05-21-2013, 11:48 AM)Your Computer Wrote:  Or he should learn about parameters and have only one function handle every key-door combination. 
True, but that might be a bit confusing for a beginner.
			  
			
			
			
		 |  
	 
 | 
 
	| 05-21-2013, 03:17 PM  | 
	
		
	 | 
 
 
	 
 |