Jump to content
duda123

Advanced AI Command

Recommended Posts

Just now, duda123 said:

 

Getting the errors when groups die?

At the start of a mission. Doing some testing on our template. When hosting a multiplayer server, these are logged in the RPT file. There is some INS_Revive errors too. I added to your GitHub.

Share this post


Link to post
Share on other sites

Found an issue with the AIC command_radio not spawning on top of the USS Freedom using the marker.

 

Duda, how can we fix this?

 

Reed

Share this post


Link to post
Share on other sites

Hey Duda, I've noticed this mod only works when you play as Bluefor. I've played against bluefor and have been able to control the enemy bluefor units and not mine (Opfor). Is this something you know about? Anyone else having this issue? Thanks

Share this post


Link to post
Share on other sites

Anyone know if Duda is still working on this? Does it still work as I'm having trouble getting the mod to work on 1.70 

 

 

Edit- My apologies I found on Steampage about middle mouse button, now everything works... awesome...Love this mod Duda

Edited by Rockapes
Found solution

Share this post


Link to post
Share on other sites

Not actively working on this mod at the moment.

Share this post


Link to post
Share on other sites
On ‎6‎/‎9‎/‎2017 at 0:49 AM, Rockapes said:

Anyone know if Duda is still working on this? Does it still work as I'm having trouble getting the mod to work on 1.70 

 

 

Edit- My apologies I found on Steampage about middle mouse button, now everything works... awesome...Love this mod Duda

 

 

What was the fix??  I love this mod? Old made missions still work when I call them up. But any new made missions since last patch....I cannot control other units in map mode now.  No matter what key I push  (or mouse) it won't select any of the options for other AI units.   What is the fix?  Much appreciated.

Share this post


Link to post
Share on other sites

Odd since last update. This works on it's own. But no longer works if I used a long time used HOUSE PATROL script.   If I use older used saved missions (with same patrol script) it works.  But any new created missions in which this patrol script is used. This won't work. It won't allow me to give any orders to friendly AI units (though they all show up in map mode).    This patrol script is below (sorry, not attaced to this one).   I can't seem to find a conflict but certainly is one with latest update and these two together.

Share this post


Link to post
Share on other sites
/*===========================================================================================
 Random House Patrol Script v2.2 for Arma 3
 by Tophe of Östgöta Ops [OOPS]
 Contact & bugreport: BIS forums
=============================================================================================
HOW TO USE:
Place unit close to a house and put this in the init field: 
guard = [this] execVM "HousePatrol.sqf"

OPTIONAL SETTINGS:
guard = [this, MODE, STAND TIME, EXCLUDED POS, STARTING POS, DEBUG] execVM "HousePatrol.sqf"
* BEHAVIOUR - set unit behaviour.
 guard = [this,"COMBAT"] execVM "HousePatrol.sqf"
 
 Options: CARELESS, SAFE, AWARE, COMBAT, STEALTH
 Default: SAFE
* STAND TIME - Set maximum amount of seconds the unit will wait before moving to next waypoint.
 guard = [this,"SAFE",50] execVM "HousePatrol.sqf"
  
 Options: Any value in seconds. 0 = continuous patrol.
 Default: 30
* EXCLUDED POSITIONS - exclude certain building positions from patrol route.
 guard = [this,"SAFE",30, [5,4]] execVM "HousePatrol.sqf"
 
 Options: Array of building positions
 Default: [] (no excluded positions)
 
* STARTING POS - Some building positions doesn't work well will the setPos command.
 Here you may add a custom starting pos. Negative number means starting pos will be randomized.
 guard = [this,"SAFE",30, [5,4], 2] execVM "HousePatrol.sqf"
 Options: Any available building position
 Default: -1 (random)
* STANCE - Tell the unit what stance to use.
 To keep the unit from going prone you can set this to MIDDLE or UP.
 AUTO will be the standard behaviour and unit will crawl around in combat mode.
 HIGH is the default mode. This is like AUTO but prone position is excluded.
 
 Options: UP, DOWN, MIDDLE, AUTO, HIGH
 Default: HIGH
 
* DEBUG - Use markers and chatlog for mission design debugging.
 guard = [this,"SAFE",30, [], -1, true] execVM "HousePatrol.sqf"  
 
 Options: true/false
 Default: false
===========================================================================================*/
if (!isServer) exitWith {};
sleep random 1;
// Set variables
_unit     = _this select 0;
_behaviour    = if (count _this > 1) then {toUpper(_this select 1)} else {"SAFE"};
_maxWaitTime   = if (count _this > 2) then {_this select 2} else {30};
_excludedPositions  = if (count _this > 3) then {_this select 3} else {[]};
_startingPos   = if (count _this > 4) then {_this select 4} else {-1};
_stance    = if (count _this > 5) then {toUpper(_this select 5)} else {"HIGH"};
_debug     = if (count _this > 6) then {_this select 6} else {false};
_position = getPos _unit;
_house = nearestBuilding _unit;
_numOfBuildingPos = 0;
_currentBuildingPos = 0;
_lastBuildingPos = 0;
_waitTime = 0;
_timeout = 0;
_behaviours = ["CARELESS", "SAFE", "AWARE", "COMBAT", "STEALTH"];
_stances = ["UP", "DOWN", "MIDDLE", "AUTO", "HIGH"];
_name = vehicleVarName _unit;

