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

4.4.1 CelEntity Addon

With the ‘cel.addons.celentity’ addon you can define your own entities directly in the world file. Here is an example on how to use that:

<addon plugin="cel.addons.celentity" entityname="SlidingDoor">
  <propclass name="pcobject.mesh">
    <action name="SetMesh">
      <par name="name" string="SlidingDoor" />
  <propclass name="pclogic.trigger">
    <property name="monitor" string="camera" />
    <action name="SetupTriggerSphere">
      <par name="sector" string="Corridors" />
      <par name="position" vector="-118,-8,78.7" />
      <par name="radius" float="4" />
  <propclass name="pclogic.quest">
    <action name="NewQuest">
      <par name="name" string="SlideDoor" />
      <par name="openx" string="-3.5" />
      <par name="openy" string="0" />
      <par name="openz" string="0" />
      <par name="closex" string="3.5" />
      <par name="closey" string="0" />
      <par name="closez" string="0" />
    <property name="state" string="closed" />

Here you see how an entity is created with the name ‘SlidingDoor’ and three property classes: ‘pcobject.mesh’ (see section Mesh), ‘pclogic.trigger’, and ‘pclogic.quest’ (see section Quest Manager). For every property class we can call actions and set properties.

You can create an entity everywhere in the map file where you can use addons. If you create an entity as a child of a ‘meshobj’ then the addon will automatically create a ‘pcobject.mesh’ (see section Mesh) property class attached to that mesh.

You can also create an entity from an entity template (see section CelEntity Template Addon) like this:

<addon plugin="cel.addons.celentity" template="EntityTemplate"
        <par name="pos" value="-24.5,0,-22.5" />

Notice how the ‘pos’ parameter is given to the template. Parameters for templates are always strings but can often be interpreted differently. In addition to the ‘pos’ parameter there is always an implicit ‘this’ parameter which will be set to the name of the entity that is being created. In this particular example it will be equal to ‘MyEntity’.

This document was generated using texi2html 1.76.