Jump to content
Sign in to follow this  

Recommended Posts

Hi guys, im trying to simulate a miles (Multiple Integrated Laser Engagement System) exercise but im having some troubles, i'm using a eventhandler "HIT" to execute the effects, like this:

 

{
  if ((side _x) == Independent) then {
  	_x addEventHandler ["HIT",{ 
		_this select 0 setCaptive true; 
		_this select 0 setdamage 0; 
		_this select 0 disableai "Anim"; 
		_this select 0 disableAI "Move"; 
		_this select 0 disableAI "AutoTarget";
		_this select 0 switchMove "AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon";
	}];
  };
} forEach allUnits;

well, if i shoot a independent unit to a leg, to a arm or even in the kevlar vest at distance, work well, the unit will stop, put his hands behind the head and the blufor IA´s stop shooting them, but, if i shoot to the units at the head, well, they simply dies, the same if i shoot to the chest in close combat... if i put the units in allowdamage false, the eventhandler "HIT" dont work... somebody knows how can i solve this? thank for all and sorry about my poor english :(

Share this post


Link to post
Share on other sites

Thanks pierremgi, I never use this EH, im try it and see how it work, ;)

Share this post


Link to post
Share on other sites

ok i used the eh handledamage like this:

 

_MilUnit = _this select 0;
_MilUnit setVariable ["selections", []];
_MilUnit setVariable ["gethit", []];
_MilUnit addEventHandler ["HandleDamage", {
	_unit = _this select 0;
	_unit disableai "Anim";
	_unit disableAI "Move";
	_unit disableAI "AutoTarget";
	if (animationState _unit != "AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon") then { _unit switchMove "AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon"};
	_selections = _unit getVariable ["selections", []];
	_gethit = _unit getVariable ["gethit", []];
	_selection = _this select 1;
	if !(_selection in _selections) then {
		_selections set [count _selections, _selection];
		_gethit set [count _gethit, 0];
	};
	_i = _selections find _selection;
	_olddamage = _gethit select _i;
	_damage = _olddamage + ((_this select 2) - _olddamage) * 0;
	_gethit set [_i, _damage];
	_damage;
}];

_index = _MilUnit getVariable ["selections", []] find "nameofselection";
_damage = if (_index >= 0) then {
	_MilUnit getVariable "gethit" select _index;
}else{
0;
};

And work like a charm, thank u pierremgi 

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
Sign in to follow this  

×