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


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

Posts: 14
Threads: 2
Joined: Sep 2010
Reputation: 4
#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
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#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
Pandemoneus Offline
Senior Member

Posts: 328
Threads: 2
Joined: Sep 2010
Reputation: 0
#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
grenadecx Offline
Junior Member

Posts: 14
Threads: 2
Joined: Sep 2010
Reputation: 4
#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
MulleDK19 Offline
Senior Member

Posts: 545
Threads: 21
Joined: Jun 2009
Reputation: 10
#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
Pandemoneus Offline
Senior Member

Posts: 328
Threads: 2
Joined: Sep 2010
Reputation: 0
#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
grenadecx Offline
Junior Member

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

Oh, how dumb someone can be Blush

Thanks, all of you!
09-20-2010, 02:43 AM
Find
Jinix Offline
Member

Posts: 111
Threads: 8
Joined: Sep 2010
Reputation: 0
#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
MulleDK19 Offline
Senior Member

Posts: 545
Threads: 21
Joined: Jun 2009
Reputation: 10
#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
Soon Offline
Member

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

Yeah, great tutorial MulleDK19! That helped me out a ton!
09-20-2010, 01:05 PM
Find




Users browsing this thread: 2 Guest(s)