Crystal Space
Welcome, Guest. Please login or register.
April 25, 2014, 02:09:00 am

Login with username, password and session length
Search:     Advanced search
8990 Posts in 2037 Topics by 7628 Members
Latest Member: Majstersztyk1989
* Home Help Search Login Register
+  Crystal Space
|-+  Crystal Space Development
| |-+  General Crystal Space Discussion
| | |-+  Source code for NPC character creation - but how to call it properly?
« previous next »
Pages: [1] Print
Author Topic: Source code for NPC character creation - but how to call it properly?  (Read 2123 times)
FCP
Guest


Email
« on: March 19, 2006, 11:42:50 pm »

The code (function):

csPtr<iCelEntity> CelTest::CreateNPCActor (const char* name,const char* /*factname*/, const csVector3& /*pos*/)
{
      csRef<iCelEntity> NPCzombie = pl->CreateEntity("zombie",bltest,"actor",
      "pcmesh","pclinearmovement",
      "pcnpcmove","pctimer",CEL_PROPCLASS_END);

   if (!NPCzombie) return 0;

   csRef<iPcMesh> zombieMesh = CEL_QUERY_PROPCLASS_ENT (NPCzombie, iPcMesh);
   zombieMesh->SetPath("/cel/data/");
   zombieMesh->SetMesh("test","cally.cal3d");
   if(!zombieMesh->GetMesh()) return 0;

   csRef<iPcLinearMovement> npclinmove = CEL_QUERY_PROPCLASS_ENT (NPCzombie,
        iPcLinearMovement);

   csRef<iPcTimer> zombieTimer = CEL_QUERY_PROPCLASS_ENT (NPCzombie,iPcTimer);
   zombieTimer->WakeUpFrame(1);

   return csPtr<iCelEntity> (NPCzombie);
}

Thats what I was able to pur together from documentation.... but when I call it some VERY bad things happen (unspecified flood of gibberish in the cmd window).

call code :
  //entity_dummy1 = CreateActor ("NPC", "", csVector3 (0,0,10));
  //if (!entity_dummy1) return false;

Any ideas why that happens?
Logged
FCP
Guest


Email
« Reply #1 on: March 20, 2006, 12:08:01 am »

upon closer inspection the"pile of gibberish" turned out to bea failed assertion on get_element function of the array.h in csutils ( in crystal space). No idea whythat happens though
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 3.589 seconds with 14 queries.