Jump to content
h4wek

SETFUEL not working on static objects

Recommended Posts

Why some static objects return on " fuel _x"  value 1, but when we "setfuel _x = 0"  on it, this not work?

?imw=637&imh=358&ima=fit&impolicy=Letter

Share this post


Link to post
Share on other sites

On the other hand,... they are static.

But you can set a variable on them.

Something like:

Spoiler

 

tank is named fury, canister is named petrol , the quantities are petrol_canister & petrol_tank. It's just an extract. It's a bunch of work to cope with relative quantity and MP environment.

 

fn_fillTank = compileFinal "
  _time = diag_tickTime;
    petrol_tank = fuel fury;
    toggle_fuel = 0;
    while {(alive fury) && petrol distance fury < 7 && petrol_canister > 0 && petrol_tank < 1 && petrol_canister > 0.1} do {
      _timing = diag_tickTime - _time;
      petrol_canister = ((petrol_canister - (_timing * 0.03)) min 20) max 0;
      petrol_tank = ((petrol_tank + (_timing * 0.03/1885)) min 1) max 0;
       call fn_HintPetrol;
      if (local fury) then {fury setFuel (petrol_tank)};
       uiSleep 1
     };
     hint '';
     toggle_fuel = 0;
  ";

player addAction ["<t color='#ffff11'>fill tank</t>", {
    params ["_tgt","_caller","_id"];
    remoteExec ['fn_fillTank']
  },nil,0,false,true,"",
  "(alive fury) && petrol distance fury < 7 && petrol_canister > 0.1 && {toggle_fuel == 0} && {isNull objectParent _this} && {_target distance petrol < 5}"
];

 

 

Extracted of my mission where players have to carry a fuel canister and toolbox for recovering an Abrams tank in good order, under Zagrabad Taliban's pressure.

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

 

Share this post


Link to post
Share on other sites

Yea now I made it on setvariables (global), but I was thinked why in editor in object parameters even for static is AMMO valu for setup - but nowhere I can't find how to read this value from this object from scripting side , beacouse allvariables not showing this parameter too.

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

×