Crystal Entity Layer: 4.4.1 CelEntity Addon

[ < ] | [ > ] |  | [ << ] | [ 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="pcmesh">
        <action name="SetMesh">
          <par name="name" string="SlidingDoor" />
        </action>
      </propclass>
      <propclass name="pctrigger">
        <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" />
        </action>
      </propclass>
      <propclass name="pcquest">
        <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" />
        </action>
        <property name="state" string="closed" />
      </propclass>
    </addon>

Here you see how an entity is created with the name ``SlidingDoor'` and three property classes: ``pcmesh'` (see section Mesh), ``pctrigger'`, and ``pcquest'` (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 ``pcmesh'` (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"
                 entityname="MyEntity">
        <params>
            <par name="pos" value="-24.5,0,-22.5" />
        </params>
    </addon>

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'`.

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ]

This document was generated using texi2html 1.76.