Fuel code

Making or wanting help making your own asset? Check in here
Post Reply
lakinen
Posts: 215
Joined: 2016-12-03 15:24

Fuel code

Post by lakinen »

Is there a possibility add fuel code to game engine for vehicles?
AlonTavor
PR:BF2 Developer
Posts: 2991
Joined: 2009-08-10 18:58

Re: Fuel code

Post by AlonTavor »

No.


.
lakinen
Posts: 215
Joined: 2016-12-03 15:24

Re: Fuel code

Post by lakinen »

Ok.tnx

greeting
Rhino
Retired PR Developer
Posts: 47909
Joined: 2005-12-13 20:00

Re: Fuel code

Post by Rhino »

Yes, you can do it in a similar way as BF1942 SF did it's rocket planes but if you can't really do a refuel mechanic.
Image
lakinen
Posts: 215
Joined: 2016-12-03 15:24

Re: Fuel code

Post by lakinen »

you're right,I found the instruction in BF.exe file."BombFuel".Most likely, there were rockets with fuel in the game.That is fuel bar.
tnx


greeting
Last edited by lakinen on 2018-11-08 00:50, edited 2 times in total.
Rhino
Retired PR Developer
Posts: 47909
Joined: 2005-12-13 20:00

Re: Fuel code

Post by Rhino »

These are the settings I tested out on my Frigate in an attempt at simulating fuel and engine usage since the ship has two sets of engines, one set of efficient not so powerful engines and another other inefficient but powerful engines and it would only use the latter if it needed to get somewhere fast and then only for so long. So with these settings, if you ran with the throttle at say 60% you would be fine, the engine would "cool" more quickly than it would "heat up", but over that it would slowly "heat up" to the point it would "overheat" and then stop working, similar to how MGs overheat if you fire them too much ingame. The biggest problem with this for my purposes was that once the engine had overheated, even if you put the throttle to 0 and waited, the engine wouldn't come back online, unless you jumped out of the vehicle and back in which was tbh, too much of a penalty. Also couldn't find a way in BF2 to show the "fuel/heat" of the engine on the HUD like you could in BF2. As such I dropped this idea but still got all my test data for it :p

Code: Select all

rem - Engine Heat/Fuel Best Settings
rem ------------------------------------------------------
ObjectTemplate.HeatIncrement 0.0006
ObjectTemplate.coolingFactor 0.000415
ObjectTemplate.InverseHeatBar 1
rem ObjectTemplate.SetHeatBarType B
rem ObjectTemplate.accumulate 1

rem ------------------------------------------------------
rem - Engine Heat/Fuel Testing
rem ------------------------------------------------------
ObjectTemplate.HeatIncrement 0.0003
ObjectTemplate.coolingFactor 0
 = 1:44 / 104 secs
 
ObjectTemplate.HeatIncrement 0.0001
ObjectTemplate.coolingFactor 0
 = 5:08 / 308 secs
 
~ 0.0308 / sec

ObjectTemplate.HeatIncrement 0.0002
ObjectTemplate.coolingFactor 0.0001
= 5:07 / 307 secs

ObjectTemplate.HeatIncrement 0.0004
ObjectTemplate.coolingFactor 0.0002
= 2:23 / 143 secs @ full throttle
= < 20mins @ 33km/h

ObjectTemplate.HeatIncrement 0.0004
ObjectTemplate.coolingFactor 0.00025
= < 30mins @ 33km/h

ObjectTemplate.HeatIncrement 0.004
ObjectTemplate.coolingFactor 0.0025
= ~ 2mins @ 33km/h

ObjectTemplate.HeatIncrement 0.004
ObjectTemplate.coolingFactor 0.003
= > 20mins @33km/h
= > 5mins @ 40km/h
= ~ 35secs @ 50km/h

ObjectTemplate.HeatIncrement 0.004
ObjectTemplate.coolingFactor 0.0027
= ~ 1:15 @ 40km/h
= ~ 2mins @ 38km/h
= ~ 2:30 @ 37km/h
= ~ 3:45 @ 36km/h
= ~ 3:30 @ 35km/h
= ~ 9:10 @ 34km/h
= < 45mins @33km/h

