Jump to content
samir17864

Playing official campaign Solo with AI units

Recommended Posts

Hello everyone,

 

I just wanted to say that playing the official campaign as single player might drive you crazy, due to the difficulty to pinpoint the location of the AI units firing on you ... We all know there is unfair side in ArmA regarding: the AI units are being able to spot you, while you - as real human player - being lost trying to spot them in return ... I made a small script (inspired by Killzone_Kid work in HERE) so that I can easily pinpoint the AI player shooting.

 

{  
	if (side _x != west) then 
	{
		_x addEventHandler ["Fired", { plyr = _this select 0; }];
	};
} forEach allUnits; 
 
addMissionEventHandler ["Draw3D", {  
    drawIcon3D [  
        "\A3\ui_f\data\map\markers\military\triangle_CA.paa",  
        [1,1,1,1],  
        [  
            (visiblePosition plyr) select 0,  
            (visiblePosition plyr) select 1,   
            3  
        ],  
        1,  
        1,  
        180,  
        "",  
        1,  
        0.03,   
        "PuristaLight",
        "",
        true
    ];  
}]; 

When you play the official campaign  alone as single player: press ESC and in the Debug Console copy and past the above code and then click on LOCAL EXEC ... Test it and see if it works for you. :f:

 

I know, some people might say: Hay! This is cheating and going to ruin the game ... I know ... I agree ... But, come on guys, the above script will just help someone to play fair with these crazy bots that can spot you like a hawk.

  • Thanks 2
  • Haha 1

Share this post


Link to post
Share on other sites

BTW,

 

I am not good in scripting ... I hope someone can develop the above code to do this:

 

1- The AI unit who is shooting  will be marked and the marker remains on it ... So there will be MANY markers to pinpoint all the AI units shooting.

2- The marker remains for only 30 seconds, after that, it will disappear.

3- The marker will be removed once the AI unit is dead.

4- An option to select the side of the AI unites needed to be marked (All - BLUFOR only - OPFOR only - RESISTANCE only).

5- An option to mark all civilians in a range of 500 meters (of course without the need for the "Fired" event handler) ... This is important, so the player can avoid shooting civilians.

6- An option to switch this whole feature on/off, so it will be up to the player to use it or not to use it.

 

I am sure there are very skilled programmers who can make this as a mod ... I have no idea if there is such mod already exist or not.

 

Edited by samir17864
correcting

Share this post


Link to post
Share on other sites

This is a better version:

 

1- The markers will now remain on shooting units (it will not jump from one unit to another).

2- The markers will show the distance between you (as human player) and other shooting units.
3- Hostile units will have red color marker .... While friendly units will have blue marker.

4- When the unit dies, the marker will disappear.

5- There is a hint showing your current health and your current stamina.

 

Please try it, test it, and please let me know if it works for you:

 

onEachFrame 
{ 
_health = getDammage player;
_stamina = getFatigue player;
hintSilent parseText format["Health: %1  -  Stamina: %2",(((1-_Health)*100)-((1-_Health)*100 mod 1)),(((1-_stamina)*100)-((1-_stamina)*100 mod 1))];
};

ENMYS = [];
FRNDS = [];
{   
 if (side _x != playerSide) then
 { 
  _x addEventHandler ["Fired", { ENMYS pushBack (_this select 0); }]; 
 } else {
  _x addEventHandler ["Fired", { FRNDS pushBack (_this select 0); }]; 
 }; 
} forEach allUnits;  
  
addMissionEventHandler ["Draw3D", {   

{
if (alive _x)  then {
drawIcon3D [   
"\A3\ui_f\data\map\markers\military\triangle_CA.paa",   
        [1,0,0,1],   
        [   
            (visiblePosition _x) select 0,   
            (visiblePosition _x) select 1,    
            2   
        ],   
        0.7,   
        0.7,   
        180,   
        str(ceil([(visiblePosition player) select 0,(visiblePosition player) select 1,0] distance [(visiblePosition _x) select 0,(visiblePosition _x) select 1,0])-2),
        0,   
        0.03,    
        "PuristaLight", 
        "center", 
        true 
    ];
};
} forEach ENMYS;

{
if (alive _x)  then {
drawIcon3D [   
"\A3\ui_f\data\map\markers\military\triangle_CA.paa",   
        [0,0,1,1],   
        [   
            (visiblePosition _x) select 0,   
            (visiblePosition _x) select 1,    
            2   
        ],   
        0.7,   
        0.7,   
        180,   
        str(ceil([(visiblePosition player) select 0,(visiblePosition player) select 1,0] distance [(visiblePosition _x) select 0,(visiblePosition _x) select 1,0])-2),
        0,   
        0.03,    
        "PuristaLight", 
        "center", 
        true 
    ];
};
} forEach FRNDS;

}];

:f:

