Frictional Games Forum (read-only)
Some beginner help, door - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: Some beginner help, door (/thread-4581.html)



Some beginner help, door - grenadecx - 09-19-2010

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
Code:
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!


RE: Some beginner help, door - Kyle - 09-19-2010

I would help you, except that I can't get the editor working... :\ Help me please.


RE: Some beginner help, door - Pandemoneus - 09-19-2010

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.


RE: Some beginner help, door - grenadecx - 09-20-2010

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?


RE: Some beginner help, door - MulleDK19 - 09-20-2010

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


RE: Some beginner help, door - Pandemoneus - 09-20-2010

(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
Code:
SetLevelDoorLocked(door_1, false);
or
Code:
SetLevelDoorLocked(asEntity, false);
instead.


RE: Some beginner help, door - grenadecx - 09-20-2010

Oh, how dumb someone can be Blush

Thanks, all of you!


RE: Some beginner help, door - Jinix - 09-20-2010

(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.


RE: Some beginner help, door - MulleDK19 - 09-20-2010

(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


RE: Some beginner help, door - Soon - 09-20-2010

Yeah, great tutorial MulleDK19! That helped me out a ton!