Frictional Games Forum (read-only)
How to enable key after few seconds? - 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: How to enable key after few seconds? (/thread-25901.html)



How to enable key after few seconds? - giacomo9 - 08-19-2014

I want to create situation like this: player walks into area and after 25 seconds appears key to locked door.

I know that I must use "AddEntityCollideCallback" and "SetEntityActive" script functions. But I don't know how to use timer for this (or something like that).


RE: How to enable key after few seconds? - Kreekakon - 08-19-2014

There are some timer script examples on the wiki, and you can take a look at them:

https://wiki.frictionalgames.com/hpl2/tutorials/script/advancedtimers

If you understand how a timer works, then the rest should be fairly straightforward since it is basic HPL2 scripting.


RE: How to enable key after few seconds? - Slanderous - 08-19-2014

Code:
void OnStart()
{

AddEntityCollideCallback("Player", "AreaNameFromLevelEditor", "func", true, 1);

}

void func(string &in asParent, string &in asChild, int alState)
{

    AddTimer("", 25.0f, "Timer_1");    

}

void Timer_1(string &in asTimer)
{

SetEntityActive("KeyNameFromLevelEditor",true);

}

Pamiętaj tylko, że klucz musi mieć odznaczone "active", możesz to znaleźć jak klikniesz na kluczyk w level editorze, jest pod jego nazwą.

Bear in mind that key has to have active set as off, it can be found when you click at the key in level editor, below the name.

(judging by his next thread I assume he is polish so i write to him in polish)


RE: How to enable key after few seconds? - Mudbill - 08-19-2014

Well, for one, you can't use a capital V in void. It might also be a bit confusing that you're using spaces in the example names, as spaces aren't allowed.

Even if he is Polish, wouldn't it be better to do it in English so that others can understand it as well? I'm talking about those here who aren't Polish who'd like to read it, and random people stumbling upon this thread because they have the same issue.


RE: How to enable key after few seconds? - Slanderous - 08-19-2014

(08-19-2014, 05:32 PM)Mudbill Wrote: Well, for one, you can't use a capital V in void. It might also be a bit confusing that you're using spaces in the example names, as spaces aren't allowed.

Even if he is Polish, wouldn't it be better to do it in English so that others can understand it as well? I'm talking about those here who aren't Polish who'd like to read it, and random people stumbling upon this thread because they have the same issue.

Good suggestions. Updated.