The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.24-0ubuntu0.18.04.17 (Linux)
File Line Function
/showthread.php 906 errorHandler->error



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


Messages In This Thread
Some beginner help, door - by grenadecx - 09-19-2010, 10:05 PM
RE: Some beginner help, door - by Kyle - 09-19-2010, 11:13 PM
RE: Some beginner help, door - by Pandemoneus - 09-19-2010, 11:21 PM
RE: Some beginner help, door - by grenadecx - 09-20-2010, 12:38 AM
RE: Some beginner help, door - by Pandemoneus - 09-20-2010, 01:23 AM
RE: Some beginner help, door - by MulleDK19 - 09-20-2010, 12:41 AM
RE: Some beginner help, door - by Jinix - 09-20-2010, 09:43 AM
RE: Some beginner help, door - by MulleDK19 - 09-20-2010, 12:48 PM
RE: Some beginner help, door - by grenadecx - 09-20-2010, 02:43 AM
RE: Some beginner help, door - by Soon - 09-20-2010, 01:05 PM



Users browsing this thread: 1 Guest(s)