What is wrong with this addEventHandler?

Sandbird

Valued Member!
I am making some objects in my dayz_server.pbo and set some global variables on them
Code:
_this = createVehicle ["Land_Campfire_burning", [7086.0464, 2746.9268, -6.6757202e-006], [], 0, "CAN_COLLIDE"];
_this setDir -130.23953;
  t11 = _this;
_this setvehicleinit ' this setVehicleVarName "t11";';

Now in my client files i have an addaction that starts a script which has this at some point:
Code:
if(_ran1 > 50)then{t11 addEventHandler ["hit", {[t11,5] execVM "custom\object_hit.sqf"}];};

I am adding a diag_log at the end to see if t11 is set and it is....
But if i set a diag_log inside the object_hit.sqf then i get nothing.....as if the script is not running at all.
Is there anything wrong with this code ?
(_ran1 is just a random value, always set to 100 now for testing)
(t11,5 <--- 5 is just a number i am using in a for loop inside the object_hit).

ps: no errors both in server and client log files.

Why isnt the eventhandler registering the hit, when i am shooting at the object?
This works fine in SP, but not in MP.

Is it because the object is created on the server and the client for some reason doesnt 'see' it ?

Using epoch 1031.
 
Last edited:
The hit event handler is local. Vehicles are only local if the player is driving them. Empty vehicles are local to the server.
https://community.bistudio.com/wiki/6thSense.eu:EG#Locality

You could set an MPHit event handler on the server instead. You will probably run into a BattlEye mpeventhandler restriction kick you will need to add an exception for though.

hmm yeah thats what i thought :/
Isnt there a way in the client side to match that object to a variable and register the hit?
like _vobj = t11 and then use _vobj to register the eventhandling ?

Or i have to move the objects to the client side in order for it work properly with the normal eventhandler.

I forgot to mention....i am also tried
Code:
  t11 = _this; publicVariable "t11";
to send the object to the clients.

I thought that was enough for the clients to 'see' the object normally....and for eventhandler to work

-Thanks
 
Back
Top