Jump to content

Search the Community

Showing results for tags 'mgi scripts'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


    • Arma Reforger
    • Vigor
    • DAYZ
    • ARMA 3
    • ARMA 2
    • YLANDS
    • ARGO
  • Die Hard OFP Lovers' Club's Topics
  • ArmA Toolmakers's Releases
  • ArmA Toolmakers's General
  • Japan in Arma's Topics
  • Arma 3 Photography Club's Discussions
  • The Order Of the Wolfs- Unit's Topics
  • 4th Infantry Brigade's Recruitment
  • 11th Marine Expeditionary Unit OFFICIAL | 11th MEU(SOC)'s 11th MEU(SOC) Recruitment Status - OPEN
  • Legion latina semper fi's New Server Legion latina next wick
  • Legion latina semper fi's https://www.facebook.com/groups/legionlatinasemperfidelis/
  • Legion latina semper fi's Server VPN LEGION LATINA SEMPER FI
  • Team Nederland's Welkom bij ons club
  • Team Nederland's Facebook
  • [H.S.O.] Hellenic Special Operations's Infos
  • BI Forum Ravage Club's Forum Topics
  • Exilemod (Unofficial)'s General Discussion
  • Exilemod (Unofficial)'s Scripts
  • Exilemod (Unofficial)'s Addons
  • Exilemod (Unofficial)'s Problems & Bugs
  • Exilemod (Unofficial)'s Exilemod Tweaks
  • Exilemod (Unofficial)'s Promotion
  • Exilemod (Unofficial)'s Maps - Mission Files
  • TKO's Weferlingen
  • TKO's Green Sea
  • TKO's Rules
  • TKO's Changelog
  • TKO's Help
  • TKO's What we Need
  • TKO's Cam Lao Nam
  • MSOF A3 Wasteland's Server Game Play Features
  • MSOF A3 Wasteland's Problems & Bugs
  • MSOF A3 Wasteland's Maps in Rotation
  • SOS GAMING's Server
  • SOS GAMING's News on Server
  • SOS GAMING's Regeln / Rules
  • SOS GAMING's Ghost-Town-Team
  • SOS GAMING's Steuerung / Keys
  • SOS GAMING's Div. Infos
  • SOS GAMING's Small Talk
  • NAMC's Topics
  • NTC's New Members
  • NTC's Enlisted Members
  • The STATE's Topics
  • HavenEmpire Gaming community's HavenEmpire Gaming community
  • Polska_Rodzina's Polska_Rodzina-ARGO
  • Carrier command tips and tricks's Tips and tricks
  • Carrier command tips and tricks's Talk about carrier command
  • ItzChaos's Community's Socials
  • Photography club of Arma 3's Epic photos
  • Photography club of Arma 3's Team pics
  • Photography club of Arma 3's Vehicle pics
  • Photography club of Arma 3's Other
  • Spartan Gamers DayZ's Baneados del Servidor
  • Warriors Waging War's Vigor
  • Tales of the Republic's Republic News
  • Operazioni Arma Italia's CHI SIAMO
  • [GER] HUSKY-GAMING.CC / Roleplay at its best!'s Starte deine Reise noch heute!
  • empire brotherhood occult +2349082603448's empire money +2349082603448
  • NET88's Twitter

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Website URL


Jabber (xmpp)








Steam url id







PlayStation PSN














