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
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


Messages In This Thread
well..I'm stuck again on doors - by megsb927 - 04-07-2013, 05:20 AM
RE: well..I'm stuck again on doors - by megsb927 - 04-07-2013, 07:33 AM
RE: well..I'm stuck again on doors - by noovra - 04-07-2013, 08:02 AM
RE: well..I'm stuck again on doors - by megsb927 - 04-07-2013, 08:58 AM
RE: well..I'm stuck again on doors - by noovra - 04-07-2013, 09:33 AM
RE: well..I'm stuck again on doors - by noovra - 04-07-2013, 10:08 AM
RE: well..I'm stuck again on doors - by megsb927 - 04-07-2013, 01:19 PM
RE: well..I'm stuck again on doors - by colin56 - 04-17-2013, 08:34 AM



Users browsing this thread: 1 Guest(s)