Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

Changing Fuel on aircraft: incorrect results when #drop tanks is 2,4,5?

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua Legion >> Changing Fuel on aircraft: incorrect results when #drop tanks is 2,4,5? Page: [1]
Login
Message << Older Topic   Newer Topic >>
Changing Fuel on aircraft: incorrect results when #drop... - 6/11/2020 5:06:11 PM   
KnightHawk75

 

Posts: 1361
Joined: 11/15/2018
Status: online
This applies to aircraft types only, and only aircraft with 2 drop+ tanks (with exception) that I've found.
Aircraft tested with no drop tanks or 1 drop tank work entirely as expected, as do those with 3.

When using unit.fuel to set fuel on type 2001, any value you give it that is a decrease, the difference seems to be applied twice. Any value you give it that is an increase the difference seems to be doubled.

Lets take a mig-31BM #3963 with a long-range aa-13 loadout and 2 drop tanks.
She starts with her main tank @ 16350 and 2 drop tanks at @ 2000 each for a total of 20350.

local u = ScenEdit_GetUnit({name='MiG-31BM Foxhound', guid='4FH7PU-0HM0E070ONF69'});
print(--before--);print(u.fuel);print(u.fuels);
{ [2001] = { max = 20350, type = 2001, name = 'AviationFuel', current = 20350 } }
{ [1] = { max = 16350, type = 2001, name = 'AviationFuel', current = 16350 }, [2] = { max = 2000, type = 2001, name = 'AviationFuel', current = 2000 }, [3] = { max = 2000, type = 2001, name = 'AviationFuel', current = 2000 } }

So let's say I want to set her fuel to 19350, a subtraction of 1000.
I have two options SetUnit or update the table and feed it back.
Lets do typical update table method.
local newfuel = u.fuel --get a copy
newfuel[2001].current = 19350; --change copy
u.fuel = newfuel -- submit our changes.
print(--after--);print(u.fuel);print(u.fuels);
---after---
{ [2001] = { max = 20350, type = 2001, name = 'AviationFuel', current = 18350 } }
{ [1] = { max = 16350, type = 2001, name = 'AviationFuel', current = 16350 }, [2] = { max = 2000, type = 2001, name = 'AviationFuel', current = 1000 }, [3] = { max = 2000, type = 2001, name = 'AviationFuel', current = 1000 } }

As you can see it doubled the difference requested and took 1000 each out of the drop tanks. You will get the same result using: ScenEdit_SetUnit({guid=u.guid, fuel={ {2001,19350} } }) for our purposes it doesn't matter which you use.

Now it's at 18350. So let's try adding back 1000 by telling it once again we would like 19350, basically just run it a second time.
---before---
{ [2001] = { max = 20350, type = 2001, name = 'AviationFuel', current = 18350 } }
{ [1] = { max = 16350, type = 2001, name = 'AviationFuel', current = 16350 }, [2] = { max = 2000, type = 2001, name = 'AviationFuel', current = 1000 }, [3] = { max = 2000, type = 2001, name = 'AviationFuel', current = 1000 } }
---after---
{ [2001] = { max = 20350, type = 2001, name = 'AviationFuel', current = 18350 } }
{ [1] = { max = 16350, type = 2001, name = 'AviationFuel', current = 16350 }, [2] = { max = 2000, type = 2001, name = 'AviationFuel', current = 1000 }, [3] = { max = 2000, type = 2001, name = 'AviationFuel', current = 1000 } }

It did not change anything, as if thinks it was at 19350 already.
If we re-run it and tell it anything above 19350, like 19360, it will add 20 fuel instead of 10.
---before---
{ [2001] = { max = 20350, type = 2001, name = 'AviationFuel', current = 18350 } }
{ [1] = { max = 16350, type = 2001, name = 'AviationFuel', current = 16350 }, [2] = { max = 2000, type = 2001, name = 'AviationFuel', current = 1000 }, [3] = { max = 2000, type = 2001, name = 'AviationFuel', current = 1000 } }
---after---
{ [2001] = { max = 20350, type = 2001, name = 'AviationFuel', current = 18370 } }
{ [1] = { max = 16350, type = 2001, name = 'AviationFuel', current = 16350 }, [2] = { max = 2000, type = 2001, name = 'AviationFuel', current = 1010 }, [3] = { max = 2000, type = 2001, name = 'AviationFuel', current = 1010 } }

Now if you test the same thing on a mig-31BM #3963 with no drop tanks: works fine.
Now if you test the same thing on a mig-35 #3914 with 1 drop tanks or 3 drop tanks: works fine.
Now if you test the same thing on a f-15EX #7441 with 4 drop tanks. try removing 1000 like above, you get the off-by-double problem 14150 becomes 12150 when setting to 13150.