if (isNil _name) then
{
 _name = format["Guard x%1y%2", floor (_position select 0), floor (_position select 1)]
};
// Set behaviour of unit
if (_behaviour in _behaviours) then
{
 _unit setBehaviour _behaviour;
}
else
{
 _unit setBehaviour "SAFE";
};

// Set unit stance
if (_stance == "HIGH") then
{
 _stanceCheck =
 {
  _unit = _this select 0;
  while {alive _unit} do
  {
   if (unitPos _unit == "DOWN") then
   {
    if (random 1 < 0.5) then {_unit setUnitPos "MIDDLE"} else {_unit setUnitPos "UP"};    
    sleep random 5;
    _unit setUnitPos "AUTO";
   };
  };
 };
 [_unit] spawn _stanceCheck;
}
else
{
 if (_stance in _stances) then {
  _unit setUnitPos _stance;
 }
 else {
  _unit setBehaviour "UP";
 };
};

// Find number of positions in building
while {format ["%1", _house buildingPos _numOfBuildingPos] != "[0,0,0]"} do {
 _numOfBuildingPos = _numOfBuildingPos + 1;
};
// DEBUGGING - Mark house on map, mark building positions ingame, broadcast information
if (_debug) then {
 for [{_i = 0}, {_i <= _numOfBuildingPos}, {_i = _i + 1}] do {
  if (!(_i in _excludedPositions)) then { 
   _arrow = "Sign_Arrow_F" createVehicle (_house buildingPos _i);
   _arrow setPos (_house buildingpos _i);
  };
 };
 player globalChat format["%1 - Number of available positions: %2", _name, _numOfBuildingPos];
 if (count _excludedPositions > 0) then
 {
  player globalChat format["%1 - Excluded positions: %2", _name, _excludedPositions];
 };
 
 _marker = createMarker [_name, position _unit];
 _marker setMarkerType "mil_dot";
 _marker setMarkerText _name;
 _marker setMarkerColor "ColorGreen";
};
// Put unit at random starting pos.
while {_startingPos in _excludedPositions || _startingPos < 0} do {
 _startingPos = floor(random _numOfBuildingPos);
};
if (_startingPos > _numOfBuildingPos - 1) then {
 _startingPos = _numOfBuildingPos - 1
};
if (_numOfBuildingPos > 0) then {
 _unit setPos (_house buildingPos _startingPos);
 _unit setPos (getPos _unit);
};
// DEBUGGING - broadcast starting position
if (_debug) then {
 player globalChat format["%1 - starting at building pos %2", _name, _startingPos]
};
// Have unit patrol inside house
while {alive _unit && (_numOfBuildingPos - count _excludedPositions) > 0} do {
 if (_numOfBuildingPos < 2) exitWith {};
 
 while {_lastBuildingPos == _currentBuildingPos || _currentBuildingPos in _excludedPositions} do {
  _currentBuildingPos = floor(random _numOfBuildingPos);
 };
 
 _waitTime = floor(random _maxWaitTime);
 _unit doMove (_house buildingPos _currentBuildingPos);
 _unit moveTo (_house buildingPos _currentBuildingPos);
 sleep 0.5;
 _timeout = time + 50;
 waitUntil {moveToCompleted _unit || moveToFailed _unit || !alive _unit || _timeout < time}; 
 if (_timeout < time) then {_unit setPos (_house buildingPos _currentBuildingPos)};
 
 // DEBUGGING - move marker to new position
 if (_debug) then {
  _name setMarkerPos position _unit;
  _text = format["%1: moving to pos %2", _name, _currentBuildingPos];
  _name setMarkerText _text;
 };
 
 sleep _waitTime;
 _lastBuildingPos = _currentBuildingPos;
};
// DEBUGGING - Change marker color if script ends
if (_debug) then {
 player globalChat format["%1 - ended house patrol loop", _name];
 _name setMarkerColor "ColorRed";
};

