Frictional Games Forum (read-only)

Full Version: [newbie] Simple script problem :S
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
i made a script for a key to open a door. the door is called mansion_2 en the key is called Key_1

Script :

void Onstart()
{
AddUseItemCallback("", "Key_1", "mansion_2", "UsedKeyDoor", true);
}

void UsedKeyDoor()
{
SetSwingDoorLocked("mansion_2", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_2", 0, false);
RemoveItem("Key_1");
}
So what's your problem?
(02-12-2011, 04:39 PM)Tanshaydar Wrote: [ -> ]So what's your problem?

well my script doesn't work Tongue fist of all. whith the SetSwingDoorLocked script does that mean that that script is locking the door, so i don't have to lock it in Level Editor? (actually i already tryed it, but the script won't lock)

When i put the key(Key_1) on the door(mansion_2) it sais, "connot use this item this way!".
It's supposed to be:
Code:
void UsedKeyDoor(string &in asItem, string &in asEntity)
Changed that, but still it doesn't change anything.
Are you trying to lock the door with a key?
no, open it
Could you try to give a name to your AddItemUseCallBack function, like that:

Code:
AddUseItemCallback("FunctionToOpenMansion_2", "Key_1", "mansion_2", "UsedKeyDoor", true);
*sigh* still same problem Sad
Well, let's go step by step.
- Level editor: Door's name is true, it's locked, key's name is true.
- In script file key's and door's name is true, functions are correct (after changes with string &in asEntity etc.)
- But in game, key cannot be used on the door?
Pages: 1 2