Skip to content
10Dozen edited this page Dec 16, 2019 · 26 revisions

DynAI Basic Functions

DynAI Behavior Functions


DynAI Basic Functions


dzn_fnc_dynai_activateZone

@ZoneLogic call dzn_fnc_dynai_activateZone

INPUT:
0: OBJECT - Zone's GameLogic
OUTPUT: NULL

Activates given zone (spawn units, set group waypoints)

PatrolZone call dzn_fnc_dynai_activateZone

dzn_fnc_dynai_isActive

@IsActive? = @ZoneLogic call dzn_fnc_dynai_isActive

INPUT:
0: OBJECT - Zone's GameLogic
OUTPUT: BOOLEAN (true - if zone was activated, false - if zone is inactive)

Return true if zone was already activated.

private _isActive = PatrolZone call dzn_fnc_dynai_isActive

dzn_fnc_dynai_moveZone

[@Zone, @Pos3d, @Direction] call dzn_fnc_dynai_moveZone

INPUT:
0: OBJECT - Zone's GameLogic
1: POS3d or OBJECT - New position of the zone as Pos3d or object
2: NUMBER - (Optional) New direction of the zone (zone will be rotated on given angle)
OUTPUT: NULL

Moves inactive zone to new position. Zone can be rotated on given angle

[PatrolZone, [1024, 1024, 0], 0] call dzn_fnc_dynai_moveZone;
[PatrolZone, getPosATL Base, 90] call dzn_fnc_dynai_moveZone;

dzn_fnc_dynai_addNewZone

[@Name, @Side, @IsActive, @Area, @Keypoints, @Tamplates, @Behaviour] spawn dzn_fnc_dynai_addNewZone

INPUT:
0: STRING - Zone's name
1: STRING - Zone's side (e.g. "west", "east", "resistance", "civilian")
2: BOOLEAN - true - active, false - inactive on creation
3: ARRAY - List of Locations or Triggers or [Pos3d, WidthX, WidthY, Direction, IsSquare(true/false)]
4: ARRAY or STRING - Keypoints (array of Pos3ds) or "randomize" to generate waypoints from zone's area
5: ARRAY - Groups templates for zone
6: ARRAY - Behavior settings in format [Speed mode, Behavior, Combat mode, Formation]
OUTPUT: NULL

Creates new DynAI zone according to passed parameters.

