Jump to content

MessageReceiveCallback


MrIslomaniac
 Share

Recommended Posts

Hey mates

MessageReceiveCallback does not seem to work with an entity Loaded from a file!

Anyone experienced that as well? Or maybe found a solution?

I would be happy to hear one :)

 

Cya

TEntity Cube = LoadModel("abstract::tree.gmf");
SetEntityCallback(Cube,(byte*)MessageReceiveCallback,ENTITYCALLBACK_MESSAGERECEIVE);

And
void _stdcall MessageReceiveCallback( TEntity entity, str message, byte* extra ) 
{
char str[256];
sprintf(str, "%d got a message. Message name: \"%s\"", (int)entity, message);
MessageBox(0, str, "MessageReceiveCallback called", 0);
}

It does work correctly if i don't load the file but use CreateCube(0);

Link to comment
Share on other sites

Nope that does not help =( Thanks anyway

P.S. i did not put the whole code in here:

8code]

TModel Cube = LoadModel("abstract::oldtree.gmf");

SetEntityKey(Cube,"Health","100");

EntityColor(Cube,Vec4(1,1,1,255));

ScaleEntity(Cube,Vec3(1,5,1));

PositionEntity(Cube,Vec3(x,y-1.25,z));

EntityType(Cube,1);

SetEntityCallback(Cube,(byte*)MessageReceiveCallback,ENTITYCALLBACK_MESSAGERECEIVE);

[/code]

Link to comment
Share on other sites

pick.entity from what I remember returns the mesh not the model. Try GetParent(pick.entity), or it's the other way around. Anyway, it has to do with that. A better test would be to step through the code and see what value your model returns after you load it, and then see what value pick.entity returns and what value GetParent(pick.entity) returns.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...