ObjectTemplate.HeatIncrement 0.04
ObjectTemplate.coolingFactor 0.028
= > 12mins @ 33km/h
= > 5mins @ 34km/h

ObjectTemplate.HeatIncrement 0.04
ObjectTemplate.coolingFactor 0.0275
= ~ 20secs @ 36km/h
= ~ 50secs @ 35km/h
= ~ 4mins @ 34km/h
= < 18mins @33km/h

ObjectTemplate.HeatIncrement 0.0004
ObjectTemplate.coolingFactor 0.000275
= ~ 3:24 @ 68.64km/h (full throttle)

ObjectTemplate.HeatIncrement 0.0008
ObjectTemplate.coolingFactor 0.00055
= ~ 1:42 @ 68.64km/h (full throttle)
= < 45mins @33km/h
= < 1hr 37mins @34km/h
= drains at 35km/h, unsure about 34km/h

ObjectTemplate.HeatIncrement 0.0006
ObjectTemplate.coolingFactor 0.000413
= ~ 2:27 @ 68.64km/h (full throttle)

ObjectTemplate.HeatIncrement 0.0006
ObjectTemplate.coolingFactor 0.000415
= ~ 2:30 @ 68.64km/h (full throttle)
Image
lakinen
Posts: 215
Joined: 2016-12-03 15:24

Re: Fuel code

Post by lakinen »

Code: Select all

ObjectTemplate.heatAddWhenFire 0.0253
ObjectTemplate.coolDownPerSec 0.3333
ObjectTemplate.overheatPenalty 4
weapon culing code source mg.tweak ine editor FireArm
Maybe you could put in "ObjectTemplate.coolDownPerSec" in your code.


The only logical solution about the display heatbar.If you look on "truck_horn" on any truck,
vehicles.
In "FireArm"-"ProjectileTemplate"I think it can change into a bland or to remain this way "horn_projectile".
Add something for test in "heatAddWhenFire" and "coolDownPerSec"
In Fire(Component) "FireInput" select same button like going forward(if the command can be duplicated).


So in theory replace the sound of the siren with a display for overheating when we move.
I did not try this in the game.

greeting

There's no real flame on your screen, it's just magic :D
Last edited by lakinen on 2018-11-08 23:59, edited 2 times in total.
lakinen
Posts: 215
Joined: 2016-12-03 15:24

Re: Fuel code

Post by lakinen »

I found a solution for heatingbar, and test.

when you put this code in any weapon you have heat bar:

Code: Select all

ObjectTemplate.heatAddWhenFire 0.0253
ObjectTemplate.coolDownPerSec 0.3333
ObjectTemplate.overheatPenalty 4
Numbers are not so important(they serve for heating and cooling time)

You can use this in Editor "FireArm" and edit.I test on horn of vehicles.And now I have overheating horn :-D
That means you can put it in all player use directly.I can also get a video if you need it.

greeting

There's no real flame on your screen, it's just magic :razz:
Arab
PR:BF2 Developer
Posts: 2898
Joined: 2012-05-18 03:37

Re: Fuel code

Post by Arab »

What I find out with overheat is that if it includes the overheat code via .con, the overheat cooldown will work properly.

But if the overheat code is defined in the .tweak, it won't cooldown.
Image
Rhino
Retired PR Developer
Posts: 47909
Joined: 2005-12-13 20:00

Re: Fuel code

Post by Rhino »

Sorry lakinen I'm finding it hard to understand your posts but I take it you mean to display the heat bar, you just have a dummy weapon with the heat bar with the same heating and cooling settings as the engine and have that controlled by the throttle as well? Interesting idea, but does mean it only works if the driver has only one weapon, otherwise, you will lose the heat bar when switching weapons and also while switching weapons, the heat bar won't be running in the bg for that other weapon when you switch back to it.
Arab wrote:What I find out with overheat is that if it includes the overheat code via .con, the overheat cooldown will work properly.

But if the overheat code is defined in the .tweak, it won't cooldown.
Intresting, may have to look into that when I revisit the Frigate's code.
Image
Arab
PR:BF2 Developer
Posts: 2898
Joined: 2012-05-18 03:37

Re: Fuel code

Post by Arab »

