Jump to content
ozdeadmeat

Multiplayer EventHandler GetIn for respawnable vehicles using the Respawn module

Recommended Posts

Hi Everyone,

 

I am sure there is a simple way to do this but I am stuffed if I can work it out. I am using the respawn module in Arma 3 and have the following expression for the vehicle respawn module

 

param [0,objNull] call OZDM_RESPAWN_SUPPORT_VEHICLE

 

The OZDM_RESPAWN_SUPPORT_VEHICLE is the following:

OZDM_RESPAWN_SUPPORT_VEHICLE = {
private ["_vehicle", "_vehicleType"];
_vehicle = _this;
_vehicleType = typeOf _vehicle;
if(IsServer) then {
	clearWeaponCargoGlobal _vehicle;
	clearMagazineCargoGlobal _vehicle;
	clearItemCargoGlobal _vehicle;
	_vehicle setVehicleAmmo 0;
	_vehicle setfuelcargo 0;
	_vehicle setrepaircargo 0;
	_vehicle setammocargo 0;
	_vehicle setfuel 1;
	};
if (_vehicleType In OZDM_FUEL_VEHICLES) then {0 = _vehicle addEventHandler ["GetIn", {_this spawn OZDM_FUEL_SUPPORT_REPORT}]};
if (_vehicleType In OZDM_AMMO_VEHICLES) then {0 = _vehicle addEventHandler ["GetIn", {_this spawn OZDM_AMMO_SUPPORT_REPORT}]};
if (_vehicleType In OZDM_REPAIR_VEHICLES) then {0 = _vehicle addEventHandler ["GetIn", {_this spawn OZDM_REPAIR_SUPPORT_REPORT}]};
if (_vehicleType In OZDM_REPAIR_VEHICLES) then {0 = _vehicle addEventHandler ["GetIn", {_this spawn OZDM_REPAIR_SUPPORT_REPORT}]};
if (_vehicleType In OZDM_TRANSPORT_VEHICLES) then {
	0 = _vehicle addEventHandler ["GetIn", {_this spawn OZDM_TRANSPORT_SUPPORT_REPORT}];
	_vehicle setVariable ["CARGO","EMPTY",true];
	_vehicle lockcargo true;
	_vehicle lockcargo [0,false];
	};
exit
};

I have another respawn module for some quad bikes that respawn quickly around the base.

 

OZDM_RESPAWN_BASE_VEHICLE = {
private ["_vehicle", "_vehicleType"];
_vehicle = _this;
_vehicleType = typeOf _vehicle;
if(IsServer) then {
clearWeaponCargoGlobal _vehicle;
clearMagazineCargoGlobal _vehicle;
clearItemCargoGlobal _vehicle;
_vehicle setVehicleAmmo 0;
_vehicle setfuel 1;
};
If (_vehicleType == "B_Quadbike_01_F") then {
_vehicle setObjectTexture [0,"\a3\soft_f_beta\quadbike_01\data\quadbike_01_civ_black_co.paa"];
_vehicle setObjectTexture [1,"a3\soft_f_beta\quadbike_01\data\quadbike_01_wheel_civblack_co.paa"];
};
exit
};

 

I have another respawn module for some quad bikes around the base that respawn when players are outside of 50m away. 

 

OZDM_RESPAWN_BASE_VEHICLE = {
private ["_vehicle", "_vehicleType"];
_vehicle = _this;
_vehicleType = typeOf _vehicle;
if(IsServer) then {
clearWeaponCargoGlobal _vehicle;
clearMagazineCargoGlobal _vehicle;
clearItemCargoGlobal _vehicle;
_vehicle setVehicleAmmo 0;
_vehicle setfuel 1;
};
If (_vehicleType == "B_Quadbike_01_F") then {
_vehicle setObjectTexture [0,"\a3\soft_f_beta\quadbike_01\data\quadbike_01_civ_black_co.paa"];
_vehicle setObjectTexture [1,"a3\soft_f_beta\quadbike_01\data\quadbike_01_wheel_civblack_co.paa"];
};
exit
};

I have noticed when joining a dedicated server that the getin event handlers aren't executing on the client and the object textures are not set correctly. 

 

For both modules the settings are as follows:

 

Wreck: Delete

Notification: Disabled

Forced Respawn: Enabled

Respawn when disabled: Enabled

 

The code works 100% in singleplayer when tested in 3DEN but not in multiplayer Dedicated Servers. I would like this to be consistent for all players including JIP players.

 

 

Any help would be greatly appreciated.

 

Thanks for your time.

Share this post


Link to post
Share on other sites

For the textures use setObjectTextureGlobal.

 

What do you mean that the getIn EH's aren't executing on the client, as in the code in those functions aren't running properly, or something else, because the effects of getIn are local to the vehicle the EH is applied to: 

https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#GetIn

Share this post


Link to post
Share on other sites

because the effects of getIn are local to the vehicle PC the EH is applied FROM:

Triggers when a unit enters a vehicle. It can be assigned to a remote vehicle but will only fire on the PC where the actual addEventHandler command was executed.

Share this post


Link to post
Share on other sites

yeah, how do I add EH for vehicles owned by the server for every person on the server?

Share this post


Link to post
Share on other sites

yeah, how do I add EH for vehicles owned by the server for every person on the server?

 

just add the EH in the file initPlayerLocal.sqf. This file is executed on each client when mission starts and the EH fires on each players machine if someone gets in the vehicle by a "GetInXXXX" action. (as descibed in the given link in Post #3)

Share this post


Link to post
Share on other sites

Including spawned vehicles via the respawn vehicles module?

Share this post


Link to post
Share on other sites

Including spawned vehicles via the respawn vehicles module?

 

including everything on which the getInXXX command can be used. This could be a vehicle like a tank, plane or helicopter or a static object like a mortar regardless how and when it was spawned as long as its known by the machine where the eventhandler was added.

 

The only exception would be a vehicle created with createVehicleLocal on another machine because in this case its not known by players machine...

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×