Rate of Fire Hook

A Forum dedicated to the Suggestion, Creation and Editing of XWA Dynamic Link Library Files

Moderator: JeremyaFr

Post Reply

Rate of Fire Hook

Leofus
Cadet 1st Class
Posts: 143
Joined: Wed Jan 11, 2006 12:01 am

Post by Leofus » Sat Jul 16, 2022 2:59 am

is there any way to change the default rate of fire for all craft with this hook? i used a hex editor to change the default rate of fire before but the current rate of fire hook seems to negate this.

Bman
Lieutenant Commander
Posts: 1167
Joined: Mon Apr 05, 2004 11:01 pm

Post by Bman » Mon Jul 18, 2022 4:03 am

You don't need to do any of that. The easiest way to address this is in the .../FlightModels folder, look for the ShipName.ini file you are flying. Open it up with notepad and scroll down to the very bottom. It might have the following or you can manually add it to your file(s):

[WeaponRate]
DechargeRate = 2
RechargeRate = 3
CooldownTimeFactor = 47

The [header] and last code line is most important. CooldownTimeFactor = 47 is the game default rate which is 1 second or 236 time units. Double 47 x 2 to get a slower rate of fire. Multiples of 2 or half that to get quicker rate.
W-I-P: TFTC, MC Viscount Cr., ISD-II Avenger, NL-1 Platform, Ton-Falk Esc. Cr., & Misc.

Leofus
Cadet 1st Class
Posts: 143
Joined: Wed Jan 11, 2006 12:01 am

Post by Leofus » Tue Jul 19, 2022 12:12 pm

Bman wrote:
Mon Jul 18, 2022 4:03 am
You don't need to do any of that. The easiest way to address this is in the .../FlightModels folder, look for the ShipName.ini file you are flying. Open it up with notepad and scroll down to the very bottom. It might have the following or you can manually add it to your file(s):

[WeaponRate]
DechargeRate = 2
RechargeRate = 3
CooldownTimeFactor = 47

The [header] and last code line is most important. CooldownTimeFactor = 47 is the game default rate which is 1 second or 236 time units. Double 47 x 2 to get a slower rate of fire. Multiples of 2 or half that to get quicker rate.
i have already done it. the problem is that the current weapon rate hook stops it from working and rather than edit the ini for every single craft i was wondering if there would be a way to avoid that and set a default rate for every craft. if not no problem. i have an old hook that allows my modded exe to function

User avatar
JeremyaFr
XWAU Member
Posts: 3921
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Tue Jul 19, 2022 4:10 pm

WIP

Hello,
Here is a WIP of the weapon rate hook.

You can now override the settings for every craft in the "[WeaponRate]" section of the "FlightModels\default.ini" file.

EDIT: link removed

Bman
Lieutenant Commander
Posts: 1167
Joined: Mon Apr 05, 2004 11:01 pm

Post by Bman » Wed Jul 20, 2022 1:17 am

Thanks Jeremy.
Last edited by Bman on Wed Feb 07, 2024 5:21 am, edited 1 time in total.
W-I-P: TFTC, MC Viscount Cr., ISD-II Avenger, NL-1 Platform, Ton-Falk Esc. Cr., & Misc.

Leofus
Cadet 1st Class
Posts: 143
Joined: Wed Jan 11, 2006 12:01 am

Post by Leofus » Thu Jul 21, 2022 10:06 am

JeremyaFr wrote:
Tue Jul 19, 2022 4:10 pm
WIP

Hello,
Here is a WIP of the weapon rate hook.

You can now override the settings for every craft in the "[WeaponRate]" section of the "FlightModels\default.ini" file.


xwa_hook_weapon_rate_WIP_2207191807.zip
you are truly amazing

edit: tested and it is glorious

User avatar
JeremyaFr
XWAU Member
Posts: 3921
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Sun Jul 24, 2022 3:51 pm

UPDATE

Hello,
I've merged the WIP version of the weapon rate hook into the stable version.

Leofus
Cadet 1st Class
Posts: 143
Joined: Wed Jan 11, 2006 12:01 am

Post by Leofus » Wed Jul 27, 2022 7:26 pm

JeremyaFr wrote:
Sun Jul 24, 2022 3:51 pm
UPDATE

Hello,
I've merged the WIP version of the weapon rate hook into the stable version.
youre the man @JeremyaFr thanks again. im loving this