Share this post


Link to post
Share on other sites
On 2017-6-11 at 4:58 AM, tmp95 said:

 

 

What was the fix??  I love this mod? Old made missions still work when I call them up. But any new made missions since last patch....I cannot control other units in map mode now.  No matter what key I push  (or mouse) it won't select any of the options for other AI units.   What is the fix?  Much appreciated.

 

Middle mouse button ( selecting orders etc ) got everything working for me, but you can change it in the settings / controls / command (from memory ). As for not working on new missions I cant help you there as every new mission I create it works fine, although the AI themselves sometimes don't like following orders but don't think its related to AIC.

Share this post


Link to post
Share on other sites

Hey Duda,

 

I know your not fully working on this mod at the moment but I was wondering based on the information on first page, using init.sqf can we add a menu option, posible  to change / manage group stances?

 

Thanks

 

 

Share this post


Link to post
Share on other sites
3 hours ago, Rockapes said:

Hey Duda,

 

I know your not fully working on this mod at the moment but I was wondering based on the information on first page, using init.sqf can we add a menu option, posible  to change / manage group stances?

 

Thanks

 

 

 

Yes, here's how the speed menu item is added and implemented. You can modify this and drop it into your init.sqf file.

 

AIC_fnc_addCommandMenuAction params are documented here:

https://github.com/sethduda/AIC/blob/master/AICommand/functions/commandMenu/fn_addCommandMenuAction.sqf

 

AIC_fnc_setGroupSpeedActionHandler = {
	params ["_menuParams","_actionParams"];
	_menuParams params ["_groupControlId"];
	private ["_group"];
	_group = AIC_fnc_getGroupControlGroup(_groupControlId);
	_actionParams params ["_speed","_label"];
	[_group,_speed] remoteExec ["setSpeedMode", leader _group]; 
	hint ("Speed set to " + _label);
};	
		
["GROUP","Half Speed",["Set Group Speed"],AIC_fnc_setGroupSpeedActionHandler,["LIMITED", "Half Speed"]] call AIC_fnc_addCommandMenuAction;
["GROUP","Full Speed (In Formation)",["Set Group Speed"],AIC_fnc_setGroupSpeedActionHandler,["NORMAL", "Full Speed (In Formation)"]] call AIC_fnc_addCommandMenuAction;
["GROUP","Full (No Formation)",["Set Group Speed"],AIC_fnc_setGroupSpeedActionHandler,["FULL", "Full (No Formation)"]] call AIC_fnc_addCommandMenuAction;	

 

You can see how all of the action menus are implemented here:

 

https://github.com/sethduda/AIC/blob/master/AICommand/functions/actions/fn_commandMenuActionsInit.sqf

 

 

Share this post


Link to post
Share on other sites
6 hours ago, duda123 said:

 

Yes, here's how the speed menu item is added and implemented. You can modify this and drop it into your init.sqf file.

 

