Page 1 of 2

Shield Recharge Hook

Posted: Sat Mar 30, 2019 7:55 pm
by JeremyaFr
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

Re: Shield Recharge Hook

Posted: Sat Mar 30, 2019 10:44 pm
by Driftwood
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?

Re: Shield Recharge Hook

Posted: Sun Mar 31, 2019 5:41 am
by Bman
:2thumbs:

Re: Shield Recharge Hook

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

Re: Shield Recharge Hook

Posted: Sun Mar 31, 2019 12:54 pm
by Mark_Farlander
Wonderful! That's why it never worked when I tried to edit those values.

Re: Shield Recharge Hook

Posted: Sun Mar 31, 2019 1:31 pm
by JeremyaFr
Hello,
I've updated the hook.
You can now define the shield recharge rate on a per mission basis.

Re: Shield Recharge Hook

Posted: Sun Mar 31, 2019 3:36 pm
by Driftwood
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?

Re: Shield Recharge Hook

Posted: Sun Mar 31, 2019 6:07 pm
by Darksaber
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

Re: Shield Recharge Hook

Posted: Sun Mar 31, 2019 6:47 pm
by JeremyaFr
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

Re: Shield Recharge Hook

Posted: Sun Mar 31, 2019 6:57 pm
by Darksaber
Cheers something to do on a rainy day :)

Re: Shield Recharge Hook

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

Re: Shield Recharge Hook

Posted: Mon Apr 01, 2019 1:59 am
by Bman
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.

Re: Shield Recharge Hook

Posted: Mon Apr 01, 2019 2:37 am
by Darksaber
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

Re: Shield Recharge Hook

Posted: Mon Apr 01, 2019 2:38 am
by Bman
Ah, interesting. Thanks mate. I removed that part from my above post so not to confuse everyone.

Re: Shield Recharge Hook

Posted: Fri Apr 05, 2019 6:17 pm
by JeremyaFr
UPDATE

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

Re: Shield Recharge Hook

Posted: Mon Feb 22, 2021 4:38 pm
by JeremyaFr
UPDATE

Hello,
I've updated the shield hook.

This hook now supports the new meshes count limit.

Re: Shield Recharge Hook

Posted: Sun Oct 03, 2021 6:43 pm
by AngeI
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?

Re: Shield Recharge Hook

Posted: Fri Oct 08, 2021 3:02 am
by Bman
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.

Re: Shield Recharge Hook

Posted: Wed Oct 13, 2021 8:01 pm
by AngeI
I've tried various scenarios, I can't get it to work, so need some input from @JeremyaFr on this.

Re: Shield Recharge Hook

Posted: Mon Nov 15, 2021 11:28 am
by AngeI
@JeremyaFr an update, it seems this feature is working ok in XWAU but broken in TFTC.

Re: Shield Recharge Hook

Posted: Fri May 19, 2023 4:16 pm
by JeremyaFr
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.

Re: Shield Recharge Hook

Posted: Wed Dec 06, 2023 7:05 pm
by JeremyaFr
UPDATE

Hello,
I've updated the shield hook.

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

Re: Shield Recharge Hook

Posted: Sat Dec 30, 2023 9:15 pm
by JeremyaFr
UPDATE

Hello,
I've updated the shield hook.

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

Re: Shield Recharge Hook

Posted: Sun Dec 31, 2023 6:16 pm
by lookiamcool
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.

Re: Shield Recharge Hook

Posted: Sun Dec 31, 2023 11:00 pm
by JeremyaFr
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.