Frictional Games Forum (read-only)
[newbie] Simple script problem :S - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: [newbie] Simple script problem :S (/thread-6555.html)

Pages: 1 2


[newbie] Simple script problem :S - nkmol - 02-12-2011

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");
}


RE: [newbie] Simple script problem :S - Tanshaydar - 02-12-2011

So what's your problem?


RE: [newbie] Simple script problem :S - nkmol - 02-12-2011

(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!".


RE: [newbie] Simple script problem :S - Linus Ă…gren - 02-12-2011

It's supposed to be:
Code:
void UsedKeyDoor(string &in asItem, string &in asEntity)



RE: [newbie] Simple script problem :S - nkmol - 02-12-2011

Changed that, but still it doesn't change anything.


RE: [newbie] Simple script problem :S - Tanshaydar - 02-12-2011

Are you trying to lock the door with a key?


RE: [newbie] Simple script problem :S - nkmol - 02-12-2011

no, open it


RE: [newbie] Simple script problem :S - Tanshaydar - 02-12-2011

Could you try to give a name to your AddItemUseCallBack function, like that:

Code:
AddUseItemCallback("FunctionToOpenMansion_2", "Key_1", "mansion_2", "UsedKeyDoor", true);



RE: [newbie] Simple script problem :S - nkmol - 02-12-2011

*sigh* still same problem Sad


RE: [newbie] Simple script problem :S - Tanshaydar - 02-12-2011

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?