Shield Recharge Hook

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

Moderator: JeremyaFr

Shield Recharge Hook

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

Post by JeremyaFr » Sat Mar 30, 2019 7:55 pm

Hello,
Here is a new hook.

xwa_hook_shield.zip

This hook permits to define shield recharge rates for any craft.

Suppose that the mission is "[MissionDir]\[Mission].tie".
Suppose that the craft is "FlightModels\[Model].opt".

The possible involved files are:
- "[MissionDir]\[Mission]_Shield.txt"
- "[MissionDir]\[Mission].ini", section "Shield"
- "FlightModels\[Model]Shield.txt"
- "FlightModels\[Model].ini", section "Shield"

To define the recharge rate, create a file named "FlightModels\[Model]Shield.txt" or create a section named "[Shield]" in "FlightModels\[Model].ini".
The format is:
UseGenerator = 0 to use RechargeRate or 1 to use PerGeneratorRechargeRate
PerGeneratorRechargeRate = per generator recharge value
RechargeRate = recharge value

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

By default, the recharge rate is controlled as this:
For starfighters the recharge rate is 20.
For Interdictor, Victory Star Destroyer, Imperial Star Destroyer, and Super Star Destroyer, the recharge rate is 5 multiplied by the number of shield generators still alive.
For other starships, the recharge rate is 5.
For other crafts, the recharge rate is 0.

For player craft, if the rate is 0 then it is set to 20.

To define the recharge rate for a craft for a given mission, create a file named "[MissionDir]\[Mission]_Shield.txt" or create a section named "[Shield]" in "[MissionDir]\[Mission].ini".
The format is a line per craft:
ModelIndex, UseGenerator, PerGeneratorRechargeRate, RechargeRate
Last edited by JeremyaFr on Mon Feb 22, 2021 4:35 pm, edited 1 time in total.
Reason: Update download link

User avatar
Driftwood
Admiral (Moderator)
Posts: 2174
Joined: Wed Oct 22, 2003 11:01 pm
Contact:

Post by Driftwood » Sat Mar 30, 2019 10:44 pm

So, wait. Does this override the MXvTED stats? So say you have a "generic" baseline slot install for say "generic fighter", you call the ship in a mission that is overriding the default opt in that "generic" spot, the game then calls the shield stats from the .ini file rather than the "hard" stats in the .exe assigned to the slot itself?

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

Post by Bman » Sun Mar 31, 2019 5:41 am

:2thumbs:
Last edited by Bman on Sat May 20, 2023 2:57 am, edited 1 time in total.
W-I-P: TFTC, MC Viscount Cr., ISD-II Avenger, NL-1 Platform, Ton-Falk Esc. Cr., & Misc.

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

Post by JeremyaFr » Sun Mar 31, 2019 8:35 am

What MXvTED calls Shield Recharge and Shield Decharge, I call them Score and Promo Points. These fields have nothing to do with shield.

User avatar
Mark_Farlander
Rebel Alliance
Posts: 580
Joined: Tue Jan 16, 2018 10:47 pm

Post by Mark_Farlander » Sun Mar 31, 2019 12:54 pm

Wonderful! That's why it never worked when I tried to edit those values.
I don't judge tactics. The Battle is the best and only Judge.

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

Post by JeremyaFr » Sun Mar 31, 2019 1:31 pm

Hello,
I've updated the hook.
You can now define the shield recharge rate on a per mission basis.

User avatar
Driftwood
Admiral (Moderator)
Posts: 2174
Joined: Wed Oct 22, 2003 11:01 pm
Contact:

Post by Driftwood » Sun Mar 31, 2019 3:36 pm

JeremyaFr wrote:
Sun Mar 31, 2019 8:35 am
What MXvTED calls Shield Recharge and Shield Decharge, I call them Score and Promo Points. These fields have nothing to do with shield.
So do they just affect the ship point value ingame?

User avatar
Darksaber
Vice Admiral
Posts: 10931
Joined: Mon Jan 10, 2000 12:01 am
Contact:

Post by Darksaber » Sun Mar 31, 2019 6:07 pm

JeremyaFr wrote:
Sun Mar 31, 2019 8:35 am
What MXvTED calls Shield Recharge and Shield Decharge, I call them Score and Promo Points. These fields have nothing to do with shield.
So your saying
Shield Rechange = Score
Shield Decharge = Promo Points

If so I could change these in MXvTED and BHE Modules
“You can please some of the people all of the time, you can please all of the people some of the time, but you can’t please all of the people all of the time”.”
- John Lydgate

Good Things Come To Those Who Wait....
Darksaber's X-Wing Station

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

Post by JeremyaFr » Sun Mar 31, 2019 6:47 pm

Driftwood wrote:
Sun Mar 31, 2019 3:36 pm
So do they just affect the ship point value ingame?
Yes
Darksaber wrote:
Sun Mar 31, 2019 6:07 pm
So your saying
Shield Rechange = Score
Shield Decharge = Promo Points

If so I could change these in MXvTED and BHE Modules
Yes

User avatar
Darksaber
Vice Admiral
Posts: 10931
Joined: Mon Jan 10, 2000 12:01 am
Contact:

Post by Darksaber » Sun Mar 31, 2019 6:57 pm

