Client Damage Notification
by Peter Simard · in Torque Game Engine · 09/09/2005 (4:53 pm) · 5 replies
I am trying to trigger an event on my client when it recieves a damage update on an object. Im putting the following code in void ShapeBase::unpackUpdate
When I run it in single player mode the onDamageUpdate event triggers fine... but when I run it as a dedicated client I see the "Executed" message in the console, but the onDamageUpdate does not fire. What am I doing wrong? Is there a better way of accomplishing this?
if (stream->readFlag()) {
mDamage = mClampF(stream->readFloat(DamageLevelBits) * mDataBlock->maxDamage, 0.f, DataBlock->maxDamage);
[b]Con::printf("Executed");
Con::executef(mDataBlock,2,"onDamageUpdate",scriptThis());[/b]When I run it in single player mode the onDamageUpdate event triggers fine... but when I run it as a dedicated client I see the "Executed" message in the console, but the onDamageUpdate does not fire. What am I doing wrong? Is there a better way of accomplishing this?
#2
It works just fine single player so I know its defined right. It just doesnt want to call when running as a dedicated client.
09/09/2005 (7:46 pm)
I am defining the function as:function Armor::onDamageUpdate(%this)
It works just fine single player so I know its defined right. It just doesnt want to call when running as a dedicated client.
#3
09/09/2005 (9:19 pm)
The dedicated client doesn't know to call it Armor - names like that aren't sent over the wire. Try Player::onCollision.
#4
function Player::onDamageUpdate(%this)
Its not firing in single player now either. Would I need to change the way the function is called? I tried replacing mDataBlock with Player but I get "error C2275: 'Player' : illegal use of this type as an expression". Sorry for questions, im still pretty new at this :/
09/09/2005 (9:58 pm)
No go. I replaced the function with:function Player::onDamageUpdate(%this)
Its not firing in single player now either. Would I need to change the way the function is called? I tried replacing mDataBlock with Player but I get "error C2275: 'Player' : illegal use of this type as an expression". Sorry for questions, im still pretty new at this :/
#5
09/11/2005 (7:06 pm)
MDatablock.. Hmm, some maybe PlayerDataBlock or whatever the player datablock class is called?
Associate Kyle Carter