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
well..I'm stuck again on doors
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#11
RE: well..I'm stuck again on doors

(04-07-2013, 07:33 AM)megsb927 Wrote:
(04-07-2013, 06:11 AM)JustAnotherPlayer Wrote: void OnStart()
{
SetEntityCallbackFunc("KEYNAME", "FUNCTION");
}

void FUNCTION(string &in asEntity, string &in Type)
{
SetSwingDoorLocked("DOORNAME", false, false);
}

(NOTE: This is the script that you've mentioned -- which is making the door to unlock BEFORE you can use it. Although it's unlocked when you pick the key up.)

I'm still confused what do I change?:/
KEYNAME to your key's name.
FUNCTION to whatever is your function.
DOORNAME to your door's name.

"Veni, vidi, vici."
"I came, I saw, I conquered."
04-07-2013, 10:13 AM
Find
megsb927 Offline
Junior Member

Posts: 30
Threads: 10
Joined: Feb 2013
Reputation: 0
#12
RE: well..I'm stuck again on doors

(04-07-2013, 09:15 AM)BeeKayK Wrote: What? Why?

Listen. You need to understand how the script functions work.

Look.

When you write this line:
AddUseItemCallback("", "Key3", "castle_1", "UsedKeyOnDoor", true);



It means, "When i use Key3 on castle_1 it should call the function UsedKeyOnDoor."
Then you create the function:

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("castle_1", false, false);
PlaySoundAtEntity("", "unlock_door", "castle_1", 0, false);
RemoveItem("Key3");
SetSwingDoorLocked("castle_2", false, false);
PlaySoundAtEntity("", "unlock_door", "castle_2", 0, false);
RemoveItem("Key4");
}



This function says: "Unlock castle_1 and castle_2! Play two sound! Remove Key1 and Key4"


Do you see there's something wrong? When you use 1 key on a door, both doors will unlock.
THat's a problem!


You have to create 2 functions!



void UsedKeyOnDoor1(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("castle_1", false, false);
PlaySoundAtEntity("", "unlock_door", "castle_1", 0, false);
RemoveItem("Key3");
}


void UsedKeyOnDoor2(string &in asItem, string &in asEntity)
{

SetSwingDoorLocked("castle_2", false, false);
PlaySoundAtEntity("", "unlock_door", "castle_2", 0, false);
RemoveItem("Key4");
}


I have called them: UsedKeyOnDoor1 and UsedKeyOnDoor2.


Now the void OnStart() looks like this:


void OnStart()
{
AddUseItemCallback("", "Key3", "castle_1", "UsedKeyOnDoor1", true);
AddUseItemCallback("", "Key4","castle_2", "UsedKeyOnDoor2", true);
}



Do you see? They call each their function.


Key3 on castle_1 calls UsedKeyOnDoor1
Key4 on caslte_2 calls UsedKeyOnDoor2
This was the problem! Thank you so much and I'm sorry I'm still new to this so I'm still learning but that was really helpfulSmile
04-07-2013, 01:19 PM
Find
colin56 Offline
Junior Member

Posts: 3
Threads: 0
Joined: Apr 2013
Reputation: 0
#13
RE: well..I'm stuck again on doors

For avoiding the door lock problem, make sure that proper key is generated. Sometime key is not generated and it remain unlocked.



Shopfronts
(This post was last modified: 04-20-2013, 05:11 AM by colin56.)
04-17-2013, 08:34 AM
Find




Users browsing this thread: 3 Guest(s)