Hooks

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

Moderator: JeremyaFr

Post Reply

Re: Hooks

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

Post by JeremyaFr » Sat Oct 20, 2018 3:03 pm

I will soon release the updated version of the hangars hook.

EDIT:
released
See the Custom Hangars thread

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

Post by JeremyaFr » Sun Oct 21, 2018 1:33 pm

UPDATE
Hello,
I've updated the turret hook.

Previously, when there was multiple crafts with turret, only the first turret was loaded. I've fixed that. Now, the correct turret is loaded.

Please redownload xwa_hook_mission_objects.zip

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

Post by Darksaber » Sun Oct 21, 2018 2:59 pm

Thanks Jeremy
“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: 3921
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Wed Nov 28, 2018 5:31 pm

UPDATE

Hello,
I've updated the main hook to include a better error message for "The called hook was not correctly installed or initialized" error.

Please redownload xwa_hook_main.zip

User avatar
rogue518
XWAU Member
Posts: 2856
Joined: Wed Jul 12, 2000 11:01 pm
Contact:

Post by rogue518 » Wed Nov 28, 2018 8:05 pm

Thanks JeremyaFr …… :D That cleared up my problem...:)

Sincerely, Rogue518
'Stay in Attack formation!' Darth Vader aka: Anakin Skywalker During the 'Battle Of Yavin'

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

Post by JeremyaFr » Sun Dec 16, 2018 2:33 pm

NEW HOOK
Hello,

Here is a hook to set the lasers flightgroup color.

Suppose that the craft is "FlightModels\[Model].opt".
To define the color, create a file named "FlightModels\[Model]WeaponColor.txt".
The format is:
WeaponColor = color value
WeaponColorXXX = color value
WeaponColor defines the default value used for all weapons.
XXX in WeaponColorXXX goes from 280 to 307. When present, this overrides the default value. You can define a different value for all weapons.
If the file does not exist, 0 is used.
You also need to add a flightgroup color to the laser OPTs.

Download:
xwa_hook_weapon_color.zip
Last edited by JeremyaFr on Fri Dec 21, 2018 7:52 pm, edited 3 times in total.

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

Post by Darksaber » Sun Dec 16, 2018 3:03 pm

This is brilliant, thanks, but sorry to be a pain

but can you go into a little more detail on what values to use

Also I have a Yellow Laser for a different version of the Slave One, what is the Yellow Value?

Again sorry to be a pain :D Thanks

EDIT: also in your Readme file you have
Suppose that the craft is "FlightModels\[Model].opt".

To define the color, create a file named "FlightModels\[Model]WeaponColor.txt".
The format is:
WeaponColor = color value

If the file does not exist, 0 is used.

See XWingWeaponRate.txt.

You also need to add a flightgroup color to the laser OPTs.
I take it "See XWingWeaponRate.txt." is a mistake and should read "See XWingWeaponColor.txt" ????
“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: 3921
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Sun Dec 16, 2018 3:39 pm

"See XWingWeaponRate.txt." is a mistake. I've fixed that ("See XWingWeaponColor.txt.").

The color value is the index of the flightgroup color in the opt file. 0 is the first flightgroup color, 1 is the second flightgroup color, and so on...
I've included a modified version of LaserRebel.opt and LaserRebelTurbo.opt in the zip. I've added a green color. You can test that with the XWing by setting "WeaponColor = 1". The lasers appear green.

For the Slave One, the Yellow color works differently. It defines the open weapon in the exe. This hook doesn't modify the weapons stats in the exe. It use the different colors (textures) defined in the OPTs.

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

Post by Darksaber » Sun Dec 16, 2018 3:58 pm

I see, thanks for the clearer explanation :)
“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 Dec 17, 2018 3:01 am

I see, in other words WeaponColor = FG markings (index 0, 1, 2,...) It's the same technique used for referencing the 6 Red Squardon X-wing textures in one model. :-) Also, the IFF side determines which laser.opt file(s) is loaded by game engine. So having additional FG's colors for those .opt models allows a lot of flexibility. Thanks Jeremy.
W-I-P: TFTC, MC Viscount Cr., ISD-II Avenger, NL-1 Platform, Ton-Falk Esc. Cr., & Misc.

User avatar
DTM
Fleet Admiral (Administrator)
Posts: 2119
Joined: Tue Apr 22, 2003 11:01 pm
Contact:

Post by DTM » Mon Dec 17, 2018 6:06 am

Great! Does it change also ion cannona and torpedoes and missiles, or only the primary weapon?

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

Post by Darksaber » Mon Dec 17, 2018 1:26 pm

For those interested here are some flightgroup lasers

LaserImp.opt and LaserImpTurbo.opt
Green = 0
Red = 1
Purple = 2
Yellow = 3

LaserRebel.opt and LaserRebelTurbo.opt
Red = 0
Green = 1
Purple = 2
Yellow = 3
FlightGroupLasers.rar
Just unpack them in the Flightmodels folder and follow the instructions that Jeremy has provided
You do not have the required permissions to view the files attached to this post.
“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: 3921
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Mon Dec 17, 2018 5:28 pm

Thanks Darksaber
DTM wrote:
Mon Dec 17, 2018 6:06 am
Great! Does it change also ion cannona and torpedoes and missiles, or only the primary weapon?
Currently, the hook works the same for any weapons. So it also works for ions, torpedos, missiles, bombs, rockets. If needed, I can modify the hook to distinguish lasers (rebel, imp, ion) and missiles (torpedo, missile, bomb, rocket).
Last edited by JeremyaFr on Wed Dec 19, 2018 5:13 pm, edited 1 time in total.

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