User avatar
JeremyaFr
XWAU Member
Posts: 3921
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Sat Jan 21, 2023 11:35 am

UPDATE

Hello,
I've updated the weapon rate hook.

This version adds support for gun turrets for objects with the hardpoints mirroring option.

User avatar
JeremyaFr
XWAU Member
Posts: 3921
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Tue Jun 13, 2023 7:41 pm

UPDATE

Hello,
I've updated the weapon rate hook.

I've added a setting to enable or disable the fire mesh filter. It is enabled by default.

User avatar
JeremyaFr
XWAU Member
Posts: 3921
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Sun Dec 24, 2023 2:42 pm

UPDATE

Hello,
I've updated the time hook and the weapon rate hook to fix an issue with the decharge/recharge rates of weapons.

Leofus
Cadet 1st Class
Posts: 143
Joined: Wed Jan 11, 2006 12:01 am

Post by Leofus » Mon Dec 25, 2023 10:34 pm

JeremyaFr wrote:
Sun Dec 24, 2023 2:42 pm
UPDATE

Hello,
I've updated the time hook and the weapon rate hook to fix an issue with the decharge/recharge rates of weapons.
your work is appreciated

User avatar
JeremyaFr
XWAU Member
Posts: 3921
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Fri Dec 29, 2023 1:51 pm

UPDATE

Hello,
I've updated the weapon rate hook to fix an issue related to the cooldown time.

User avatar
JeremyaFr
XWAU Member
Posts: 3921
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Tue Feb 06, 2024 2:44 pm

UPDATE

Hello,
I've updated the weapon rate hook.

New features are weapons profiles.

# model decharge and recharge rates.

Suppose that the craft is "FlightModels\[Model].opt".

To define the decharge and recharge rates, create a file named "FlightModels\[Model]WeaponRate.txt" or create a section named "[WeaponRate]" in "FlightModels\[Model].ini".
You can override the settings in "FlightModels\WeaponRate.txt" or in the "[WeaponRate]" section in "FlightModels\default.ini".

The format is:
DechargeRate = decharge value
RechargeRate = recharge value
CooldownTimeFactor = cooldown time value
EnergyTransferRate = energy transfer value
IsImpactSpinningEnabled = enabled value
ImpactSpinningSpeedFactorPercent = percent value
ImpactSpinningAngleFactorPercent = percent value

If the file does not exist, default values are used.

Suppose that the mission is "[MissionDir]\[Mission].tie".
To define a DechargeRate and RechargeRate for a flightgroup, create a file named "[MissionDir]\[Mission]_WeaponRates.txt" or create a section named "[WeaponRates]" in "[MissionDir]\[Mission].ini".
The format is
DechargeRate_fg_# = decharge value
RechargeRate_fg_# = recharge value
EnergyTransferRate_fg_# = energy transfer value
IsImpactSpinningEnabled_fg_# = enabled value
ImpactSpinningSpeedFactorPercent_fg_# = percent value
ImpactSpinningAngleFactorPercent_fg_# = percent value

Replace # with the flightgroup index.
Set the value to -1 to use per-craft settings.

By default, the decharge rate is controlled as this:
if the ship category is Starfighter,
if the craft is TieFighter or TieBomber, the decharge rate is 3,
else the decharge rate is 4.
else
if the weapon sequence is < 4, the decharge rate is 3,
else there is no decharge.

By default, the recharge rate is controlled as this:
if the craft is TieFighter or TieBomber, the recharge rate is 3 * PresetLaser,
else the recharge rate is 2 * PresetLaser.

The default value for CooldownTimeFactor is 47.

By default, the energy transfer rate is controlled as this:
if the craft is MissileBoat, the recharge rate is 32,
else the energy transfer rate is 4.

By default, the "is impact spinning enabled" setting is the global value (1).
The ImpactSpinningSpeedFactorPercent is a percent applied to the craft speed on computing the spinning. The default value is 100.
The ImpactSpinningAngleFactorPercent is a percent applied to the angle between the craft and the weapon on computing the spinning. The default value is 100.

See TieFighterWeaponRate.txt and TieBomberWeaponRate.txt.

# weapons profiles

Suppose that the craft is "FlightModels\[Model].opt".

To define the weapons stats, create a file named "FlightModels\[Model]WeaponStats.txt" or create a section named "[WeaponStats]" in "FlightModels\[Model].ini".
You can override the settings in "FlightModels\WeaponStats.txt" or in the "[WeaponStats]" section in "FlightModels\default.ini".