Now it gets even more odd.
Grab an EA-6B ICAPIII with 5 tanks on a ferry loadout:
---before---
{ [2001] = { max = 11550, type = 2001, name = 'AviationFuel', current = 11550 } }
{ [1] = { max = 7000, type = 2001, name = 'AviationFuel', current = 7000 }, [2] = { max = 910, type = 2001, name = 'AviationFuel', current = 910 }, [3] = { max = 910, type = 2001, name = 'AviationFuel', current = 910 }, [4] = { max = 910, type = 2001, name = 'AviationFuel', current = 910 }, [5] = { max = 910, type = 2001, name = 'AviationFuel', current = 910 }, [6] = { max = 910, type = 2001, name = 'AviationFuel', current = 910 } }

ScenEdit_SetUnit({guid=u.guid, fuel={ {2001,10550} } }) --lets try removing the same 1000.

---after---
{ [2001] = { max = 11550, type = 2001, name = 'AviationFuel', current = 7000 } }
{ [1] = { max = 7000, type = 2001, name = 'AviationFuel', current = 7000 }, [2] = { max = 910, type = 2001, name = 'AviationFuel', current = 0 }, [3] = { max = 910, type = 2001, name = 'AviationFuel', current = 0 }, [4] = { max = 910, type = 2001, name = 'AviationFuel', current = 0 }, [5] = { max = 910, type = 2001, name = 'AviationFuel', current = 0 }, [6] = { max = 910, type = 2001, name = 'AviationFuel', current = 0 } }

^I can't explain that one, removed 4550. And if you run again after that asking for say 11000, it results in 8800?

Anyway in all cases when setting via the gui the problem does not appear on any of the tested aircraft.

< Message edited by KnightHawk75 -- 6/11/2020 5:07:19 PM >
Post #: 1
RE: Changing Fuel on aircraft: incorrect results when #... - 6/14/2020 3:11:11 AM   
michaelm75au


Posts: 13426
Joined: 5/5/2001
From: Melbourne, Australia
Status: offline
I think the issue is that with external tanks, the amount is spread across all the tanks, but the property is trying to update them individually. Which means the last tank's amount becomes the amount for all tanks.
Didn't notice this when I first built the property.

I will look at tweaking that.

_____________________________

Michael

(in reply to KnightHawk75)
Post #: 2
RE: Changing Fuel on aircraft: incorrect results when #... - 6/14/2020 3:34:46 AM   
michaelm75au


Posts: 13426
Joined: 5/5/2001
From: Melbourne, Australia
Status: offline
This looks better...
quote:


local u = ScenEdit_GetUnit({name='MiG-31BM Foxhound', guid='NZZYVJ-0HM0G1F7MPTLQ'})
print('--before--');print(u.fuel);print(u.fuels);
local newfuel = u.fuel --get a copy
newfuel[2001].current = 17350; --change copy
u.fuel = newfuel -- submit our changes.
print('--after--');print(u.fuel);print(u.fuels);

--before--
{ [2001] = { max = 20350, type = 2001, current = 15350, name = 'AviationFuel' } }
{ [1] = { max = 16350, type = 2001, current = 15350, name = 'AviationFuel' }, [2] = { max = 2000, type = 2001, current = 0, name = 'AviationFuel' }, [3] = { max = 2000, type = 2001, current = 0, name = 'AviationFuel' } }
--after--
{ [2001] = { max = 20350, type = 2001, current = 17350, name = 'AviationFuel' } }
{ [1] = { max = 16350, type = 2001, current = 16350, name = 'AviationFuel' }, [2] = { max = 2000, type = 2001, current = 500, name = 'AviationFuel' }, [3] = { max = 2000, type = 2001, current = 500, name = 'AviationFuel' } }


I updated the process to handle aircraft differently to other types which could have multiple fuel types.
PS. It now uses the same function as the GUI (Set fuel and airborne time ...).

< Message edited by michaelm75au -- 6/14/2020 3:46:16 AM >


_____________________________

Michael

(in reply to michaelm75au)
Post #: 3
RE: Changing Fuel on aircraft: incorrect results when #... - 6/14/2020 8:30:56 PM   
KnightHawk75

 

Posts: 1361
Joined: 11/15/2018
Status: online
Yeah I remember that update around march\feb of 2019 (and was thankful for adding the filling up additional tanks back then via lua in cmano), I never noticed this problem cause but it was probably there, I just happened to stumble upon it\notice it now.

Thanks for looking into it and getting it tweaked. :)


< Message edited by KnightHawk75 -- 6/14/2020 8:31:34 PM >

(in reply to michaelm75au)
Post #: 4
Page:   [1]
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua Legion >> Changing Fuel on aircraft: incorrect results when #drop tanks is 2,4,5? Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

0.141