Frictional Games Forum (read-only)
[SCRIPT] Chest unlocked by a key [Solved] - 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 - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: [SCRIPT] Chest unlocked by a key [Solved] (/thread-24525.html)



Chest unlocked by a key [Solved] - ethics - 02-03-2014

So i've seen in other custom stories you need to find a key to unlock a chest, which contains something you need.

I couldn't manage to get a script working for this case, my assumption would be this:

void OnStart()
{
SetLeverStuckState("chest", true, true);
AddUseItemCallback("", "keyy5", "chest", "unlockchest", true);
}

void unlockchest(string &in asItem, string &in asEntity)
{
SetLeverStuckState("chest", false, true);
RemoveItem("keyy5");
}

But whenever I start the map, I get the error shown in the picture.

Can anyone help me?


RE: Chest unlocked by a key - FlawlessHappiness - 02-03-2014

SetLeverStuckState("chest", true, true);

The bold "true" is supposed to be a number.
If you look in the engine scripts it says "int". "int" means it's a number with no decimals Smile

Here it's possibly -1, 0 or 1.


Also you seem to have something wrong with a timer. Mind posting that too? The fatal error tells you which line it is.


RE: Chest unlocked by a key - ethics - 02-15-2014

(02-03-2014, 12:01 PM)FlawlessHair Wrote: SetLeverStuckState("chest", true, true);

The bold "true" is supposed to be a number.
If you look in the engine scripts it says "int". "int" means it's a number with no decimals Smile

Here it's possibly -1, 0 or 1.


Also you seem to have something wrong with a timer. Mind posting that too? The fatal error tells you which line it is.

nevermind I figured it out myself. I also made a 3-lock chest out of it!
(You have to find 3 keys to open it)
Big Grin