Forum Jump :

Author Message


Posts: 67
Rank:


Level: Member

Country: ca
Location:
Occupation:
Age:
In-game name:

 
#1 Posted at 2013-10-04 19:10        
     
Introducing: {Spooky}-UnitSetPos
Written By: Peppy Zolkiewski
Intention:Group Stance and Mode Control.

I would like to introduce you to the {Spooky}-UnitSetPos.sqf
A Stance and Mode Control a Single Unit or Entire group with in ArmA II !.

{Spooky}-UnitSetPos brings near instant response to Stance changes with the option of per-selecting default Modes and Formation for each Stance be it, “UP”, “MIDDLE” or “DOWN”.

Features:
A: Stance Enforcement On / Off
B: Flexible Stance Enforcement be it “ALWAYS” or on “WHILE STOPED”,
C: Behavior modes On/Off
D: Combat modes On/Off
E: Formations On/Off
F: Per-selectable Behavior modes for each Stance.
G: Per-selectable Combat modes for each Stance.
H: Per-selectable Formations for each Stance.

Special Features:
When a AA or AT solder switch to there secondary the group will respond by crouching when AT or AA is active and fall back in to the normal stance enforcement, Standing, Crouching etc... as the AA or AT solder switches back to the primary weapon.

Special Stance responses for Medics given the Medic is leader of the group, While medic is healing the Team will Crouch. Future releases will control this response by proximity where the {Spooky} -AI may chose to effect there stance or “Act”* depending on the Situational Responses.

Example:
(if Leader = Prone)-(Mode=STEALTH, LIMITED, RED, and LINE.)
(if Leader = Crouched)-(Mode=AWARE, NORMAL, RED, DIMIAND)
(if Leader = Standing)-(Mode=SAFE, FULL, YELLOW, and COLOMN)
Or
(if Medic = Healing)-(Mode=AWARE, LIMITED, RED, DIMIAND)

Note: By having the option of per-selecting what Modes and Formations our group should follow gives a better sense of control.

Whats Should Be Expected In the Future Releases of this script.
A: Additional Situational Responses for AA, AT and the members of these units group depending on proximity and position to this Unit
B: Add additional Situational Responses* for the Group as a whole
C: Add additional Situational Responses* for the Unit

Situational Responses*:
Under-fire / Firing
Healing / Injured
Distance From Leader
Nearest Enemy Distance
Nearest Enemy know-about
Nearest Place of Cover
Nearest guard points
Nearest Weapon / Ammo
Nearest Entry

NOTE:Situational Responses will be held temperately with in each script for testing and development purposes, however these will be removed in future updates as these “Situational Responses“ will be integrated as part of the {Spooky}-Base AI. Where the AI will interact with the {Spooky}-UnitSetPos if a situation should require, so bare in mind “Situational Responses“ will not always remain a part of the {Spooky}-UnitSetPos script but the Responses will given there is a Situation that call a specific response, Also just to mention All Arrays will also be moved out of all the {Spooky} Scripts once the {Spooky}-Base is established, dramatically reducing CODE and file sizes of the {Spooky} Project.

Example: the AI “Situational Responses“ would stop a unit from Standing to follow its Leader witch is standing while that unit is under fire!, Instead the AI would seek the nearest Cover point, Weapon and Entry point (Vehicles included in future releases) and would forward that unit to {Spooky}-Man-tracker*, where that Unit would stay covered for a short time, while Tracking its leader until regrouped with it.

NOTE: {Spooky}-UnitSetPos has Control over the group much like way-points would, however each is effected by the Stance rather than the way-point, additionally by using Triggers all preset modes could be changed on the fly adding a new sense of control over AI or player group.

