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

4.3.11 Trigger

The trigger property class is capable of detecting when another entity (that has a pcmesh) enters or leaves an area defined by this trigger. In that case it can send messages to the entity that contains this property class and/or the entities that enter/leave the trigger area.

Property Class Details

General Information

PcTrigger can be used when you want an entity to receive messages when some other entity enters or leaves a certain area of influence. Also the entity entering the trigger will receive a message on entering or leaving the area.

Currently it has support for different area types, including Sphere, Box, Beam and AboveMesh.

SetupTrigger<TriggerType> method is available as api function and action to setup the trigger either at runtime code or in map/quest xml.

Also further functionality is available from iPcTrigger api to set callbacks or some additional customization (check api docs).

Trigger Message Callbacks

The following messages are sent by this property class:

All messages receive an ‘entity’ parameter with the entity with the trigger (for _leavetrigger and _entertrigger messages), or the entity entering the trigger (for _entityenters or _entityleaves messages).

Trigger Properties

This property class has some properties to further customize trigger behaviour.

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="area1floor" plugin="cel.addons.celentity">
  <propclass name="pcobject.mesh">
    <action name="SetMesh">
      <par string="afloormesh" name="name"/>
  <propclass name="pclogic.trigger">
    <property string="player" name="monitor"/>
    <action name="SetupTriggerAboveMesh">
      <par name="entity" string="afloormesh"/>
      <par name="maxdistance" float="1.0"/>

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

This document was generated using texi2html 1.76.