RE: well..I'm stuck again on doors - PutraenusAlivius - 04-07-2013
(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.
RE: well..I'm stuck again on doors - megsb927 - 04-07-2013
(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 helpful
RE: well..I'm stuck again on doors - colin56 - 04-17-2013
For avoiding the door lock problem, make sure that proper key is generated. Sometime key is not generated and it remain unlocked.
Shopfronts
|