AIC_fnc_addCommandMenuAction params are documented here:

https://github.com/sethduda/AIC/blob/master/AICommand/functions/commandMenu/fn_addCommandMenuAction.sqf

 


AIC_fnc_setGroupSpeedActionHandler = {
	params ["_menuParams","_actionParams"];
	_menuParams params ["_groupControlId"];
	private ["_group"];
	_group = AIC_fnc_getGroupControlGroup(_groupControlId);
	_actionParams params ["_speed","_label"];
	[_group,_speed] remoteExec ["setSpeedMode", leader _group]; 
	hint ("Speed set to " + _label);
};	
		
["GROUP","Half Speed",["Set Group Speed"],AIC_fnc_setGroupSpeedActionHandler,["LIMITED", "Half Speed"]] call AIC_fnc_addCommandMenuAction;
["GROUP","Full Speed (In Formation)",["Set Group Speed"],AIC_fnc_setGroupSpeedActionHandler,["NORMAL", "Full Speed (In Formation)"]] call AIC_fnc_addCommandMenuAction;
["GROUP","Full (No Formation)",["Set Group Speed"],AIC_fnc_setGroupSpeedActionHandler,["FULL", "Full (No Formation)"]] call AIC_fnc_addCommandMenuAction;	

 

You can see how all of the action menus are implemented here:

 

https://github.com/sethduda/AIC/blob/master/AICommand/functions/actions/fn_commandMenuActionsInit.sqf

 

 

 

Thanks Duda,

 

I don't know much bout scripting but I think I tried all that correctly and couldn't get it to work, this is what I put in my init.sqf

 

AIC_fnc_setGroupStanceActionHandler = {
    params ["_menuParams","_actionParams"];
    _menuParams params ["_groupControlId"];
    private ["_group"];
    _group = AIC_fnc_getGroupControlGroup(_groupControlId);
    _actionParams params ["_stance","_label"];
    [_group,_stance] remoteExec ["setUnitPos", leader _group]; 
    hint ("Stance set to " + _label);
};    
        
["GROUP","Stand",["Set Group Stance"],AIC_fnc_setGroupStanceActionHandler,["UP", "Stand"]] call AIC_fnc_addCommandMenuAction;
["GROUP","Crouch",["Set Group Stance"],AIC_fnc_setGroupStanceActionHandler,["MIDDLE", "Crouch"]] call AIC_fnc_addCommandMenuAction;
["GROUP","Prone",["Set Group Stance"],AIC_fnc_setGroupStanceActionHandler,["DOWN", "Prone"]] call AIC_fnc_addCommandMenuAction;
["GROUP","Auto",["Set Group Stance"],AIC_fnc_setGroupStanceActionHandler,["AUTO", "Auto"]] call AIC_fnc_addCommandMenuAction;

 

Your help is appreciated and thanks again

Share this post


Link to post
Share on other sites
2 minutes ago, Rockapes said:

 

Thanks Duda,

 

I don't know much bout scripting but I think I tried all that correctly and couldn't get it to work, this is what I put in my init.sqf

 

AIC_fnc_setGroupStanceActionHandler = {
    params ["_menuParams","_actionParams"];
    _menuParams params ["_groupControlId"];
    private ["_group"];
    _group = AIC_fnc_getGroupControlGroup(_groupControlId);
    _actionParams params ["_stance","_label"];
    [_group,_stance] remoteExec ["setUnitPos", leader _group]; 
    hint ("Stance set to " + _label);
};    
        
["GROUP","Stand",["Set Group Stance"],AIC_fnc_setGroupStanceActionHandler,["UP", "Stand"]] call AIC_fnc_addCommandMenuAction;
["GROUP","Crouch",["Set Group Stance"],AIC_fnc_setGroupStanceActionHandler,["MIDDLE", "Crouch"]] call AIC_fnc_addCommandMenuAction;
["GROUP","Prone",["Set Group Stance"],AIC_fnc_setGroupStanceActionHandler,["DOWN", "Prone"]] call AIC_fnc_addCommandMenuAction;
["GROUP","Auto",["Set Group Stance"],AIC_fnc_setGroupStanceActionHandler,["AUTO", "Auto"]] call AIC_fnc_addCommandMenuAction;

 

