Arma 3
MGI ADVANCED MODULES
PierreMGI  [開發人員] 2019 年 3 月 18 日 下午 12:53
AIs could grab some weapons
Discussion about AIs and loot weapons.
最後修改者:PierreMGI; 2019 年 3 月 18 日 下午 12:55
< >
目前顯示第 1-7 則留言,共 7
Völe 2019 年 3 月 19 日 下午 2:26 
How about scripting?
This is my old function to assist gunner take machine gun when gunner is dead.
Via some effort you can make FSM or something of your choice to suit your needs.

fnc_Replace_MG =
{
/*
needs to be spawned becaous use of while and sleep (scheluded environment)

waitUntil {!alive Machinegunner};
if !(alive MachinegunnerAssistant) exitWith {};
nul = [Machinegunner, MachinegunnerAssistant] spawn fnc_Replace_MG;
*/
private ["_oldGunner", "_newGunner", "_weaponHolders", "_WeaponHolder", "_weapons", "_magazines"];
_oldGunner = _This select 0;
_newGunner = _This select 1;
_weaponHolders = nearestObjects [_oldGunner,["WeaponHolderSimulated"],5];
_WeaponHolder = _weaponHolders select 0;
_weapons = weaponCargo _WeaponHolder;
_magazines = Magazines _oldGunner;

//hint format ["Fallen gunner: %1\nNew Gunner: %2\nWeapon: %3\nMagazines: %4", _oldGunner, _newGunner, _weapons, _magazines];

while {_newGunner distance _oldGunner > 3} do
{
_newGunner doMove getPos _oldGunner;
sleep 10;
};

//I dont remember which one works best
_newGunner action ["TakeWeapon", _WeaponHolder, (_weapons select 0)];
{_newGunner action ["TakeWeapon", _oldGunner, _x];} forEach weapons _oldGunner;
{_newGunner action ["TakeMagazine", __oldGunner, _x];} forEach magazines _oldGunner;

//may need some editing but you probly know the rest
};

:)
Völe 2019 年 3 月 19 日 下午 2:38 
引用自 PierreMGI
OK. I have also some hours on Arma and I didn't play with AIs without weapon, but civilians. I saw many times units out of ammo, but not without weapons. Probably, a mod or a mission I don't know. Reloading weapons seems to me simple. Searching for grabbing another weapon is far more difficult. For example, BI didn't implement a smart action menu for that. You just have a list of possible, known weapons that you can order the subordinate for reloading. No matter if it's far away. For AIs, by their own, the problem is more difficult: why, when, where, who decide, who command the AI... go/no go cases.

As for AI to decide ideas
Why?
A) AI has now weapon -> go for function to search any weapon.
B) Squad has no spesific weapon [ units _Group findIf {(weapon _x) isEqualTo 'WantedWeapon'} == -1); ] -> go for function to search spesific weapon in range,

When?
A) no combat and choises around
B) Urgent need (No AT and engaging tanks

Who command the AI?
Squad leader virtualy via scripts and if player is squad leader maybe use limited functions.

Go/No Go.
Measure distances, think current loadout. Does unit have enough full magazines (or simplifiied just could count AI magazines)
PierreMGI  [開發人員] 2019 年 3 月 19 日 下午 5:30 
Thanks for contribution and ideas. I spent monthes on heal module. So be patient! I'm not able to do that in a week.
ShankZ 2019 年 3 月 20 日 上午 10:38 
Kiitos Völe!
Play3r 2021 年 8 月 20 日 上午 3:59 
Any chance you can make it so the unit that runs for Ammo can report " GoTo Reload" or something like it from the game ?
PierreMGI  [開發人員] 2021 年 8 月 20 日 上午 9:56 
That means using an existing sentence (to comply with all factions). Not impossible but demands some time for me.
PierreMGI  [開發人員] 2022 年 3 月 2 日 上午 7:36 
Ai running "out of ammo" can now reload at ground/vehicle/crate/corpse... (see documentation). remaining problem: even if the Ai grabs a new weapon and reload, then fires, its icon (when in group) stays at low ammo status. No clue about that.
< >
目前顯示第 1-7 則留言,共 7
每頁顯示: 1530 50