-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AI Logistics - Vehicles with route pickets #803
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good start, some changes needed however.
Randomly occurring script error around an '==' check in an IF statement but does seem to work still
This is never ok. Script errors that appear to still work can't be written off as known issues.
(The error here is an undefined variable)
// TODO: Change this to use a common component for spawned AI deletion | ||
|
||
(_leader getVariable [QEGVAR(common,assignedVehicle), objNull]) call CBA_fnc_deleteEntity; | ||
(vehicle _leader) call CBA_fnc_deleteEntity; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why has this changed? This is designed to delete the vehicle given to the unit at spawn, to cover cases where the unit is no longer inside the vehicle
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I first looked at it, I didn't remember assigning the vehicle with a setVar so thought it would return nothing. I've reverted it back.
Also think using synchronized picket modules instead of the path calculation might be better and give greater control to the mission maker. |
I actually really like this, probably alot easier to. Might be able to change the picket behaviour to by using LAMBs camp or garrison. |
- Various fixes - Correcting merge mistakes
I've added code to make the logistics vehicle drive to the picket locations. It tries to find the nearest road to the picket location. If empty it'll just go to the picket location. An issue with this I can forsee is that if a picket is placed between say a fork and ends up travelling down a different road than mission maker intended so will require a degree of intelligent placement, not sure we could script for that outcome. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some previously resolved things marked as unresolved.
Few things highlighted in one place only (params ordering, changes to side), make sure changed in all relevant places
[{ | ||
params ["_module"]; | ||
[_module] call FUNC(createLogisticVehicle); | ||
}, [_module], random _time] call cba_fnc_waitAndExecute; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This random _time
needs to be considered with a minimum. This will currently resolve from 0
to _time
.
If you want variance in the timeout, consider adding the base timeout to some random value. e.g
_time + random 60
or _time + random (_time / 10)
addons/ailogistics/CfgVehicles.hpp
Outdated
}; | ||
}; | ||
}; | ||
class GVAR(logisticsPicketGroup) : GVAR(module) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bad indentation
GVAR(unitPoolString) = []; | ||
GVAR(logisticVehiclePoolString) = []; | ||
GVAR(routePickets) = false; | ||
GVAR(picketLocations) = []; | ||
GVAR(picketUnitPoolString) = []; | ||
GVAR(picketGroupSize) = 0; | ||
GVAR(logisticsObject) = ObjNull; | ||
GVAR(logisticalVehicleNumber) = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If these variables are not used, remove them. Looks like everything is done via the module variables?
|
||
if (!isServer) exitWith {}; | ||
|
||
params ["_module"]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
params
first, before server check, for consistency
|
||
{ | ||
private _sideFromModule = _x getVariable [QGVAR(side), 0]; | ||
if (_sideFromModule == 0) then { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it planned that this could run twice for the same modules?
If so, the types are going to be out of whack due to the reassignment of the variable.
For robustness, I would resolve the side here for use only and leave the module variable intact as a number.
e.g
private _sideNumber = _x getVariable [QGVAR(side), 0];
private _side = [EAST, INDEPENDENT] select _sideNumber;
|
||
params ["_module", "_group"]; | ||
|
||
private _destinationModule = (synchronizedObjects _module) select {_x isKindOf "uksf_ailogistics_logisticsDestination"}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the macro version instead of magic strings.
QGVAR(logisticsDestination)
and
QGVAR(logisticsPicketGroup)
} else { | ||
_module setVariable [QGVAR(side), INDEPENDENT]; | ||
}; | ||
private _side = _module getVariable [QGVAR(side), EAST]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here for the side thing as above. Once you reassign this variable, if you read it anywhere else it'll be the wrong type
@@ -0,0 +1,6 @@ | |||
class CfgFactionClasses { | |||
class EGVAR(common,eden); | |||
class ADDON: EGVAR(common,eden){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class ADDON: EGVAR(common,eden){ | |
class ADDON: EGVAR(common,eden) { |
When merged this pull request will: