-
Content Count
104 -
Joined
-
Last visited
-
Medals
Single Status Update
See all updates by bLAcKmAgE87
-
Unlimited Ammo For Any Vehicle Entered by any selectable player...
addMissionEventHandler ["TeamSwitch", { params ["_previousUnit", "_newUnit"]; _veh1 = vehicle _newUnit ; _firstAmmo = _veh1 ammo (currentMuzzle _newUnit ) ; [_previousUnit, _newUnit , _firstAmmo] execVM 'reloadingJets.sqf' ; }];
reloadingJets.sqf
_myMan = vehicle ( _this select 1) ; _firstAmmo = (_this select 2 ) ; hint str _firstAmmo ; _myMan setVariable ["iniAmmo",[_firstAmmo]] ; _myMan addEventHandler ["Fired", { _this spawn { params ["_veh", "_weapon", "_muzzle" ]; if(_veh != objNull ) then { private _thatCount = ((_this select 0) getVariable "iniAmmo" ) select 0 ; hint (str "while firing" + str _thatCount) ; private _ammo = _veh ammo _muzzle ; private _givenLeg = ( _thatCount ) ; private _againStuff = _givenLeg - 1 ; if (_ammo < _againStuff) then { //Sleep .1; _veh setVehicleAmmo 1; }; }; }}];
How do I avoid calling a .sqf? So that all my handlers exist on one file?
Originally this was from the idea that once inside any object/vehicle the script would go off, but in practiceor in editor you are constantly switching sides/playable units->
init.sqf(abrg)player addEventHandler ["GetInMan", { params ["_unit", "_role", "_vehicle", "_turret"]; _vehicle addEventHandler ["Fired", { _this spawn { params ["_veh", "_weapon", "_muzzle"]; private _ammo = _veh ammo _muzzle; if (_ammo == 0) then { //Sleep .3; _veh setVehicleAmmo 1; }; }}];