Frictional Games Forum (read-only)

Full Version: How to enable key after few seconds?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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).
There are some timer script examples on the wiki, and you can take a look at them:

https://wiki.frictionalgames.com/hpl2/tu...ncedtimers

If you understand how a timer works, then the rest should be fairly straightforward since it is basic HPL2 scripting.
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)
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.
(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.