Cheers something to do on a rainy day :)
“You can please some of the people all of the time, you can please all of the people some of the time, but you can’t please all of the people all of the time”.”
- John Lydgate

Good Things Come To Those Who Wait....
Darksaber's X-Wing Station

User avatar
keiranhalcyon7
Lieutenant JG
Posts: 599
Joined: Tue Jan 02, 2018 6:41 am

Post by keiranhalcyon7 » Sun Mar 31, 2019 10:02 pm

Darksaber wrote:
Sun Mar 31, 2019 6:07 pm
If so I could change these in MXvTED
Now I'm curious. How?

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

Post by Bman » Mon Apr 01, 2019 1:59 am

Hi Jeremy, when we utilize UseGenerator = 1, PerGeneratorRechargeRate = 5, RechargeRate = 0, I'm assuming that means that a given .opt model must have at least one ShieldGenerator type Mesh present, otherwise UseGenerator = 0 .... statement is used. Is that fair statement? Thanks.
Last edited by Bman on Mon Apr 01, 2019 2:39 am, edited 1 time in total.
W-I-P: TFTC, MC Viscount Cr., ISD-II Avenger, NL-1 Platform, Ton-Falk Esc. Cr., & Misc.

User avatar
Darksaber
Vice Admiral
Posts: 10931
Joined: Mon Jan 10, 2000 12:01 am
Contact:

Post by Darksaber » Mon Apr 01, 2019 2:37 am

Bman wrote:
Mon Apr 01, 2019 1:59 am
In the data.txt file of MXvTED, at the bottom section rename like this . . .
Actually NO, wrong! That doesn't work, If changed using the data.txt file you'll only disable them

I'll actually change it from within, using Resource Hacker
“You can please some of the people all of the time, you can please all of the people some of the time, but you can’t please all of the people all of the time”.”
- John Lydgate

Good Things Come To Those Who Wait....
Darksaber's X-Wing Station

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

Post by Bman » Mon Apr 01, 2019 2:38 am

Ah, interesting. Thanks mate. I removed that part from my above post so not to confuse everyone.
W-I-P: TFTC, MC Viscount Cr., ISD-II Avenger, NL-1 Platform, Ton-Falk Esc. Cr., & Misc.

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

Post by JeremyaFr » Fri Apr 05, 2019 6:17 pm

UPDATE

I've uploaded the hook to GitHub and OneDrive. It can be downloaded via XwaHooksSetup.

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

Post by JeremyaFr » Mon Feb 22, 2021 4:38 pm

UPDATE

Hello,
I've updated the shield hook.

This hook now supports the new meshes count limit.

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

Post by AngeI » Sun Oct 03, 2021 6:43 pm

Hi, I was just trying to test this out and I need to understand what the value represents. If I set Recharge to say 5, is that 5hp per second or something else? In any case I was testing this on a Modified Frigate and no matter what value I put in, I never noticed any shield recharging going on. What am I missing?

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

Post by Bman » Fri Oct 08, 2021 3:02 am

One of the TFTC patches applies the 200%-->100% max Shields for all capital ships at mission start. Maybe that is interfering? Also in AlliED mission editor, if you set status1 or status2 fields to (200%) I think that helps the recharge process but it's slow. The Neb-B2 doesn't have a shield generator mesh, so I'm guessing that the UseGenerator = 0, PerShieldGeneratorRate = 0, but RechargeRate =5 or a higher number to speed things up. Ive not tested this so it's just an assumption.
Last edited by Bman on Fri Oct 15, 2021 8:16 am, edited 2 times in total.
W-I-P: TFTC, MC Viscount Cr., ISD-II Avenger, NL-1 Platform, Ton-Falk Esc. Cr., & Misc.

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

Post by AngeI » Wed Oct 13, 2021 8:01 pm

I've tried various scenarios, I can't get it to work, so need some input from @JeremyaFr on this.

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

Post by AngeI » Mon Nov 15, 2021 11:28 am

@JeremyaFr an update, it seems this feature is working ok in XWAU but broken in TFTC.

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

Post by JeremyaFr » Fri May 19, 2023 4:16 pm

UPDATE

Hello,
I've updated the shield hook.

I've added a IsShieldRechargeForStarshipsEnabled setting.

You can enable or disable the shield recharge for starships with the IsShieldRechargeForStarshipsEnabled setting.

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

Post by JeremyaFr » Wed Dec 06, 2023 7:05 pm

UPDATE

Hello,
I've updated the shield hook.

I've fixed a bug with the craft update function related to shields.

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

Post by JeremyaFr » Sat Dec 30, 2023 9:15 pm

UPDATE

Hello,
I've updated the shield hook.

I've fixed an issue with the shield recharge speed.

lookiamcool
Recruit
Posts: 2
Joined: Wed Jan 26, 2022 1:08 pm

Post by lookiamcool » Sun Dec 31, 2023 6:16 pm

I've just tried playing with the latest versions of the hook_shield, hook_weapon_rate, and hook_time and it seems that with default values the shield recharge/decharge and weapon recharge/decharge are too fast, possibly 2x or 4x of normal. Anyone else notice this?
Weapon fire rate otherwise seems normal.

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

Post by JeremyaFr » Sun Dec 31, 2023 11:00 pm

Hello,
Thank you for the bug report.

I've updated the hooks.
You can update the hooks via the launcher and see if it is better.

Post Reply