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

4.3.6 Mover

This is a mover property class. It works closely with ‘pcmove.linear’ and ‘pcmove.actor.standard’ in order to help in making higher level movement actions while checking collision detection along the way.

Property Class Details

General Information

PcMover can be used when you want to control movement of an entity by specifying a point to move to.

Currently it has only one method to move to a certain point in the map, and another one to stop it, but it is possible that later other methods will be added.

MoveTo

With MoveTo an entity can be pointed to a certain point in some sector and it will try to move to the specified distance of the point. The method accepts an optional parameter to set whether to make an initial line of sight test before starting movement. If this test is activated and there is no direct line of sight to target point, then movement will be aborted.

Note this property class will test for arrival based only on x and z axis, to avoid entity never arriving due to entity center and destination not being in perfect alignment (which is easy due to the own entity body for example).

You can use MoveTo from API or as a cel action.

Interrupt

This method allows to manually interrupt some movement. After calling this, the mover will forget about what it was doing.

You can use Interrupt from API or as a cel action.

Message Callbacks

This property class can send the following messages to the behaviour.

pcmover_arrived: Will be sent when destination is reached.

pcmover_impossible: Sent when the (optional) initial line of sight test fails.

pcmover_interrupted: Sent if a new movement is started while another one is under way, or movement is manually interrupted using interrupt.

Defining a mover 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. Usually though, this property class will be added manually to entities, but there is nothing preventing you from creating this already in the map.

 
<addon entityname="FinalMonster" plugin="cel.addons.celentity">
  <propclass name="pcobject.mesh">
    <action name="SetMesh">
      <par string="EvilMonster" name="name"/>
    </action>
  </propclass>
  <propclass name='pcmove.linear'>
    <action name='InitCDMesh'>
      <par float='10.0' name='percentage'/>
    </action>
  </propclass>
  <propclass name="pcmove.actor.standard" />
  <propclass name="pcmove.mover" />
  <behaviour layer="blpython" name="moverent"/>
</addon>

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

This document was generated using texi2html 1.76.