[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.3.9 Timer

The timer property class implements a simple timer.

Property Class Details

General Information

PcTimer can be used if you want an entity to wake up every frame, after a while or at certain time lapses.

Currently it has two different timing modes called WakeUp and WakeUpFrame. This can be set either through pcclass actions (from map or blxml), or by using the iPcTimer interface (for c++ or python).

WakeUp

With WakeUp mode a specific lapse of time can be defined, and the entity holding this property class will receive the ‘pctimer_wakeup’ message once it is elapsed. Also repeat can be defined, and then the timer will keep sending the message each time the time lapse expires, otherwise the timer will be cleared afterwards.

WakeUpFrame

WakeUpFrame wakes the entity either after or before each frame is drawn, this is best for continuously updating parameters from the entity with this property class when used before the frame, or drawing/post processing when used after the frame is drawn.

It allows for one parameter for specifying at what moment entity will be woken up, possible values are:

This mode sends the ‘pctimer_wakeupframe’ message to the entity at the requested moment with two parameters: ‘elapsedticks’ and ‘currentticks’.

Defining a trigger for an entity in map xml.

To define an entity that uses this property class we add a <propclass> stance to the entity or entity template <addon> section.

 
<addon entityname="FinalMonster" plugin="cel.addons.celentity">
  <propclass name="pctools.timer">
    <action name="WakeUp">
      <par name="time" long="14.0"/>
      <par name="repeat" bool="true"/>
    </action>
  </propclass>
  <propclass name="pcobject.mesh">
    <action name="SetMesh">
      <par string="EvilMonster" name="name"/>
    </action>
  </propclass>
  <behaviour layer="blpython" name="lookat"/>
</addon>

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated using texi2html 1.76.