| 
		
	
		| lanlord000   Junior Member
 
 Posts: 3
 Threads: 1
 Joined: Aug 2011
 Reputation: 
0
 | 
			| Need help with script 
 
				What is wrong with this script, when i start the map it gives me an error. The names a right and everyting else. Am noobish at scripting
 ////////////////////////////
 // Run when entering map
 void OnEnter()
 
 {
 AddUseItemCallback("", "roomkey_1", "mansion_1", "UsedKeyOnDoor", true);
 }
 void UsedKeyOnDoor(string &in asItem, string &in asEntity)
 {
 SetSwingDoorLocked("mansion_1", false, true);
 PlaySoundAtEntity("", "unlock_door", "mansion_1", 0, false);
 RemoveItem("roomkey_1");
 }
 
 void OnLeave()
 
 {
 AddUseItemCallback("", "roomkey_2", "mansion_3", "UsedKeyOnDoor", true);
 }
 void UsedKeyOnDoor(string &in asItem, string &in asEntity)
 {
 SetSwingDoorLocked("mansion_3", false, true);
 PlaySoundAtEntity("", "unlock_door", "mansion_3", 0, false);
 RemoveItem("roomkey_2");
 }
 
 void OnLeave()
 
 {
 
				
(This post was last modified: 08-22-2011, 12:32 PM by lanlord000.)
 |  |  
	| 08-21-2011, 01:41 AM |  |  
	
		| Tanshaydar   From Beyond
 
 Posts: 3,085
 Threads: 17
 Joined: Mar 2009
 Reputation: 
67
 | 
			| RE: Need help with script 
 
				Why do you have a use item callback in your OnLeave function? Do you know what OnLeave works for?
			 
 |  |  
	| 08-21-2011, 01:50 AM |  |  
	
		| lanlord000   Junior Member
 
 Posts: 3
 Threads: 1
 Joined: Aug 2011
 Reputation: 
0
 | 
			| RE: Need help with script 
 
				 (08-21-2011, 01:50 AM)Tanshaydar Wrote:  Why do you have a use item callback in your OnLeave function? Do you know what OnLeave works for? 
No Not really, nobbish at scripting
			 |  |  
	| 08-21-2011, 02:23 AM |  |  
	
		| Elven   Posting Freak
 
 Posts: 862
 Threads: 37
 Joined: Aug 2011
 Reputation: 
26
 | 
			| RE: Need help with script 
 
				Why you have double OnLeave?
			 
 |  |  
	| 08-21-2011, 02:26 AM |  |  
	
		| Khan   Member
 
 Posts: 61
 Threads: 12
 Joined: Aug 2011
 Reputation: 
0
 | 
			| RE: Need help with script 
 
				You dont need two OnLeave's. everything that happens will be above the Onleave.  
 void OnStart()
 {
 AddUseItemCallback("", "roomkey_1", "mansion_1", "UsedKeyOnDoor", true);
 AddUseItemCallback("", "roomkey_2", "mansion_3", "UsedKeyOnDoor_2", true);
 }
 void UsedKeyOnDoor(string &in asItem, string &in asEntity)
 {
 SetSwingDoorLocked("mansion_1", false, true);
 PlaySoundAtEntity("", "unlock_door", "mansion_1", 0, false);
 RemoveItem("roomkey_1");
 }
 void UsedKeyOnDoor_2(string &in asItem, string &in asEntity)
 {
 SetSwingDoorLocked("mansion_3", false, true);
 PlaySoundAtEntity("", "unlock_door", "mansion_3", 0, false);
 RemoveItem("roomkey_2");
 }
 
 void OnLeave()
 {
 
 }
 
 That should work.
 
				
(This post was last modified: 08-21-2011, 12:53 PM by Khan.)
 |  |  
	| 08-21-2011, 04:33 AM |  |  
	
		| lanlord000   Junior Member
 
 Posts: 3
 Threads: 1
 Joined: Aug 2011
 Reputation: 
0
 | 
			| RE: Need help with script 
 
				 (08-21-2011, 04:33 AM)Khan Wrote:  You dont need two OnLeave's. everything that happens will be above the Onleave. 
 Void OnStart()
 {
 AddUseItemCallback("", "roomkey_1", "mansion_1", "UsedKeyOnDoor", true);
 AddUseItemCallback("", "roomkey_2", "mansion_3", "UsedKeyOnDoor_2", true);
 }
 void UsedKeyOnDoor(string &in asItem, string &in asEntity)
 {
 SetSwingDoorLocked("mansion_1", false, true);
 PlaySoundAtEntity("", "unlock_door", "mansion_1", 0, false);
 RemoveItem("roomkey_1");
 }
 void UsedKeyOnDoor_2(string &in asItem, string &in asEntity)
 {
 SetSwingDoorLocked("mansion_3", false, true);
 PlaySoundAtEntity("", "unlock_door", "mansion_3", 0, false);
 RemoveItem("roomkey_2");
 }
 
 void OnLeave()
 {
 
 }
 
 That should work.
 
first it gave me an error but then i changed the Void to void and it worked
			 
				
(This post was last modified: 08-21-2011, 12:28 PM by lanlord000.)
 |  |  
	| 08-21-2011, 12:25 PM |  |  
	
		| Khan   Member
 
 Posts: 61
 Threads: 12
 Joined: Aug 2011
 Reputation: 
0
 | 
			| RE: Need help with script 
 
				 (08-21-2011, 12:25 PM)lanlord000 Wrote:   (08-21-2011, 04:33 AM)Khan Wrote:  You dont need two OnLeave's. everything that happens will be above the Onleave. 
 Void OnStart()
 {
 AddUseItemCallback("", "roomkey_1", "mansion_1", "UsedKeyOnDoor", true);
 AddUseItemCallback("", "roomkey_2", "mansion_3", "UsedKeyOnDoor_2", true);
 }
 void UsedKeyOnDoor(string &in asItem, string &in asEntity)
 {
 SetSwingDoorLocked("mansion_1", false, true);
 PlaySoundAtEntity("", "unlock_door", "mansion_1", 0, false);
 RemoveItem("roomkey_1");
 }
 void UsedKeyOnDoor_2(string &in asItem, string &in asEntity)
 {
 SetSwingDoorLocked("mansion_3", false, true);
 PlaySoundAtEntity("", "unlock_door", "mansion_3", 0, false);
 RemoveItem("roomkey_2");
 }
 
 void OnLeave()
 {
 
 }
 
 That should work.
 first it gave me an error but then i changed the Void to void and it worked
 
woops, accidently put a capital V. 
			 
				
(This post was last modified: 08-21-2011, 12:53 PM by Khan.)
 |  |  
	| 08-21-2011, 12:53 PM |  |  |