There will be new version coming soon ... Please, can someone help me to change this to a mod !!

 

  • Like 1

Share this post


Link to post
Share on other sites

You could try TPW Mods: 

One of the many features of this mod is the so-called HUD which puts tactical glasses into your inventory. If you put them on you can get a lot of info about friends and foes. 

  • Like 1

Share this post


Link to post
Share on other sites

This is improved version ... Now, I added an option to switch this whole thingy on/off ... Press Ctrl+Insert to toggle it  ON or OFF (meaning: it is up to the player to use this feature, or not to use it).

waituntil {!(IsNull (findDisplay 46))};     
actv=true;     
_keyDown = (findDisplay 46) displayAddEventHandler ["KeyDown", "(if (_this select 1 == 210 && _this select 3) then {actv=!actv;})"];    
  
OTHRS = [];   
FRNDS = [];   

onEachFrame    
{    
 _health = getDammage player;   
 _stamina = getFatigue player;
 hintSilent parseText format["Health: %1  -  Stamina: %2",(((1-_Health)*100)-((1-_Health)*100 mod 1)),(((1-_stamina)*100)-((1-_stamina)*100 mod 1))];
 {      
  if (!(_x getVariable ["added_EV",false])) then {  
   if (faction _x == "BLU_F") then { _x addEventHandler ["Fired", { FRNDS pushBack (_this select 0); }]; };   
   if (faction _x == "BLU_G_F") then { _x addEventHandler ["Fired", { FRNDS pushBack (_this select 0); }]; };   
   if (faction _x == "OPF_F") then { _x addEventHandler ["Fired", { OTHRS pushBack (_this select 0); }]; };   
   if (faction _x == "OPF_G_F") then { _x addEventHandler ["Fired", { OTHRS pushBack (_this select 0); }]; };   
   if (faction _x == "IND_F") then { _x addEventHandler ["Fired", { OTHRS pushBack (_this select 0); }]; };   
   if (faction _x == "IND_G_F") then { _x addEventHandler ["Fired", { OTHRS pushBack (_this select 0); }]; };   
   _x setVariable ["added_EV",true];  
  };  
 } forEach allUnits;  
}; 
   
addMissionEventHandler ["Draw3D", {      
{   
if (alive _x && actv)  then {   
drawIcon3D [      
"\A3\ui_f\data\map\markers\military\triangle_CA.paa",      
        [1,0,0,1],      
        [      
            (visiblePosition _x) select 0,      
            (visiblePosition _x) select 1,       
            2      
        ],      
        0.7,      
        0.7,      
        180,      
        str(ceil([(visiblePosition player) select 0,(visiblePosition player) select 1,0] distance [(visiblePosition _x) select 0,(visiblePosition _x) select 1,0])-2),   
        0,      
        0.03,       
        "PuristaLight",    
        "center",    
        true    
    ];   
};   
} forEach OTHRS;   
   
{   
if (alive _x && actv)  then {   
drawIcon3D [      
"\A3\ui_f\data\map\markers\military\triangle_CA.paa",      
        [0,0,1,1],      
        [      
            (visiblePosition _x) select 0,      
            (visiblePosition _x) select 1,       
            2      
        ],      
        0.7,      
        0.7,      
        180,      
        str(ceil([(visiblePosition player) select 0,(visiblePosition player) select 1,0] distance [(visiblePosition _x) select 0,(visiblePosition _x) select 1,0])-2),   
        0,      
        0.03,       
        "PuristaLight",    
        "center",    
        true    
    ];   
};   
} forEach FRNDS;   
     
}];

 

  • Thanks 1

Share this post


Link to post
Share on other sites
1 hour ago, Alpha-Kilo said:

You could try TPW Mods: 

One of the many features of this mod is the so-called HUD which puts tactical glasses into your inventory. If you put them on you can get a lot of info about friends and foes. 


Hello Alpha-Kilo, thank you for the info.

 

 

11 hours ago, GEORGE FLOROS GR said:

Hello there samir !

 

Check here:

 

 

 

Hello GEORGE FLOROS GR, I appreciate your reply, however, I will keep searching for a step by step tutorial on how to make a script into a mod.

  • Like 1

Share this post


Link to post
Share on other sites
10 hours ago, froggyluv said:

MGI mod by Pierre has a red cursor flash that lets you know where enemies are shooting at you from

 

https://steamcommunity.com/sharedfiles/filedetails/?id=673533220

 

 

So nice ... Thank you froggyluv for guiding me to that mod ... I made the above code so that I can get some reasonable balance between real human player and the in game AI units. Right now, it is very simple: just copy and paste the above code in the Debug Console and click LOCAL EXEC and you are good to go, the marker will not show until the unit shoot, once the unit shoot a bullet, its location will be discovered and marked with a small triangle with the distance between the human player and that unit (blue color for friendly units,  red color for opposing units). The player can switch on/off this feature by pressing Ctrl+Insert.

 

