3den-Enhanced icon indicating copy to clipboard operation
3den-Enhanced copied to clipboard

Implement attribute to turn units into agents

Open markanlb opened this issue 1 year ago • 0 comments

Hi, I was thinking about a new function for "3den-Enhanced". An option in the attributes to spawn the unit as an "Agent".

I made a little code that could allow it. Thanks for your work. Keep it up 👍

private _unitAgent = this;

private _position = getPosATL _unitAgent;
private _direction = getDir _unitAgent;
private _type = typeOf _unitAgent;
private _animationState = animationState _unitAgent;
private _unitAgentLoadout = getUnitLoadout _unitAgent;
private _unitAgentVariables = allVariables _unitAgent;
private _localVariables = [];

{ _localVariables pushBack [_x, _unitAgent getVariable _x]; } forEach _unitAgentVariables;

deleteVehicle _unitAgent;

private _agent = createAgent [_type, _position, [], 0, "CAN_COLLIDE"];
_agent setDir _direction;
_agent setVariable ["BIS_fnc_animalBehaviour_disable", true];
_agent switchMove _animationState;
_agent setUnitLoadout _unitAgentLoadout;
{ _agent setVariable [_x select 0, _x select 1]; } forEach _localVariables;

markanlb avatar Oct 21 '24 10:10 markanlb