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
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#6
RE: well..I'm stuck again on doors

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

Trying is the first step to success.
04-07-2013, 09:15 AM
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 FlawlessHappiness - 04-07-2013, 09:15 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)