Post by keiranhalcyon7 » Mon Dec 17, 2018 5:56 pm

It might be preferable to distinguish between all weapon types. Say ship A is intended to fire type 1 lasers and default ions, and ship B is intended to fire default lasers and type 1 ions. Is this configuration currently possible? I think currently both ships would end up firing type 1 of both weapons.

User avatar
Rookie_One1
Rebel Alliance
Posts: 1656
Joined: Thu Feb 26, 2004 12:01 am

Post by Rookie_One1 » Mon Dec 17, 2018 6:04 pm

Should be very interesting when DSUCP and XWAUP packs get updated
Rookie One, is that you?? - Ru Merleen, Rebel Spy at Imdaar Alpha
Current Holder of the Frying Pan of Death

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

Post by JeremyaFr » Mon Dec 17, 2018 7:48 pm

UPDATE
You can now select a different value for all weapons.

EDIT: link removed

The format is:
WeaponColor = color value
WeaponColorXXX = color value

WeaponColor defines the default value used for all weapons.
XXX in WeaponColorXXX goes from 280 to 307. When present, this overrides the default value. You can define a different value for all weapons.
Last edited by JeremyaFr on Fri Dec 21, 2018 7:53 pm, edited 1 time in total.

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

Post by Darksaber » Tue Dec 18, 2018 12:38 pm

Thanks Jeremy that's brilliant
“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
Darksaber
Vice Admiral
Posts: 10931
Joined: Mon Jan 10, 2000 12:01 am
Contact:

Post by Darksaber » Tue Dec 18, 2018 9:24 pm

Hi Jeremy,

Just testing your new weapon color hook I've added other colors to LaserIon.opt and LaserIonTurbo.opt

the colors are

Blue=0
LightBlue=1
BluePurple=2
RedPurple=3

Testing with the assault gunboat,

These are the settings I have in the AssaultGunboatWeaponsColor.txt

WeaponColor = 0
WeaponColor284 = 3

When your firing any of the lasers on full charge the LaserImpTurbo.opt, LaserRebelTurbo.opt ot LaserIonTurbo.opt fires and when your on half charge the lasers switch to LaserImp.opt, LaserRebel.opt ot LaserIon.opt

The problem is when your firing the Ions (284) on full charge it first fires the Ionturbo.opt but it still fires FG0 = Blue, and only switches to Ion.opt FG3 (RedPurple) when the charge is halved

It should be showing both FG3 on full or half charge, hope you understand

I've included the Opts for you to test for yourself :) Remember to backup the other LaserIon.opt & LaserIonTurbo.opt first :)
LaserIonTest.rar
You do not have the required permissions to view the files attached to this post.
“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: 3921
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Wed Dec 19, 2018 4:32 pm

Darksaber wrote:
Tue Dec 18, 2018 9:24 pm
These are the settings I have in the AssaultGunboatWeaponsColor.txt
Typo: AssaultGunboatWeaponColor.txt

Ion turbo is 285. So to have 3 for the ion, you have that in AssaultGunboatWeaponsColor.txt:

Code: Select all

WeaponColor284 = 3
WeaponColor285 = 3

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

Post by Darksaber » Wed Dec 19, 2018 4:57 pm

Sorry, yes the typo, the file I have though is correct spelling :)

and Opps, I thought it would work the same as the normal Red/Green lasers, I didn't realise you had to add both

Ok just another quick question

Not that I'm going to, but hypothetically........

A craft can change to a number of different missiles and torpedoes in game or in skirmish, If I were to change the missiles and torpedoes and add different FG's (which I'm not) to those, I would also have to add other lines in the list, something like so :-

Code: Select all

WeaponColor = 0
WeaponColor284 = 3
WeaponColor285 = 3
WeaponColor286 = 1
WeaponColor287 = 2
WeaponColor291 = 3
WeaponColor292 = 1
WeaponColor293 = 2
WeaponColor294 = 3
WeaponColor295 = 0
WeaponColor296 = 1
Just on the off chance that I might want to select a different missile or torpedo with a different FG for that craft

Would this be correct??

Thanks again :)
“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: 3921
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Wed Dec 19, 2018 5:12 pm

It is correct.
But I think that it doesn't work for countermeasures.

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

Post by Darksaber » Wed Dec 19, 2018 6:55 pm

Ok gotta, thanks :D
“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: 3921
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Fri Dec 21, 2018 7:54 pm

UPDATE
Hello,
I've uploaded the weapon color hook to my OneDrive and to GitHub.
There is no change.

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

Post by JeremyaFr » Sun Dec 30, 2018 11:50 am

NEW HOOK
Hello,
Here is a new hook. It permits to enable interdictor feature for any craft.

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

To enable the interdictor feature, create a file named "FlightModels\[Model]Interdictor.txt".
The format is:
IsInterdictor = 1
or
IsInterdictor = 0

If the file does not exist, default values are used. By default, the ModelIndex 137 Interdictor2 and ModelIndex 141 ModStrikeCruiser are interdictor.

xwa_hook_interdictor.zip

User avatar
Trevor
Lieutenant JG
Posts: 541
Joined: Thu Dec 04, 2014 7:11 pm

Post by Trevor » Sun Dec 30, 2018 12:41 pm

With all these hooks there is a potential for a lot of txt files, have you thought about making a unified ini file for each craft with section headers?

then you could have:
Suppose that the craft is "FlightModels\[Model].opt".

To enable the interdictor feature, create a file named "FlightModels\[Model].ini"
[Interdictor]
IsInterdictor = 1

[otherhook]


This would still be future proof as any new hook simply adds a section and any new features simply read their key=value pair while old hooks (who would be using an old hook anyway) ignore new features.

Trev

Post Reply