The format of the default profile is:
WeaponXXX_DurationIntegerPart = value
WeaponXXX_DurationDecimalPart = value
WeaponXXX_Score = value
WeaponXXX_Speed = value
WeaponXXX_Power = value
WeaponXXX_PowerSpeedPercent = value
WeaponXXX_FireRate = value
WeaponXXX_DurationOffset = value
WeaponXXX_FireRatio = value
WeaponXXX_Range = value
WeaponXXX_IsPrecise = value
WeaponXXX_DegreeOfSpreadMask = value

The format of a profile is:
ProfileName_WeaponXXX_DurationIntegerPart = value
ProfileName_WeaponXXX_DurationDecimalPart = value
ProfileName_WeaponXXX_Score = value
ProfileName_WeaponXXX_Speed = value
ProfileName_WeaponXXX_Power = value
ProfileName_WeaponXXX_PowerSpeedPercent = value
ProfileName_WeaponXXX_FireRate = value
ProfileName_WeaponXXX_DurationOffset = value
ProfileName_WeaponXXX_FireRatio = value
ProfileName_WeaponXXX_Range = value
ProfileName_WeaponXXX_IsPrecise = value
ProfileName_WeaponXXX_DegreeOfSpreadMask = value

ProfileName is the name of the profile.
XXX is the weapon index, between 280 and 307.
If the value is -1 then default values from the weapons arrays in the exe are used. You can view them with XwaWorskpaceViewer.
For the PowerSpeedPercent setting, the value is between 0 and 100. The default value is 100. This setting is the percent factor applied to the weapon speed used to compute the weapon power.
For the FireRate setting, for lasers the default value is 47 , and for warheads the default value is 118 for TieWarheads and 472 for other crafts.
For the DurationOffset setting, the default value is 59.
For the FireRatio setting, the default value is -1. This means that the value is taken from the exe craft struct. You can view it with XwaWorskpaceViewer.
For the Range setting, the default value is -1. This means that the value is taken from the exe craft struct. You can view it with XwaWorskpaceViewer.
For the IsPrecise setting, the default value is 1. 1 means that the weapon is precise. 0 means that there is a degree a spread like player turret.
For the DegreeOfSpreadMask setting, the default value is 255 (0xff). This setting is a binary mask which control the degree of spread.
To define a profile for the player, append _Player after WeaponXXX. For example: WeaponXXX_Player_DurationIntegerPart or ProfileName_WeaponXXX_Player_DurationIntegerPart.
To define a profile based on the difficulty, append _Easy, _Medium, or _Hard after WeaponXXX. For examples: WeaponXXX_Easy_DurationIntegerPart or ProfileName_WeaponXXX_Easy_DurationIntegerPart.
To define a profile for the player based on the difficulty, append the player key and the difficulty key. For example: WeaponXXX_Player_Easy_DurationIntegerPart or ProfileName_WeaponXXX_Player_Easy_DurationIntegerPart.

Suppose that the mission is "[MissionDir]\[Mission].tie".
To define a weapons profile for a flightgroup, create a file named "[MissionDir]\[Mission]_WeaponProfiles.txt" or create a section named "[WeaponProfiles]" in "[MissionDir]\[Mission].ini".
The format is
WeaponProfile_fg_# = ProfileName
Replace # with the flightgroup index.
The default ProfileName is "Default".

# warhead profiles

Suppose that the craft is "FlightModels\[Model].opt".

To define the warheads stats, create a file named "FlightModels\[Model]WarheadStats.txt" or create a section named "[WarheadStats]" in "FlightModels\[Model].ini".
You can override the settings in "FlightModels\WarheadStats.txt" or in the "[WarheadStats]" section in "FlightModels\default.ini".

The format of the default profile is:
WarheadXXX_CapacityPercent = value

The format of a profile is:
ProfileName_WarheadXXX_CapacityPercent = value

