Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to enable key after few seconds?
giacomo9 Offline
Junior Member

Posts: 37
Threads: 11
Joined: Nov 2012
Reputation: 0
#1
How to enable key after few seconds?

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).
08-19-2014, 12:48 PM
Find
Kreekakon Offline
Pick a god and pray!

Posts: 3,063
Threads: 70
Joined: Mar 2012
Reputation: 124
#2
RE: How to enable key after few seconds?

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.

[Image: Tv0YgQb.gif]
Image by BandyGrass
08-19-2014, 12:51 PM
Find
Slanderous Offline
Posting Freak

Posts: 1,606
Threads: 78
Joined: Dec 2012
Reputation: 63
#3
RE: How to enable key after few seconds?

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)
(This post was last modified: 08-19-2014, 06:06 PM by Slanderous.)
08-19-2014, 01:50 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#4
RE: How to enable key after few seconds?

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
Find
Slanderous Offline
Posting Freak

Posts: 1,606
Threads: 78
Joined: Dec 2012
Reputation: 63
#5
RE: How to enable key after few seconds?

(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.
08-19-2014, 06:07 PM
Find




Users browsing this thread: 1 Guest(s)