This thing can be debatable. Someone can say: Arma is a military war simulation application (game), and the above code will make the "game" unrealistic!! Because, in real battle, soldiers will NOT have such markers ... In my first post, I already said: (( I know ... I agree )) ... When it comes to realism, the question will be: Are all these mods we add to the vanilla "game", are they realistic??

Share this post


Link to post
Share on other sites

I still don't know how to DELETE the icons created by the command drawIcon3D ... removeMissionEventHandler seems to be not helping in the above code ... My question is:

 

Is there a command that will permanently delete the icons (images) created by drawIcon3D ??

Share this post


Link to post
Share on other sites

removeMissionEventHandler seems to be not helping in the above code

 

It does work as I use it for something similar -can you show how you are using it?

Share this post


Link to post
Share on other sites
16 hours ago, froggyluv said:

removeMissionEventHandler seems to be not helping in the above code

 

It does work as I use it for something similar -can you show how you are using it?

 

Hello froggyluv,

 

Never mind, it is my mistake ... I am new to the scripting in ArmA ... Would you please test this new script:

actv = true;
markrs = "Markers active";
MEH_added = false;
_keyDown = (findDisplay 46) displayAddEventHandler ["KeyDown", "(if (_this select 1 == 210 && _this select 3) then {actv=!actv;})"];


onEachFrame
{
	_health = getDammage player;
	_stamina = getFatigue player;
	hintSilent parseText format["Health: %1  -  Stamina: %2 <br/> %3",(((1-_Health)*100)-((1-_Health)*100 mod 1)),(((1-_stamina)*100)-((1-_stamina)*100 mod 1)),markrs];
	if (!actv) then
	{
		markrs = "Markers not active";
		removeMissionEventHandler ["Draw3D",MEH_idx];
		MEH_added = false;
	} else {
		if (!MEH_added) then
		{
			MEH_idx = addMissionEventHandler ["Draw3D", {

			{
				if ((faction _x == "OPF_F" OR faction _x == "OPF_G_F" OR faction _x == "IND_F" OR faction _x == "IND_G_F") && (_x targetKnowledge player select 1) && (alive _x)) then
				{
					_target = _x;
					_player = player;
					_targetPosition = _target modelToWorldVisual[0,0,2];
					_playerPosition = positionCameraToWorld[0,0,0];
					_distance = _targetPosition distance _playerPosition;
					_fov = round (call KK_fnc_trueZoom * 20) / 2;
					_dir = _targetPosition vectorDiff _playerPosition;
					_playerDir = _playerPosition vectorFromTo positionCameraToWorld[0,0,1];
					_cross = (_playerDir) vectorCrossProduct (vectorUp _player);
					_drawUpNormal = vectorNormalized (_cross vectorCrossProduct _dir); 
					_drawUp = _drawUpNormal vectorMultiply ( 0.1 * _distance / _fov );
					_drawDown = (_drawUpNormal vectorMultiply ( 0.05 * _distance / _fov )) vectorDiff [0,0,2];
					_drawPosUp = _targetPosition vectorAdd _drawUp;
					_drawPosDown = _targetPosition vectorAdd _drawDown;	
					_dist = ceil([(visiblePosition player) select 0,(visiblePosition player) select 1,0] distance [(visiblePosition _x) select 0,(visiblePosition _x) select 1,0])-2;
					_typ = getText (configFile >> "cfgVehicles" >> typeOf _x >> "displayName");
					drawIcon3D ["\A3\ui_f\data\map\markers\military\triangle_CA.paa",[1,0,0,0.7],_drawPosUp,0.7,0.7,180,str(_dist),0,0.03,"PuristaBold"];
					drawIcon3D ["",[1,0,0,0.7],_drawPosDown,0.7,0.7,180,_typ,0,0.03,"PuristaBold"];
				};
			} foreach AllUnits;

			}];
			MEH_added = true;
			markrs = "Markers active";
		};
	};

};



KK_fnc_trueZoom = {
    (
        [0.5,0.5] 
        distance2D  
        worldToScreen 
        positionCameraToWorld 
        [0,3,4]
    ) * (
        getResolution 
        select 5
    ) / 2
};

This new code is more effective ... Why?

1- It does not affect the "game" performance.

2- Only the enemies will be marked ... No need to mark friendly units.

3- The enemy will be marked once the enemy "KNOWS" about your presence in nearby area ... In other words, no need to wait until the enemy unit shoot. This will give more balance, i.e, once the enemy knows about you, you will know about the enemy in return.

4- The marker will contain a small triangle and the distance and the type of the enemy unit.

5- Enemy units inside vehicle will also be marked.

6- Markers are better when zooming in or zooming out.

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

×