Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support | Gametee


Post Reply 
 
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Some beginner help, door
Author Message
grenadecx Offline
Junior Member

Posts: 14
Joined: Sep 2010
Reputation: 4
Post: #1
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
Find all posts by this user Quote this message in a reply
Kyle Offline
Posting Freak

Posts: 911
Joined: Sep 2010
Reputation: 7
Post: #2
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
Find all posts by this user Quote this message in a reply
Pandemoneus Offline
Senior Member

Posts: 328
Joined: Sep 2010
Reputation: 0
Post: #3
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
Find all posts by this user Quote this message in a reply
grenadecx Offline
Junior Member

Posts: 14
Joined: Sep 2010
Reputation: 4
Post: #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
Find all posts by this user Quote this message in a reply
MulleDK19 Offline
Senior Member

Posts: 545
Joined: Jun 2009
Reputation: 10
Post: #5
RE: Some beginner help, door

I wasn't expecting to release my videos before I had made a few more.

But I'll make an exception Tongue Here's one: http://hpl2.frictionalgames.com/wiki:user:mulledk19

[Image: 16455.png]
09-20-2010 12:41 AM
Find all posts by this user Quote this message in a reply
Pandemoneus Offline
Senior Member

Posts: 328
Joined: Sep 2010
Reputation: 0
Post: #6
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
Find all posts by this user Quote this message in a reply
grenadecx Offline
Junior Member

Posts: 14
Joined: Sep 2010
Reputation: 4
Post: #7
RE: Some beginner help, door

Oh, how dumb someone can be Blush

Thanks, all of you!
09-20-2010 02:43 AM
Find all posts by this user Quote this message in a reply
Jinix Offline
Member

Posts: 111
Joined: Sep 2010
Reputation: 0
Post: #8
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 Tongue 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.

Jinix ~~~ZiXiZ~~~ OAP
09-20-2010 09:43 AM
Find all posts by this user Quote this message in a reply
MulleDK19 Offline
Senior Member

Posts: 545
Joined: Jun 2009
Reputation: 10
Post: #9
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 Tongue 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 Smile

[Image: 16455.png]
09-20-2010 12:48 PM
Find all posts by this user Quote this message in a reply
Soon Offline
Member

Posts: 50
Joined: Sep 2010
Reputation: 0
Post: #10
RE: Some beginner help, door

Yeah, great tutorial MulleDK19! That helped me out a ton!
09-20-2010 01:05 PM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)