Jump to content

Soapbox0331

Member
  • Content Count

    64
  • Joined

  • Last visited

  • Medals

Posts posted by Soapbox0331


  1. I may be asking too much of the ARMA AI here, but I wanted to run this by the experts here. I am still searching for a way to have Ai hunt players but avoid contact...like an AI anti-recon tracker keeping tabs on a recon team, both elements seriously trying to avoid contact. I have used the below code (from @opusfmspol) in the unit's 2nd waypoint, which works, and thinking easier to get the desired effect than BIS_fnc_stalk. I was hoping there was a way to modify this to do the following:
    1) When AI is within 200m of nearest player, executes a MyScriptHere.sqf.
    2) AI moves back to a waypoint 300m from the direction they came from (so if approached player from the south, move south).
    3) Hold at that waypoint for 5 minutes and then start the hunt again.

    Any ideas?


    if (isServer) then { 
            _null = this spawn { 
                    Hunt_players_fnc = { 
                            _player = objNull; 
                            _players = +(allPlayers - (entities "HeadlessClient_F")); 
                           _distance = 100000; 
                            { 
                                    if (alive _x && _x distance (Leader _this) < _distance) then { 
                                            _distance = _x distance (Leader _this);  
                                            _player = _x; 
                                    }; 
                            } foreach _players; 
     
                            if !(isNull _player) then { 
                                    _wp = (Group _this) addWaypoint [getPos _player, (50 + (floor(random 100)))]; 
                                    _wp setWaypointStatements ["true","_null = this spawn Hunt_players_fnc;"]; 
                                    _wp setWaypointType "SAD"; 
                                    _wp setWaypointCombatMode "GREEN"; 
                                    _wp setWaypointSpeed "LIMITED"; 
                            }; 
                    }; 
     
                    _null = _this spawn Hunt_players_fnc; 
            };  
    };
     


  2. Hello all. New to scripting and trying to baby-step my way through an event handler to get this:
    In MP/dedicated any player placing one of these two types of claymore mines from SOGPF ("vn_mine_m18_x3_ammo" OR "vn_mine_m18_x3_range_ammo"), a white phosphorus grenade ("vn_m34_grenade_mag") attaches to the placed mine object, and when claymore mine is triggered/detonated an additional detonation of "vn_m34_grenade_ammo" takes place at same location. 
     

    I was thinking this starts with a player addEventHandler, maybe player addEventHandler "Fired", but looking at other EH types, wondering if it's better to use "Explosion" or even "Activate" (not sure if that is applying to mines). Any help/education is appreciated.


  3. 6 hours ago, Gunter Severloh said:

    Again in my mission using an ai mod like lambs not only reduces the fps, with alot of ai garrisoned it

    also makes garrisoned units move from their position, so in relation with this script using lambs or another mod

    may make the ai not do what their supposed to do or make them do more, it depends on the functions of the ai mod too.

    I am excited to use this script! @Gunter Severloh from your video, what MOD gets you the FIA Zombies and what HTH are you using?


  4. On 8/26/2020 at 3:37 PM, jakeplissken said:

    Here is a nice script snippet that would allow quick revives like invade and annex when using ACE.

     

    
    med = {
    
    	if ( (typeOf player == "rhsusf_socom_marsoc_sarc") or (typeOf player == "rhsusf_army_ocp_medic") || (_this select 0 distance player) < 3 ) then {
    		["Administering first aid.", 9, {true}, {}, {}] call CBA_fnc_progressBar;
    		player playMove "AinvPknlMstpSnonWnonDr_medic5";
    		sleep 13;
    		[player, _this select 0] call ace_medical_treatment_fnc_fullHeal;
    	};
    };
    
    myfnc_uncon_special = {
    	params ["_unit", "_isUnconscious"];
    
    	if ( (typeOf player == "rhsusf_socom_marsoc_sarc") or (typeOf player == "rhsusf_army_ocp_medic") ) then {
    		private _action = _unit addAction ["Revive", {call med;}];
    		_unit setUserActionText [_action , "Revive", "<img size='2' image='\A3\Ui_f\data\IGUI\Cfg\Revive\overlayIcons\r75_ca.paa'/>"];
    	};
    
    if (!_isUnconscious) then {
    	removeAllActions _unit;
    };
    
    };
    
    ["ace_unconscious", myfnc_uncon_special] call CBA_fnc_addEventHandler;

    This might be very useful for you as well. Give it a go and see what you think.

    This is very helpful.
    Is there a way to make this available for unconscious BLUFOR (west) only? I think now it recognizes any unconscious. Also, does this work for for MP dedicated (running from initPlayerLocal.sqf)?


  5. On 8/30/2021 at 7:23 PM, Maff said:

    The command removeItem should do the job, even if it is in your uniform, vest or backpack.

    From your example you aren't using the command right.

    
    this removeItem "ACE_plasmaIV_250";

    Note the string, or quotes, around the class name.


    Now. How you use it in this instance depends on a few things.
    Are you only playing Single Player? Or, Is it Multiplayer?

    If it's Single Player, you can simply use the following in the On Activation field of your trigger;

    
    player removeItem "ACE_plasmaIV_250";



     

    How should I be using removeItem in MP, dedicated?


  6. @Harzach 

    Along this same line, would like to add the opportunity to place defective ammo on dead AI. I have an ammo can with this:

    [    
        this,                                                
        "Draw bad ammo",                                            
        "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",        
        "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",        
        "_this distance _target < 3",                            
        "_caller distance _target < 3",                            
        {player playMove "AinvPknlMstpSrasWrflDnon_Putdown_AmovPknlMstpSrasWrflDnon";},                                            
        {},                                                        
        {AmmoDrawn = true; publicVariable "AmmoDrawn"; hint "ammo drawn";},                    
        {},                                                        
        [],                                                        
        2,                                                        
        0,                                                        
        true,                                                    
        false                                                    
    ] remoteExec ["BIS_fnc_holdActionAdd", 0];


    BadAmmo.sqf:

    addMissionEventHandler ["EntityKilled", {    
        params ["_killed", "_killer", "_instigator"];
        
        if ((faction _killed) == "CIV_f" || faction _killer isEqualTo faction _killed) exitWith {false};
            [_killed,                                               
            "Plant bad ammo",                                           
            "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",       
            "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",       
            "_this distance _target < 3 && AmmoDrawn",                           
            "_caller distance _target < 3 && AmmoDrawn",                           
            {player playMove "AinvPknlMstpSrasWrflDnon_Putdown_AmovPknlMstpSrasWrflDnon";},                                                       
            {},                                                       
            {hint "ammo planted";},                   
            {},                                                       
            [],                                                       
            2,                                                       
            0,                                                       
            true,                                                   
            false                                                   
    ] remoteExec ["BIS_fnc_holdActionAdd", 0, _killed];
    }];

     

    1) If I have [] execVM "BadAmmo.sqf"; in initServer.sqf, does it run as soon as AmmoDrawn = true? Or am I running that script from the addAction on the ammo can?

     

    2) Also to confirm, using the publicVariable "AmmoDrawn", new joins (JIP) will have this option once they join?


  7. 1 hour ago, Harzach said:

     

    Right forest, wrong tree - you are still adding/updating the MEH/variables/holdAction every time a player joins. Try initServer.sqf.

     

    As for JIP, they're in missionNameSpace, so new joins should be receiving their current values.

     

    Thanks @Harzach 

     

    Forget that it exists.

     

    What is appropriate for the init.sqf...if anything?


  8. This is a great solution to random intel on AI from @wogz187 that is working for me in MP dedicated:

     

    missionNameSpace setVariable ["intel_hints", ["SMALL DIARY", "DOCUMENTS", "UNIT PATCH"]];

     

    addMissionEventHandler ["EntityKilled", {    
        params ["_killed", "_killer", "_instigator"];
        
        if ((faction _killed) == "CIV_f" || faction _killer isEqualTo faction _killed) exitWith {false};
            [_killed,
        "Search for intel",
        "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
        "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
        "!alive _target",
        "_caller distance _target <3",
        {_caller playMove "AinvPknlMstpSrasWrflDnon_Putdown_AmovPknlMstpSrasWrflDnon";},
        {},
        {params ["_target", "_caller", "_actionId", "_arguments"];

                _target removeAction _actionID;
                []spawn {
                    hint "Searching...";
                    sleep 1;

                    if ((round random 10) > 7) then {
                        hint selectRandom (missionNameSpace getVariable ["intel_hints", []])
                    } else {
                        hint "Nothing found..."
                    }
                }
            },
        {},
        [],
        2,
        0,
        false,
        false,
        false
    ] remoteExec ["BIS_fnc_holdActionAdd", 0, _killed];
    }];

     

    I am running it from init.sqf: [] execVM "randomIntel.sqf";

     

    1) There are multiple "Search for intel" entries on a single AI (looks like one per player). Does running this from initPlayerLocal correct that? 

     

    2) For JIP, does having a publicVariable in this script allow players joining late to see this addAction?


  9. 22 minutes ago, Harzach said:

    My point is that having all of those scripts is likely unnecessary. Share your code.

    @Harzach I am sure you are right. Ok, intent is to create some variety to environment when players get to/spawn in their base/FOB. These are the "varieties" of flybys:

     

    AmbientFlyby_1.sqf:

    sleep 1;
    ambientFly = [getmarkerpos "FlyByStart", getMarkerPos "FlyByEnd", 120, "FULL", "uns_ov10_usaf_FAC", WEST] call BIS_fnc_ambientFlyBy;

     

    AmbientFlyby_2.sqf:

    sleep 1;
    ambientFly = [getmarkerpos "FlyByEnd_2", getMarkerPos "FlyByStart_2", 100, "FULL", "vn_b_air_uh1d_02_07", WEST] call BIS_fnc_ambientFlyBy;

     

    AmbientFlyby_3.sqf:

    sleep 1;
    ambientFly = [getmarkerpos "FlyByStart", getMarkerPos "FlyByEnd", 120, "FULL", "vn_i_air_ch34_02_02", WEST] call BIS_fnc_ambientFlyBy;
    sleep 2;
    ambientFly = [getmarkerpos "FlyByStart", getMarkerPos "FlyByEnd", 130, "FULL", "vn_i_air_ch34_02_02", WEST] call BIS_fnc_ambientFlyBy;

     

    AmbientFlyby_4.sqf:

    sleep 1;
    ambientFly = [getmarkerpos "FlyByStart_2", getMarkerPos "FlyByEnd_2", 200, "FULL", "uns_A1J_HCAS", WEST] call BIS_fnc_ambientFlyBy;
    sleep 3;
    ambientFly = [getmarkerpos "FlyByStart_2", getMarkerPos "FlyByEnd_2", 220, "FULL", "uns_A1J_HCAS", WEST] call BIS_fnc_ambientFlyBy;

     

     


  10. 26 minutes ago, Joe98 said:

    I did find another way and I don't understand this either.   I don't understand the underscore at the beginning.

     

    I have copied this from an old thread by somebody else.

     

    _rNum = selectRandom [1,2,3,4,5];

     

    if ( _rNum == 1 ) then { execVM "script1.sqf"; };

    if ( _rNum == 2 ) then { execVM "script2.sqf"; };

    if ( _rNum == 3 ) then { execVM "script3.sqf"; };

    if ( _rNum == 4 ) then { execVM "script4.sqf"; };

    if ( _rNum == 5 ) then { execVM "script5.sqf"; };

     

     

    Would I place all of that in a script?

     

    .

     

     

     

    @Joe98 I have used same method...this is all in one script. In my case, called from a trigger. AmbientFlyby.sqf:

     

    _rNum = selectRandom [1,2,3,4];

    if ( _rNum == 1 ) then { execVM "AmbientFlyby_1.sqf"; };
    if ( _rNum == 2 ) then { execVM "AmbientFlyby_2.sqf"; };
    if ( _rNum == 3 ) then { execVM "AmbientFlyby_3.sqf"; };
    if ( _rNum == 4 ) then { execVM "AmbientFlyby_4.sqf"; };

     

    Then subsequent AmbientFlyby scripts 1-4 are in the mission file.


  11. On 7/30/2022 at 2:41 AM, Play3r said:

    take a look on this page:

     

    https://community.bistudio.com/wiki/BIS_fnc_stalk 

     

    Ex 2: private _stalking = [grp1, group player, nil, nil, { player distance BIS_Heli < 100 }, "BIS_mrkRetreatMarker"] spawn BIS_fnc_stalk;

     

    Thanks @Play3r. Script (pretty sure I got this from someone in the BI community) I am using for spawning a group and having them stalk works (called from trigger, MP dedicated server):

     

    if !(isServer) exitWith {};

    _spawnPoints = ["marker_LZ1"];
    _unitsInGroup = ["vn_o_men_nva_65_16"];

    _spawnMarker = _spawnpoints select (floor random (count _spawnpoints));

    _unksSpawnPosition = getMarkerPos _spawnMarker; //[x,y,z]

    newGroup = createGroup [east,true];
    _newLeader = "vn_o_men_nva_65_16" createUnit [_unksSpawnPosition,newGroup,"newLeader = this"];
    sleep 1;

    {
        _newUnit = _x createUnit [_unksSpawnPosition,newGroup,"newUnit = this"];
        sleep .4;
    }forEach _unitsInGroup;
    sleep 1;
    newGroup setBehaviour "STEALTH";
    _stalk = [newGroup,group (allPlayers select 0), 300, 200, nil, nil] spawn BIS_fnc_stalk;

     

     

    The idea would be the stalkers get under 200m from players and move to CP marker simulating reporting what they found. I have tried a couple of variants but I don't think I have my mind around identifying the AI and nearest player (BLUFOR) for the purposes of using the "distance" method:

    _stalk = [newGroup,group (allPlayers select 0), 300, 200, {(something defining AI) distance (something identifying nearest player) < 200, "marker_CP"] spawn BIS_fnc_stalk;

     

    Any ideas?

     

     


  12. On 12/23/2021 at 9:06 PM, opusfmspol said:

    // grpB pursues grp1 until all units in grp1 are dead, then returns to base (original start position). B_1_handle = [grpB, grp1,10,0,{[grpB,currentWaypoint grpB] setWaypointType "SAD"; {Alive _x} Count (Units grp1) == 0},(Position Leader grpB)] Spawn BIS_fnc_stalk;

     

    Rather than having grpB eliminate grp1, how do I get grpB to return to base when within 200m of nearest player (using MP dedicated)?


  13. 2 hours ago, pognivet said:

    i really hope you try to keep working on this and adding more features although it already works quite well. i use it more than any other script. with a few tricks using the "INIT=" parameter you can do some pretty interesting things.

    @pognivetI feel the same...this is a go to script on everything I make. Can you give me an example of something you do with the "INIT=" parameter?

×