ProfileName is the name of the profile.
XXX is the warhead index, between 0 and 10.
WarheadType_None = 0,
WarheadType_SpaceBombs = 1,
WarheadType_HeavyRockets = 2,
WarheadType_Missiles = 3,
WarheadType_ProtonTorpedos = 4,
WarheadType_AdvancedMissiles = 5,
WarheadType_AdvancedTorpedos = 6,
WarheadType_MagPulse = 7,
WarheadType_IonPulse = 8,
WarheadType_AdvancedMagPulse = 9,
WarheadType_ClusterBombs = 10,
If the value is -1 then default values from the warheads arrays in the exe are used.
For the CapacityPercent setting, the value is a percent. The default value is 100. This setting is the percent factor applied to warheads capacity.

Suppose that the mission is "[MissionDir]\[Mission].tie".
To define a warheads profile for a flightgroup, create a file named "[MissionDir]\[Mission]_WarheadProfiles.txt" or create a section named "[WarheadProfiles]" in "[MissionDir]\[Mission].ini".
The format is
WarheadProfile_fg_# = ProfileName
Replace # with the flightgroup index.
The default ProfileName is "Default".

# energy profiles

Suppose that the craft is "FlightModels\[Model].opt".

To define the energy stats, create a file named "FlightModels\[Model]EnergyStats.txt" or create a section named "[EnergyStats]" in "FlightModels\[Model].ini".
You can override the settings in "FlightModels\EnergyStats.txt" or in the "[EnergyStats]" section in "FlightModels\default.ini".

The format of the default profile is:
SpeedFactor = value

The format of a profile is:
ProfileName_SpeedFactor = value

ProfileName is the name of the profile.
If the value is -1 then default values are used.
For the SpeedFactor setting, the value is a percent. This setting is the factor applied to the speed. For the TieBomber, the default value is 6. For the TieFighter, the default value is 18. For other crafts, the default value is 12.

Suppose that the mission is "[MissionDir]\[Mission].tie".
To define a energy profile for a flightgroup, create a file named "[MissionDir]\[Mission]_EnergyProfiles.txt" or create a section named "[EnergyProfiles]" in "[MissionDir]\[Mission].ini".
The format is
EnergyProfile_fg_# = ProfileName
Replace # with the flightgroup index.
The default ProfileName is "Default".

# linking profiles

Suppose that the craft is "FlightModels\[Model].opt".

To define the linking stats, create a file named "FlightModels\[Model]LinkingStats.txt" or create a section named "[LinkingStats]" in "FlightModels\[Model].ini".
You can override the settings in "FlightModels\LinkingStats.txt" or in the "[LinkingStats]" section in "FlightModels\default.ini".

The format of the default profile is:
LaserLink = value
PreventAILasersIonWhenDisabling = value
PreventAIIonWhenNotDisabling = value
PreventPlayerLinkedLasersIon = value

The format of a profile is:
ProfileName_LaserLink = value
ProfileName_PreventAILasersIonWhenDisabling = value
ProfileName_PreventAIIonWhenNotDisabling = value
ProfileName_PreventPlayerLinkedLasersIon = value

ProfileName is the name of the profile.
If the value is -1 then default values are used.
For the LaserLink setting, the value is between -1 and 4.
For the PreventAILasersIonWhenDisabling setting, the value is between -1 and 1. -1 means global value. 0 means disabled. 1 means enabled.
For the PreventAIIonWhenNotDisabling setting, the value is between -1 and 1. -1 means global value. 0 means disabled. 1 means enabled.
For the PreventPlayerLinkedLasersIon setting, the value is between -1 and 1. -1 means global value. 0 means disabled. 1 means enabled.

Suppose that the mission is "[MissionDir]\[Mission].tie".
To define a linking profile for a flightgroup, create a file named "[MissionDir]\[Mission]_LinkingProfiles.txt" or create a section named "[LinkingProfiles]" in "[MissionDir]\[Mission].ini".
The format is
LinkingProfile_fg_# = ProfileName
Replace # with the flightgroup index.
The default ProfileName is "Default".

# mesh filter

To enable or disable the fire mesh filter set the "EnableFireMeshFilter" setting. It is enabled by default.

User avatar
AngeI
Lieutenant JG
Posts: 523
Joined: Sun Jan 24, 2016 5:27 pm

Post by AngeI » Thu Feb 08, 2024 9:14 am

Just as an FYI, most of this new stuff is for the benefit of TFTC so I've been playing with them extensively including documenting the effects and what the numbers translate to, so let me know if you need some help if you want to mess with it :handy:

User avatar
JaggedFel
Galactic Empire
Posts: 433
Joined: Wed Sep 06, 2006 11:01 pm
Contact:

