Crystal Space
Welcome, Guest. Please login or register.
October 22, 2014, 10:54:50 am

Login with username, password and session length
Search:     Advanced search
9010 Posts in 2044 Topics by 8791 Members
Latest Member: Bouncys
* Home Help Search Login Register
+  Crystal Space
|-+  Crystal Space Development
| |-+  Support
| | |-+  Attach attributes to a CEL entity?
« previous next »
Pages: [1] Print
Author Topic: Attach attributes to a CEL entity?  (Read 2983 times)
Panch
Jr. Member
**
Posts: 80


View Profile Email
« on: February 23, 2008, 01:15:45 am »

Is it possible to attach attributes, like Health and Strength directly to an entity?

Thanks!
Logged
jorrit
Administrator
Hero Member
*****
Posts: 1706


View Profile
« Reply #1 on: February 23, 2008, 06:34:45 am »

Yes, use the tools.property property class for that.

Greetings,
Logged
Panch
Jr. Member
**
Posts: 80


View Profile Email
« Reply #2 on: February 23, 2008, 03:15:20 pm »

Awesome, thanks!
Logged
Panch
Jr. Member
**
Posts: 80


View Profile Email
« Reply #3 on: February 23, 2008, 06:59:00 pm »

I added

Code:
<propclass name="tools.property" />

to the entity file name but the engine bugs out when the file is loaded. It says there is no factory to load the property class too.

the entity file:
Code:
<world>
  <plugins>
    <plugin name="celentity">cel.addons.celentity</plugin>
  </plugins>

  <sector name="Scene">

    <addon plugin="celentity" entityname="Muck1">

      <propclass name="pcobject.mesh">
        <action name="LoadMesh">
  <par name="filename" string="/lib/Muck/library" />
  <par name="factoryname" string="spr3dSphere" />
</action>
      </propclass>

      <propclass name="pcobject.mesh.select" />
<propclass name="tools.property" />

      <propclass name="pcmove.linear">
        <action name="InitCD">
  <par name="body" vector=".2,.2,.2" />
  <par name="legs" vector=".2,.2,.2" />
  <par name="offset" vector="0,-.3,0" />
</action>
      </propclass>

      <behaviour name="box_behave" />

    </addon>

  </sector>
</world>

and the C++ code:
Code:
battle1_entity = pl->FindEntity("Muck1");
csRef<iPcProperties> pcprop = CEL_QUERY_PROPCLASS_ENT (battle1_entity, iPcProperties);
pcprop->SetProperty("Health", muckHealth);

I must be missing something?
Logged
jorrit
Administrator
Hero Member
*****
Posts: 1706


View Profile
« Reply #4 on: February 23, 2008, 08:19:23 pm »

Don't take everything I say literally. The name is 'pctools.property' as you can see from all the other property classes that also start with 'pc'. The ref manual also contains documentation on this.

Greetings,
Logged
Panch
Jr. Member
**
Posts: 80


View Profile Email
« Reply #5 on: February 24, 2008, 12:26:26 am »

whoops hehe Smiley

I looked in the manual and in the API but i must be missing it somehow. is there a listing somewhere of all the properties? I've looked through all the stuff i can find at:
http://www.crystalspace3d.org/main/Documentation ?

Like the manual says to load the specific factories, although only "mesh" is given. I tried:

Code:
if (!pl->LoadPropertyClassFactory ("cel.pcfactory.tools"))
return false;

EDIT -
Well, the proper plug-in name is:
Code:
<propclass name="pctools.properties" />


Is there a listing of them (properties/plugins) somewhere to browse?

Thanks!
« Last Edit: February 24, 2008, 06:45:28 am by Panch » Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 4.164 seconds with 15 queries.