Jump to content

Rydygier

Member
  • Content Count

    4805
  • Joined

  • Last visited

  • Medals

  • Medals

Posts posted by Rydygier


  1. Oh. :) Didn't check demo, my fault. All because of reading in rush. Maybe also this will become useful someday...

    Anyway needed behavior shouldn't be too hard to implement. At the moment I'm coding something quite similar - to make AI do something, when enemy is spotted. "Something" may be firing shrapnel at enemy pos as well. Perhaps this will be sufficient (still written in rush, but "should work"):

    "KillOnSight.sqf"

    _shrapnelGuy = _this select 0;
    
    while {((alive _shrapnelGuy) and not (isNull _shrapnelGuy))} do 
    {
    _target = _shrapnelGuy findNearestEnemy _shrapnelGuy;
    if not (isNull _target) then
    	{
    	[_shrapnelGuy,_target] execVM "ShootAtHim.sqf"// or [_shrapnelGuy,_target] spawn AIRBURST_ROUTINE or whatever
    	};
    
    sleep 10;
    }

    and executed by something like:

    nul = [this] execVM "KillOnSight.sqf"

    (in unit's init field)

    or

    [_unit] execVM "KillOnSight.sqf"

    (in .sqf file, like init.sqf for example)

    This will check every 10 seconds, if there is known to "shrapnelGuy" enemy around. If so, then yours function will be called. This function of course should contain all needed filters, like range, amount of nearby enemies and so on.


  2. Still help with AI FOs routines needed?

    Will be brief, sorry, lack of time currently:

    (ie. for all enemy detected, check if there are more than say 5-10 within a certain radius, if so target the middle, add 30 to the z pos, set the range for the distance and fire...)

    If you can handle with code for all of this, there is need to determine, which AI units should have FO ability (prepare ana array contains names of such units), then exec (or spawn) for all FO's in array this code in loop with some interval and maybe waituntil for end of previous fire mission.

    You may also consider two aspects: choosing of best target amongst known enemies in spotting and arty range (considering it's kind, mentioned number of units in impact range, speed (slower = better), and even height (to avoid targeting planes/choppers in air)), and to take an amendment because of target's movement vector (to predict, where target will be after time, that will pass between calling fire mission and impact, if it moves in given average direction with given average speed). Such code is implemented in my "Fire at Will" (see "spoiler" below), also I know, that BlakeAce, who uses similar method, added also some calculations for movement along roads, which makes this really sophisticated targeting routine. Difference is, that both FAW and Blackace's AI FO are based on Arma's ARTY module funcionalities, you have chosen path of spawning ammo (like here: WIP-Improving-Bon-s-artillery-script). But this shouldn't make a big difference, only this delay will be probably easier to determine here, because you exactly know value of this delay, as it is implemented by you, not dictated by Arty Module/game ballictic simulation.

    So, if you are interested in my method for AI-driven choosing target, then check FAW file: "RydArtyTrg.sqf" below line 88 (above this line is completed array of AI FO's). This is, I afraid, rather messy code, but I hope, that it will be helpful somehow. And here is part of "FireAtWill.sqf" for move vector amendment:

    	_targetPos = getPosASL _targlead;
    
    _X0 = (_targetpos select 0);
    _Y0 = (_targetpos select 1);
    sleep 10;
    _targetPos = getPosASL _targlead;
    _X1 = (_targetpos select 0);
    _Y1 = (_targetpos select 1);
    sleep 10;
    _targetPos = getPosASL _targlead;
    _X2 = (_targetpos select 0);
    _Y2 = (_targetpos select 1);
    
    _Xav = (_X1+_X2)/2;
    _Yav = (_Y1+_Y2)/2;
    
    _transspeed = ([_X0,_Y0] distance [_Xav,_Yav])/15;
    _transdir = (_Xav - _X0) atan2 (_Yav - _Y0);
    
    _Xhd = _transspeed * sin _transdir * 2.7 * _TTI;
    _Yhd = _transspeed * cos _transdir * 2.7 * _TTI;
    

    and after no-friendly-fire routine that may reduce this amendment:

    	_impactpos = [(_targetpos select 0) + _Xhd, (_targetpos select 1) + _Yhd,_targetpos select 2];

    This contains values proper for ARTY module's artillery time of flight (_TTI factor - , here varies from 20 to 35, not remember for sure, but this is probably not second of time of flight equivalent, rather about half of it, you can find this value for yours script empirical way). Takes 20 seconds to calculate vector. The longer the more reliable vector ("sleeps"). _Xhd and _Yhd are obviously final amendments in meters for both coord axis (E-W and N-S).

    In this file you can also find dispersion calculating because of weapon/shell accuracy and skills (condition) of FO and gun crews/battery commander, weather factor and such things. Sorry, for now can't explain all this more detailed.

    You can also consider to put FO into stealth/no fire/no engage. See this (and related - "See also") command: setCombatMode.

    Hope, that this will be useful.

    Good luck! :)


  3. What I need, is to start chosen animation, eg.:

    player switchMove "c7a_bravo_ErcTOdovadeni1";
    player playMove "c7a_bravo_dovadeni1";
    

    and then to interrupt it in very strictly chosen moment with returning to normal movements. So, after some sleep trying to use this:

    player switchMove "c7a_bravo_dovadeni1TOerc";

    or this:

    player switchMove "";

    But in both cases my avatar after interrupt becomes static - not responding to keybord input, but is almost totally "frozen" in default position. Just is not moving, only blinks at me, bastard.

    Tried also with SwitchAction interrupt, with similar effect. Is there any solution of this? To achieve desired effect without this stuck issue?


  4. I can confirm this problem with Ground Transportation. Same here, without ACE or ASR or anything like that. In fact this is only a small inconvenience to me. In such case I just "borrow" some nearby random civil ural or something and ride away with my team. Mission ends when distance to action area is sufficiently large (2 km?). BTW - indeed, this mission is very high quality. I feel the immensity of work involved - with great effect. Damn good.


  5. There is wip3 uploaded (link in initial post). I would like to invite to some testing, especially this version. Implemented new, experimental Morale-Fleeing-Panic routine, but haven't much time for testing all this. I will be grateful for any feedback, how this works and for bug reporting. See TO DO list for details and list of other implemented features. There is used allowFleeing command. BTW still do not know, what is the difference between this command and "courage" skill setting.


  6. Quite strange. And known to me also from other scripts... Though AllUnits here sometimes return null objects or given unit from last AllUnits array is destroyed between AllUnits collecting and nearestObjects collecting, so haven't a position attribute, when needed (so this error is generated, as nearestObjects need a position or object, that have a position)... Maybe this back-up will help:

    _AllM = [];
    if not (isNull (vehicle _x)) then {_AllM = nearestObjects [(vehicle _x), ["CAManBase"], 500]};

    instead of:

    _AllM = nearestObjects [(vehicle _x), ["CAManBase"], 500];

    Give ma a word, if this helped, I'm curious...


  7. To make KIA Sparks not show player's deaths you can try this in AddKMark.sqf for EH version:

    _markedSides = [];
    
    if ("W" in _this) then {_markedSides = _markedSides + [west]};
    if ("E" in _this) then {_markedSides = _markedSides + [east]};
    if ("R" in _this) then {_markedSides = _markedSides + [resistance]};
    if ("C" in _this) then {_markedSides = _markedSides + [civilian]};
    
    while {(true)} do
    {
    
    	{
    [color="#FF0000"]		if not (isPlayer _x) then
    		{[/color]
    		_isEH = _x getVariable ("isEH" + (str _x));
    		if (isNil ("_isEH")) then {_isEH = false};
    
    		if (((side _x) in _markedSides) and not (_isEH)) then 
    			{
    			_KilledEH = _x addEventHandler ["Killed", {nul = _this spawn KIAUnMark}];
    			_x setVariable [("isEH" + (str _x)),true,false];
    			}
    		[color="#FF0000"]}[/color]
    	}
    foreach AllUnits;
    
    _ad = AllDead;
    if (isNil ("_ad")) then {_ad = []};
    
    	{
    	_x removeAllEventhandlers "Killed";
    	}
    foreach _ad;
    
    sleep 20;
    };

    To make Blood Drops ("more blood" version, "less blood" - similar) not considering players as valid witnessess:

    _markedSides = [];
    
    if ("W" in _this) then {_markedSides = _markedSides + [west]};
    if ("E" in _this) then {_markedSides = _markedSides + [east]};
    if ("R" in _this) then {_markedSides = _markedSides + [resistance]};
    if ("C" in _this) then {_markedSides = _markedSides + [civilian]};
    
    while {(true)} do
    {
    sleep 5;
    _freshWound = [];
    _blood = 0;
    
    	{
    	_bm = _x getVariable ("BloodMarked" + (str _x));
    	if (isNil ("_bm")) then {_bm = false};
    	_i = "markBlood" + (str _x);
    
    	_blood = 0;
    	_posX = 0;
    	_posY = 0;
    	_cnt = 0;
    
    	[color="#FF0000"]if not (isPlayer _x) then
    		{[/color]
    		_AllM = nearestObjects [(vehicle _x), ["CAManBase"], 500];
    
    			{
    			_wound = damage _x;
    			if (not (_x in _freshWound) and (_wound > 0)) then
    				{
    				_freshWound = _freshWound + [_x];
    				_blood = _blood + _wound;
    				_posX = _posX + ((getPosASL _x) select 0);
    				_posY = _posY + ((getPosASL _x) select 1);
    				_cnt = _cnt + 1;
    				if not (alive _x) then
    					{
    					_bm2 = _x getVariable ("BloodMarked" + (str _x));
    					if (isNil ("_bm2")) then {_bm2 = false};
    					if (_bm2) then 
    						{
    						deleteMarker ("markBlood" + (str _x));
    						_x setVariable [("BloodMarked" + (str _x)),false,false];
    						}
    					}
    				}
    			}
    		foreach _AllM
    		[color="#FF0000"]};[/color]
    
    	if (_cnt > 0) then 
    		{
    		_posX = _posX/_cnt;
    		_posY = _posY/_cnt;
    		};
    
    	if (_blood >= 1) then
    		{		
    		_x setVariable [("BloodMarked" + (str _x)),true,false];
    
    		if not (_bm) then 
    			{
    			_i = createMarker [_i,[_posX,_posY]];
    			_i setMarkerColor "ColorRed";
    			_i setMarkerShape "ICON";
    			_i setMarkerType "DOT"
    			};
    
    		_amount = _blood/2;
    		if (_amount > 8) then {_amount = 8};
    		_alpha = 0.3 + (_blood/50);
    		if (_alpha > 0.9) then {_alpha = 0.9};
    
    		_i setMarkerPos [_posX,_posY];
    		_i setMarkerSize [_amount,_amount];
    		_i setMarkerAlpha _alpha;
    		};
    
    	if ((_bm) and (_blood < 1)) then
    		{
    		_x setVariable [("BloodMarked" + (str _x)),false,false];
    		deleteMarker _i;
    		}
    	}	
    foreach AllUnits;
    
    _ad = AllDead;
    if (isNil ("_ad")) then {_ad = []};
    
    	{
    	_bm3 = _x getVariable ("BloodMarked" + (str _x));
    	if (isNil ("_bm3")) then {_bm3 = false};
    	if (_bm3) then {deleteMarker ("markBlood" + (str _x))};
    	}
    foreach _ad;
    };

    and for disabling only counting player's wounds, but players still may be a witnessess:

    _markedSides = [];
    
    if ("W" in _this) then {_markedSides = _markedSides + [west]};
    if ("E" in _this) then {_markedSides = _markedSides + [east]};
    if ("R" in _this) then {_markedSides = _markedSides + [resistance]};
    if ("C" in _this) then {_markedSides = _markedSides + [civilian]};
    
    while {(true)} do
    {
    sleep 5;
    _freshWound = [];
    _blood = 0;
    
    	{
    	_bm = _x getVariable ("BloodMarked" + (str _x));
    	if (isNil ("_bm")) then {_bm = false};
    	_i = "markBlood" + (str _x);
    
    	_AllM = nearestObjects [(vehicle _x), ["CAManBase"], 500];
    	_blood = 0;
    	_posX = 0;
    	_posY = 0;
    	_cnt = 0;
    		{
    		_wound = damage _x;
    		if (not (_x in _freshWound) and (_wound > 0)[color="#FF0000"] and not (isPlayer _x)[/color]) then
    			{
    			_freshWound = _freshWound + [_x];
    			_blood = _blood + _wound;
    			_posX = _posX + ((getPosASL _x) select 0);
    			_posY = _posY + ((getPosASL _x) select 1);
    			_cnt = _cnt + 1;
    			if not (alive _x) then
    				{
    				_bm2 = _x getVariable ("BloodMarked" + (str _x));
    				if (isNil ("_bm2")) then {_bm2 = false};
    				if (_bm2) then 
    					{
    					deleteMarker ("markBlood" + (str _x));
    					_x setVariable [("BloodMarked" + (str _x)),false,false];
    					}
    				}
    			}
    		}
    	foreach _AllM;
    
    	if (_cnt > 0) then 
    		{
    		_posX = _posX/_cnt;
    		_posY = _posY/_cnt;
    		};
    
    	if (_blood >= 1) then
    		{		
    		_x setVariable [("BloodMarked" + (str _x)),true,false];
    
    		if not (_bm) then 
    			{
    			_i = createMarker [_i,[_posX,_posY]];
    			_i setMarkerColor "ColorRed";
    			_i setMarkerShape "ICON";
    			_i setMarkerType "DOT"
    			};
    
    		_amount = _blood/2;
    		if (_amount > 8) then {_amount = 8};
    		_alpha = 0.3 + (_blood/50);
    		if (_alpha > 0.9) then {_alpha = 0.9};
    
    		_i setMarkerPos [_posX,_posY];
    		_i setMarkerSize [_amount,_amount];
    		_i setMarkerAlpha _alpha;
    		};
    
    	if ((_bm) and (_blood < 1)) then
    		{
    		_x setVariable [("BloodMarked" + (str _x)),false,false];
    		deleteMarker _i;
    		}
    	}	
    foreach AllUnits;
    
    _ad = AllDead;
    if (isNil ("_ad")) then {_ad = []};
    
    	{
    	_bm3 = _x getVariable ("BloodMarked" + (str _x));
    	if (isNil ("_bm3")) then {_bm3 = false};
    	if (_bm3) then {deleteMarker ("markBlood" + (str _x))};
    	}
    foreach _ad;
    
    
    };

    Both above my be combined - no players as witnesses and not counting player's wounds. NTBSW (not tested, but should work)


  8. 1. There are allowFleeing and setSkill ["Courage",0.X] commands. Are both doing same thing, or effects of usage differs in any way (how, if so)? I think that is probably not quite the same, because first may be applied to group or object (unit only?) second - only to unit... Also quote BIKI about setSkill array:

    Sets ability level of person (commander unit). Value of skill may vary from 0 to 1.

    If this is only for team leader, then perhaps this affects all his group, or only him?

    2. What is default (usual) level of Fleeing and/or courage skill? There is also skill command to retrieve actual value, but how to retrive by a script actual value, that is changed by allowFleeing (if isn't same, as courage skill)? Say, that I want initially to change this parameter, and later go back to initial number, so I need to know, what was value of this before first change...


  9. Looks very simply&smooth&easy. Like it.

    Following humble notes based on my own mission, demo needs ACE unfortunatelly.

    1. Perhaps a bit closer to true CFF protocol will be (if you want this, of course), if there will be two methods:

    a) GRID: FO sends: own GRID (locstat) and target's GRID (script will calculate FO's bearing (angle between line, that links both positions and north) with this data so adjustments should be proper from FO's point of view);

    In my opinion is too easy here, when is needed only click on map. Better is to force a FO to manually find on map and input GRID value (less deadly accuracy beacuse of FO mistakes, not only arty shells dispersion). Maybe optional?

    b) POLAR: FO sends: locstat, bearing and distance to target instead of GRIDS.

    2. Maybe better will be smaller, than 50 m adjustment step (10 meters? or both - smaller two buttons instead of one, left with 10 m, right with 50 m). In real should be, but Arma's Arty ammo is over-powered in my opinion, mortar's especially, so here is not so important such accuracy, still will be nice;

    3. Make hints silent or even better move info about current adjustment, grid and bearing from hints into control window and rest - see point 7.

    4. Angle in fact should be in mils rather than in degrees, but this needs compass or laser tool with mils scale or some manual calculations - too complicated?

    5. Maybe to add some "end of mission" button for reset already entered adjustments, bearing and anything else?

    6. In my opinion control window may automatically return shortly after each adjustment explosion, but not after FFE.

    7. Radio messages (at least text chat) with sent/upcoming communications, possibly similar to real CFF protocol will add immersion. Additional idea - some radio (chat/text) warning, if arty is called danger close to FO position.

    8. Other ammo types?

    EDIT: some related RPT errors:

    File C:\Users\Rydygier\Documents\ArmA 2\missions\ZSUArty.Desert_E\diags\zsuArty.hpp, line 123: '/zsuArty/zsuArtyButtonRequest.action': Missing ';' prior '}'
    File C:\Users\Rydygier\Documents\ArmA 2\missions\ZSUArty.Desert_E\diags\zsuArty.hpp, line 134: '/zsuArty/zsuArtyButtonRequest1.action': Missing ';' prior '}'
    File C:\Users\Rydygier\Documents\ArmA 2\missions\ZSUArty.Desert_E\diags\zsuArty.hpp, line 146: '/zsuArty/zsuArtyButtonAdd50.action': Missing ';' prior '}'
    File C:\Users\Rydygier\Documents\ArmA 2\missions\ZSUArty.Desert_E\diags\zsuArty.hpp, line 157: '/zsuArty/zsuArtyButtonDrop50.action': Missing ';' prior '}'
    File C:\Users\Rydygier\Documents\ArmA 2\missions\ZSUArty.Desert_E\diags\zsuArty.hpp, line 168: '/zsuArty/zsuArtyButtonLeft50.action': Missing ';' prior '}'
    File C:\Users\Rydygier\Documents\ArmA 2\missions\ZSUArty.Desert_E\diags\zsuArty.hpp, line 179: '/zsuArty/zsuArtyButtonRight50.action': Missing ';' prior '}'
    File C:\Users\Rydygier\Documents\ArmA 2\missions\ZSUArty.Desert_E\diags\zsuArty.hpp, line 192: '/zsuArty/zsuArtyButtonAdjust.action': Missing ';' prior '}'
    File C:\Users\Rydygier\Documents\ArmA 2\missions\ZSUArty.Desert_E\diags\zsuArty.hpp, line 205: '/zsuArty/zsuArtyButtonFFE1.action': Missing ';' prior '}'
    File C:\Users\Rydygier\Documents\ArmA 2\missions\ZSUArty.Desert_E\diags\zsuArty.hpp, line 217: '/zsuArty/zsuArtyButtonFFE3.action': Missing ';' prior '}'
    File C:\Users\Rydygier\Documents\ArmA 2\missions\ZSUArty.Desert_E\diags\zsuArty.hpp, line 229: '/zsuArty/zsuArtyButtonFFE5.action': Missing ';' prior '}'
    File C:\Users\Rydygier\Documents\ArmA 2\missions\ZSUArty.Desert_E\diags\zsuArty.hpp, line 242: '/zsuArty/zsuArtyButtonFFEtemplate.action': Missing ';' prior '}'
    File C:\Users\Rydygier\Documents\ArmA 2\missions\ZSUArty.Desert_E\diags\zsuArty.hpp, line 253: '/zsuArty/zsuArtyButtonExit.action': Missing ';' prior '}'
    File C:\Users\Rydygier\Documents\ArmA 2\missions\ZSUArty.Desert_E\diags\zsuArty.hpp, line 297: '/zsuArtyFO/zsuArtyButtonBearingUp.action': Missing ';' prior '}'
    File C:\Users\Rydygier\Documents\ArmA 2\missions\ZSUArty.Desert_E\diags\zsuArty.hpp, line 308: '/zsuArtyFO/zsuArtyButtonBearingDown.action': Missing ';' prior '}'
    File C:\Users\Rydygier\Documents\ArmA 2\missions\ZSUArty.Desert_E\diags\zsuArty.hpp, line 319: '/zsuArtyFO/zsuArtyButtonBearingUp2.action': Missing ';' prior '}'
    File C:\Users\Rydygier\Documents\ArmA 2\missions\ZSUArty.Desert_E\diags\zsuArty.hpp, line 330: '/zsuArtyFO/zsuArtyButtonBearingDown2.action': Missing ';' prior '}'
    File C:\Users\Rydygier\Documents\ArmA 2\missions\ZSUArty.Desert_E\diags\zsuArty.hpp, line 341: '/zsuArtyFO/zsuArtyButtonBearingUp3.action': Missing ';' prior '}'
    File C:\Users\Rydygier\Documents\ArmA 2\missions\ZSUArty.Desert_E\diags\zsuArty.hpp, line 352: '/zsuArtyFO/zsuArtyButtonBearingDown3.action': Missing ';' prior '}'
    File C:\Users\Rydygier\Documents\ArmA 2\missions\ZSUArty.Desert_E\diags\zsuArty.hpp, line 363: '/zsuArtyFO/zsuArtyButtonExit.action': Missing ';' prior '}'


  10. I'm not sure, how heavy for CPU are EHs when added, but I know, that without EH method additional cyclic loop with short sleep is needed to catch moment of death of every unit, and this makes script heavier for sure. Using of EH here is simply, how to say this, more elegant?

    ---------- Post added at 19:30 ---------- Previous post was at 19:03 ----------

    Again then, thanks to muzzleflash, better, not interfering EH versions.

    BD&KIAS-EH

    So now we have four versions: two because of Blood Drops (less or more intensive) and two because of implemetation method and CPU load of "KIA Sparks": with and without EH "Killed". In this versions, as Kremator did, checking for EH is less frequent (every 20 sec, so this is maximal time needed for spawned units to become considered by KIA Sparks).


  11. By using removeAllEventHandlers you prevent any other scripts from doing something useful when a unit is killed too.

    Yep, that is the problem. setVar, you say? You mean setVarialbe? Hmm. Indeed, I can hold there info, that EH was added, as I do with other info and then to add new EH only for units without this info. Why I did not think about this? Thanks for an advices! :)


  12. thanks Rydygier, should asked you if it was ok, first, but...

    Eh, no, no need to ask. Anyone can do with HAC code anything he want. Modify, borrow, cannibalize... Only this way easily something may be corrupted.

    You may consider initialized separatelly file with such code:

    while {(true)} do
    {
    sleep 600;
    _groupA= ["BIS_BAF",(getMarkerPos "spawn_w")] call fnc_spawnGroup;
    _GroupB = ["RU",(getMarkerPos "spawn_e")] call fnc_spawnGroup;
    // and/or other spawning code here
    };
    

    To do yours spawning magic every 10 minutes, or:

    while {(true)} do
    {
    sleep 30;
    if ((count AllGroups) < 5) then 
    	{
    	_groupA= ["BIS_BAF",(getMarkerPos "spawn_w")] call fnc_spawnGroup;
    	_GroupB = ["RU",(getMarkerPos "spawn_e")] call fnc_spawnGroup;
    	// and/or other spawning code here
    	}
    };

    To check every 30 secs, if there is less than 5 groups on map and if so, then to spawn something new... Posibilities are many...

    I have made a coop mission with HAC, it can take up to 30 min before HAC give us any oders, and we must move all the time

    placed HAC on server... and 2 player on the same side. not tried on dedicated.

    Emm. Not sure, if I understand this correctly: you mean, that HAC needs 30 minutes before starts to do something? Or he gives to you idle orders first 30 minutes and only then some "real" attack mission? First option is very weird, second - possible. Especially, if HAC has under his control many groups. HETMAN uses own forces proportionaly to situation. If no enemy is spotted - previously only recon groups have anything serious to do...

    Init config looks good (except comments :)) so maybe it is some MP-only HAC issue - HETMAN wasn't created for multiplayer and for working in network, however I know, that some people with success used HAC that way. If not this, then I do not know, what is the problem here. Spawned groups are for sure recognized by HAC - tested this with DAC personally, but in SP. Remains to give me some repro mission with this problem, if you are able to prepare such demo with described before conditions...

    ---------- Post added at 18:22 ---------- Previous post was at 18:18 ----------

    I wonder if there are any events from HAC that I can cath and place spawn from my spawn script?

    If that must be event from HAC, then you should to use somehow mentioned RydHQ_Cyclecount. There are many internal, but global variables, but only some can be used here. Maybe also mentioned in manual morale factor? I don't know, when you want to make spawns (in what circumstances should occurs). Time is an only factor, or maybe number of groups on map is important? All this can be done without refering to HAC variables however (see above code examples).

    EDIT: oh, there is also of course possiblity to use objectives factor - spawn, when objective is lost or conquered... Use RydHQ_NObj variable for this. It has values 1, 2, 3 or 4 - means number of next (actual) objective and 5 means all objectives conquered.


  13. Here is another sad scripter's story about EH for spawned during gameplay units:

    Every new units should have single EH "Killed" containing KIA script. And there are only three usable here commands known to me: addEventHandler, removeEventHandler and removeAllEventHandlers. There is no command for checking, if there is some EH on unit, so can't implement nothing in kind of "only, if there is no EH "Killed" on unit then give it such EH".

    Next logical option should be to use every cycle for allUnits "remove-add new" procedure.

    For alive only. To count also dead I need AllDead command, and this command is available only in OA, so at the moment can use it only blindly, without testing. If you want to try, then replace code of AddKMark.sqf in EH version of KIA with this:

    _markedSides = [];
    
    if ("W" in _this) then {_markedSides = _markedSides + [west]};
    if ("E" in _this) then {_markedSides = _markedSides + [east]};
    if ("R" in _this) then {_markedSides = _markedSides + [resistance]};
    if ("C" in _this) then {_markedSides = _markedSides + [civilian]};
    
    while {(true)} do
    {
    
    	{
    	if ((side _x) in _markedSides) then 
    		{
    		_x removeAllEventHandlers "killed";			
    		}
    	}
    foreach (AllUnits + AllDead);
    
    	{
    	if ((side _x) in _markedSides) then 
    		{
    		_KilledEH = _x addEventHandler ["Killed", {nul = _this spawn KilledMark}]
    		}
    	}
    foreach AllUnits;
    
    sleep 5;
    };

    This will every cycle remove EHs from all, alive and dead, and then will add new one EH only for alive.

    So should be to use for each unit removeEventHandler command (of given index - each EH of given type on unit has own index number) and just then addEventHandler. But... For some weird reason index number of EH for given unit changes, when another EH of this type with lower index number is removed. For exapmle if I have on unit two EHs "Killed" (eg first from respawn script and second from KIA), first has index of 0, and second - of 1. Now if I remove first EH, then index of second will not stay 1, alas, but become 0, so if I try to remove EH of index, that was given previously to that EH, there may be another EH removed instead, or none, because of this index change.

    Only option, that is available is to remove every cycle all EHs of given type every cycle for every unit and then to add new one for each of unit...


  14. HAC will take control over spawned units with next cycle. But this not means, that for sure HAC will immediately send spawned troops into combat. But at least some idle order should be given (sentry or patrol). To know, when it is beginning of new cycle, you may use RydHQ_Cyclecount (for "A" Leader version) variable, which is growing every cycle per 1. Eg:

    while {(true)} do
    {
    sleep 1;
    hintsilent (str RydHQ_Cyclecount)
    }

    Interval between cycles varies in wide range (about 10 sec - several minutes).

    Code is constructed in such way, that HAC every cycle is completing info about all controlled units from zero, so then HAC grabs also new spawned units/groups.

    Of course, if all is set proper. For example BAF units needs RHQ init config to be recognized by HAC. And must be not in limited control mode (or, if so, new spawned units must be included under HAC's control separatelly). Can I see yours HAC init config?

    Also I recommend to not touch HAC scripts and use separate file for generating spawns.

    I can check some repro mission with this problem, if above explanations will not help, but this must be pure arma2, without any, I say again, any OA (CO), BAF or other non-vanilla content.


  15. OK. Here you go, both previously uploaded versions (less and more blood drops) with non-EH based KIA Sparks. Works, but perhaps is a bit heavier for CPU.

    BD&KIASdemoCD

    EDIT:

    i am looking to replace the DOT marker for the vehicle

    Something like this perhaps (new KIAVmark.sqf code):

    _veh = _this select 0;
    _pos = getPosASL _veh;
    
    _i = "markVKill" + (str _veh);
    
    _i = createMarker [_i,_pos];
    _i setMarkerColor "ColorBlack";
    _i setMarkerShape "ICON";
    _i setMarkerType "mil_triangle";
    _i setMarkerSize [1,1];
    _alpha = 1;
    _size = 1;
    
    while {(_alpha > 0)} do
    {
    sleep 0.2;
    _i setmarkerAlpha _alpha;
    _i setMarkerSize [_size,_size];
    _size = _size - 0.008;
    _alpha = _alpha - 0.01;
    };
    
    deleteMarker _i;


  16. Big, persistent red markings are "Blood Drops" - means area, where blood spilled and where is someone nearby to tell about this (alive unit of chosen side(s)). Their radius and intensity depends on sum of damage from units in radius of checked area (with some limits of course). Orange dots are "KIA Sparks" - apperas when someone is just died. Bigger red, but quickly disappearing dots are sparks for just destroyed vehicles.

    Checked Demoznized's code, and all seems to be clear. As was probably said (?) this KIA Sparks will badly interefere with any script, that uses "Killed" EH. It just removes every cycle all "Killed" EH's from units. It is neccessary part of making KIA spawn-friendly. It is hard to talk about "workaround" for this, rather need to be fundamentally rewritten to avoid usage of "Killed" EH. There is some hope, I can try something...


  17. There is also sixth option: bodies will be counted as long, as they not turn into ".p3d" remnants (about 20-30 sec. ?) here is same demo as above with rewritten in a such way "Blood Drops":

    BD&KIASdemo

    and here is with option 4:

    BD&KIASdemoB

    (more blood and more long lasting spots)

    Note: users of OA 1.57 and above will probably (I can't check) see slightly better effect, because script utilizes for "blood cleaning" additional loop with AllDead command, introduced in OA 1.57.


  18. "MEMENTO MORI, or a sad story about life, death and veng... and miserable life of scripter"

    As is known, each unit after death becomes civilian side. :o:

    So how to determine, to which side belonged unit before?

    Had only one idea: to give all units "dog tags", means setVariable with hardcoded side to retrive by getVariable from the body, and this seems to be enough for vehicles in "KIA Sparks" (script works) but...

    ...after some tests with "Blood Drops" I noticed, that units of proud names such as "O 1-1-A:1" and similar shortly after death remain only as pitiful remnants kind of "1e5a6900# 17507: soldier_light.p3d". :o: :o:

    In this moment value stored by setVariable seems to be gone... :o: :o: :o:

    Ergo there is no known to me method of retrieving initial side of dead unit from its body... :don7:

    So what to do with side filter in "Blood Drops"? I see five possibilities:

    1. To sift units of chosen side at the beginning and to store them in an separate array. But this is bad idea, because then all spawned later units will be ignored;

    2. To change sides with factions (filtering by faction, not by side). But this is bad idea, because then will be excluded non-generic factions (from unofficial addons);

    3. To count damage of only wounded, and ignore dead;

    4. To count wounded of chosen side and all dead, regardless of side;

    5. To use procedure described by me yesterday, and to make, that every just spawned unit will be somehow added to array of counted by script units, if is of chosen side - but here method is dependent of used spawning script (code must be added to the spawner, not to the counter).

    Last one combined with first looks best for me, but if this should be universal visualiser, then 4th option becomes most promising.


  19. More improvements:

    http://www8.zippyshare.com/v/92714120/file.html

    - spawned during mission units/vehicles are (should be) considered;

    - "Blood Drops" is side sensitive, set for "west" currently;

    - resolved problem with side of destroyed vehicles (is always civilian, so implemented some setVariable for each vehicle containing its initial side), so "KIA Sparks" also can be in this version side-sensitive, and is;

    - easy way to set for given side(s) - see init.sqf for each demo to know, how to initialize for chosen side or sides. This is achieved by adding a letter in quotes to array before execVM. These letters are: "W" for west, "E" for east "R" for resistance and "C" for civilian. Any combination of counted sides may be achieved this way. Order is not important, but it is (I suppose) case-sensitive. Example of init.sqf of both scripts:

    ["E","W"] execVM "BDStart.sqf";
    ["W","E","R"] execVM "KIAStart.sqf";

    and init by in-editor init field of unit/object/trigger/whatever:

    nul = ["W","E"] execVM "BDStart.sqf";nul = ["W","E","R"] execVM "KIAStart.sqf";

    - both are slightly heavier for CPU now.

    Not tested with any "spawner" script, but I hope, these work fine.

    EDIT: And some more "real combat" Chernaruss demo, that combinig both scripts. First markers should be on map after a minute or so, when fight gets more intense.

    BD-KIASdemo

    Known issue: sometimes some blood drop may be duplicated and stay on map even, if should disappear (rare). Not sure, why, but hey, it is hard to wash off blood, is not it?

×