Auto Refuel & Auto repair station not working good

oshydaka

New Member
Hello guys !

I've a little problem with my auto repair part of script

Here is the script :

Code:
private ["_target", "_caller", "_id"];

_target = _this select 0;
_caller = _this select 1;
_id = _this select 2;
_args = _this select 3;
_amount = _args select 0;
_amount2 = _args select 1;

if (isNil "ib_refueling_in_progress") then { ib_refueling_in_progress = false; };

if (!ib_refueling_in_progress) then {

    ib_refueling_in_progress = true;

    titleText ["Refuel and repair", "PLAIN DOWN", 3];

    while {(vehicle _caller == _target) and (local _target)} do {
            private ["_velocity", "_cfcust","_cfcust2"];

            _velocity = velocity _target;
            _cfcust = fuel _target;
                            _cfcust2 = damage _target;

            if ((_velocity select 0 > 1) or (_velocity select 1 > 1) or (_velocity select 2 > 1)) exitWith {
                    titleText ["Refuel and repair stopped", "PLAIN DOWN", 3];
            };
            if (_cfcust >= 1.0 and _cust2 <= 0) exitWith {
                    titleText ["Refuel and repair done", "PLAIN DOWN", 3];
            };
       
            sleep 0.5;
       
            _cfcust = _cfcust + _amount;
       
            if (_cfcust >= 1.0) then { _cfcust = 1.0; };
       
            _target setFuel _cfcust;
       
            _cfcust2 = _cfcust2 - _amount2;
            if (_cfcust2 <= 0.0) then { _cfcust2 = 0.0; };
            _target setDamage _cfcust2;                           
    };

    titleFadeOut 1;

    ib_refueling_in_progress = false;
};

When I'm inside the huey, it's all green :



And, when i scroll to "Repair" ingame, i can see all part damaged :



So problem is, this code only update the "Damage" field in the DB.



I think I need to use the setHit function, but I don't really understand what to do with that, and how to use it to don't have to do something like this :

Code:
_target setHit ["elektronika", 0];
_target setHit ["glass1", 0];
_target setHit ["glass2", 0];
_target setHit ["glass3", 0];
_target setHit ["motor", 0];
_target setHit ["korba", 0];
(......)

So, anyone can help me please ? ^^

Thanks a lot !
 
Back
Top