[
    "NewPatrolZone"
    , "EAST"
    , false
    , [ [1045,2000,0], 150, 150, 0, false ]
    , "randomize"
    , [ 
        [2,[["O_Soldier_F", [], "kit_nato_r"],["O_Soldier_F", [], "kit_nato_r"]] 
    ]
    , ["LIMITED","SAFE","RED","WEDGE"]
] call dzn_fnc_dynai_addNewZone;

dzn_fnc_dynai_deactivateZone

[@Zone, (Optional)@Condition] call dzn_fnc_dynai_deactivateZone

INPUT:
0: OBJECT - Zone's GameLogic
1: CODE - (optional) conditional code that returns BOOLEAN
OUTPUT: NULL

Deactivates zone and remove all zone's units/vehicles. It's possible to activate zone again. Optionally functions can add new condition for zone activation.

[Zone1, { time > 600 }] call dzn_fnc_dynai_deactivateZone;

dzn_fnc_dynai_getZoneKeypoints

@List of Keypoints = @Zone call dzn_fnc_dynai_getZoneKeypoints

INPUT:
0: OBJECT - Zone's GameLogic
OUTPUT: ARRAY (List of POS3d)

Returns the list of zone's keypoints (Pos3d)

private _keypoints =  PatrolZone call dzn_fnc_dynai_getZoneKeypoints;

dzn_fnc_dynai_setZoneKeypoints

[@Zone, @List of Keypoint] call dzn_fnc_dynai_setZoneKeypoints

INPUT:
0: OBJECT - Zone's GameLogic
1: ARRAY - List of POS3d of new keypoints (e.g. [[100,100,0], [200,200,0]])
OUTPUT: NULL

Updates zone's keypoints with new values. If zone already activated - force zone's groups to acquire new waypoints.

[ PatrolZone, [[1024, 1024, 0], [2024, 2024, 0]] ] call dzn_fnc_dynai_setZoneKeypoints;
[ PatrolZone, [getPosATL Base, getPosATL Bay] ] call dzn_fnc_dynai_setZoneKeypoints;

dzn_fnc_dynai_getGroupTemplates

@Templates = @Zone call dzn_fnc_dynai_getGroupTemplates

INPUT:
0: OBJECT - Zone's GameLogic
OUTPUT: ARRAY (List of zone's groups templates)

Returns the list of the zone's groups templates

private _templates =  PatrolZone call dzn_fnc_dynai_getGroupTemplates;

dzn_fnc_dynai_setGroupTemplates

[@Zone, @Templates] call dzn_fnc_dynai_setGroupTemplates

INPUT:
0: OBJECT - Zone's GameLogic
1: ARRAY - List of the new group templates
OUTPUT: NULL

Update zone with new group templates. For active zone - does nothing, but for inactive zone - allows to change what units will be spawned in zone.

[
    PatrolZone
    , [ 
        [2,[["O_Soldier_F", [], "kit_nato_r"],["O_Soldier_F", [], "kit_nato_r"]] 
    ] 
] call dzn_fnc_dynai_setGroupTemplates;

dzn_fnc_dynai_getZoneVar

@Property = [@Zone, @PropertyName] call dzn_fnc_dynai_getZoneVar

INPUT:
0: OBJECT - Zone's GameLogic
1: STRING - Property name (e.g. "isactive", "groups")
OUTPUT: @Property value (can be any format)

Returns value of the given property. Properties are: "list" - (array) list of all available properties; "area" - (array) list of zone's locations; "kp"/"points"/"keypoints" - (array) list of zone's keypoints (Pos3ds); "isactive" - (boolean) is zone was activated; "prop"/"properties" - (array) list of zone's basic properties (that were set up with DynAI tool); "init"/"initialized" - (boolean) is zone initialized; "groups" - (array) list of zone's groups

private _var = [PatrolZone, "area"] call dzn_fnc_dynai_getZoneVar;

dzn_fnc_dynai_getGroupVar

@Property = [@Group, @PropertyName] call dzn_fnc_dynai_getGroupVar

INPUT:
0: GROUP - Zone's group
1: STRING - Property name (e.g. "wpSet", "units")
OUTPUT: @Property value (can be any format)

Returns value of the given property. Properties are: "list" - (array) list of all available properties; "home" - (object) home zone's game logic; "units" - (array) list of group's units; "vehicles" - (array) list of group's vehicles; "wpset" - (boolean) is group already has waypoints

private _groupVar = [group _unit, "vehicles"] call dzn_fnc_dynai_getGroupVar;

DynAI Behavior Functions


dzn_fnc_dynai_addGroupAsSupporter

@Unit call dzn_fnc_dynai_addGroupAsSupporter

INPUT:
0: OBJECT or GROUP - Unit or group to add as supporter
OUTPUT: NULL

Add unit's group to Reinforcement Response system

(group _unit) call dzn_fnc_dynai_addGroupAsSupporter;
_unit call dzn_fnc_dynai_addGroupAsSupporter;

dzn_fnc_dynai_addUnitBehavior

[@Unit, @Behavior] call dzn_fnc_dynai_addUnitBehavior

INPUT:
0: OBJECT - Unit to add behavior
1: STRING - Behavior type (e.g. "indoor", "vehicle hold")
OUTPUT: NULL

Adds behavior script to unit. "Indoor" -- behavior for units inside the buildings/sentries; "Vehicle Hold" -- vehicle/turret behaviour (rotation);

[_unit, "Indoor"] call dzn_fnc_dynai_addUnitBehavior;
[_vehicle, "Vehicle Hold"] call dzn_fnc_dynai_addUnitBehavior;

dzn_fnc_dynai_moveGroups

[@Zone, [@Pos3d], @Type] call dzn_fnc_dynai_moveGroups

INPUT:
0: OBJECT - Zone's GameLogic
1: ARRAY - List of Pos3d. If [] - random points inside zone's area will be used.
2: STRING - Type of the movement ("PATROL","SAD","RANDOM SAD")
OUTPUT: NULL

Moves all zone's groups through given list of positions (or random points). Type: "PATROL" - random order of poses; "SAD" - move through given poses and SAD on last one "RANDOM SAD" - SAD on random poses

[PatrolZone, [], "SAD"] call dzn_fnc_dynai_moveGroups;
[PatrolZone, [ [1000,1000,0], [1050,1050,0] ], "PATROL"] call dzn_fnc_dynai_moveGroups;
[PatrolZone, [ getPosATL Base, getPosATL Bay ], "PATROL"] call dzn_fnc_dynai_moveGroups;

dzn_fnc_dynai_setGroupsMode

[@Zone, @Template or [@Behaviour, @Combat, @Speed]] call dzn_fnc_dynai_setGroupsMode

INPUT:
0: OBJECT - Zone's Game Logic
1: STRING or ARRAY - Name of the template or array of [Behavior, Combat mode, Speed mode]
OUTPUT: NULL

Changes group behavior settings. Templates: "SAFE" - move with limited speed, weapons down. Do not wait for enemy; "AWARE" - move with limited speed, weapons down, wait for enemy; "COMBAT" - move normal speed, weapon up, wait for enemy;

[PatrolZone, "AWARE"] call dzn_fnc_dynai_setGroupsMode;
[PatrolZone, ["LIMITED","SAFE","RED"]] call dzn_fnc_dynai_setGroupsMode;