From e670b4ed55c459a21090bd0178ceaaaf12d87989 Mon Sep 17 00:00:00 2001 From: hybrid Date: Thu, 11 Jun 2026 19:58:31 +0300 Subject: init --- Common/Functions/Common_CreateVehicle.sqf | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Common/Functions/Common_CreateVehicle.sqf (limited to 'Common/Functions/Common_CreateVehicle.sqf') diff --git a/Common/Functions/Common_CreateVehicle.sqf b/Common/Functions/Common_CreateVehicle.sqf new file mode 100644 index 0000000..b110416 --- /dev/null +++ b/Common/Functions/Common_CreateVehicle.sqf @@ -0,0 +1,20 @@ +Private ["_lock","_position","_side","_type","_vehicle"]; +_type = _this select 0; +_position = _this select 1; +_side = _this select 2; +_lock = _this select 3; + +_vehicle = _type createVehicle _position; +if (_side != resistance) then { + _vehicle SetVehicleInit Format["[this,%1] ExecVM 'Common\Common_InitUnit.sqf';",_side]; + ProcessInitCommands; + Call Compile Format ["_vehicle addEventHandler ['Killed',{[_this select 0,_this select 1,%1] Spawn UnitKilled}]",_side]; +} else { + //--- Note To be optimized, 1.03 BIS BUG, cannot add resistance side via call compile format? which still isn't fixed in OA 1.59... + _vehicle addEventHandler ["Killed",{[_this select 0,_this select 1,resistance] Spawn UnitKilled}]; +}; +_vehicle lock _lock; + +diag_log Format["[WFBE (INFORMATION)][frameno:%4 | ticktime:%5] Common_CreateVehicle: A %1 '%2' vehicle has been created (position: %3)",str _side,_type,_position,diag_frameno,diag_tickTime]; + +_vehicle \ No newline at end of file -- cgit v1.3.1