Your help is appreciated and thanks again

 

Do you get the action added to the command menu, but it has no effect when you select it? Or, does it not even show up in the command menu?

Share this post


Link to post
Share on other sites
3 minutes ago, duda123 said:

 

Do you get the action added to the command menu, but it has no effect when you select it? Or, does it not even show up in the command menu?

 

Don't even get a menu option....So I have the info correct I guess..

 

I haven't PBO'd the test mission just testing from editor, not sure if that makes a difference

Share this post


Link to post
Share on other sites
2 minutes ago, Rockapes said:

 

Don't even get a menu option....So I have the info correct I guess..

 

Well, your use of setUnitPos won't work (since it need to be executed for each unit). However, not sure why you wouldn't even see the menu item. You sure it's actually executing your code? Try running your code from the debug window after you're already in-game.

Share this post


Link to post
Share on other sites
6 minutes ago, duda123 said:

 

Well, your use of setUnitPos won't work (since it need to be executed for each unit). However, not sure why you wouldn't even see the menu item. You sure it's actually executing your code? Try running your code from the debug window after you're already in-game.

 

I cant get the menu option even by using debug console..I'm guessing there's probably no point anyways now as I couldn't find anything to change group stance, all seems to be related to as you said individual units..

 

Share this post


Link to post
Share on other sites
Just now, Rockapes said:

 

I cant get the menu option even by using debug console..I'm guessing there's probably no point anyways now as I couldn't find anything to change group stance, all seems to be related to as you said individual units..

 

 

Getting setUnitPos to work isn't too hard - this should do it:

 

[[_group, _stance], {
    params ["_group", "_stance"];
    { _x setUnitPos _stance } forEach units _group;
}] remoteExec ["spawn", groupOwner _group];

 

Just gotta figure out why your menu isn't updating.

Share this post


Link to post
Share on other sites
7 minutes ago, duda123 said:

 

Getting setUnitPos to work isn't too hard - this should do it:

 

[[_group, _stance], {
    params ["_group", "_stance"];
    { _x setUnitPos _stance } forEach units _group;
}] remoteExec ["spawn", groupOwner _group];

 

Just gotta figure out why your menu isn't updating.

 

Its got me beat, but I appreciate your help all the same

Share this post


Link to post
Share on other sites
18 minutes ago, Rockapes said:

 

Its got me beat, but I appreciate your help all the same

 

Here's a working version. Put this in your init.sqf file.

 

#include "\AICommand\functions\functions.h"

AIC_fnc_setGroupStanceActionHandler = {
    params ["_menuParams","_actionParams"];
    _menuParams params ["_groupControlId"];
    private ["_group"];
    _group = AIC_fnc_getGroupControlGroup(_groupControlId);
    _actionParams params ["_stance","_label"];
	[[_group, _stance], {
		params ["_group", "_stance"];
		{ _x setUnitPos _stance } forEach units _group;
	}] remoteExec ["spawn", groupOwner _group];
    hint ("Stance set to " + _label);
};    
        
["GROUP","Stand",["Set Group Stance"],AIC_fnc_setGroupStanceActionHandler,["UP", "Stand"]] call AIC_fnc_addCommandMenuAction;
["GROUP","Crouch",["Set Group Stance"],AIC_fnc_setGroupStanceActionHandler,["MIDDLE", "Crouch"]] call AIC_fnc_addCommandMenuAction;
["GROUP","Prone",["Set Group Stance"],AIC_fnc_setGroupStanceActionHandler,["DOWN", "Prone"]] call AIC_fnc_addCommandMenuAction;
["GROUP","Auto",["Set Group Stance"],AIC_fnc_setGroupStanceActionHandler,["AUTO", "Auto"]] call AIC_fnc_addCommandMenuAction;

 

Share this post


Link to post
Share on other sites
4 minutes ago, duda123 said:

 

Here's a working version:

 


