| 
		
	
		| grenadecx   Junior Member
 
 Posts: 14
 Threads: 2
 Joined: Sep 2010
 Reputation: 
4
 | 
			| Some beginner help, door 
 
				Hey. 
I made a basic map and I wanted to have a locked door and a key to open it with. So I have a door entity called "door_1" and a key entity called "key_1". And from what information I could gather, I need to create a "mapname.hps" file, where I add the script that makes this possible.
 
Since I'm not familiar with this kinda of scripting, I read a few threads and I came up with this:
 
mapname.hps
 void UseKey(string &in asItem, string &in asEntity){// Set the entity(desk or door) to unlocked
 SetSwingDoorLocked(asEntity, false, true);
 
 // Remove the item used from the inventory
 RemoveItem(asItem);
 }
 
 void OnStart(){
 //Add the Lantern and 10 Tinderboxes when in Debug mode, always good to have light!
 if(ScriptDebugOn()){
 GiveItemFromFile("lantern", "lantern.ent");
 for(int i=0;i<10;i++) GiveItemFromFile("tinderbox_"+i, "tinderbox.ent");
 }
 
 AddUseItemCallback("useexit", "key_1", "door_1", "UseKey",true);
 
 }
So when I use the key on the door, the key get removed, but the door does not get unlocked. Some help would be appreciated!
			 |  |  
	| 09-19-2010, 10:05 PM |  |  
	
		| Kyle   Posting Freak
 
 Posts: 911
 Threads: 36
 Joined: Sep 2010
 Reputation: 
7
 | 
			| RE: Some beginner help, door 
 
				I would help you, except that I can't get the editor working... :\ Help me please.
			 
 |  |  
	| 09-19-2010, 11:13 PM |  |  
	
		| Pandemoneus   Senior Member
 
 Posts: 328
 Threads: 2
 Joined: Sep 2010
 Reputation: 
0
 | 
			| RE: Some beginner help, door 
 
				I tried your script and it works for me.Are you sure you called the door "door_1" in the editor?
 Entity names are case sensitive.
 
 |  |  
	| 09-19-2010, 11:21 PM |  |  
	
		| grenadecx   Junior Member
 
 Posts: 14
 Threads: 2
 Joined: Sep 2010
 Reputation: 
4
 | 
			| RE: Some beginner help, door 
 
				I have checked tons of times, my entities are called that. Perhaps I should mention that I use a level door, but that should work the same, should it not?
			 |  |  
	| 09-20-2010, 12:38 AM |  |  
	
		| MulleDK19   Senior Member
 
 Posts: 545
 Threads: 21
 Joined: Jun 2009
 Reputation: 
10
 |  |  
	| 09-20-2010, 12:41 AM |  |  
	
		| Pandemoneus   Senior Member
 
 Posts: 328
 Threads: 2
 Joined: Sep 2010
 Reputation: 
0
 | 
			| RE: Some beginner help, door 
 
				 (09-20-2010, 12:38 AM)grenadecx Wrote:  I have checked tons of times, my entities are called that. Perhaps I should mention that I use a level door, but that should work the same, should it not? 
Yes you should, that actually is the problem. 
The level door isn't a swing door. =/
 
You have to use
 SetLevelDoorLocked(door_1, false);
or
 SetLevelDoorLocked(asEntity, false);
instead.
			 
 |  |  
	| 09-20-2010, 01:23 AM |  |  
	
		| grenadecx   Junior Member
 
 Posts: 14
 Threads: 2
 Joined: Sep 2010
 Reputation: 
4
 | 
			| RE: Some beginner help, door 
 
				Oh, how dumb someone can be    
Thanks, all of you!
			 |  |  
	| 09-20-2010, 02:43 AM |  |  
	
		| Jinix   Member
 
 Posts: 111
 Threads: 8
 Joined: Sep 2010
 Reputation: 
0
 | 
			| RE: Some beginner help, door 
 
				 (09-20-2010, 12:41 AM)MulleDK19 Wrote:  I wasn't expecting to release my videos before I had made a few more.
 But I'll make an exception
  Here's one: http://hpl2.frictionalgames.com/wiki:user:mulledk19 
you asked for feedback after the tutorial.  
You explain quite well and it's sounds easy to do -if a bit hard to follow at first. 
I have not tried that yet but it looks fairly straightforward, it shows how to do it - but a bit hurried. so I'll be re-winding and pausing a lot. 
it'll really help if you keep reminding us, when using the keyboard, what keys are being used to help navigation and shortcuts. 
Am looking forward to more.
			 
 |  |  
	| 09-20-2010, 09:43 AM |  |  
	
		| MulleDK19   Senior Member
 
 Posts: 545
 Threads: 21
 Joined: Jun 2009
 Reputation: 
10
 | 
			| RE: Some beginner help, door 
 
				 (09-20-2010, 09:43 AM)Jinix Wrote:   (09-20-2010, 12:41 AM)MulleDK19 Wrote:  I wasn't expecting to release my videos before I had made a few more.
 But I'll make an exception
  Here's one: http://hpl2.frictionalgames.com/wiki:user:mulledk19 you asked for feedback after the tutorial.
 You explain quite well and it's sounds easy to do -if a bit hard to follow at first.
 I have not tried that yet but it looks fairly straightforward, it shows how to do it - but a bit hurried. so I'll be re-winding and pausing a lot.
 it'll really help if you keep reminding us, when using the keyboard, what keys are being used to help navigation and shortcuts.
 Am looking forward to more.
 
Thanks for the feedback. I'll keep that in mind    
 |  |  
	| 09-20-2010, 12:48 PM |  |  
	
		| Soon   Member
 
 Posts: 50
 Threads: 11
 Joined: Sep 2010
 Reputation: 
0
 | 
			| RE: Some beginner help, door 
 
				Yeah, great tutorial MulleDK19!  That helped me out a ton!
			 |  |  
	| 09-20-2010, 01:05 PM |  |  |