About Store Forum Documentation Contact
Donations:
309$/mo



Post Reply 
[Solved] Problem spawning custom type object
Author Message
Semmy13 Offline
Member

Post: #1
[Solved] Problem spawning custom type object
Hi guys, I need again you help.
I'm working at an university project. This will be an mmo.
I've added in the enum.h file a couple of custom types for my character.
When I receive other players data in a client I should add the other player to the world.

Now I have this pieces of code:
PHP Code:
Game::ObjMemx<PCcharPCcharss
A global variable

PHP Code:
Game::World .init()
                .
setObjType(PlayersOBJ_PLAYER)
                .
setObjType(Items  ,OBJ_ITEM  )
                .
setObjType(StaticsOBJ_STATIC)
                .
setObjType(PCcharssOBJ_PC)
                .New(
+"world/"+cha.zone+".world"); 
In the init function, where OBJ_PC is a custom type.

PHP Code:
Game::ObjParams obj// set object parameters
            
obj.mesh    (trueMeshes   .ptrRequire("obj/Chr/human/body.mesh"));
            
obj.skeleton(trueSkeletons           ("obj/Chr/human/body.skel"));
            
obj.matrix.setScalePos(1.0f,Vec(yPosition.x,yPosition.y,yPosition.z));

            
obj.type(true"OBJ_PC");
            
Game::World.objCreate(obj,Matrix(obj.scale(), Vec(yPosition.x,yPosition.y,yPosition.z))); 
Where I receive other client data.
I've tryed to set the obj type to my custom type but PCcharss.elms() is still 0.
(This post was last modified: 05-19-2011 11:44 AM by Semmy13.)
05-18-2011 09:02 PM
Find all posts by this user Quote this message in a reply
Semmy13 Offline
Member

Post: #2
RE: Problem spawning custom object type
I'm looking the bloody massacre code and I see that it use a single AI class with an enum type and some switches in every function.
There's no way to use different classes for different npc?
05-19-2011 10:33 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #3
RE: Problem spawning custom object type
you can use multiple classes,
you must be doing something wrong - check dynamically creating objects tutorial
05-19-2011 10:42 AM
Find all posts by this user Quote this message in a reply
Semmy13 Offline
Member

Post: #4
RE: Problem spawning custom object type
Thanks for the reply.
I've already check it.
There is the global variable:
PHP Code:
Game::ObjMemx<Game::ItemItems

During the world init you set it as OBJ_ITEM container:
PHP Code:
Game::World.init      (                     )
              .
setObjType(Items,OBJ_ITEM       )
              .New       (
"world/barrels.world")
              .
update    (Cam.at               ); 
And then you load a barrel obj with the OBJ_ITEM type.

I need to do something similar but with different obj type.
In the default enum there's OBJ_PLAYER and OBJ_CHR but I want to use 4 different classes for 4 different kind of character.
05-19-2011 10:51 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #5
RE: Problem spawning custom object type
after editing enums.h you need to start Editor so it can convert .h to binary .h in the same folder
05-19-2011 11:33 AM
Find all posts by this user Quote this message in a reply
Semmy13 Offline
Member

Post: #6
RE: Problem spawning custom object type
Just so simple wink
Now it works! Thank you very much (I've spent one day on this problem) grin

[Edit] Flagged as solved grin
(This post was last modified: 05-19-2011 11:45 AM by Semmy13.)
05-19-2011 11:44 AM
Find all posts by this user Quote this message in a reply
Post Reply