Hello,
I would to create a script life point with AddEventHandler HandleDamage, I need to subtract the variable "maxlife" each time this object get damage from anybody.
But I don't how to.
_bossrandom = floor(random 1001);
this setVehicleVarName str _bossrandom;
_boss = this;
dommageext = 0;
maxlife = (10000 - dommageext);
_boss addEventHandler ["HandleDamage", {
params ["_unit", "_dommage"];
_unit = _this select 0;
_dommage = _this select 2;
_unit setDamage 0;
_life = maxlife;
if (_life < 0) then {
_life = 0;
};
_unit setDamage 0;
if (_life <= 0) then {
_unit setDamage 1;
};
dommageext = _dommage;
publicVariable "dommageext";
hint format ["Variable : %2\nDommages reçus : %1\nVie restante : %3\n dommage externe %4", _dommage, _unit, _life, dommageext];
}];