#include "\AICommand\functions\functions.h"

AIC_fnc_setGroupStanceActionHandler = {
    params ["_menuParams","_actionParams"];
    _menuParams params ["_groupControlId"];
    private ["_group"];
    _group = AIC_fnc_getGroupControlGroup(_groupControlId);
    _actionParams params ["_stance","_label"];
	[[_group, _stance], {
		params ["_group", "_stance"];
		{ _x setUnitPos _stance } forEach units _group;
	}] remoteExec ["spawn", groupOwner _group];
    hint ("Stance set to " + _label);
};    
        
["GROUP","Stand",["Set Group Stance"],AIC_fnc_setGroupStanceActionHandler,["UP", "Stand"]] call AIC_fnc_addCommandMenuAction;
["GROUP","Crouch",["Set Group Stance"],AIC_fnc_setGroupStanceActionHandler,["MIDDLE", "Crouch"]] call AIC_fnc_addCommandMenuAction;
["GROUP","Prone",["Set Group Stance"],AIC_fnc_setGroupStanceActionHandler,["DOWN", "Prone"]] call AIC_fnc_addCommandMenuAction;
["GROUP","Auto",["Set Group Stance"],AIC_fnc_setGroupStanceActionHandler,["AUTO", "Auto"]] call AIC_fnc_addCommandMenuAction;

 

 

Wow, that's awesome, works like a treat. I am not gonna pretend I understand half of it but it works like a dream. Thanks very much Duda. Appreciate all the help, and again love all your mods. My son especially loves your ATS mod

Share this post


Link to post
Share on other sites

Since 1.70 Update.  This fantastic mod only works if I place a limited # of enemy on the map. Once I place a certain amount (say 30 + enemy) I can no longer control my BluFor groups. I can click on them, the issue order pop up appears but once I click on set waypoints (or set formation) it goes right away and wont issue orders.  Works fine with only a limited number of enemies placed. But once I hit a threshold my BluFor units are unable to take orders. ??

Share this post


Link to post
Share on other sites

If we could make the guy inside not to land and get out,whenever we issue squad command ,we could make them stay inside and kick-out sideways and set speed and altitude,we could get a awesome tool for helicopter pilots to direct movie-style missions.!

Combat Formations System has what I`m after-but I would need the pilot to stay inside if all aircraft.

 

Soo hope to get that into this mod-and preferably get this to work well with C2 Command and Control mod  aswell.

 

Thank you for all you`re effort and time doing this. 

Share this post


Link to post
Share on other sites
12 minutes ago, john1 said:

If we could make the guy inside not to land and get out,whenever we issue squad command ,we could make them stay inside and kick-out sideways and set speed and altitude,we could get a awesome tool for helicopter pilots to direct movie-style missions.!

Combat Formations System has what I`m after-but I would need the pilot to stay inside if all aircraft.

 

Soo hope to get that into this mod-and preferably get this to work well with C2 Command and Control mod  aswell.

 

Thank you for all you`re effort and time doing this. 

 

What do you mean by "If we could make the guy inside not to land and get out,whenever we issue squad command"?

 

Which command are you issuing?

Share this post


Link to post
Share on other sites

I`m trying to get the helicopter pilot to position himself where I tell him and then follow me at a set speed (that I need to be at walking speed) or set that speed very accuratly and force him to remain in helo and be able to position him side to me or even -if possible-form Wedge and be able to set one helo  slightly above and to the side of the first one.

 

If possible -add all Formations to make them "connected" 2 and 2 and 4 and 4.As a menu item,"Fly wingman formation" or such.

 

If possible also add a "Shoot my target" and "Other target" order.

 

It would be neat,now when ai-pilots don`t fear taking fire-to force a "Stay in place at all cost"-order was possible.Then add a script that makes anyone inside a set distance be teleported inside helo,as a CESAR-helicopter.

 

This is what I want-but he lands and get out.And I can`t issue that kind of precise commands that I need ,want this way more than setting up a Static weapon Feature or Arty commands and such,thank you for you`re effort on this mod.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×