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
Small little Issue.
A Tricky Carnie Offline
Member

Posts: 72
Threads: 15
Joined: Sep 2011
Reputation: 0
#1
Small little Issue.

Okay...I have two keys in one map, however, when I unlock the first door (the second key is behind the first locked door), it actually ends up unlocking both doors at once.

How do I fix this?

10-06-2011, 10:59 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#2
RE: Small little Issue.

Help me help you: post your code.

Tutorials: From Noob to Pro
10-06-2011, 11:06 PM
Website Find
A Tricky Carnie Offline
Member

Posts: 72
Threads: 15
Joined: Sep 2011
Reputation: 0
#3
RE: Small little Issue.

(10-06-2011, 11:06 PM)Your Computer Wrote: Help me help you: post your code.
This is what I have for my script:
Spoiler below!
////////////////////////////
// Run when entering map
void OnEnter()
{
AddUseItemCallback("", "key_2", "mansion_1", "KeyOnDoor", true);
AddUseItemCallback("", "key_3", "mansion_2", "KeyOnDoor", true);
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_1", 0, false);
RemoveItem("key_2");
SetSwingDoorLocked("mansion_2", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_2", 0, false);
RemoveItem("key_3");

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}

10-06-2011, 11:18 PM
Find
Elven Offline
Posting Freak

Posts: 862
Threads: 37
Joined: Aug 2011
Reputation: 26
#4
RE: Small little Issue.

Both functions call same function called "KeyOnDoor"

You need to make 2 different callbacks one is KeyOnDoor and other is KeyOnDoor2

And both of them opens different doors Smile!

Aka, it should be like this:

void OnEnter()
{
AddUseItemCallback("", "key_2", "mansion_1", "KeyOnDoor", true);
AddUseItemCallback("", "key_3", "mansion_2", "KeyOnDoor2", true);
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_1", 0, false);
RemoveItem("key_2");
}

void KeyOnDoor2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_2", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_2", 0, false);
RemoveItem("key_3");
}

The Interrogation
Chapter 1

My tutorials
10-06-2011, 11:22 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#5
RE: Small little Issue.

I thought that was the case.

A more efficient method:
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "unlock_door", asEntity, 0, false);
RemoveItem(asItem);
}

Tutorials: From Noob to Pro
(This post was last modified: 10-06-2011, 11:24 PM by Your Computer.)
10-06-2011, 11:23 PM
Website Find
A Tricky Carnie Offline
Member

Posts: 72
Threads: 15
Joined: Sep 2011
Reputation: 0
#6
RE: Small little Issue.

Thanks, both of you, I had a feeling it was something simple.


10-06-2011, 11:25 PM
Find




Users browsing this thread: 2 Guest(s)