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
Script Help Two doors, one key?
KamenRiderSun Offline
Junior Member

Posts: 5
Threads: 2
Joined: Mar 2012
Reputation: 0
#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
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#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
Website Find
KamenRiderSun Offline
Junior Member

Posts: 5
Threads: 2
Joined: Mar 2012
Reputation: 0
#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
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#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
Website Find
KamenRiderSun Offline
Junior Member

Posts: 5
Threads: 2
Joined: Mar 2012
Reputation: 0
#5
RE: Two doors, one key?

Thanks for the help, I'll figure something out, hopefully.


03-27-2012, 12:23 AM
Find




Users browsing this thread: 2 Guest(s)