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

Privacy Policy


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Two doors, one key?
Author Message
KamenRiderSun Offline
Junior Member

Posts: 5
Joined: Mar 2012
Reputation: 0
Post: #1
Two doors, one key?
I'm currently working on a CS that's very choice driven. [Is "Bump in the Night" taken as a CS name? Blush ]
Right now, I'm having a little issue with making one key able to unlock two doors, removing the other choice in the process. My question is, is this even possible?

First I tried this:

void OnStart()
{
SetMessage("Messages", "Intro", 0);
AddUseItemCallback("OpenDoor", "ChoiceKey", "LevelDoor_Mansion", "UnlockLevelDoor", true);
AddUseItemCallback("OpenDoor", "ChoiceKey", "LevelDoor_Basement", "UnlockLevelDoor", true);
}

void UnlockLevelDoor(string &in item, string &in entity)
{
SetLevelDoorLocked(entity, false);
RemoveItem(item);

But no results. I then tried:

AddUseItemCallback("OpenDoor", "ChoiceKey", "LevelDoor_Mansion", "UnlockLevelDoor1", true);
AddUseItemCallback("OpenDoor", "ChoiceKey", "LevelDoor_Basement", "UnlockLevelDoor2", true);
}

void UnlockLevelDoor1(string &in item, string &in entity)
{
SetLevelDoorLocked(entity, false);
RemoveItem(item);
}
void UnlockLevelDoor2(string &in item, string &in entity)
{
SetLevelDoorLocked(entity, false);
RemoveItem(item);
}

Also, no results. My confusion is whether my scripting method or syntax are wrong, or if it's just not possible.
Thanks for any advice!
(This post was last modified: 03-26-2012 10:50 PM by KamenRiderSun.)
03-26-2012 10:47 PM
Find all posts by this user Quote this message in a reply
Your Computer Offline
SCAN ME!

Posts: 3,231
Joined: Jul 2011
Reputation: 215
Post: #2
RE: Two doors, one key?
For starters, don't give both callbacks the same internal name and don't tell the game to remove the key from inventory when used on one door.

Tutorials: From Noob to Pro
03-26-2012 11:07 PM
Visit this user's website Find all posts by this user Quote this message in a reply
KamenRiderSun Offline
Junior Member

Posts: 5
Joined: Mar 2012
Reputation: 0
Post: #3
RE: Two doors, one key?
Thanks, I'll change the callback names. I'm guessing there isn't a work-around way of having the key still be destroyed when used? I hoped to use that as a way of cutting the other route off, but I suppose I can either lock the door behind the player, or just get rid of the key altogether.
03-27-2012 12:04 AM
Find all posts by this user Quote this message in a reply
Your Computer Offline
SCAN ME!

Posts: 3,231
Joined: Jul 2011
Reputation: 215
Post: #4
RE: Two doors, one key?
(03-27-2012 12:04 AM)KamenRiderSun Wrote:  Thanks, I'll change the callback names. I'm guessing there isn't a work-around way of having the key still be destroyed when used? I hoped to use that as a way of cutting the other route off, but I suppose I can either lock the door behind the player, or just get rid of the key altogether.

I'm not sure if i was understood, but i intended "internal names" to differ from "callback names." Also, you would need local map variables and an extra function to check if the key has unlocked both doors and, if so, remove the key from inventory.

Tutorials: From Noob to Pro
03-27-2012 12:17 AM
Visit this user's website Find all posts by this user Quote this message in a reply
KamenRiderSun Offline
Junior Member

Posts: 5
Joined: Mar 2012
Reputation: 0
Post: #5
RE: Two doors, one key?
Thanks for the help, I'll figure something out, hopefully.
03-27-2012 12:23 AM
Find all posts by this user Quote this message in a reply
Post Reply 




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