Post by JaggedFel » Mon Mar 04, 2024 1:12 am

JeremyaFr wrote:
Tue Feb 06, 2024 2:44 pm
# model decharge and recharge rates.

Suppose that the craft is "FlightModels\[Model].opt".

...
DechargeRate = decharge value
RechargeRate = recharge value
CooldownTimeFactor = cooldown time value
EnergyTransferRate = energy transfer value
...

Suppose that the mission is "[MissionDir]\[Mission].tie".
...
DechargeRate_fg_# = decharge value
RechargeRate_fg_# = recharge value
EnergyTransferRate_fg_# = energy transfer value
...
Is there also supposed to be a CooldownTimeFactor that's per FG in Mission, or is that only for FlightModels?
Ye Olde Galactic Empire Mission Editor v1.15.6
Current software WIPs: TIE Layout and Cutscene Editor, TIE/XvT Cockpit Editor
Libraries / Format specs: *.tie, *.plt, *.tfr, *.lfd , *.act, *.dat image files, *.fnt

User avatar
JeremyaFr
XWAU Member
Posts: 3921
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Mon Mar 04, 2024 8:54 am

Hello,
The CooldownTimeFactor setting is only for flight models.

Leofus
Cadet 1st Class
Posts: 143
Joined: Wed Jan 11, 2006 12:01 am

Post by Leofus » Mon Mar 18, 2024 5:18 pm

JeremyaFr wrote:
Sat Jan 21, 2023 11:35 am
UPDATE

Hello,
I've updated the weapon rate hook.

This version adds support for gun turrets for objects with the hardpoints mirroring option.
ok ive got some dumb questions. how is hardpoint mirroring enabled or disabled for craft? is it a function of the fire mesh filter? also what is the fire mesh filter? does that mean a craft can fire through itself and out the other side?

the mirroring thing has kinda been in the back of my mind because i noticed doing some light opt editing that some ships have almost all the hardpoints on one side. i may or may not have added hardpoints to the other side myself :hilfe:

if these questions are too dumb feel free to ignore them :ops: apologies in advance

User avatar
JeremyaFr
XWAU Member
Posts: 3921
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Mon Mar 18, 2024 6:47 pm

Hello,

With the EnableFireMeshFilter setting you can define whether or not a craft can fire from a mesh which is disabled or destroyed.

You can edit the hardpoint mirroring with XwaWorkspaceEditor.

Leofus
Cadet 1st Class
Posts: 143
Joined: Wed Jan 11, 2006 12:01 am

Post by Leofus » Mon Mar 18, 2024 6:53 pm

JeremyaFr wrote:
Mon Mar 18, 2024 6:47 pm
Hello,

With the EnableFireMeshFilter setting you can define whether or not a craft can fire from a mesh which is disabled or destroyed.

You can edit the hardpoint mirroring with XwaWorkspaceEditor.
thank you very much for the reply. if i ever have any money im gonna give you some

edit: holy cow. i never tried this workspace editor... ive still been using mxvted and the occasional hex editor... this is awesome

User avatar
JeremyaFr
XWAU Member
Posts: 3921
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Wed Mar 27, 2024 5:25 pm

UPDATE

Hello,
I've updated the weapon rate hook.

I've added these settings:

EnergyTransferRatePenalty = energy transfer penalty value
EnergyTransferWeaponLimit = energy transfer limit for weapons
EnergyTransferShieldLimit = energy transfer limit for shields
MaxTorpedoCountPerPass = value
MaxTorpedoCountPerTarget = value

EnergyTransferRatePenalty_fg_# = energy transfer penalty value
EnergyTransferWeaponLimit_fg_# = energy transfer limit for weapons
EnergyTransferShieldLimit_fg_# = energy transfer limit for shields
MaxTorpedoCountPerPass_fg_# = value
MaxTorpedoCountPerTarget_fg_# = value

WeaponXXX_DechargeRate = value
WeaponXXX_RechargeRate = value
WeaponXXX_EnergyLowHighSeparation = value
WeaponXXX_Side = value
WeaponXXX_SideModel = value
ProfileName_WeaponXXX_DechargeRate = value
ProfileName_WeaponXXX_RechargeRate = value
ProfileName_WeaponXXX_EnergyLowHighSeparation = value
ProfileName_WeaponXXX_Side = value
ProfileName_WeaponXXX_SideModel = value

Post Reply