THIS IS A TEST SCRIPT AND IS MAY NOT HAVE ALL FUCNTIONS AVALIABLE.
[
<==UNIT NAME
1 / 0<==ENABLE
1 / 0<==SET HOLDPOS
[
1 / 0 <==ENABLE BEHAVOUR MODES
1 / 0<==ENABLE FORMATION SELECTIONS
1 / 0<==ENABLE COMBAT MODE SELECTIONS
]
[
0 - 4<==BEHAVOUR "MIDDLE"
0 - 4<==BEHAVOUR "DOWN"
0 - 4<==BEHAVOUR "UP"
]
[
0 - 4<==SELECT COMBATMODE "MIDDLE"
0 - 4<==SELECT COMABTMODE "DOWN"
0 - 4<==SELECT COMABTMODE "UP"
]
[
0 - 8<==FORMATION "MIDDLE"
0 - 8<==FORMATION "DOWN"
0 - 8<==FORMATION "UP"
]

*”Act” refers to an “Act” or Data Array created by the {Spooky}-FastStepRec Scripts.
* “{Spooky}-Man-tracker.sqf” A Tracking script not Public as of yet.

/*-----------------------------------------------------------------------------
UnitPosSet.sqf v.2.0
===============
Author: 
Remarks: Controls Groups Stanc/ Modes and Formations.

Copy Stance with MODESET, COMMSET, FORMSSET
Options:

EXAMPLE OF With/ HOLDPOS, MODESET, COMMSET, FORMSSET
NULL= [player,1,1,1,1,1,[3,4,2],[4,2,3],[8,6,7]]

EXAMPLE OF W/ HOLDPOS, MODESET, COMMSET
NULL= [player,1,1,1,1,0,[3,4,2],[4,2,3],[8,6,7]]

EXAMPLE OF W/ HOLDPOS, MODESET
NULL= [player,1,1,1,0,0,[3,4,2],[4,2,3],[8,6,7]]

EXAMPLE OF W/ HOLDPOS, COMMSET
NULL= [player,1,1,0,1,0,[3,4,2],[4,2,3],[8,6,7]]

EXAMPLE OF W/ HOLDPOS, FORMSSET
NULL= [player,1,1,0,0,1,[3,4,2],[4,2,3],[8,6,7]]

EXAMPLE OF W/O HOLDPOS, MODESET, COMMSET, FORMSSET
NULL= [player,1,0,0,0,0,[0,0,0],[0,0,0],[0,0,0]]

EXAMPLE OF default
NULL= [player,1,0,0,0,0,[0,0,0],[0,0,0],[0,0,0]]

Place in units INIT to for testing.
NULL= [this,1,1,1,1,1,[0,4,2],[4,2,3],[8,6,7]] execVM "UnitPosSet.sqf";

todo:
Speed Reactions settings (not complete)
-----------------------------------------------------------------------------*/
// Normal operation would have the following line in the missons INIT.sqf
[] spawn compile preprocessFile "{Spooky}-StanceArarry.aRy";

Fnc_SetPos={
private ["_Select","_Acts","_c","_cc","_a","_aa","_x","_b","_bb","_Unit","_Enbl","_HolP","_ModS","_ComM","_ForS","_ModsAry","_ComMAry","_ForSAry","_eVNT"];

    _Unit = _this select 0 select 0;
    _Enbl = _this select 0 select 1;
    _HolP = _this select 0 select 2;
    _ModS = _this select 0 select 3;
    _ComM = _this select 0 select 4;
    _ForS = _this select 0 select 5;
    _ModsAry=_this select 0 select 6;
    _ComMAry=_this select 0 select 7;
    _ForSAry=_this select 0 select 8;

    _eVNT = _Unit addEventHandler ["AnimChanged",""];

    while {true and _Enbl == 1} do
	{
        waitUntil{_eVNT==0};

        if(_HolP==1)then
        {_Acts = animationState _Unit;
        if (StanceUp find _Acts > -1)then
        {
            {
                _x setUnitPos "Up";
                _Select=0;
            }forEach units group _Unit;
        }else{
            if (StanceMd find _Acts > -1)then
            {
                {
                    _x setUnitPos "Middle";
                    _Select=1;
                } forEach units group _Unit;
            }else{
                if (StanceLo find _Acts > -1)then
                {
                    {
                        _x setUnitPos "Down";
                        _Select=2;
                    } forEach units group _Unit;
                }}};
            };

            if(_ModS==1)then
            {
                _a=_ModsAry select _Select;
                _aa=BehAveAray select _a;
                _x setBehaviour _aa;

                _b=_ComMAry select _Select;
                _bb=ComBatAray select _b;
                _x setCombatMode _bb;

                if(_ForS==1)then
                {
                    {
                        _c=_ForSAry select _Select;
                        _cc=FoRMatAray select _c;
                        _x setFormation _cc;
                    } forEach units group _Unit;
                };
            };
        };
    };
    [_this] spawn Fnc_SetPos;
    exit;

This post was edited by Bingoz (2013-10-14 08:14, ago)


Author Message


Posts: 67
Rank:


Level: Member

Country: ca
Location:
Occupation:
Age:
In-game name:

 
#2 Posted at 2013-10-13 23:17        
     
UPDATE!

Change Log:
1: Redundant code and duplicate code strings have been removed
2: Internal animation arrays have been removed and made External
3: Added support for All Units.
4: Code Restructure

The {Spooky}-UnitSetPos.sqf script and External array are available for download and testing at the following location.

{Spooky}-UnitSetPos.zip
http://www37.zippyshare.com/v/20325297/file.html

This post was edited by Bingoz (2013-10-14 08:11, ago)