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


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Locked Door and Key Issue
Nitrowing Offline
Junior Member

Posts: 16
Threads: 4
Joined: Dec 2010
Reputation: 0
#1
Question  Locked Door and Key Issue

I've browsed through the various tutorials and searched through these forums for a solution to my Key>Door related issues and failed to find anything that helps, so here goes. It's probably some stupid error but, I need a push in the right direction.

void UseKey("Hotel Room Key, "Hotel Room Door"){
    // Set the entity(desk or door) to unlocked
    SetSwingDoorLocked("Hotel Room Door", false, true);

    // Remove the item used from the inventory
    RemoveItem(Hotel Room Key);
    PlaySoundAtEntity("", "unlock_door.snt", "Hotel Room Door",0.0f, true);
    AddDebugMessage("The Door has successfully opened. Congratulations!", false);
    }


////////////////////////////
// Run first time starting map
  void OnStart()
     {
          if(ScriptDebugOn())
          {
               GiveItemFromFile("lantern", "lantern.ent");
               SetPlayerLampOil(100.0f);

               for(int i = 0;i < 10;i++)
               {
                    GiveItemFromFile("tinderbox", "tinderbox.ent");
               }
          }
     }


////////////////////////////
// Run when entering map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{
}
}
Any help would be appreciated.
12-22-2010, 12:55 AM
Find
ThePaSch Offline
Member

Posts: 108
Threads: 11
Joined: Sep 2010
Reputation: 0
#2
RE: Locked Door and Key Issue

Yup, you missed quite a few ""s there.
void UseKey("Hotel Room Key", "Hotel Room Door"){
    // Set the entity(desk or door) to unlocked
    SetSwingDoorLocked("Hotel Room Door", false, true);

    // Remove the item used from the inventory
    RemoveItem("Hotel Room Key");
    PlaySoundAtEntity("", "unlock_door.snt", "Hotel Room Door",0.0f, true);
    AddDebugMessage("The Door has successfully opened. Congratulations!", false);
    }
12-22-2010, 04:00 AM
Find
Nitrowing Offline
Junior Member

Posts: 16
Threads: 4
Joined: Dec 2010
Reputation: 0
#3
RE: Locked Door and Key Issue

Fatal Error: Could not load script.
Main (1, 13) : ERR: Expected Data Type
Main (40, 1) : ERR: Unexpected token '}'

OK so I fixed the second error by removing the } at the last line. The (1, 13) one I'm not so sure about.
I'd assume it wants something added/changed to this line:
void UseKey("Hotel Room Key", "Hotel Room Door"){

Resolved the issue by browsing some more. Scrapped the old stuff and threw this at the end of the basic one.
////////////////////////////
// Actual functions

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Hotel Room Door", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "Hotel Room Door", 0.0f, false);
RemoveItem("Hotel Room Key");
AddDebugMessage("The Door has successfully opened. Congratulations!", false);
}
And this at the onEnter part:
// Run when entering map
void OnEnter()
{
AddUseItemCallback("", "Hotel Room Key", "Hotel Room Door", "KeyOnDoor", true);
}
(This post was last modified: 12-22-2010, 07:22 AM by Nitrowing.)
12-22-2010, 05:51 AM
Find




Users browsing this thread: 2 Guest(s)