FCP
Guest
|
 |
« Reply #3 on: March 19, 2006, 05:56:47 pm » |
|
Can you or anyone give me a tip or an example code of loading an npc using the CEL's api though?
Or is it even possible at this stage, with pcnpcmove beahivioral layer and iPcNpcMove structs not being fully implemented?
This is what I have for loading an NPC code (that crashes the program when called):
csPtr<iCelEntity> CelTest::CreateNPCActor (const char* name, const char* /*factname*/, const csVector3& /*pos*/)
{ csRef<iCelEntity> NPCentity_cam = pl->CreateEntity (name, bltest, "actor", "pcactormove", "pcmesh", "pcmeshselect", "pclinearmovement", "pctooltip", "pcinventory", "pcsoundlistener", if (!entity_cam) return 0;
// Get the iPcActorMove interface so that we can set movement speed. csRef<iPcActorMove> pcactormove = CEL_QUERY_PROPCLASS_ENT (NULL, iPcActorMove); pcactormove->SetMovementSpeed (2.0f); pcactormove->SetRunningSpeed (5.0f); pcactormove->SetRotationSpeed (1.75f); pcactormove->SetJumpingVelocity (6.31f);
csRef<iPcMesh> evilpcmesh = CEL_QUERY_PROPCLASS_ENT (NPCentity_cam, iPcMesh); bool evilhascal3d = true; evilpcmesh->SetPath ("/cel/data/"); evilhascal3d = evilpcmesh->SetMesh ("test", "cally.cal3d");
//calls to iPcNpcMove struct csRef<iPcNpcMove> npclinmove = CEL_QUERY_PROPCLASS_ENT (NPCentity_cam, iPcNpcMove);
return csPtr<iCelEntity> (NPCentity_cam); }
And the call in CreateRoom():
entity_dummy1 = CreateNPCActor ("NPC", "", csVector3 (0,0,10)); if (!entity_dummy1) return false;
Any idea why that crashes?
|