Rhino wrote:Sorry lakinen I'm finding it hard to understand your posts but I take it you mean to display the heat bar, you just have a dummy weapon with the heat bar with the same heating and cooling settings as the engine and have that controlled by the throttle as well? Interesting idea, but does mean it only works if the driver has only one weapon, otherwise, you will lose the heat bar when switching weapons and also while switching weapons, the heat bar won't be running in the bg for that other weapon when you switch back to it.



Intresting, may have to look into that when I revisit the Frigate's code.
Going into more detail from the previous post, it's obviously defined in overheat.con which contains arguments and defined types per projectile type, diameter, firerate etc and referenced using the code structure below for all Vehicle GenericFirearms/Weapons like cannons and therefore makes the overheat penalty cooldown work properly for handheld weapons too:

Code: Select all

include ../../../weapons/common/overheat.con "shell" "25mm" "1" "200"
Kinda how that works but I guess it's down to .con being suited more for the overheat engine component?
Last edited by Arab on 2018-11-09 13:37, edited 6 times in total.
Image
lakinen
Posts: 215
Joined: 2016-12-03 15:24

Re: Fuel code

Post by lakinen »

:smile: Let's start from the beginning.
"Also couldn't find a way in BF2 to show the "fuel/heat"..."-I thought it was a question, so I tried to do it

"Sorry lakinen I'm finding it hard to understand your posts but I take it you mean to display the heat bar, you just have a dummy weapon with the heat bar with the same heating and cooling settings as the engine and have that controlled by the throttle as well?"

-Yup,but but I did not put the same heating and cooling settings as the engine,because this is just test.

"but does mean it only works if the driver has only one weapon, otherwise, you will lose the heat bar when switching weapons and also while switching weapons, the heat bar won't be running in the bg for that other weapon when you switch back to it."

-I did not think about it,because my goal is display heat.And I went with that thought,that driver of ship,car.. only drive nothing more.

And i do the test.I simulated that instead of the siren,i put heat bar-Successfully

"that controlled by the throttle as well?""-no success(i thought it would work,because I saw it in the editor that can change commands in throttle,but when i test dont work),only fire button.Maybe because of duplication of commands.

I just edit apc_horn_m113_noammocounter.tweak put inside:

Code: Select all

ObjectTemplate.heatAddWhenFire 0.0253
ObjectTemplate.coolDownPerSec 0.3333
ObjectTemplate.overheatPenalty 4
numbers are not important,it's just for the test,and i put in apc_horn_m113,because i use Gopher.

Arab wrote:

Code: Select all

include ../../../weapons/common/overheat.con "shell" "25mm" "1" "200"
Kinda how that works but I guess it's down to .con being suited more for the overheat engine component?
I did not put that code inside,because that's how I see it,ratio of the bullet, grananates in relation to the speed of the ejection for heatbar

https://www.youtube.com/watch?v=Tk7FXZ5enHY
the sound of the siren in the video can be turned off

The idea was that when you go ahead you see the heating indicator.*for start)

and a list of functions that I found in BF2.exe which have some connections with heat,which maybe can use:

Code: Select all

heatAddWhenFire
inheritHeatFromPrimary
killHeatSeekingMissile
inverseHeatBar
heatBarType
setHeatBarType
getHeatBarType
weaponHud.overheatSound
ObjectTemplate.overheatPenalty
ObjectTemplate.heatAddWhenFire
ObjectTemplate.inheritHeatFromPrimary
ObjectTemplate.InverseHeatBar 1
ObjectTemplate.setHeatBarType B
ObjectTemplate.setHeatBarType G
ObjectTemplate.weaponHud.overheatSound
SecondaryHeatColorAlpha
PrimaryHeatColorAlpha
PrimaryHeatValue
PrimaryHeatShow
SecondaryHeatValue
heatIncrement
Full code look like this:

Code: Select all

rem -------------------------------------
ObjectTemplate.projectileTemplate horn_projectile
ObjectTemplate.keepProjectiles 5
ObjectTemplate.itemIndex 1
ObjectTemplate.heatAddWhenFire 0.0253
ObjectTemplate.coolDownPerSec 0.3333
ObjectTemplate.overheatPenalty 4

greeting

There's no real flame on your screen, it's just magic :wink:
Last edited by lakinen on 2018-11-09 20:10, edited 1 time in total.
Post Reply

Return to “PR:BF2 Community Modding”