Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
bendy303

MP: handleDamage using remoteExec "call" method

Recommended Posts

HI,

I want to store the damage handler ID for all units in MP game, both AI and remote players.

At the moment, I am using a custom damage handler, so doing:

 

[_unit, ["handleDamage", {
		params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint", "_directHit", "_context"];

		// work some damage handler magic with some code

		_damage 
}]] remoteexec ["addeventhandler", _unit];



and this works 100% fine. 

HOWEVER we cannot store event handler IDs using remoteexec in this way. 

So trawling through the forums, I see you can also remoteexec a "call".

However when I try it, it doesnt apply the damage handler. 

This is the code that DOES NOT APPLY THE HANDLER:

[[_unit],{

          _unit addEventHandler ["HandleDamage", {
          params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint", "_directHit", "_context"];


          // work some damage handler magic with some code

          _damage 
          }]; //end DamageHandler

}] remoteExec ["call", _unit, true];
				



Why is it not working?

it seems all logical?

(I don't store the event handler ID in the latter code, because I cannot even get the handler working)

help greatly appreciated

cheers

Bendy
 

Share this post


Link to post
Share on other sites
[
  _unit,
  { 
    params ["_unit"];
    _unit addEventHandler ["HandleDamage",
      {
         params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint", "_directHit", "_context"];
         .....
      }
    ]
  }
] remoteExec ["call", _unit, _unit];

 

  • Like 2

Share this post


Link to post
Share on other sites
2 hours ago, pierremgi said:

[
  _unit,
  { 
    params ["_unit"];
    _unit addEventHandler ["HandleDamage",
      {
         params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint", "_directHit", "_context"];
         .....
      }
    ]
  }
] remoteExec ["call", _unit, _unit];

 


ahhh silly me. Thanks Pierre!

indeed, the
params ["_unit"];
was missing

thanks a million!

Bendy 

Share this post


Link to post
Share on other sites

×