| 
		
	
		| Macetrow   Junior Member
 
 Posts: 38
 Threads: 3
 Joined: Apr 2012
 Reputation: 
1
 | 
			| RE: Noob in trouble! 
 
				No message showed up when i tried to use the key, and i quadrouple x 100000 checked and spammed enter after typing the name and saved it.
			 |  |  
	| 04-14-2012, 07:31 PM |  |  
	
		| DRedshot   Senior Member
 
 Posts: 374
 Threads: 23
 Joined: Jun 2011
 Reputation: 
11
 | 
			| RE: Noob in trouble! 
 
				Very strange... 
Are any other scripts in your .hps working? 
From what I can see, there is no problem with the scripting at all!
 
Try creating a script area around the door, tick the 'ItemInteraction' box, and change it's name to "mansion_3_area". Then change your code to the following:
 void OnStart(){
 AddUseItemCallback("KeyOnArea", "key_1", "mansion_3_area", "UsedKeyOnArea", true);
 SetEntityCallbackFunc("key_1", "OnPickup");
 }
 
 void UsedKeyOnArea(string &in item, string &in entity)
 {
 SetSwingDoorLocked("mansion_3", false, true);
 PlaySoundAtEntity("", "unlock_door.snt", "mansion_3", 0, false);
 RemoveItem(item);
 SetEntityActive(entity , false);
 
 AddDebugMessage("Key has been used, is door unlocked?" , false);
 }
It's not the ideal way to do it, but I can't see any way that this can fail.
			
 
				
(This post was last modified: 04-14-2012, 08:27 PM by DRedshot.)
 |  |  
	| 04-14-2012, 08:27 PM |  |  
	
		| JenniferOrange   Senior Member
 
 Posts: 424
 Threads: 43
 Joined: Jun 2011
 Reputation: 
33
 | 
			| RE: Noob in trouble! 
 
				The error is right here:void UsedKeyOnArea(string &in item, string &in entity)
 it's supposed to be (string &in asItem, string &in asEntity)
 C'MON GUYS, JEEZ. Just kidding. <3
 
 
 Ba-da bing, ba-da boom.
 |  |  
	| 04-14-2012, 09:47 PM |  |  
	
		| Macetrow   Junior Member
 
 Posts: 38
 Threads: 3
 Joined: Apr 2012
 Reputation: 
1
 | 
			| RE: Noob in trouble! 
 
				All my other scripts except for the "unlock door" scripting is working. I spawn a monster with my key and shit, but i can't use that key to open any door.
 I tried the long shot, but that didn't work either.
 |  |  
	| 04-14-2012, 09:49 PM |  |  
	
		| DRedshot   Senior Member
 
 Posts: 374
 Threads: 23
 Joined: Jun 2011
 Reputation: 
11
 | 
			| RE: Noob in trouble! 
 
				I'm out of ideas then. Did you try using an area as the entity to use the item on instead of the door? Or as suggested above changing entity -> asEntity and item -> asItem.
 
 If you've done both, I can't help you, sorry.
 
 
 |  |  
	| 04-14-2012, 10:06 PM |  |  
	
		| SilentStriker   Posting Freak
 
 Posts: 950
 Threads: 26
 Joined: Jul 2011
 Reputation: 
43
 | 
			| RE: Noob in trouble! 
 
				DRedshot may be right, I think the syntax is wrong. It should be string &in asEntity, string &in asItem
 
 |  |  
	| 04-14-2012, 10:21 PM |  |  
	
		| Macetrow   Junior Member
 
 Posts: 38
 Threads: 3
 Joined: Apr 2012
 Reputation: 
1
 | 
			| RE: Noob in trouble! 
 
				I've tried all that you just suggested, it doesn't work. I have no idea what is making my door not work (or key). Think i'm just gonna end my dream of ever producing my very own custom story :/
			 |  |  
	| 04-14-2012, 11:08 PM |  |  
	
		| SilentStriker   Posting Freak
 
 Posts: 950
 Threads: 26
 Joined: Jul 2011
 Reputation: 
43
 | 
			| RE: Noob in trouble! 
 
				Try this, This is the last attempt 
 void OnStart()
 {
 AddUseItemCallback("", "key_1", "mansion_3", "UsedKeyOnDoor", true);
 SetEntityCallbackFunc("key_1", "OnPickup");
 }
 
 void UsedKeyOnDoor(string &in asItem, string &in asEntity)
 {
 SetSwingDoorLocked("mansion_3", false, true);
 PlaySoundAtEntity("", "unlock_door.snt", "mansion_3", 0, false);
 RemoveItem("key_1");
 }
 
 
				
(This post was last modified: 04-14-2012, 11:13 PM by SilentStriker.)
 |  |  
	| 04-14-2012, 11:13 PM |  |  
	
		| Macetrow   Junior Member
 
 Posts: 38
 Threads: 3
 Joined: Apr 2012
 Reputation: 
1
 | 
			| RE: Noob in trouble! 
 
				Sorry, but it didn't work :/
			 |  |  
	| 04-14-2012, 11:16 PM |  |  
	
		| SilentStriker   Posting Freak
 
 Posts: 950
 Threads: 26
 Joined: Jul 2011
 Reputation: 
43
 | 
			| RE: Noob in trouble! 
 
				Could you send me the map and script file? You can send in pm if you want   
 |  |  
	| 04-14-2012, 11:17 PM |  |  |