Found 31 results

  1. MGI ADVANCED MODULES Hi all, Here is an addon for mission makers. If you need to easily spawn some factions, some civilian life or just add randomized weapons loot in houses... If you want an advanced AI heal & revive, for SP or MP mission, able to heal players or bros.. ... or respawning AIs, in waves or at once.. If you want a transport support on any vehicle... A vehicle respawn system with crew, waypoints, loadouts, addActions, arsenal.... Friendly kill sanction... AI cannons able to fire HE shells on infantry... Some generators able to switch on/off a district... or adapt silencers to combat behavior... or perhaps a simple tool for reading all map object classes/display names/p3d model names... Other tools like tire puncture on barbed wires? ... And of course, MP compatible, favorite mods compatible... Here you are. MODULES on Steam: https://steamcommunity.com/sharedfiles/filedetails/?id=1682280809 The summary is just here. The modules are described and explained in an updated documentation: DOCUMENTATION LINK Have fun! Pierre MGI
  2. NO MORE SINGLE DEATH (SP/MP) - PLAYER CAN AUTO-REVIVE Hi all, Did you play some "ESCAPE MALDEN" in MP while single player and get the frustration of "lost mission on death"? Sure, you're alone and nobody will revive you. Respawn kills you and the game is over! Same for some SP session of complex mission. If you don't have the switch units possibility, game is over at first death. The script overrides this fate. Just choose (or not) the two parameters set at the first line. parameters: REVIVE DELAY / CLEAR AREA Revive delay: Simply change the first value in first line. This value is also a delay for captive status. i hard-coded a minimum: (min set to 20 sec. for cinematic if MP revive allowed, 10 sec. min if not). Clear area: the enemy infantry will be killed within this radius. That's useful for reviving inside a hornet's nest. Can be set to 0. Recommended value: 20 m. Usage: Copy/ paste the code in one of these places: running script for player(s) / trigger set to true / init.sqf / initPlayerLocal.sqf / console Example, for ESCAPE MALDEN, enable debug console in parameters and copy /paste the code, exec local. NOTES: - in MP, this script will work as long as there is an unique player. If some JIP, the script will be stopped. - Not compatible with other damage event handlers. If you want, you can try to make it work along with some other damage EHs, just removing the 6th line: player removeAllEventHandlers "handleDamage"; [5,50] call { params [["_delay",20,[0]],["_clear",0,[0]]]; if (count (call bis_fnc_listPlayers) != 1) exitwith {}; MGI_ReviveDelay = [_delay max 10,_delay max 20] select (player call BIS_fnc_reviveEnabled); MGI_clearArea = _clear; player removeAllEventHandlers "handleDamage"; MGI_fn_revive = compileFinal " params ['_unit']; waituntil {lifeState _unit == 'incapacitated' or !alive _unit or (!(_unit call BIS_fnc_reviveEnabled) && damage _unit >=0.86)}; if (!(_unit call BIS_fnc_reviveEnabled)) then { _unit setUnconscious true }; if (lifeState _unit == 'incapacitated') then { _unit setCaptive true; _unit allowdamage false; _unit setVariable ['inc',false]; {_x setDamage 1} forEach (( _unit nearEntities ['CAManBase', MGI_clearArea]) select {side _x getFriend playerSide < 0.6 && side _x != civilian}) - [_unit]; uisleep 3; _unit allowDamage true; if (_unit call BIS_fnc_reviveEnabled) then { ['#rev',1,_unit] call BIS_fnc_reviveOnState; _unit setCaptive true; _unit allowdamage false; } else { _unit setDamage 0; _unit setUnconscious false; }; }; uiSleep MGI_reviveDelay; _unit allowdamage true; _unit setCaptive false; "; player addEventHandler ["handleDamage", { params ["_unit","","_dam"]; if (count allplayers !=1) exitWith { player removeEventHandler ["handleDamage",_thiseventHandler] }; _veh = objectParent _unit; if (!isnull _veh && isNil {_veh getVariable ["incVeh",nil]} && (damage _veh > 0.7 or (!canfire _veh && !canMove _veh) or _dam > 0.3)) then { _veh setVariable ["incVeh",true]; _unit allowdamage false; _unit setCaptive true; [_unit,_veh] spawn { params ["_unit","_veh"]; _unit action ["GetOut", _veh]; _tim = diag_tickTime; waitUntil {isnull objectParent _unit or diag_tickTime > _tim + 3}; uiSleep 2; _veh setVariable ["incVeh",nil]; _unit allowdamage true; _unit setCaptive false; }; }; if (!(_unit getVariable ["inc",false]) && isNull objectParent _unit) then { _unit setVariable ["inc",true]; _unit spawn MGI_fn_revive; }; _dam min 0.86 }]; }; Enjoy!
  3. DETONATING CORD Hi all, This topic gave me the idea to script a little for a detonating cord. So, you can add this code in init.sqf or else. Just be sure your unit(s) created before running the code. Parameters: UNITS / PROJECTILE / SAFETY DISTANCE / CORD LENGTH MGI_fnc_detCord = { params [["_units",[],[objNull,[]]],["_thrownEnd","SmokeShellOrange"],["_safetyDist",15],["_cordLength",60]]; if (_units isEqualType objNull) then {_units = [_units]}; MGI_passToEhCord = [_thrownEnd,_safetyDist,_cordLength]; { _x addEventHandler ["firedMan", { params ["_unit", "", "", "", "", "_magazine", "_projectile"]; MGI_passToEhCord params ["_thrownEnd","_safetyDist","_cordLength"]; if (_magazine == _thrownEnd) then { [_unit,_projectile,_safetyDist,_cordLength] spawn { params ["_unit","_projectile","_safetyDist","_cordLength"]; private _veh = if (isNull objectParent _unit) then [{"B_UAV_01_F" createVehicleLocal getpos _unit},{objectParent _unit}]; if (_veh isKindOf "B_UAV_01_F") then {_veh hideObject true}; private _rope = ropeCreate [_veh,[0,0,0],_projectile,[0,0,0],_cordLength,["",[0,0,10]]]; uisleep 6; private _segs = (_veh nearObjects ["ropesegment",_cordLength]) select {_x distanceSqr _veh > _safetyDist^2}; if !(_segs isEqualTo []) then { _unit addAction ["detonate cord",{ params ["_target", "_caller", "_id", "_args","_exploEnd"]; _args params ["_rope","_veh","_segs","_projectile"]; _target removeAction _id; for "_i" from 0 to count _segs -1 do { _explo = createVehicle ["mini_grenade",getpos (_segs #_i),[],0,"CAN_COLLIDE"]; _explo hideObjectGlobal true; if (_i == count _segs -1) then {_exploEnd = _explo}; }; waitUntil {isNull _exploEnd}; if (_veh isKindOf "B_UAV_01_F") then {deleteVehicle _veh}; deleteVehicle _rope; deleteVehicle _projectile; },[_rope,_veh,_segs,_projectile],0,true,false,"","alive _target"]; }; }; }; }]; } forEach _units; }; player call MGI_fnc_detCord; // example Have fun!
  4. AI VEHICLE RESPAWN SP/MP Hi all, Did you ever try the BI respawn vehicle module? That works well on empty ones, as far as you linked the vehicles to the module. With some disappointment trying to link a flying helicopter and see it (them!) falling to the ground. A little code in the "expression field" and, yeah, you create a new crew and a helo just hovering now! But, what if you want, not only the standard crew, but also the airborne assault squad into it? When? Where on helo track (waypoints)? And, why not respawning a crate? and the loadout for any respawned vehicle/crate? I suggest the following script to allow AI vehicle, manned or empty, but no player on board), respawning according to parameters. This works in SP or MP. Only vehicles (+ full crew if any) / crates are concerned as far as the respawn for killed infantry AI units is the object of a this other script. version April 29th 2020 Totally reworked for better reliability in heavy scenario (MP/SP) This script is also available as module in MGI ADVANCED MODULES, with more possibilities. parameters: VEHICLES / POSITIONS / DELAY / RESPAWN WHEN DISABLED / EMPTY VEHICLES (ALL) Examples: [] spawn MGI_fnc_vehicleRespawn // [] passed as parameter equals to [ [ ], "death", 10, false, true] All empty vehicles can respawn on their position at death, after 10 sec delay, without possibility to respawn if just disabled. [ [WEST,EAST], ["mrk1","death","start",""], nil, false,false ] spawn MGI_fnc_vehicleRespawn // equals to [ [WEST,EAST], ["myMrk1","death"], 15, false,false] here, only WEST & EAST ai vehicles can respawn: - on the marker "myMrk1" if any, (on death position if marker not present), for BLUFOR vehicles - on the position of death for OPFOR vehicles, (other strings in positions array are useless), 10 second delay (default), without respawn when disabled. Code to be run on server (eventually on Headless Client). example: initServer.sqf if no HC. or inside a simple trigger in 3den, server only, non-repeatable, condition true ___________________________________________________________________ SCRIPT Enjoy! Pierre MGI Notes: - If you choose to respawn the disabled vehicles, these will be destroyed (then respawned), probably earlier than for the normal destruction. Destruction occurs sooner but not before the crew leaves the vehicle. So, if you allow crew staying inside immobilized vehicle, this "respawn on disabled" is postponed until destruction by enemy or abandon. - using the second script, some behaviors like custom loadout and actions menu needs to fire the EH handle damage. That is to say, you have to damage the vehicle in-game (firing at it), not using a simple setDamage via debug console (this command doesn't trigger the EH). Also, let some seconds after mission start (Arma engine actions menu returm something for the actionParams). Version 13112018: added possibility to "respawn" the code written in init field of a vehicle. Version 06122018: improved jets respawn. Version 09102019: spawning vehicles on carrier at sea. Version 13103019: fuel management and some extra cases Version 26112019: all mags are restored with the exact ammo count. Version 19122019: respawned vehicle is locked same as destroyed one. Version 19042020: better reliability in heavy mission context. All in one script. Version 21072020: repaired UAV respawn
  5. CRATERS Hi all, This topic gave me an idea for scripting craters after an explosion. I share this code you can add in an sqf or a trigger set to TRUE, server only should work. I'll add a similar code in my "terrain & map interactive" MGI module. Parameters: none MGI_hashAmmo = createHashMapFromarray (("true" configClasses (configFile / "cfgAmmo")) apply {[configName _x, getNumber (_x/"hit")]}); ["MGI_craters", "onEachFrame", { _flyingProj = (8 allObjects 2); { if (isNil {_x getVariable "EH"} ) then { _x setVariable ["EH", _x addEventHandler ["explode", { params ["_proj","_pos","_vel"]; _pos deleteAt 2; private _hit = MGI_hashAmmo get typeOf _proj; private _calc = log ((sqrt vectorMagnitude _vel*sqrt _hit) max 1.1); [_proj,_calc,_pos] spawn { params ["_proj","_calc","_pos"]; sleep 0.1; private _crater = _pos nearestObject "#crater"; if (!isNull _crater) then { _pos = getPosASL _crater; private _surface = (configFile /"cfgSurfaces"/ (surfaceType _pos splitString "#")#0); private _depress = getTerrainHeightASL _pos - ((_calc/(getNumber (_surface / "surfaceFriction") max 1)*(getNumber (_surface /"dust") max 0.01 min 1)) min 3); _pos set [2,_depress]; (setTerrainHeight [[_pos],TRUE]) remoteExec ["call",2]; }; }; }] ]; }; } forEach _flyingProj; }] call BIS_fnc_addStackedEventHandler; This code creates craters after explosion on ground (where Arma craters are). So, not on vehicles, not on buildings. Note1: Firing AP shell (armor piercing one) doesn't lead to explosion (Arma engine), so you need to fire HE shell for craters. Note2: at this time, craters after crash (planes) don't fire the code. this code is for EXPLODING PROJECTILES only. Feedback are welcome! Have fun.
  6. FUNCTIONS FOR GETTING / SETTING VEHICLE LOADOUT Hi all, Here is a script for getting the loadout of any vehicle or crate (any container in fact) then transfer it on another vehicle or crate. This works in SP or MP. This functions work also for virtual arsenal, edited, or scripted with addAction command. If any uniform, vest or backpack with their own custom loadout inside it, you'll recover the exact loadout for each one. (I didn't push to keep the same ammo count on each mag...) So, it's compatible and consistent with some automatic loaded backpacks, which will be loaded as you let them instead of their auto-default loadout. NB1: The loadout of the receiving container will be replaced by the loadout you get. NB2: see also the respawn vehicle script for integration of these two functions on respawning vehicles. (script to be issued soon). parameters: one objet <vehicle or crate, preferable> applying to getVehicleLoadout, two objects <new vehicle or crate, old vehicle or crate> applying to getVehicleLoadout Limitations: The object you picked the loadout with getVehicleLoadout must not be deleted before you apply the setVehicleLoadout on another object. Not tested, crates and vehicles overall load limitations, if any. I didn't see any of them so far. Examples: car1 call MGI_fnc_getVehicleLoadout; // you pick the current loadout of a vehicle; cursorTarget call MGI_fnc_getVehicleLoadout; // if you're pointing at a backpack on ground, you pick its loadout (must stay on cursorTarget for transferring the whole backpack in a named vehicle/crate); [car2,crate1] call MGI_fnc_setVehicleLoadout; // you call the loadout of crate1, previously recorded with MGI_fnc_getVehicleLoadout; The two objects must be present, not applicable on player or infantry units (see BI commands getUnitLoadout / setUnitLoadout) you apply the loadout of crate1 on car2, these two objects have now the same loadout. [car2,cursorTarget] call MGI_fnc_setVehicleLoadout; // see above. If you are still on same cursorTarget, you pass the container to the new object (so,new vehicle must be named for debug console usage). Codes to be run anywhere you need it, locally, preferably on server. MGI_fnc_getVehicleLdout MGI_fnc_setVehicleLdout EDITED
  7. Hello all, The command nearestAirport doesn't exist. Here is a little script for finding the nearest existing (native) airport or edited one (USS Freedom). MGI_fnc_nearestAirport = { params [["_plane",player,[objNull,[]],[2,3]],"_airport_pos","_airport_inter","_checkValue","_airportName","_airport_dir","_airport_or"]; private _world = (configFile / "cfgWorlds" / worldName); private _airports = [[0,getArray (_world / "ilsPosition"), getArray (_world / "ilsDirection")]]; private _airport_dist = 10^6; private _dynAirports = (allAirports #1); { _airports pushBack [_forEachIndex,getArray (_x / "ilsPosition"),getArray (_x /"ilsDirection")] } forEach ("true" configClasses (_world / "secondaryAirports")); if (_airports isNotEqualTo [] && ((count _airports !=1) or (_airports #0#1#0 != _airports #0#1#1))) then { _airports = _airports apply {[(_x#1) distance2D _plane,_x]}; _airports sort TRUE; _airport_dist = (_airports #0#0); _airport_pos = (_airports #0#1#1); _airport_dir = _plane getDir _airport_pos; _checkValue = (_airports #0#1#2); _airport_or = if ((_checkValue #2) != 0) then [{atan ((_checkValue #0)/(_checkValue #2))},{90}]; _airportName = text (nearestLocation [_airport_pos,"NameLocal"]); }; if (_dynAirports isNotEqualTo []) then { _airports = _dynAirports apply {[_x distance2D _plane,_x]}; _airports sort TRUE; _airport_inter = (_airports #0#0); if (_airport_inter < _airport_dist) then { _airport_pos = getpos (_airports #0#1); _airport_dir = _plane getDir _airport_pos; _airport_dist = _airport_inter; _airportName = "CVN"; _airport_or = (172+ getdir (_airports #0#1)) mod 360; }; }; [_airportName,round _airport_or,_airport_pos,round _airport_dist,round _airport_dir]; }; Usage: just call it like: call MGI_fnc_nearestAirport; // refers to player by default plane1 call MGI_fnc_nearestAirport; // refers to object plane1 [anyPosition] call MGI_fnc_nearestAirport; // any position must be an array inside the array of parameter (like: [getpos player] or [[xxx,yyy]]...) The function will return an array with: [name of the airport (location), orientation of the main runway/angle deck for CVN, position of the airport, distance, azimuth] Note: you can add it in cfgFunctions for better performance while calling it multiple times: In your description.ext (or cpp ,hpp in addons) class cfgFunctions { class MGI { class anyCategoryYouWant { file = "yourSubFolder(s)"; // "\yourSubFolder(s) for addon" class nearestAirport{}; }; }; }; Then place the code in an sqf named fn_nearestAirport inside your path (described as file). SQF starts with params line and ends with the returning array (must not be wrapped inside MGI_fnc_nearestAirport {...};) And same usage in scripts: plane1 call MGI_fnc_nearestAirport;
  8. MGI HALO JUMP Hi all, Here is a little script to make an object as HALO JUMP base. All AI group units with 100 m of the caller will perform the jump. Other players are not concerned. Required: at least one object to add this HALO jump action. parameters: JUMP ALTITUDE / SAFETY ALTITUDE / THIS (object init field) / AI GROUP example: 0 = [this,2000,90] execVM "MGI_HALO.sqf" // in init field of a pole. or simply: car1 execVM "MGI_HALO.sqf" // 2000 ,90 and true are params by default. MGI_HALO.sqf : MGI_HALO = { params [["_pole",objNull,[objNull]],["_jump_alt",2000,[0]],["_jump_safety",90,[0]]]; MGI_compHALO = compileFinal " _plyr = _this; MGI_fnc_orient = { _obj = _this select 0; _p = _this select 1; _obj setVectorDirAndUp [ [ 0,cos _p,sin _p], [[0,-sin _p,cos _p],0] call BIS_fnc_rotateVector2D ] }; _plyr setVariable ['bpk',unitBackpack _plyr]; _plyr setVariable ['lockInv', _plyr addEventHandler ['InventoryOpened', {true}]]; if (backpack _plyr != '') then { _whs = createVehicle ['WeaponHolderSimulated_Scripted',getpos _plyr vectorAdd [0,-2,1],[],0,'can_collide']; _plyr action ['DropBag', _whs, typeOf (_plyr getVariable 'bpk')]; ['EHid','onEachFrame', { params ['_plyr','_whs']; if (backpack _plyr != 'B_parachute') then { _plyr action ['dropBag', _whs, typeOf (_plyr getVariable 'bpk')]; _plyr action ['AddBag', _whs, 'B_Parachute'] }; call{ if (stance _plyr == 'UNDEFINED') exitWith { _whs attachTo [_plyr,[-0.1,-0.05,-0.7],'leaning_axis']; [_whs,-180] call MGI_fnc_orient }; if (stance _plyr != 'UNDEFINED') exitWith { _whs attachTo [_plyr,[-0.1,0.75,-0.05],'leaning_axis']; [_whs,-90] call MGI_fnc_orient }; }; if (isNil {_plyr getVariable ['bpk',nil]}) then { ['EHid', 'onEachFrame'] call BIS_fnc_removeStackedEventHandler }; },[_plyr,_whs] ] call BIS_fnc_addStackedEventHandler }; "; waitUntil {time >0 && count allPlayers >0 }; _pole addAction ["<t color='#00ffff'>HALO jump for group (AI)</t>",{ params ["_target","_caller","_id","_parameters"]; openmap [true,false]; titleText["Select Map Position", "PLAIN"]; _parameters params ["_jump_alt","_jump_safety"]; ["Jump","onMapSingleClick", { 0 cutText ["","black",0.01,true]; params ["","_pos","","","_jump_alt","_jump_safety","_MGI_forSquad"]; _caller = player; _MGI_units = (units _caller) select {local _x && alive _x && _x distanceSqr _caller < 100000 && isnull objectParent _x}; { [_x,_forEachIndex,_pos,_jump_alt,_jump_safety] spawn { params ["_unit","_index","_pos","_jump_alt","_jump_safety"]; private ["_bpk","_bpktype","_whs","_para"]; if (isPlayer _unit) then { _unit call MGI_compHALO; }; uisleep 2; _unit allowDamage false; _unit setPos [(_pos select 0)-60 + random 30,(_pos select 1) -60 + random 30, (_jump_alt max 200) + (12 *_index)]; waitUntil {(getpos _unit select 2) > _jump_safety -50}; uisleep 0.2; if (isPlayer _unit) then { _bpk = _unit getVariable "bpk"; _bpktype = typeOf (_unit getVariable "bpk"); _whs = objectParent _bpk; _unit addBackpackGlobal "B_parachute"; }; 0 cutText ["","black in",1,true]; waitUntil {(getpos _unit select 2) < ([_jump_safety max 90,_jump_safety] select (isPlayer _unit)) +20 or (!isnull objectParent player) }; if (!isplayer _unit) then { uisleep 0.8; _chute = createVehicle ["Steerable_Parachute_F", getpos _unit, [], 0, "can_collide"]; _unit moveInDriver _chute; } else { _unit allowDamage true; if (!isTouchingGround _unit) then { _unit action ["OpenParachute", _unit]; } }; _para = objectParent _unit; waitUntil {!isnull _para}; _para allowDamage false; waitUntil {sleep 0.5; (isTouchingGround _unit && isNull _para) or surfaceIsWater (getpos _unit) or !alive _unit}; if (isPlayer _unit) then { _unit setVariable ["bpk",nil]; waitUntil {isNull _para}; deleteVehicle _para; sleep 0.5; if (!isNull _whs) then { detach _whs; _whs setPos (_unit modelToWorld [0,-2,1]); _unit action ["AddBag",objectParent _bpk, _bpktype]; sleep 2; deleteVehicle _whs; }; _unit removeEventHandler ['inventoryOpened',_unit getVariable 'lockInv']; } else { uisleep 2; _unit allowdamage true; }; }; } forEach _MGI_units; openmap [false,false]; false },_parameters] call bis_fnc_addStackedEventHandler; waitUntil {sleep 1; !visibleMap}; ["Jump","onMapSingleClick"] call BIS_fnc_removeStackedEventHandler; },[_jump_alt,_jump_safety], 5,false, true,"","vehicle _this == _this"]; _pole addAction ["<t color='#00ffff'>HALO jump solo</t>",{ params ["_target","_caller","_id","_parameters"]; openmap [true,false]; titleText["Select Map Position", "PLAIN"]; _parameters params ["_jump_alt","_jump_safety"]; ["Jump","onMapSingleClick", { 0 cutText ["","black",0.01,true]; params ["","_pos","","","_jump_alt","_jump_safety","_MGI_forSquad"]; _caller = player; [_caller,_pos,_jump_alt,_jump_safety] spawn { params ["_unit","_pos","_jump_alt","_jump_safety"]; private ["_bpk","_bpktype","_whs","_para"]; _unit call MGI_compHALO; uisleep 2; _unit allowDamage false; _unit setPos [_pos select 0,_pos select 1, (_jump_alt max 200)]; waitUntil {(getpos _unit select 2) > _jump_safety -50}; uisleep 0.2; _bpk = _unit getVariable "bpk"; _bpktype = typeOf (_unit getVariable "bpk"); _whs = objectParent _bpk; _unit addBackpackGlobal "B_parachute"; 0 cutText ["","black in",1,true]; waitUntil {(getpos _unit select 2) < _jump_safety max 90 or (!isnull objectParent player) }; _unit allowDamage true; if (!isTouchingGround _unit) then { _unit action ["OpenParachute", _unit]; }; _para = objectParent _unit; waitUntil {!isnull _para}; _para allowDamage false; waitUntil {sleep 0.5; (isTouchingGround _unit && isNull _para) or surfaceIsWater (getpos _unit) or !alive _unit}; if (isPlayer _unit) then { _unit setVariable ["bpk",nil]; waitUntil {isNull _para}; deleteVehicle _para; sleep 0.5; if (!isNull _whs) then { detach _whs; _whs setPos (_unit modelToWorld [0,-2,1]); _unit action ["AddBag",objectParent _bpk, _bpktype]; sleep 2; deleteVehicle _whs; }; _unit removeEventHandler ['inventoryOpened',_unit getVariable 'lockInv']; } else { uisleep 2; _unit allowdamage true; }; }; openmap [false,false]; false },_parameters] call bis_fnc_addStackedEventHandler; waitUntil {sleep 1; !visibleMap}; ["Jump","onMapSingleClick"] call BIS_fnc_removeStackedEventHandler; },[_jump_alt,_jump_safety], 5,false, true,"","vehicle _this == _this"]; }; 0 = [this,2000,90] spawn MGI_HALO Now, you can choose in game if you HALO jump solo or in group (AI fellows within 100 meters). EDITED : version nov 19th 2020 Have fun
  9. MAGAZINES REPACK Hi all, Here is a simple script for repacking magazines by double-clicking on them in inventory. Just add it in init.sqf or better, in initPlayerLocal.sqf parameters: NONE MODIFIED 01/11/19 Have fun!
  10. AI REVIVE/HEAL SP/MP Last update 26th/11/2018 Hi all, Here is a script to allow AIs reviving and healing bros, according to parameters. This works in SP or MP. Compatible so far with AI RESPAWN script (see tag) Don't override the respawn system (MP) Incapacitation: This script relies on incapacitated status for players or AIs. This status is created when not existing (SP, or MP Ais) to allow revive scenario. parameters: REACT / HEAL DELAY / AI CAN REVIVE / KIT NEEDED / NEED MEDIC / AI CAN HEAL EXTRA GRP / BROS / WHITE FLAG ON MEDIC IN ACTION Parameters can be added to description.ext, class Params, just add what you want in classes: "react" "bleedOut" "noReviveForAI" "AiKit" "AiMedic" "bros" "whiteflag". So you can choose them while in lobby. Anyway, if you pass parameters calling the function, these params will override the lobby ones (except for bros class, see below). Code must run on all PCs. So, init.sqf, (trigger, non-repeatable, condition true)... Totally reworked (see below). EDITED: version with added parameter (see spoiler above. Should work fine in MP. Feedback welcome. Added possibility for multiple call lines. Last version with waypoints instead of domove + added parameter "white flag". Added one check more for distance form medic to wounded. What's a bro? - A bro is a unit (AI or player) who can be revived while unconscious, if some conditions are met (hard coded like within 200 m of another bro, or configured). In case of several healer candidates, the closer is elected. - That's also a unit able to heal unconscious unit (SP/MP) under the same conditions. But here, player(s) are not engaged in the process. They can heal but if an AI meet the conditions, this one will start the process. So, healer/healed is the same family: Bros. In which, the players are free to heal or not. How bros work (7th param or description.ext param class: bro ) - in SP, bros are switchable units by default. You can override this, passing a 7th param when calling MGI_fn_Revive, as shown in example (last code line). - in MP, * if bros class is present in description.ext, you can't override it; You have to choose one of the two settings: playable units or side player. Your description.ext should look like this (specifically for bros class): Bros = all players as default parameter means you can have different side and bros can heal anywhere.. if conditions are met. Keep on mind that disabled AI (slots) in lobby don't have existence and playableUnits = allPlayers (all playing guys), and not all playable units as in editor. So, each time you can let the slot as AI enabled, it's better. The list is updated anyway. The other possible parameter is set as WEST here. * if these parameters are not fine for your scenario, you can modify the bros class but you have to change the working line referring to your values: In the main function MGI_fn_Revive, look for: if (MGI_bros isEqualType 0) then { MGI_bros = [switchableUnits+playableUnits, WEST] select ("bros" call BIS_fnc_getParamValue); <<<<< THIS LINE CAN BE MODIFIED: [<your default array of bros>,<another choice>] select ("bros" call BIS_fnc_getParamValue) } else { MGI_bros = _MGI_bros }; * You can also delete the bros class in description.ext, and sets the 7th parameter as shown in the following example: [nil,nil,nil,nil,nil,nil,east] call MGI_fn_Revive; This way, here EAST will take place of the missing (and non over-writable) bros class. The other parameters are set to nil, for not overriding the other existing classes. * Don't forget, there is nothing mandatory, neither description.ext parameters, nor function parameters (See default above). You can add any unit in "bros" team, just setting a variable: yourUnit (or cursorTarget) setVariable ["passedBros",true,true]; Extra Examples: call MGI_fn_Revive // parameters are default ones, or defined by your description.ext: standard usage in MP (allowing parameters in description.ext) [nil,nil,nil,nil,nil,nil,east] call MGI_fn_Revive; // MP reworked/added side , class bros removed, other classes in description.ext [30,60,true,0,false,1,independent] call MGI_fn_Revive; // this will override the mission MP parameters in lobby, except the independent if bros class exist! Better usage for SP or even, in MP: [nil,nil,nil,nil,nil,nil,west,false] call MGI_fn_Revive; sleep 2; [nil,nil,nil,nil,nil,nil,east,false] call MGI_fn_Revive; Don't forget! bros class must be inactive/deleted in description.ext
  11. Hi all, Want to play with a "One man tank"? Here is a little script for "World of tank" aficionados. Works on all tanks in game, as far as you can jump into the driver's seat. Usage: you're driver until you move the mouse, pointing cannon at cursor direction. Driver is always in 3rd person. Then, you're gunner but you can use your keys to continue driving the tank. - in external view, you'll be back at driver's seat if no waypoint (see further) and no turret movement for 10 seconds. - in gunner view, you stay as gunner role and continue to drive. - if in gunner (or external) view and right click (Temporary zoom) on landscape, you create a temporary waypoint where the tank goes as far as you don't touch any of the driver's keys. Driver's keys will delete this waypoint when strike. Hints to know: - when driving from gunner's seat, avoid maintaining the forward key when you need to turn. release all, strike left(/right), maintain if you want; As soon as the direction is good, release left(/right) key, strike forward key. The tank will start to sway a little around the desired direction but will go where you want. Remember release all keys to make change. - there is no rear clutch while in gunner, just because Arma's engine prefers a 180° turn instead of a 10 meter rear drive... So, I disabled the backward key in gunner. Other stuffs: There are 2 parameters O/1 for displaying: - tank icon, in order to have a clear view of the direction of the tank when you are in gunner view. Gun is always up, of course. - little radar displaying other vehicles in game, along with knowledge of these units. Now, the function. Just add it into init.sqf or initPlayer.sqf, or any script which run for player: MGI_1ManTank = { params [["_icon",1,[0]],["_radar",1,[0]]]; if (!hasInterface) exitWith {}; MGI_iTk = _icon; MGI_rdrTk = _radar; MGI_timerTurreting = 0; MGI_timerStopping = 0; MGI_icon_tk = ""; coef_ratioTK = (getResolution select 4)/ 1.77778; coef_uiSpaceTK = 0.55/(getResolution select 5); MGI_keysMovingTk = ["carForward","Turbo","carSlowForward","carBack","carLeft","carRight"] apply {actionkeys _x select 0}; MGI_destTk = [0,0,0]; inGameUISetEventHandler ["Action", " if (_this select 0 isKindOf 'tank') then { MGI_icon_tk = getText (configFile >> 'cfgVehicles' >> typeof (_this select 0) >> 'icon'); if ((_this select 3) == 'GetInDriver' and count crew (_this select 0) > 0) then { _units = crew (_this select 0); {unassignVehicle _x} forEach _units; _units allowGetIn false }; if ((_this select 3) in ['GetInGunner','GetInCommander','GetInTurret']) exitWith { hint parseText ('<t>Jump in driver'+""'""+'s seat<t/>'); true}; if ((_this select 3) in ['MoveToGunner','MoveToCommander','MoveToTurret'] && !(player getVariable ['gunning',false])) exitWith { hint parseText ('<t>Only driver'+""'""+'s seat available<t/>'); true}; } "]; _MGI_EHTank = ["MGI_TK","onEachFrame", { coef_zoomTK = ([0.5,0.5] distance worldToScreen positionCameraToWorld [0,10,10])* (getResolution select 5); _veh = vehicle player; if (inputAction "zoomTemp" == 1 && {!isnil "MGI_agent"}) then { MGI_destTk = screenToWorld [0.5,0.5]; if (isnil "MGI_signTkDest") then { MGI_agent setDestination [MGI_destTk, 'VEHICLE PLANNED', true]; MGI_destTk set [2,2]; MGI_signTkDest = "Sign_Arrow_Large_F" createvehicle MGI_destTk }; }; if (!isnil "MGI_signTkDest" && {MGI_destTk isEqualTo [0,0,0] or (player distanceSqr MGI_destTk < 100) or driver _veh == player}) then { deleteVehicle MGI_signTkDest; MGI_signTkDest = nil}; if (!(_veh isKindOf "tank") && !isNil "MGI_agent") exitWith { deleteVehicle MGI_agent; MGI_agent = nil; if (!isnil "MGI_keysDriving") then {(findDisplay 46) displayRemoveEventHandler ["keyDown",MGI_keysDriving]; MGI_keysDriving = nil}; if (!isnil "MGI_keysDrivingUp") then {(findDisplay 46) displayRemoveEventHandler ["keyUp",MGI_keysDrivingUp]; MGI_keysDrivingUp = nil}; }; if (player == driver _veh) then { {_veh lockTurret [_x,true]} forEach allTurrets _veh; if (cameraView != "external" && _veh isKindOf "tank") then {player switchcamera "external"} } else { if (player == gunner _veh && diag_tickTime > MGI_timerTurreting + 10 && (cameraView == "external" && isnil "MGI_signTkDest")) then { player action ["MoveToDriver", _veh]; player setVariable ["gunning",false]; if !(isnil "MGI_agent") then {deleteVehicle MGI_agent; MGI_agent = nil;{_veh lockTurret [_x,true]} forEach allTurrets _veh}; }; }; if (isnil "MGI_keysDriving") then { MGI_keysDriving = (findDisplay 46) displayAddEventHandler ["KeyDown", " private _handled = false; if (!isnil 'MGI_agent') then { MGI_timerStopping = diag_tickTime; _veh = vehicle player; call { if ((_this select 1) == MGI_keysMovingTk select 4) exitWith { MGI_agent setDestination [_veh modelToWorldVisual [-30,10,0], 'VEHICLE PLANNED', true]; MGI_destTk = [0,0,0]; _handled = true }; if ((_this select 1) == MGI_keysMovingTk select 5) exitWith { MGI_agent setDestination [_veh modelToWorldVisual [30,10,0], 'VEHICLE PLANNED', true]; MGI_destTk = [0,0,0]; _handled = true }; if ((_this select 1) == MGI_keysMovingTk select 1) exitWith { MGI_agent setDestination [_veh modelToWorldVisual [0,100,0], 'VEHICLE PLANNED', true]; MGI_agent setSpeedMode 'FULL'; MGI_destTk = [0,0,0]; _handled = true }; if ((_this select 1) == MGI_keysMovingTk select 2) exitWith { MGI_agent setDestination [_veh modelToWorldVisual [0,30,0], 'VEHICLE PLANNED', true]; MGI_agent setSpeedMode 'LIMITED'; MGI_destTk = [0,0,0]; _handled = true }; if ((_this select 1) == MGI_keysMovingTk select 0) exitWith { MGI_agent setDestination [_veh modelToWorldVisual [0,100,0], 'VEHICLE PLANNED', true]; MGI_agent setSpeedMode 'NORMAL'; MGI_destTk = [0,0,0]; _handled = true }; if ((_this select 1) == MGI_keysMovingTk select 3) exitWith { MGI_agent setDestination [_veh modelToWorldVisual [0,0,0], 'DoNotPlan', true]; MGI_destTk = [0,0,0]; _handled = true }; }; }; _handled "]; MGI_keysDrivingUp = (findDisplay 46) displayAddEventHandler ["KeyUp", " if (!isnil 'MGI_agent' && diag_tickTime > MGI_timerStopping + 3 && (MGI_destTk isEqualTo [0,0,0])) then { MGI_agent setDestination [vehicle player modelToWorldVisual [0,0,0], 'DoNotPlan', true] }; "]; }; }] call BIS_fnc_addStackedEventHandler; _MGI_DrawRadar = addMissionEventHandler ["draw3D",{ if (cameraView == "gunner" && vehicle player isKindOf "tank") then { _veh = vehicle player; _aTurret = Deg (_veh AnimationPhase "mainturret"); if (MGI_iTk == 1) then { _tkIconPos = positionCameraToWorld [0,-370/coef_zoomTK,1000]; _damageTK = [2*(damage _veh),2 - 2 * (damage _veh),0.3,0.5]; drawIcon3D [MGI_icon_tk, _damageTK,_tkIconPos, 2, 2, - _aTurret, "", 1, 0.05, "TahomaB"]; }; if (MGI_rdrTk == 1) then { for "_i" from 0 to 350 step 10 do { _posdiam = positionCameraToWorld [(sin _i) * 110 * coef_ratioTK / coef_zoomTK,(-370+ ((cos _i) * 110)) / coef_zoomTK,1000]; drawIcon3D ["A3\ui_f\data\IGUI\Cfg\squadRadar\SquadRadarOtherGroupUnit_ca.paa", [0.7,1,0.3,0.8], _posdiam, 0.4, 0.4, 0, "", 1, 0.05, "PuristaMedium"]; }; if (!isnil "MGI_signTkDest") then { _dirS = (((_veh) getRelDir MGI_destTK) + _aTurret) mod 360; _d2S = ((player distanceSqr MGI_destTK) min 10^6) max 10^4; _xx = 100 - ((10^6-_d2S)/19800); _posWpt = positionCameraToWorld [(sin _dirS) * _xx * coef_ratioTK / coef_zoomTK,(-370+ ((cos _dirS) * _xx)) / coef_zoomTK,1000]; drawIcon3D ["A3\ui_f\data\GUI\Cfg\Cursors\hc_move_gs.paa", [1,1,0.5,1], _posWpt, 0.5, 0.5, 0, "", 1, 0.05, "PuristaMedium"]; }; _allvehicles = vehicles select {alive _x && !(_x isKindOf "WeaponHolderSimulated") && side _x != civilian}; _enyVehs = _allvehicles select {side _x getFriend side player < 0.6}; _frdVehs = _allvehicles - _enyVehs; if ( count (_enyVehs + _frdVehs) > 0) then { private ["_icon","_color"]; { if (_x isKindOf "air") then { _icon = "A3\ui_f\data\IGUI\Cfg\tacticalDisplay\targetAirTexture_gs.paa" } else { _icon = "A3\ui_f\data\IGUI\Cfg\tacticalDisplay\targetTexture_gs.paa" }; _dir = ((_veh) getRelDir _x) + _aTurret; _d2 = ((player distanceSqr _x) min 10^6) max 10^4; _dd = 100 - ((10^6 - _d2)/19800); _posVeh = positionCameraToWorld [(sin _dir) * _dd * coef_ratioTK / coef_zoomTK,(-370+ ((cos _dir) * _dd)) / coef_zoomTK,1000]; call { if (_x in _frdVehs) exitWith { _kwn = player knowsAbout _x; _color = if (_kwn < 1.5) then [{[0.3,0.3,0.3,0.3]},{[0.3,0.8,0.9,0.8]}]; }; _kwn = playerSide knowsAbout _x; _color = [0.3 max (_kwn/2),((0.3 max (_kwn/2)) min (2 - (0.3 max (_kwn/2)))) max 0.3,0.3,0.3 + (0.5*_kwn/4)]; }; drawIcon3D [_icon, _color, _posVeh, 0.5, 0.5, 0, "", 1, 0.05, "PuristaMedium"]; } forEach (_allvehicles - [_veh]); }; }; }; }]; _MGI_mousingGunner = (findDisplay 46) displayAddEventHandler ["mouseMoving", { _veh = vehicle player; if (_veh isKindOf "tank") then { player setVariable ["gunning",true]; if (gunner _veh != player) then {player action ["MoveToTurret",_veh,[0]]}; MGI_timerTurreting = diag_tickTime; if (isnil "MGI_agent") then { MGI_agent = createAgent ["B_Soldier_VR_F", getpos _veh, [], 0, "CAN_COLLIDE"]; MGI_agent moveInDriver _veh; MGI_agent setBehaviour "COMBAT"; MGI_agent setSpeedMode "FULL"; }; }; }]; }; Then call this function with desired parameters: [1,1] call MGI_1ManTank; // 1 = enable tank icon, 1 = enable radar EDITED : You'll find below, a lighter version (with no radar and no destination on marker). This light version is also updated & improved in MGI Advanced Modules. Hope you'll have fun! Pierre MGI
  12. AI INFANTRY RESPAWN SP/MP Hi all, Here is a script to allow AIs respawning according to parameters. This works in SP or MP. Only infantry (on foot AI) concerned as far as the killed AIs while in vehicles is the object of a second script. parameters: SIDE(S) / POSITIONS / DELAY / MIN UNITS IN GROUPS / REMAINING LOADOUT Examples: [] spawn MGI_fnc_unitRespawn // [] passed as parameter equals to [ [WEST,EAST,RESISTANCE,CIVILIAN], "start", 10, 144, false] All ai units can respawn on their position at start, after 10 sec delay, with their initial loadout. [ [WEST,EAST], ["mrk1","death","start",""], nil, 3 ] spawn MGI_fnc_unitRespawn // equals to [ [WEST,EAST], ["mrk1","death"], 15, 3, false] here, only WEST & EAST ai units can respawn: - on the marker "mk1" if any, on death position if not, for BLUFOR - on the position of death for OPFOR, (other strings in positions array are useless), 10 second delay (default), if their group headcount is below 3 (delay already started at death), with their initial loadout. Code to be run on server. (trigger, server only, non-repeatable, condition true) or initServer.sqf
  13. Hi all, I'm frequently scripting around BI modules overriding. I scripted some "multiple bombs" + "napalm" CAS for thus who knows MGI tactical pack addon. Today, I'd like to share a little script if you would like to drop a car (any vehicle) instead of a crate. Place a BI support module (virtual drop). It should work also with a real support. Not tested. Name it. Don't forget the BI support requester, sync modules as usual. In the BI module, write all vehicle types you want (helicopter classes existing in your cfgVehicles); In my example, as I'm fond of UNSUNG: ["uns_ach47_m200","uns_ch47_m60_army"] and this remark: the APEX V44 Blackfish ("B_T_VTOL_01_armed_F") is a plane but you can use it for faster drop! add what you want in the crate init, for example, I like to signal the crate with smoke/flare and add virtual arsenal on it: [_this,{ _this addAction ["<t color='#ffff11'>Arsenal</t>", {["Open",true] spawn BIS_fnc_arsenal},nil,10,false,true,"", ""]} ] remoteExec ["call"]; _flare = if (sunOrMoon <0.5) then [{"F_20mm_Yellow"},{"smokeShellYellow"}]; _fumi = _flare createvehicle getPosATL _this; _fumi attachTo [_this,[0,0,-2]]; Remark: this code is for standard drop of a crate, but will be overridden with vehicle code. add a simple calling code in the Vehicle init of the module (here vehicle is the helicopter, not the parcel!): _this spawn MGI_fnc_dropVeh with the following remark: I use to compile sqf in init.sqf: MGI_fnc_dropVeh = compileFinal preprocessFileLineNumbers "MGI_fnc_dropVeh.sqf"; (You can also directly execVM it, writing _this execVM "MGI_fnc_dropVeh.sqf" in vehicle init of the module). Now, the sqf code: MGI_fnc_dropVeh.sqf: Last version 03rd/08/18 _veh = _this; if !(_veh isKindOf "uns_ach47_m200") exitWith {}; comment "choose the helicopter class you want for car drop, the other ones will drop simple crates."; _home = getpos _this; _grpVeh = group _veh; sleep 3; _currentwpt = [_grpVeh, currentWaypoint _grpVeh]; _currentwptPos = waypointPosition _currentwpt; _currentwptdesc = waypointDescription _currentwpt; deleteWaypoint _currentwpt; _wpt = _grpVeh addWaypoint [_currentwptPos,0]; _wpt setWaypointDescription _currentwptdesc; _wpt setWaypointStatements ["TRUE", " if (isServer) then { [this, this getVariable 'BIS_SUPP_supportRunCoords', 'B_Parachute_02_F', 'B_MRAP_01_hmg_f', this getVariable 'BIS_SUPP_selectedModule'] spawn { _pilot = _this select 0; _wpPos = _this select 1; _chuteType = _this select 2; _crateType = _this select 3; _crateCode = compile ""[_this,{_this addAction ['Arsenal',{['Open',true] spawn BIS_fnc_arsenal},nil,10,false,true,'', '']}] remoteExec ['call']; _flare = if (sunOrMoon <0.5) then [{'F_20mm_Yellow'},{'smokeShellYellow'}]; _fumi = _flare createvehicle getPosATL _this; _fumi attachTo [_this,[0,0,-2]]""; comment 'optional remove the _crateCode line if you dont want an arsenal'; _oldDist = _pilot distance _wpPos; while {_oldDist >= _pilot distance _wpPos} do { _oldDist = _pilot distance _wpPos; sleep 0.1 }; _pilot setVariable ['BIS_SUPP_supporting', FALSE]; _chute = createVehicle [_chuteType, [100, 100, 200], [], 0, 'FLY']; _chute setPos [position _pilot select 0, position _pilot select 1, (position _pilot select 2) - 50]; _crate = createVehicle [_crateType, position _chute, [], 0, 'NONE']; vehicle _pilot setVariable ['MGI_crate',_crate,true]; _crate call _crateCode; comment 'to be removed also, if the _crateCode line is removed above.'; _crate attachTo [_chute, [0, 0, 0]]; waitUntil {position _crate select 2 < 3 || isNull _chute}; detach _crate; _chute setVelocity [0,5,0]; vehicle _pilot setVariable ['MGI_crate',nil,true]; }; }; "]; _grpVeh setCurrentWaypoint _wpt; _wp2 = _grpVeh addWaypoint [_home, 0]; _wp2 setWaypointType "Move"; _wp2 setWaypointBehaviour "SAFE"; _wp2 setWaypointStatements ["TRUE", "vehicle this land 'LAND'"]; _veh land "none"; waitUntil {!isnil {_veh getVariable "MGI_crate"}}; sleep 60; {deleteVehicle _x} forEach crew _veh; deleteVehicle _veh; Hope you'll have fun with that. An adapted version is now included in the MGI advanced Modules addon.
  14. Hello all, Here is a little script enabling AIs for rearming when out of ammo. If I'm right, the vanilla behavior is: - AI leaders sometimes order their AI subordinates for rearming at crates (probably only simple crates/vehicles with accurate magazines). Anyway they don't succeed in that (or barely). What I experienced is AIs running after vehicles, AIs stuck, AIs disobeying... If you have better experience on that, please share. - as playing leader of AIs, you can order your units to rearm at... known abandoned weapons, crates,... no matter if you don't know where they are and how far. The list can be looooong (as a day without bread) , and the, totally useless. you can see you AI crossing the map without few chance for actually rearming. Well, I'm trying here another approach, in this way: - first of all, I limit the script to AIs with played leader. (Just avoiding too many codes on server, but feel free to test what ever units you want); - only AI units owning a primary weapon are concerned: No player, no tourist; - When the AI has less than 10 remaining shots in its primary weapon, if magazines or weapons can be picked, within 100 m of the unit (anytime), the AI will move and pick them up. The possibilities and priorities are: - Any object stated as Arsenal (virtual crates/ vehicles with arsenal code...), is scouted as priority 1. That means the AI will reload at this object, with compatible mags, no matter the content of the arsenal crate/vehicle. At this time, and possibly for ever, I don't make any filter about possible limitation on arsenal. That means any enemy (concerned AI) can rearm at any arsenal. - The priority 2 is crates/vehicles fitted with compatible mags. The rearm action on a crate can empty it. This action is the standard behavior of Arma's engine. If you want more, see module! Anyway, the mags can be inside uniforms, vests, backpacks inside the crate or the vehicle. Not so bad. - the priority 3 is friendly fallen corpses... There is neither arsenal, nor crate but some fellows are lying on ground with compatible mags. That's the last chance for AI to keep their actual primary weapon; - the last priority (4) is any weapon found on ground, inside crate or vehicle. This weapon is different from the original. If several choices, the AI will pick one at random... At this time, I don' have filter for all possible cases and skills of AIs... It's just out of my scope. anyway this weapon can be inside a backpack, inside a crate... I added a mandatory mag for this weapon as I don't want the AIs out of ammo, then picking a weapon, out of ammo then... in a boring cycle. Furthermore, at this time, the abandoned weapon is deleted. Note 1: Vehicles are considered as crates if engine off! Note 2: You can stop an AI (stop order), so he will not continue his search for mags or weapons (but he will not fight without ammo). Of course, as I'm scripting also for my mod: MGI Advanced Modules, I added a Rearm Module enabling more possibilities: - You can easily choose different units (to be upgraded perhaps); - When your AI rearms, the secondary weapon (if any) is refilled in tube (so 1 shot). The AI receives up to 3 first aid kit and hand grenades or smokes. The AI grabs also up to 6 grenades for GL if any. - the rearm and switchweapon vanilla actions are replaced by animations (same ones) and custom scripts avoiding vanilla inventory (too many mags, no grenades, poor fak) Known limitations: - the hand guns are not treated at all; - the GL and launchers are treated in module, but only in case of low primary weapon ammo which stays the triggering factor; Compatible for MP (the treated units are local on each PC/Server), compatible with mods. Depending on mods, you can experience some little difference: - compatibles mags means... compatible mags and some vanilla mags can be used instead of specific ones, for arsenal. I'm not responsible of these choices. - on the other hand, there are several "FirstAidKit" along with mods. Some of them keep the class name and modify the aspect, some of them modify the whole stuff (for nuts,imho). Your AI can receive firstAidKit instead of "blabla_holyKitofTheGreatesModEverWritten" . They will not make difference, and you'll see that if you pick items on dead AI fellow. Have fun! Version: 28 / 07/ 21 in init.sqf
  15. Hi all, You'll not find too much topics about hashmap (see Halek's post) and I thought that could be useful to open this specific topic on this command group. Hashmap is a very powerful tool, not so difficult to script. You have full explanation on links but roughly, you're creating a table (hashmap) in which any call (get) for entry (key) is almost immediate and doesn't depend on the rank of what you're searching. The hashmap creation can take some times in process, as any other table creation. There is an added value if once in game you need to grab lines repetitively. I give you a little example: Let's say you want to grab compatibles mags for some primary weapons. There are different way for that. The first good question is to determine if you need these info repeatedly (for multiple units, events... as example): So, as practical example, for Arma vanilla (there are 376* primary weapons): 1st method (no need to create anything) use BIS_fnc_compatibleMagazines (or similar ones): Let's test some primary Weapons in debug console performance button: "srifle_DMR_01_F" call BIS_fnc_compatibleMagazines; // found in 0,0243 ms: ["10rnd_762x54_mag"] "sgun_HunterShotgun_01_sawedoff_F" call BIS_fnc_compatibleMagazines; // found in 0,0316 ms: ["2rnd_12gauge_pellets","2rnd_12gauge_slug"] "arifle_MXM_Hamr_LP_BI_F" call BIS_fnc_compatibleMagazines // found in 0.0716ms: ["30rnd_65x39_caseless_mag","30rnd_65x39_caseless_khaki_mag","30rnd_65x39_caseless_black_mag","30rnd_65x39_caseless_mag_tracer","30rnd_65x39_caseless_khaki_mag_tracer","30rnd_65x39_caseless_black_mag_tracer","100rnd_65x39_caseless_mag","100rnd_65x39_caseless_khaki_mag","100rnd_65x39_caseless_black_mag","100rnd_65x39_caseless_mag_tracer","100rnd_65x39_caseless_khaki_mag_tracer","100rnd_65x39_caseless_black_mag_tracer"] So, each time you need these mags, you must call the function then wait for the result. The delay depends on multiple factors: rank in cfgWeapons, muzzles, mags... I guess Now, let's "prepare tables": First of all, primary weapons: primWpns = ("getNumber (_x/'type') == 1 && {getNumber (_x/'scope') == 2}" configClasses (configfile /"cfgWeapons")) apply {configName _x}; Note*: some weapons don't have picture in gear (inventory) but are playable. Scope =1. You can add them if needed. then: CompatibleMagsTable = primWpns apply {[_x, _x call BIS_fnc_compatibleMagazines]}; As result, you'll obtain something like: [["srifle_DMR_01_F",["10rnd_762x54_mag"]], ["srifle_DMR_01_ACO_F",["10rnd_762x54_mag"]], ["srifle_DMR_01_MRCO_F",["10rnd_762x54_mag"]], ["srifle_DMR_01_SOS_F",["10rnd_762x54_mag"]], ["srifle_DMR_01_DMS_F",["10rnd_762x54_mag"]], ["srifle_DMR_01_DMS_snds_F",["10rnd_762x54_mag"]], ["srifle_DMR_01_ARCO_F",["10rnd_762x54_mag"]],...and so on] Of course, it takes a long time (27 ms without any mod) to draw this table but you need to do that once, at mission start. So, that doesn't really matter in game. Then, during game: 2nd method - use the ready table finding the elements for the entry (weapon): CompatibleMagsTable select ( primWpns find "srifle_DMR_01_F") select 1 // found in 0.0009 ms CompatibleMagsTable select ( primWpns find "arifle_MXM_Hamr_LP_BI_F") select 1 // found in 0.038 ms CompatibleMagsTable select ( primWpns find "sgun_HunterShotgun_01_sawedoff_F") select 1 // found in 0.059 ms Truly, the result depends on the rank of the tested primary weapon inside the result for configClasses (primWpns). The code exits as soon as the weapon is found and there is no difficulty for grabbing the mags. BUT, if you compare the results for 1st and 2nd methods, is there a great added value in term of average performance ? Probably yes if your table is more complex, (with multiple things to grab for an entry)... Anyway, forget this 2nd method. Now, the core of the topic. Hashmaps are introduced since Arma 2.01. 3rd method - Let's create a hashMap, as we created a table above: Starting with the primary weapon classes as reference: primWpns = ("getNumber (_x/'type') == 1 && {getNumber (_x/'scope') == 2}" configClasses (configfile /"cfgWeapons")) apply {configName _x}; Now the hashmap where all these classes will be keys of entry: MGI_Hash_Mags = primWpns createHashMapFromArray (primWpns apply {_x call BIS_fnc_compatibleMagazines}); It's very similar to the former table and it takes also 27 ms for preparing it. But... Now you have a hashmap and you can call what you need like this: MGI_Hash_Mags get "srifle_DMR_01_F" // found in 0.0007 ms MGI_Hash_Mags get "arifle_MXM_Hamr_LP_BI_F" // found in 0.0007 ms MGI_Hash_Mags get "sgun_HunterShotgun_01_sawedoff_F" // found in 0.0011 ms Performance friendly isn't it? Have fun.
  16. Hi all, I decided to give some time on existing Navy assets in community, even if Arma is much more a Land force milsim,... with few air assets. First of all, BI has produced: - the CVN Freedom, an object not really dynamic, but stated as a "dynamic airport" with some added components as radar or AA defenses from BI, but also cats and arresting wires. - the FA 18 Black Wasp II , the only aircraft with a tail hook (mandatory if you want to stay aboard 😉) On the other hand, the community produced, at least: - the USS Nimitz, unfortunately also a "static dynamic airport", but with much more possibilities (moving excepted) than the USS Freedom, - many outstanding mods, with plenty of aircraft, but for Navy, so planes with tail hook, the award is for Unsung one. In fact, I'm not sure you will find any other mod with Navy jets and planes able to land on deck of a carrier. After that... some mods are worth the trial, sometimes with better aerodynamics and realism: RHS, IFA3, CUP... Why all aircraft carrier are static? Probably make them sailing and able to recover some played (or AI) aircraft is far too complex.(We are not on DCS). The Vehicle In Vehicle possibility (since Apex) is for transportation but doesn't really meet the requirement for deck handling. Can we make them move (for a scenery or an attack by enemy)? Yes, at least for CVN USS Freedom. Here is a little code I wrote for a pattern. The CVN start a leg of x seconds, turns left or right, and so on. The position is at the first leg start, choose the orientation of the pattern (no matter the orientation of the object (Land_Carrier_01_base_F) in editor, the leg duration (in sec.) , and the direction of the turn (right = true). This pattern is optimized for 60FPS which make it U-turn in 5 minutes (fast but realistic) and move the CVN at 60 km/h (roughly). I'd rather write 32 knots. CVN PATTERN (CVN1 is the name of the BI aircraft carrier) MGI_CVN_PATTERN = { params [["_CVN",objNull],["_firstDir",0],["_leg",300],["_rightTurn",TRUE]]; if (!isServer) exitWith {}; _CVN setdir ((_firstDir + 180) mod 360); _CVN setVariable ["CVNPattern",[_firstDir, getDir _CVN]]; _CVN setVariable ["CVNTrueDir",_firstDir]; _CVN setVariable ["CVNTimer",0.1 - diag_tickTime]; ["movingCarrier","onEachFrame", { private _CVN = _this param [0,objNull]; private _leg = _this param [1,300]; private _rightTurn = _this param [2,TRUE]; private _dir = _CVN getVariable "CVNTrueDir"; private _t = _CVN getVariable "CVNTimer"; _CVN setdir ((_dir + 180) mod 360); _CVN setPosWorld ASLToATL (_CVN getpos [0.3,_dir]); [_CVN] call BIS_fnc_Carrier01PosUpdate; if (((diag_tickTime + (_CVN getVariable "CVNTimer")) mod _leg) < 0.1) then { _CVN setVariable ["CVNTimer", - diag_tickTime]; _CVN setVariable ["CVNTrueDir",_dir + ([-0.01,0.01] select _rightTurn)]; if (abs((360 +(_CVN getVariable "CVNTrueDir") mod 360) mod 360 - (_CVN getVariable "CVNPattern")#1) < 0.5) then { _CVN setVariable ["CVNTrueDir",(_CVN getVariable "CVNPattern")#1]; reverse (_CVN getVariable "CVNPattern"); _CVN setVariable ["CVNTimer",0.1 - diag_tickTime]; }; }; }, [_CVN,_leg,_rightTurn] ] call bis_fnc_addStackedEventHandler; }; [CVN1,45,120,FALSE] call MGI_CVN_PATTERN; So, the dynamic airport starts to be dynamic. I added also the rescue helicopter "pedro" , following the CVN. You can take control on it, or let it do his job. It takes few seconds to be on station, at start. PEDRO RESCUE: MGI_rescuePedro = { params [["_helo",objNull],["_CVN",objNull]]; if (!isServer or [_helo,_CVN] findIf {isNull _x} > -1) exitWith {}; currentPilot _helo disableAI "radioProtocol"; _helo setdir (getdir _CVN +180); _helo setpos (_CVN modelToWorld [200,0,35]); _helo flyInHeight 30; _helo flyInHeightASL [50,50,50]; [_helo,_CVN] spawn { params ["_helo","_CVN"]; waitUntil {!isNil{_CVN getVariable "CVNTrueDir"} or !alive _helo}; while {alive _helo} do { _dir = _CVN getVariable "CVNTrueDir"; _helo move (_CVN modelToWorld [200,-400,35]); _helo limitSpeed (diag_fps * (1+ (0.005 * ((_helo distance2D (expectedDestination _helo #0))-500)))); sleep 5 } } }; [this,CVN1] call MGI_rescuePedro; What about deck landing? You can test an approach, even a touch, but you can't stay aboard as for any other moving objects. Now, for the fun you can attach the jet on deck. I did a little trigger, itself attached to the CVN, but that is not really sexy. What about USS Nimitz (mod)? Unfortunately, I didn't succeed in making it sail properly... The result is a full flush deck, as the bridge dives... No time for workaround relative positions of all the parts. So, we are still far from a realistic Navy ambiance. For example, the main tool for a deck landing: the Optical Landing System (OLS) is missing. In a second step, I will comment the airplane simulation. I'm not a modder but there are some tips which could improve the game playability and immersion. That's not incompatible. Have fun. All comments and remarks welcome as usual. Pierre
  17. Hi all, Here is a new module in MGI Advanced Module addon, for spawning any groups you want, any time... (done) This module allows: - to spawn any group, even customized, on any side, - spawning on multiple possible areas (triggers) - with a wide randomized choice or a very specific group. You can place several modules on the map, each of them have their own parameters; 1. Choose the side (applies to all groups spawned from a module, no matter the initial vanilla side). So civilian units can be aggressors. 2. decide if you want to spawn: * at total random (so the groups are picked in cfgGroups, but for the side you chose (normal limitation) * at randomized or specific faction(s) . They must exist in cfgGroups (not all factions from cfgFactionClasses are available for groups). All factions (cfgGroups) are available so not depending, here, on the final side * You can filter these first possibilities by the type(s) of groups. For example, "infantry" and/or "motorized" and/or "armored"... But, these types must exist in the cfgGroups. * you can choose to spawn a specific group (from cfgGroups).. or even an array of units, vehicles... or even an edited group (with all customized textures, pylons, loadouts...) * linked group(s) on module, customized or not, will be candidates for spawning. That's fine for spawning not existing groups such as air or sea patrols. 3. Choose the attitude: behavior, combat mode, formation... 4. choose the repeat sequence (limitation and delay) 5. decide on what condition groups module can spawn (not only at start, but any time!) 6. decide for a simple task (or not). Chase players, enemies, defend... 7. run a code for each group (useful for specific task) MODULE(S) IN 3DEN - Position/ area of the module(s) if no synced trigger area. Direction of the module, in 3den, is the direction of the group (if no synced trigger area) SYNCED TRIGGER AREA(S) - The position, area and direction of the module doesn't matter any more. The group(s) are spawning at randomized positions in randomized trigger area(s), with the direction of the trigger area. SYNCED UNIT(S) - In 3den, you can place (customized or not) group(s) with the module(s). No matter if you synced one (leader or not) or several units of a group, with the module. The group will be candidate for spawning. PARAMETERS SIDE - Definitely the side of your group(s) for this module. No matter the choice you did (edited group, chosen faction(s), or type(s) of group or group(s)..) What ever you spawn we belong to this side. --> But, if you let the module at full random (no synced group, no, faction, no type, no group), in this case, the randomized group is picked among the native possibility from cfgGroups. So, if you just select a side (say EAST), you'll spawn randomized groups(s) from OPFOR. HOW MANY GROUPS - The number of group(s) to be spawned at each occurrence. Randomization will depend on the possibility of what you want to spawn, so your choice) Min 1 max 12 (limited for performance saving when spawning heavy customized groups. Feel free to add other modules) NOTE: The modules works with edited groups or existing configs/classes of groups in cfgGroups (see config viewer from console). So, scripted groups have always the architecture: configFile >> "cfgGroups" >> "side" >> "faction"* >> "type of group" >> "group" ... then units/vehicles for each group Example: side like "Indep" , faction like "IND_E_F", type like "infantry", group like "I_E_InfSquad" FACTION(S)* - If empty, no filter about them. If filled without any more details (type(s), group(s) ) all available factions in cfgGroups can be used to spawn any child type, then any child group. But ⚠️ all current faction names can't work. Some existing factions in cfgFactionClasses are not present in cfgGroups. For example: "CIV_IDAP_F" (IDAP civilian faction has no group) or even "OPF_V_F" (Arma Viper) can't work in the architecture of cfgGroups. (for Viper, the only group defined in: configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "SpecOps" >> "OI_ViperTeam" exits. So at faction level, there is nothing to do). You can fill the parameter with a working class like: "OPF_F" , or the config (configfile >> "CfgGroups" >> "East" >> "OPF_F"), or an array of these possibilities. Not case sensitive. TYPE(S) - if more a filter about what you want to spawn. That should be simple as "infantry" or " motorized or mechanized" or "armored". That doesn't. Even in Arma vanilla, you can find exotic classes as "motorized_MTP". Any dev has his own mind to sort the groups by types. The reason is probably the way you can find sorted groups in 3den's right panel. But, it's just impossible (or needs an updated list of hundreds of names) to filter groups easily. You have to do that job, if you want to do so, writing a config or a class or an array of that, for filtering the type(s). Not case sensitive but do not make typo's error! If wrong, there is no more filter. You can fill the parameter with a working class (not the config) like: "specops", or an array of these possibilities. SPECIFIC GROUP(S) - a step more for less randomization. You are at the group level. As factions, you can fill it with class (of group) or config or an array of these possibilities. Much more, you can add arrays of units/vehicles class(es). That's also a way to customize some groups, but one the contrary of synced edited ones, you'll not able to define appearance for vehicles or pylons payload at this moment. RADIUS AREA - radius of the module area, so the spawn area if no synced trigger areas. Useless if any trigger area synced. GROUP(S) DIRECTION - orientation of the module in 3den (shift mousse drag) . Do not write anything on field (it's a result, not an entry). Useless if any trigger area synced. GROUP(S) SKILL - As 3den, skill for whole group, with +/-10% randomized on each units. ENABLE DYNAMIC SIMULATION - As in 3den. See Biki for detailed explanation (recommended) CONDITION FIELD - checked every 2 seconds. So, much more convenient than a simple condition of presence at start! Feel free to do what you want but return a boolean. Examples: * spawning only at night : sunOrMoon < 0.5 * strengthening weakened side : INDEPENDENT countSide allGroups < 3 * waiting for more players : count allPlayers > 2 * even checking for 1000 m distance at least from any player: private _possAreas = _logic getVariable "possAreas"; (count allPlayers > 0 && allPlayers findIf {private _plyr = _x; _possAreas findIf {_plyr distance _x#0 < 1000} == -1} == -1) but that will not despawn or hide or disable the groups! See the dynamic simulation instead. REPEAT OCCURRENCE - the added times for re-spawning the same groups (not at the same place) . 0 means no more occurrence. -1 means infinite repeat. So if you want to spawn 3 times a group, set it to 2 (1 shot + 2 added) INTERVAL FOR REPEAT - A delay between 2 consecutive spawns , if the condition are met. If not, the spawn will wait for condition to be TRUE, then spawn, then wait for interval duration, then check for condition... min 30 sec max 2 hours. FORMATION OF THE GROUP - As usual. Sometimes this setting is reinitialized to default wedge. I didn't identify why. So check twice before OK button and save scenario. BEHAVIOR - (or behaviour, sorry) Same as usual COMBAT MODE - same as usual SPEED MODE - As usual. same little problem as formation. Check twice. INSIGNIA - I hope that works fine everywhere... CODE FOR GROUP - Blank of any code (without {}). Passes parameters are <group> <<leader>, <vehicles of the group> . For example, just write: params ["_grp","_lead","_vehs"]; private _wp = _grp addWaypoint [<aPosition>,0]; _wp setWaypointType "MOVE"; _lead forceFlagTexture "\A3\Data_F\Flags\Flag_red_CO.paa"; {_x setFuel 0.2} forEach _vehs No bracket, just like this. BASIC TASK - can be: * Do Nothing (the preferred one of dumb AIs) * Attack nearest known enemy. So the group will start after an enemy knowledge acquisition. Not before. I hope I managed air assets for chasing air assets... I can't imagine infantry running after a jet. * Chase nearest enemy. Same as above but the position of nearest enemy is known (for spawning attack waves for example) * Attack nearest Player (known enemy) . The group must acquire the detection of a hostile player. * Chase nearest player (enemy). The group will start the hunting on player's (updated) position. * Defend this area. some SAD waypoints in the area of the group(s). known difficulties - Mods like Unsung or CUP or RHS (all in fact) requires a sharp attention for the name of the factions/groups but also Types... of groups. You can't imagine hundreds of names for stupid things like "infantry" "armored" "mechanized" ... That should be normalized, but not! - Too many mods, even non used by mission, but just loaded on server (so ticked), will affect the randomization for nuts, and lead to unwanted results like Arma or CUP units during Unsung play. know bugs all corrected so far To do list: - respawn without delay on whole group death - add a filter for mods... A lot of work. Enjoy! All feedback welcome. [RELEASED]
  18. Hi all, Here is a script you can run for each player (initPlayerLocal.sqf is just fine!) This script allow to lock / unlock any door of any house. Works fine in Arma3. I added a little workaround for WW2 houses like in CUP core used by IFA3 mod. That probably worth for ant Arma2 houses, not tested. There is just one parameter: TRUE means players must have the item "Keys" in their inventory. And no, I will not script for specific keys for due houses! Say it's a pass. FALSE allows players to lock - unlock the doors of the houses without keys. NOTE : you can also manage just some houses (see below) 0 = FALSE spawn { params [["_needKeys",FALSE],"_houses",["_house",objNull]]; while {true} do { if (isNull objectParent player) then { _houses = ((nearestObjects [player, ["house"], 50]) select {isNil {_x getVariable "securedHouse"}}); if (count _houses > 0) then { _house = _houses select 0; _house setVariable ["securedHouse",_needKeys]; [ _house, "Lock-unlock door", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", " call { private _intersects = []; private _intersect = ''; private _door_anim = ''; private _is_door = FALSE; private _dist = 4; { _intersects = ([_target, _x] intersect [ASLToATL eyepos player, (screentoworld [0.5,0.5])]); if (count (_intersects select 0) > 0) exitwith { _intersects } } forEach ['FIRE','GEOM','VIEW']; if (count _intersects > 0) then { _intersect = _intersects select 0 select 0; _dist = _intersects select 0 select 1; _is_door = ('door' in toLowerANSI _intersect); if (_is_door && _dist < 4) then { if ('ww2_' in toLowerANSI typeOf _target) then { _door_anim = format ['%1_anim', _intersect]; } else { _door_anim = format ['%1_rot', _intersect]; }; }; }; if (_this distance _target < 15 && {_door_anim !=''} && {_target animationPhase _door_anim == 0} && {'keys' in magazines _this or !(_target getVariable 'securedHouse')}) then { _target setVariable ['MGIselDoor',[_intersect,_door_anim]]; true } else {false}; }; ", "true", {}, {}, { if (_target getVariable ["MGIselDoor",[]] isnotEqualTo []) then { (_target getVariable "MGIselDoor") params ["_door","_door_anim"]; private _doorState = format ['bis_disabled_%1',_door]; if (_target getVariable [_doorState,0] == 0) then { _target setVariable [_doorState,1,true]; if ("ww2_" in toLowerANSI typeOf _target) then { [_target,_doorState,_door_anim] spawn { params ["_target","_doorState","_door_anim"]; while {alive _target && _target getVariable _doorState == 1} do { _target animate [_door_anim,0,TRUE]; sleep 0.1; }; }; }; } else { _target setVariable [_doorState,0,true]; }; }; }, {}, [], 5, nil, false, false ] call BIS_fnc_holdActionAdd; }; }; sleep 2; }; }; For specific houses, you want to secure (w. or w/o keys): The general parameter determines the need of keys if you want to skip this code for most of the houses except those which are in a trigger area (example trg1), just replace the line: _houses = ((nearestObjects [player, ["house"], 50]) select {isNil {_x getVariable "securedHouse"}}); by: _houses = ((nearestObjects [player, ["house"], 50]) select {isNil {_x getVariable "securedHouse"} && _x inArea trg1 }); Have fun!
  19. MGI GUN RUN Last update: 01/05/2020 Hi all, Here is another script to add a specific gun run, calling a virtual or real CAS. This script is to copy/paste inside BI init CAS module. Nothing more to do! The code will search for "cannon" or "Gatling" in the pilot's weapon. So far, it doesn't work for gunners. You can see "no pilot cannon" in the sub-menu. If you find some non-listed pilot's cannon, let me know. Tips: - Always place your module/aircraft at 2 km from a target area. It's far better for a straight-in approach. You can even place them outside of the map. - Don' try to repeat the CAS too soon with a real aircraft. It will turn around the target without aiming it. Don't forget, pilots are dumb (I can say that referring to my own career). - At this time, Buzzard is far more precise than Wipeout which generously spread ammo with poor efficiency. Code to copy/paste in init field of the CAS module: MGI_CAS_MODULE_1 = this; MGI_CAS = compileFinal " if !(GUNRUNCAS) exitWith {}; private _isVirtual = ({_x isKindOf 'air'} count synchronizedObjects MGI_CAS_MODULE_1 ==0); private _pilot = player getVariable 'BIS_SUPP_selectedProvider'; private _veh = vehicle _pilot; private _home = getPos MGI_CAS_MODULE_1; private _trts = (_veh WeaponsTurret [-1]) select { getText (configfile >> 'CfgWeapons' >> _x >> 'nameSound') == 'cannon'}; waitUntil {!isNil {_pilot getVariable 'BIS_SUPP_requester'} && {!isNull (_pilot getVariable 'BIS_SUPP_requester')}}; private _requester = _pilot getVariable 'BIS_SUPP_requester'; 'Gun run requested' remoteExec ['hint',_requester]; waitUntil {!isnil {_pilot getVariable 'BIS_SUPP_supportRunCoords'}}; private _coords = _pilot getVariable 'BIS_SUPP_supportRunCoords'; private _alt = getTerrainHeightASL _coords; private _limit = [40,90] select (_veh distance2D _coords < 2500); _pilot setCombatMode 'BLUE'; _veh flyInHeightASL [_alt +500,_alt +500,_alt +500]; waitUntil {_veh distance2D _coords < 2000}; if (!isNil 'BIS_SUPP_laserTGT') then {deleteVehicle BIS_SUPP_laserTGT; BIS_SUPP_laserTGT = nil}; private _timer = diag_tickTime; _veh flyInHeightASL [_alt +100,_alt +100,_alt +100]; private _resultOK = false; 'In sight' remoteExec ['hint',_requester]; private _typeForIndep = (WEST getFriend RESISTANCE >0.6); private _tgttype = ['laserTargetE','laserTargetW'] select (side _veh == WEST or (side _veh == RESISTANCE && _typeForIndep)); private _tgt = createVehicle [_tgttype,_coords,[],0,'none']; if (count _trts > 0) then { _trt = _trts select 0; private _mags = (getArray (configfile >> 'CfgWeapons' >> _trt >> 'magazines')) arrayIntersect (_veh magazinesTurret [-1]); comment ""private _cnt = getNumber (configFile >> 'cfgMagazines' >> _mags select 0 >> 'count')""; _pilot setCombatMode 'RED'; _pilot reveal [_tgt,4]; _veh selectWeaponTurret [_trt,[-1]]; private _cnt =_veh magazineTurretAmmo [_veh currentMagazineTurret [-1],[-1]]; while {diag_tickTime < _timer + _limit} do { _tgt setPosASL (getPosASL _tgt vectorAdd [0,0,(0.18 * (_veh distance2D _tgt)) -270]); _veh selectWeaponTurret [_trt,[-1]]; _veh doTarget _tgt; if ((_veh weaponDirection _trt vectorCos (AGLToASL _coords vectorDiff (eyepos _pilot))) > 0.999) then { [[_veh,_trt], BIS_fnc_fire] remoteExec ['call',_veh]; if (_veh magazineTurretAmmo [_veh currentMagazineTurret [-1],[-1]] < _cnt) then {_resultOK = true}; } else { _pilot lookAt _tgt }; uiSleep .01; }; }; if (!_resultOK) then {_pilot setVariable ['BIS_SUPP_failed',true]}; (['Gun run aborted','Gun run terminated, resuming support'] select _resultOK) remoteExec ['hint',_requester]; if !(_isVirtual) then { waitUntil {waypointType [group _veh,currentWaypoint group _veh] == 'MOVE'}; [group _veh,currentWaypoint group _veh] setWaypointPosition [_home,0]; [group _veh,currentWaypoint group _veh] setWaypointStatements ['true','']; _veh setFuel 1; {_veh setAmmo [_x, 2000]} forEach _trts; }; _pilot setVariable ['BIS_SUPP_supporting',false]; if (_isVirtual && alive _veh) then {uiSleep 120; deleteVehicle _veh}; "; 0 = MGI_CAS_MODULE_1 spawn { while {true} do { GUNRUNCAS = false; waitUntil {uiSleep 0.2; !isnil {player getVariable "BIS_SUPP_selectedProvider"}}; waitUntil {!isNil {player getVariable "BIS_SUPP_request"} && {(player getVariable "BIS_SUPP_request") #0 == "CAS_Bombing"} && {!isnull (player getVariable "BIS_SUPP_selectedProvider")}}; private _pilot = player getVariable "BIS_SUPP_selectedProvider"; private _veh = vehicle _pilot; private _trts = (_veh WeaponsTurret [-1]) select { getText (configfile >> "CfgWeapons" >> _x >> "nameSound") == "cannon"}; private _cooldown = time - (_this getVariable ["BIS_SUPP_lastCall",time -122]) - ((_this getVariable ["BIS_SUPP_cooldown",0]) max 60); BIS_SUPP_commMenu = BIS_SUPP_commMenu + [ [ ["Gun run request",["No pilot cannon!",format ["wait for %1 sec",-(round _cooldown)]] select (_cooldown < 0)] select (count _trts == 0 or _cooldown <0), [4], "", -5, [[ "expression","GUNRUNCAS = true; [] spawn MGI_CAS; player setVariable ['BIS_SUPP_ammoType', 0]" ]], "1", ["1","0"] select (count _trts == 0 or _cooldown < 0), "\A3\ui_f\data\IGUI\Cfg\WeaponCursors\cannon_gs.paa" ] ]; uiSleep 0.1; showCommandingMenu "#USER:BIS_SUPP_commMenu"; waitUntil {uiSleep 0.2; isNil {player getVariable "BIS_SUPP_selectedProvider"} or {!isNil {player getVariable "BIS_SUPP_selectedProvider"} && isnull (player getVariable "BIS_SUPP_selectedProvider")}}; }; }; Seems to be short? It took me a lot of hours to find this solution. Feel free to test, comment, ask for some implementation. Pierre
  20. WEAR WHAT YOU WANT Hi all, Fed up with the cloth restriction? You can kill civilians but not wear their clothes! You want to infiltrate enemy player places but you can't wear their uniforms. You can't count the threads about forceAddUniform with any interest in game, except for some specific action... If you want to wear what you find on corpses, crates, or ground.. just add the following code for each allowed players (initPlayerLocal.sqf seems great). Just make sure player is already defined. version Mar 13th 2018 updated 21/06/18 UPDATED: new version 20/12/2019 Corrected 25/06/2020 on Larry0503 feedback for uniforms with multiple classes (present in all sides) parameters: NONE fnc_otherUnif = { params ["_type","_return"]; if (_type == 0) exitWith { MGI_button = _return #1; false }; if (_type == 1 and !isnil "MGI_button" && {MGI_button == 1}) then { disableSerialization; _control = _return select 0; _index = _return select 1; private _idc = ctrlIDC _control; private _text = lbText [_idc, _index]; private _picture = lbPicture [_idc,_index]; private _uniforms = ("getText (_x >> 'displayName') == _text && getNumber (_x >> 'ItemInfo' >> 'type') == 801" configClasses (configFile >> "CfgWeapons")); if (_uniforms isEqualType [] && {!(_uniforms isEqualTo [])}) then { [_idc,_text,_picture,_index,_uniforms] spawn { params ["_idc","_text","_picture","_index","_uniforms",["_selectedUnif",""],"_unifConts",["_uniformObject",objNull],"_otherItems","_g0"]; private _currentUnif = uniform player; private _currentInvent = uniformItems player; _currentInvent = (_currentInvent arrayIntersect _currentInvent) apply {private _v= _x;[_x]+[{_v isEqualTo _x} count _currentInvent]}; private _selectedUnif = ((_uniforms select {toLower (gettext (_x >> "picture")) splitString "\"joinString "\" == _picture}) apply {configName _x}); if (_selectedUnif isEqualTo []) exitWith {}; if !(pl_container isKindOf "CAManBase") then { _unifConts = (everyContainer pl_container select {getNumber (configFile >> "CfgWeapons" >> _x #0 >> 'ItemInfo' >> 'type') == 801}); _uniformObject = objNull; private ["_cnt","_selectedCfg"]; scopeName "main"; for "_i" from 0 to count _selectedUnif -1 do { _cnt = 0; _selectedCfg = _selectedUnif #_i; for "_j" from 0 to _index do { if (lbText [_idc,_j] == _text) then { _cnt = _cnt +1; _uniformObject = _unifConts select {_selectedCfg == (_x #0)} select (_cnt -1) select 1; if (!isnil "_uniformObject" && {!isNull _uniformObject}) then { _selectedUnif = _selectedCfg; breakTo "main" }; }; }; _uniformObject = objNull; }; } else { _selectedUnif = _selectedUnif #0; _uniformObject = uniformContainer pl_container }; if (!isNull _uniformObject && !(player isUniformAllowed _selectedUnif)) then { private _itemsAndMags = (_uniformObject call MGI_orderItsAndMgs) params ["_selectedItems","_selectedMags"]; if !(pl_container isKindOf "CAmanbase" or isNull pl_container) then { private _its = getItemCargo pl_container; private _mgs = magazinesAmmoCargo pl_container; private _unifItems = _unifConts apply {_x #0}; private _vestConts = (everyContainer pl_container select {getNumber (configFile >> "CfgWeapons" >> _x #0 >> 'ItemInfo' >> 'type') == 701}); private _vestItems = _vestConts apply {_x #0}; _otherItems = +(_its #0) - _unifItems - _vestItems; _otherItems = _otherItems apply {[_x,_its #1#(_its #0 find _x)]}; private _conts = _unifConts + _vestConts; for '_i' from 0 to count _Conts -1 do { if (_conts #_i #1 == _uniformObject) exitWith { _conts deleteAt _i }; }; pl_container setVariable ["MGIallContForWear",[]]; { private _itsAndMgs = ((_x #1) call MGI_orderItsAndMgs) params ["_its","_mgs"]; (pl_container getVariable "MGIallContForWear") pushBack [_x #0,_its,_mgs]; } forEach _conts; _g0 = pl_container; clearItemCargoGlobal _g0; } else { _g0 = createVehicle ['WeaponHolderSimulated_Scripted', (player modelToWorld [0,1,1]), [], 0, 'CAN_COLLIDE'] }; player forceAddUniform _selectedUnif; private _unif = uniformContainer player; {_unif addItemCargoGlobal [_x#0,_x#1]} count _selectedItems; {_unif addMagazineAmmoCargo [_x#0,_x#2,_x#1]} count _selectedMags; call { if (pl_container isKindOf "CAManBase") exitWith { removeUniform pl_container }; { _x params ["_cont",["_it",[]],["_mag",[]]]; pl_container addItemCargoGlobal [_cont,1]; private _createdCont = pl_container call MGI_lastCont; {_createdCont addItemCargoGlobal [_x#0,_x#1]} count _it; {_createdCont addMagazineAmmoCargo [_x#0,_x#2,_x#1]} count _mag; } forEach (pl_container getVariable "MGIallContForWear"); {_g0 addItemCargoGlobal [_x #0,_x #1]} forEach _otherItems; }; _g0 addItemCargoGlobal [_currentUnif,1]; _lastCont = _g0 call MGI_lastCont; {_lastCont addItemCargoGlobal [_x #0,_x #1]} forEach _currentInvent; if (_g0 isKindOf "WeaponHolderSimulated" && {(count itemCargo _g0 + count magazineCargo _g0 + count weaponCargo _g0 + count backpackCargo _g0) == 0}) then { deleteVehicle _g0 }; }; }; }; MGI_button = 0; false }; }; MGI_orderItsAndMgs = compileFinal " params [['_uniformObject', objNull,[objNull]]]; private _items = getItemCargo _uniformObject; private _mags = magazinesAmmoCargo _uniformObject; private _selectedItems = (_items #0) apply {[_x,_items #1#(_items #0 find _x)]}; private _selectedMags = (_mags arrayintersect _mags) apply {private _v= _x;_x+[{_v isEqualTo _x} count _mags]}; [_selectedItems,_selectedMags]; "; MGI_lastCont = compileFinal " params [['_cont',objNull]]; private '_lastCont'; _invent = (everyContainer _cont - (everyBackpack _cont apply {[typeOf _x,_x]})); if !(_invent isEqualTo []) then { _lastCont = _invent select (count _invent -1) select 1; } else { _lastCont = _cont; }; _lastCont "; player addEventHandler ["InventoryOpened", { params ["_unit", "_container"]; pl_container = _container; [] spawn { waitUntil {!(isNull findDisplay 602)}; disableSerialization; {(findDisplay 602 displayCtrl _x) ctrlAddEventHandler ["MouseButtonClick", "[0,_this] call fnc_otherUnif"]} forEach [632,640]; {(findDisplay 602 displayCtrl _x) ctrlAddEventHandler ["LBSelChanged", "[1,_this] spawn fnc_otherUnif"]} forEach [632,640]; }; }]; USAGE: just right click on uniform you want to wear. NOTE: seems a long code for forcing to wear a uniform? Just feel free to optimize without downgrading a working code on crates, corpses, or ground without multiplying gears or losing items...
  21. Hi all, Perhaps I missed something, but, for whatever reason, it's impossible to make difference between sides or factions for an OPFOR Katiba and a BLUFOR MX . So weapons haven't side. I never found something useful in cfgWeapons to make a filter for faction, side, even group or unit using such or such weapon. I imagine that if you want to filter all BLUFOR used weapons for arsenal or any loot script, you have to grave in marble the array of all weapons you want to manage... Typically, that's what I want to avoid: elaborating fixed lists for any mods... boring! So If you have a solution... thanks for sharing it. At this time, I have a little workaround, not the best I'm afraid. If you want weapons used by BLUFOR: private _wpnsWestList = []; private _cfgMen = "getNumber (_x >> 'scope') >=2 && configName _x isKindOf 'SoldierWB'" configClasses (configFile >> "cfgvehicles"); { _cfgWpnsW = getArray (_x >> "weapons"); {if (getNumber (configfile >> "cfgWeapons" >> _x >> "type") in [1,2,4]) then {_wpnsWestList pushBackUnique _x}} forEach _cfgWpnsW; } forEach _cfgMen; _wpnsWestList = _wpnsWestList - ["B_Patrol_Soldier_HeavyGunner_weapon_F"]; Note: I was surprised to find such unit classes like "B_Patrol_HeavyGunner_F" and its "B_Patrol_Soldier_HeavyGunner_weapon_F" as primary weapon which is a simple "LMG_Zafir_F". Don't ask me why this exception... For OPFOR, anyway, change 'SoldierWB' to 'SoldierEB' (and remove the last line of course) , and for INDEP, 'SoldierGB' will do the trick. Any improvement or better idea is welcome! Thanks
  22. Hi all, Here is a new mission for Iron Front AIO at Omaha Colleville (CUP terrains). The SP / MP revive heal should work fine! Have fun! https://steamcommunity.com/sharedfiles/filedetails/?id=1537586400
  23. IN GAME TASKS ON MARKERS Hi all, Here is a little script to create some tasks while in game, just placing markers on map. EDITED: 23/12/2018 parameters: none There is no parameters. Just place some map markers. The available markers are "OBJECTIVE" "AMBUSH" "DESTROY" "PICK UP" "JOIN" (like actions for units). All others remain standard markers. Channel: As markers come with selectable channel "GLOBAL" "SIDE" "COMMAND" "GROUP" "VEHICLE", the automated task will be displayed for the same channel. So, don't forget a global marker will create a global task, and so on. Task deletion: There are 2 ways for deleting a task: - try to delete the red circle marker below the task marker. Not easy. Usually works when you catch the marker owner name in MP. - go to task description and click on "Delete task" It's an active link. Associated action: At this time, there is no difference between the type of tasks. These tasks are like some 3D markers and are displayed as tasks. But there is no condition for completion. That means, these tasks can be CREATED or ASSIGNED but never COMPLETED or CANCELED. They can be deleted. Extra feature: In task description, you can click on "GO GO GO" link. This will order the concerned units (CHANNEL) to move at the task destination. You can order a task for the side, then order another task for your group. This, you can have two different objectives. But, please, keep on mind AIs will obey to the last order. So, have some players coordination in MP. That's the main reason why the move order is not automatic. You can create all tasks you need as 3D markers, then decide to order or not a movement for units. All comments, ideas are welcome! Run this code on initPlayerLocal.sqf or any script running with interface (player). A condition true trigger works also. Thanks Pierre MGI
  24. ADAPT SILENCERS TO COMBAT/STEALTH SITUATION Hi all, Did you remark that AIs don't adapt their muzzle sound suppressor (silencer) with the ordered situation (STEALTH / COMBAT)?. Here is a little code for adding/removing existing silencer on current weapon. Notes: - by "existing", I means the silencer must be on weapon or inside unit's gear. Furthermore, as you can start with an already equipped silencer and no more room in gear, this script will record that in a variable and will be able to re-fit the silencer on weapon instead of losing him due to the lack of room. (a kind of extra pocket). - MP compatible but I intentionally worked at idle for better performance. If your unit's localization (PC owning it) is supposed to change, You'll need to make the variable broadcast (adding true as 3rd parameter). And, that's for the specific case your unit need the "extra pocket". - players are not concerned, but it's easy, for automatic adapted muzzle, to remove the isPlayer condition. - for performance, this script is not "on each framed". It could be. I chose to fire the code using the "animChanged" EH. In some cases, the unit can start to fire without changing its animation. So, try to order the new behavior in advance (Anims often change anyway). - some silencer can be non-removable, hard-coded with model, or simply don't exist! There is nothing to do with that. It's up to you to choose the right weapon. Tested on Vanilla and CUP. For other mods, have your own test. This will depend on how silencer classes are named. version Nov. 20th 2018 parameters: NONE { _x addEventHandler ["AnimChanged", { params ["_unit","","_silencer"]; if (!isplayer _unit) then { if (isnil {_unit getVariable "MGI_silencer"}) then { _unit setVariable ["MGI_silencer",[]] }; _silencers = (items _unit select {["_snds",_x] call bis_fnc_instring}) + (weapons _unit apply {_unit weaponAccessories _x param [0, ""]} select {_x != ""}) + (_unit getVariable "MGI_silencer"); call { if (behaviour _unit == "COMBAT" && {isNull objectParent _unit} && {_unit weaponAccessories currentMuzzle _unit param [0, ""] != ""}) exitWith { _silencer = _unit weaponAccessories currentMuzzle _unit param [0, ""]; call { if (currentWeapon _unit isEqualTo primaryWeapon _unit) exitWith { _unit removePrimaryWeaponItem _silencer; }; if (currentWeapon _unit isEqualTo handGunWeapon _unit) exitWith { _unit removeHandGunItem _silencer; }; }; call { if (_unit canAddItemToBackpack _silencer) exitWith { _unit addItemToBackpack _silencer; }; if (_unit canAddItemToVest _silencer) exitWith { _unit addItemToVest _silencer; }; if (_unit canAddItemToUniform _silencer) exitWith { _unit addItemToUniform _silencer; }; (_unit getVariable "MGI_silencer") pushBackUnique _silencer; }; }; if (behaviour _unit == "stealth" && {isNull objectParent _unit} && {_unit weaponAccessories currentMuzzle _unit param [0, ""] == ""}) exitWith { {_unit addWeaponItem [currentWeapon _unit,_x]} count _silencers; _silencer = _unit weaponAccessories currentMuzzle _unit param [0, ""]; if (_silencer in (_unit getVariable ["MGI_silencer",[]])) then { _unit setVariable ["MGI_silencer", (_unit getVariable "MGI_silencer") - [_silencer]]; } else { if (_silencer in items _unit) then {_unit removeitem _silencer}; }; }; }; }; }] } forEach (playableUnits + switchableUnits);
  25. Hi all, If you used to play on Kunduz, Afghanistan map, you remarked the doors of any building are not active. Here is a simple code to add in initPlayerLocal.sqf to make them work. (Create it in mission root if missing) if (modParams ["@Kunduz, Afghanistan", ["active"]] param [0,false]) then { inGameUISetEventHandler ["action"," private _intersects = []; if (_this select 4 == 'Close Door' or _this select 4 == 'Close Window') then { _anims = 'true' configClasses (configfile >> 'CfgVehicles' >> typeof cursorObject >> 'AnimationSources') apply {configName _x}; { _intersects = ([cursorObject, _x] intersect [ASLToATL eyepos player, (screentoworld [0.5,0.5])]); if (count (_intersects select 0) > 0) exitwith {_intersects} } forEach ['VIEW','GEOM','FIRE']; if (count _intersects > 0) then { _select_door = (_intersects select 0) select 0; { if (count _anims > 0 && {[_select_door,_x] call Bis_fnc_inString}) exitWith { cursorObject animateSource [_x, 0];true}; false } forEach _anims; }; }; if (_this select 4 == 'Open Door' or _this select 4 == 'Open Window') then { _anims = 'true' configClasses (configfile >> 'CfgVehicles' >> typeof cursorObject >> 'AnimationSources') apply {configName _x}; { _intersects = ([cursorObject, _x] intersect [ASLToATL eyepos player, (screentoworld [0.5,0.5])]); if (count (_intersects select 0) > 0) exitwith {_intersects} } forEach ['VIEW','GEOM','FIRE']; if (count _intersects > 0) then { _select_door = (_intersects select 0) select 0; { if (count _anims > 0 && {[_select_door,_x] call Bis_fnc_inString}) exitWith { cursorObject animateSource [_x, 1];true};false } forEach _anims; }; }; "]; }; Have fun on this beautiful map. Updated Nov. 20th 2018 (see comments)