KillahPotatoes / KP-Liberation

The work on GreuhZbugs Liberation Mission for Arma 3 continues...
MIT License
266 stars 302 forks source link

Workaround for Bug in Drone AI #825

Closed nathanvoglsam closed 3 years ago

nathanvoglsam commented 3 years ago
Q A
Bug fix? kind of?
New feature? yes
Needs wipe? no

Description:

Currently there is a bug with Arma 3 that causes the AI unit inside an aerial drone to cease accepting new orders after it completes a "LAND" order. This, of course, makes it impossible to rearm and refuel them making them non-viable to actually use without constantly reloading the mission.

I found a workaround by deleting the "units" inside the drone and replacing them with a fresh set of units. This pull request adds another action onto any drone similar to the "unflip" action. It just deletes the old crew and puts in a new one with createVehicleCrew.

Successfully tested on:

I've only tested on Dedicated MP as that was the easiest way for me to test, but considering 90% of my PR is copy pasted from the unflip action's code I wasn't in a rush to test it on Local MP.

The only original code in this PR is

params ["_target", "_caller", "_actionId", "_arguments"];

// Delete the old crew
{
    (vehicle _x) deleteVehicleCrew _x;
} forEach (crew _target);

// Creates a new crew, which will work again.
createVehicleCrew _target;
nathanvoglsam commented 3 years ago

Closed as I want to clean the branches up and resubmit

Wyqer commented 3 years ago

Maybe you can have a look to implement this via the objectInits on uavs with enabled inheritance. That's much cleaner, as we currently also going away from these ugly loops for action managing.

Example refs https://github.com/KillahPotatoes/KP-Liberation/blob/master/Missionframework/kp_objectInits.sqf https://github.com/KillahPotatoes/KP-Liberation/blob/master/Missionframework/functions/fn_addActionsFob.sqf

And please create your working branch from the v0.96.71 branch. Also setting this as target for your Pull Request.