Jump to content

oksman

Member
  • Content Count

    417
  • Joined

  • Last visited

  • Medals

  • Medals

Community Reputation

17 Good

2 Followers

About oksman

  • Rank
    Gunnery Sergeant

core_pfieldgroups_3

  • Interests
    Boxing and football
  • Occupation
    Student

Contact Methods

  • Biography
    Arma2: Pilot and Editor. My life: Boxing!
  • Youtube
    OksmanToH

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hey BI Forums! Good to be back! So I've been out of the action for some time and I come back a little bit rusty when it comes to MP Coding & Scripting! But I've worked on a way to make missions more dynamic for our group, making it so that if the enemy faction is aware of the player any enemy within X meter of that play will start hunting him. It's currently very crude and only a proof of concept, so fine tuning and all those bits can come later but now I find myself getting some issues that is related to the AI! The code is below, now I'm asking for some help to figure out what happens to the AI groups. The AI seems to stop moving all of a sudden, their group halts even with waypoints added, however when I go into Zeus and create a new waypoint (replacing the scripted ones) they start moving and activate, so that the next round of scripted waypoints work again. Basically I have to "reset" the AI Hunters with Zeus waypoints for them to act on the given scripted waypoints again which makes little sense! Ah the perils of playing with Arma 3 AI, why u so not nice 😄 Any thoughts or help will be much appreciated! You are free to use the script for your missions, haven't found any issues in Singleplayer so if you want to create some survival scenarios then go ahead and use it! Please do credit my script if you have any form of HONOR! Cheers fellas, good to be back with ya! /* How to USE: Script is dynamic, it should launch as soon as first trigger or mission starts depending on your preference. When the enemy faction knows of the players on the ground, all enemy forces in specified radius will start hunting the players. They will not follow if players are extracted via helicopters or hunt helilcopters on their own. Ground vehicles will be hunted. Code to Launch: null = [ENEMYFACTION,RANGE] execVM "Oksman_Dynamic_Hunt.sqf"; Example: null = [WEST,1000] execVM "Oksman_Dynamic_Hunt.sqf"; */ if (hasInterface && !isServer) exitWith {false}; // Ensures only server or HC runs this script - Tack Neky _EnemyFaction = _this select 0; _Range = _this select 1; oks_hunted = false; oks_activated=true; oks_debug=true; publicVariable "oks_hunted"; publicVariable "oks_activated"; publicVariable "oks_debug"; if (oks_debug) then {SystemChat "hunt.sqf started"; "hunt.sqf started" remoteExecCall ["SystemChat"];}; /* * Loop and find out if AllPlayers are KnownTo Enemy Faction. Once known is true, then fill the knownPlayers into Array. * Then for each Enemy Group look for allPlayers if Inside Array & Within Range. If so then Hunt, if not then cancel until next KnownTo Loop? */ OKS_Hunt = { params ["_Player","_PlayerArray"]; /* * This code is run for all known players. Take the player, find the nearest enemies of the players. * When you have the list of all Enemies, run the OKS_Hunting for all enemies near the player. */ _list = _Player nearEntities [["Man", "Car", "Motorcycle", "Tank"], _Range]; _listAir = _Player nearEntities ["Air", _Range + _Range]; _nearenemies = _list select {side _X == _EnemyFaction && isFormationLeader _X;}; { _X setVariable ["isHunting", false]; if !(_X getVariable ["isHunting",false]) then { _X setVariable ["isHunting", true]; [_X,_PlayerArray] call OKS_Hunting; } } foreach _nearenemies; _nearAir = _listAir select {side _X == _EnemyFaction && isFormationLeader _X;}; { _X setVariable ["isHunting", false]; if !(_X getVariable ["isHunting",false]) then { _X setVariable ["isHunting", true]; [_X,_PlayerArray] call OKS_Hunting; } } foreach _nearAir; }; OKS_Hunting = { params ["_Hunter","_PlayerArray"]; /* The Hunter Group is known and the PlayerArray is sent into code. Use the Hunter and the PlayerArray to sort the array Find the nearest target in PlayerArray and hunt that. */ _sorted = [_PlayerArray,[],{_x distance _Hunter},"ASCEND"] call BIS_fnc_sortBy; _nearestPlayer = _sorted select 0; if(oks_debug) then {hint format ["Array: %1\n\nTarget: %2",_sorted,_nearestPlayer]; "Array & Target" remoteExecCall ["SystemChat"];}; /* If Hunter has more than 1 waypoint. Delete, doStop and Reset. */ /// For future use: getVariable ["ACE_isUnconscious", false]; { if(_X getVariable ["ACE_isUnconscious", false]) then{_X setDamage 1;} } foreach units group _Hunter; if(count waypoints group _Hunter>0) then { {deleteWaypoint((waypoints group _Hunter)select 0)}forEach waypoints group _Hunter; if !(Vehicle _Hunter isKindOf "LandVehicle") then { {doStop _X; _X doFollow leader group _X} foreach units group _Hunter; }; }; if(oks_debug) then {SystemChat format ["Nearest Player: %1 Hunter: %2",_nearestPlayer,_Hunter]; "Nearest Player" remoteExecCall ["SystemChat"];}; _wp1 = group _Hunter addWaypoint [position _nearestPlayer, 0]; _wp1 setWaypointType "MOVE"; _wp1 setWaypointSpeed "NORMAL"; group _Hunter setSpeedMode "NORMAL"; if (vehicle _Hunter isKindOf "LandVehicle") then { group _Hunter setBehaviourStrong "SAFE"; } else { group _Hunter setBehaviourStrong "AWARE"; }; group _Hunter setCurrentWaypoint _wp1; if (vehicle _hunter isKindOf "LandVehicle") then { _null = [group _Hunter, position _nearestPlayer, 600] call bis_fnc_taskPatrol; }; if (vehicle _hunter isKindOf "Air") then { _null = [group _Hunter, position _nearestPlayer, 1000] call bis_fnc_taskPatrol; }; if (vehicle _hunter isKindOf "Man") then { _null = [group _Hunter, position _nearestPlayer, 300] call bis_fnc_taskPatrol; }; { _X setWaypointSpeed "FULL"; } foreach waypoints _Hunter; }; while {oks_activated} do { if (oks_debug) then {systemChat "oks_activated True"; "oks_activated TRUE" remoteExecCall ["SystemChat"]; }; _playerHunted = []; /* Original AllPlayers Control for MP { if ((_EnemyFaction knowsAbout _X > 0.5 || _EnemyFaction knowsAbout vehicle _X > 0.5 ) && isTouchingGround (vehicle _X)) then {_playerHunted pushBackUnique _X; oks_hunted = true; if(debug) then {systemChat format ["OKS_Hunted true. KnowsAbout: %1",_EnemyFaction knowsAbout _X]; } sleep 0.5;} } foreach (AllPlayers - (Entities "HeadlessClient_F")) */ /* *Check if EnemyFaction knows about All OPFOR units on Map, if they know about them, add to array _PlayerHunted *Set Hunted to true then oks_debug message the Knowsabout Value. Code below is for ALL units so they can hunt AI for testing purposes otherwise use the above for players only. */ { if (Side _X == WEST &&(_EnemyFaction knowsAbout _X > 0.5 || _EnemyFaction knowsAbout vehicle _X > 0.5 ) && isTouchingGround (vehicle _X)) then {_playerHunted pushBackUnique _X; oks_hunted = true; if (oks_debug) then {systemChat format ["oks_hunted true. KnowsAbout: %1",_EnemyFaction knowsAbout _X]}; "oks_hunted TRUE" remoteExecCall ["SystemChat"]; sleep 0.5;} } foreach AllUnits; if (oks_debug) then {SystemChat Format ["AllPlayers Done. List: %1",_playerHunted]; "AllPlayers Done" remoteExecCall ["SystemChat"]; }; /* *If a target is above 0.5 & isTouchinGround then Hunted is true. Initiate the OKS_Hunt for all Players in _PlayerHunted AKA all players known to enemy faction. */ if (oks_hunted) then { if (oks_debug) then {systemChat "Initiated Hunted"; "Initiated Hunted" remoteExecCall ["SystemChat"]; }; { if (alive _X && !(_x getVariable ["ACE_isUnconscious", false])) then { [_X,_playerHunted] call OKS_Hunt; } } foreach _playerHunted; }; sleep 60; }; OKS_Hunting = { params ["_TargetArray", "_Hunter"]; if(count waypoints _Hunter>0) then { {deleteWaypoint((waypoints _Hunter)select 0)}forEach waypoints _Hunter; {doStop _X; _X doFollow leader group _X} foreach units group _Hunter; }; _sorted = [_TargetArray,[],{_x distance _Hunter},"ASCEND"] call BIS_fnc_sortBy; _nearestunit = _sorted select 0; hint format ["Array: %1 Target: %2",_sorted,_nearestunit]; //{deleteWaypoint[group _Hunter,_X]}forEach waypoints _Hunter; SystemChat format ["Test: %1 %2",_nearestunit,_Hunter]; _wp1 = group _Hunter addWaypoint [position _nearestunit, 0]; _wp1 setWaypointType "MOVE"; _wp1 setWaypointSpeed "NORMAL"; group _Hunter setSpeedMode "NORMAL"; group _Hunter setBehaviourStrong "AWARE"; group _Hunter setCurrentWaypoint _wp1; _null = [group _Hunter, position _Target, 300] call bis_fnc_taskPatrol; {_X setWaypointSpeed "FULL"; _X setWaypointBehaviour "AWARE"; } foreach waypoints _Hunter; {_X setBehaviour "AWARE"; } foreach units group _Hunter; };
  2. Hey guys, got a question regarding DAC. I can't seem to spawn infantry, when I spawn infantry the leaders are created but the group doesn't populate. If I move close it still remains the same, however when doing it with motorized or vehicles in general it works fine. Activation Game Logic Type None Repeatable Condition (Time > 5) This is my onAct fun = ["z1",[1,0,0],[6,5,50,7],[1,3,10,10],[],[],[2,2,2,2,2]] spawn DAC_Zone Anyone got any clues? After a while the groups join each other I'm guessing because of lack of units in the team. Please help! Want to use the DAC gods to make missions!
  3. oksman

    Arma3 Videos

  4. oksman

    Arma3 Videos

  5. oksman

    Arma3 Videos

  6. oksman

    Arma3 Videos

    Collected a few videos since last! Enjoy and subscribe if you want more :D
  7. oksman

    Arma3 Videos

  8. oksman

    Arma3 Videos

  9. oksman

    Arma3 Videos

  10. oksman

    Arma3 Videos

  11. oksman

    Arma3 Videos

    Part 2! Also flashback to some older missions GOL played, some seriously funny bugs on the Kunduz Island :)
  12. oksman

    Arma3 Videos

  13. oksman

    Arma3 Videos

×