Hooks

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

Moderator: JeremyaFr

Post Reply

Re: Hooks

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

Post by keiranhalcyon7 » Sun Dec 30, 2018 4:50 pm

Seconded, and same request for per-mission files.

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

Post by JeremyaFr » Mon Dec 31, 2018 2:24 pm

I will do that.

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

Post by DTM » Tue Jan 01, 2019 10:54 am

Thank you!!!!!

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

Post by JeremyaFr » Wed Jan 02, 2019 2:11 pm

UPDATE

Hello,
I've updated the hooks to add support for .ini files per-craft or per-mission. The files are "FlightModels\[Model].ini" next to "FlightModels\[Model].opt" and "[MissionDir]\[Mission].ini" next to "[MissionDir]\[Mission].tie".

The sections in "FlightModels\[Model].ini" are:

Code: Select all

[Sound]
...

[HangarObjects]
...

[HangarMap]
...

[FamHangarMap]
...

[HangarCamera]
...

[FamHangarCamera]
...

[Camera]
...

[Size]
...

[Interdictor]
...

[Pilot]
...

[SFoils]
...

[WeaponColor]
...

[WeaponRate]
...
The sections in "[MissionDir]\[Mission].ini" are:

Code: Select all

[Resdata]
...

[Sounds]
...

[Objects]
...

[HangarObjects]
...

[HangarMap]
...

[FamHangarMap]
...

[HangarCamera]
...

[FamHangarCamera]
...

[mission_tie]
...
Please redownload all the hooks.
The easy way is via XwaHooksSetup.

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

Post by Darksaber » Wed Jan 02, 2019 2:47 pm

Thanks Jeremy, should make life a little simpler, now to get to work converting it all lol

I take it, it doesn't matter what order they go in, as I tend to go alphabetical

Code: Select all


[Camera]
...

[FamHangarCamera]
...

[FamHangarMap]
...

[HangarCamera]
...

[HangarMap]
...

[HangarObjects]
...

[Interdictor]
...

[Pilot]
...

[SFoils]
...

[Size]
...

[Sound]
...

[WeaponColor]
...

[WeaponRate]
...
Jeremy could you upload a couple of examples of the new ini files please just to get us going and on the right track please
“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
Trevor
Lieutenant JG
Posts: 541
Joined: Thu Dec 04, 2014 7:11 pm

Post by Trevor » Wed Jan 02, 2019 6:49 pm

Also, what is your comment tag? is it ; ?
eg

Code: Select all

;this is a test of the interdictor for craft x
; This craft also has a hangar based on rebels tv series
[Interdictor]
IsInterdictor = 0 ;well, it turns out xyz didn't have this feature 

[Sound]
…
Trev

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

Post by JeremyaFr » Wed Jan 02, 2019 7:08 pm

The code parses comments on per-line basis. You can't have both comment and data on the same line. A comment line begins with "#", ";" or "//".

Here is 2 examples:

For XWing.opt:

Code: Select all

;XWing.ini

[Pilot]
;mesh index, angle, speed, behavior
6, 32, 2, 1
9, 32, 2, 2

[SFoils]
;mesh index, angle, closing speed, opening speed
1, 8, 1, 1
2, 12, 1, 1
3, 12, 1, 1
4, 8, 1, 1
10, 8, 1, 1
11, 12, 1, 1
12, 12, 1, 1
13, 8, 1, 1
14, 8, 1, 1
15, 12, 1, 1
16, 12, 1, 1
17, 8, 1, 1

[Sound]
EngineSoundInterior = 1
EngineSoundFlyBy = 1
For CalamariCruiserNew.opt:

Code: Select all

;CalamariCruiserNew.ini

[HangarMap]
; Must contain at least 4 object line.
; Format is : model index, position X, position Y, position Z, heading XY, heading Z
; Numbers can be in decimal or hexadecimal (0x) notation.
; When position Z is set to 0x7FFFFFFF, this means that the object stands at the ground.

;ModelIndex_314_HangarMonitor
314, -1059, 1313, 0x7FFFFFFF, 38600, 0

;ModelIndex_309_HangarCrane
309, 725, -416, 0x7FFFFFFF, 23500, 0

;ModelIndex_313_HangarGenerator
313, -1352, 1440, 0x7FFFFFFF, 536, 0

;ModelIndex_310_HangarCrate
310, 794, -810, -848, 6800, 12500

;ModelIndex_310_HangarCrate
310, -803, -1464, 0x7FFFFFFF, 49200, 0

;ModelIndex_310_HangarCrate
310, -1563, 944, 0x7FFFFFFF, 51436, 0

;ModelIndex_083_ContainerBox
83, -506, -2136, -722, 32836, 16480

;ModelIndex_083_ContainerBox
83, -841, -1628, 0x7FFFFFFF, 53100, 0

;ModelIndex_083_ContainerBox
83, 1240, -2098, -722, 272, 16480

;ModelIndex_084_ContainerSphere
84, -834, -2034, 0x7FFFFFFF, 32336, 0

;ModelIndex_080_CargoCanister
80, -3474, -275, 0x7FFFFFFF, 29436, 0

;ModelIndex_002_Ywing
2, -1038, -798, 0x7FFFFFFF, 7700, 0

;ModelIndex_050_Shuttle
50, 1146, -1288, -741, 50536, 0

;ModelIndex_310_HangarCrate
310, -873, -1456, -849, 60472, 20400

;ModelIndex_310_HangarCrate
310, -3095, -592, 0x7FFFFFFF, 51436, 0

;ModelIndex_083_ContainerBox
83, -1751, -1996, 0x7FFFFFFF, 31172, 0

;ModelIndex_083_ContainerBox
83, 979, -2103, 0x7FFFFFFF, 37036, 0

;ModelIndex_084_ContainerSphere
84, -1374, -2068, 0x7FFFFFFF, 40536, 0

;ModelIndex_080_CargoCanister
80, 3474, 357, 0x7FFFFFFF, 20536, 0

;ModelIndex_080_CargoCanister
80, -195, -1910, 0x7FFFFFFF, 54372, 0

;ModelIndex_004_Bwing
4, 1378, 0, 0x7FFFFFFF, 40036, 0

;ModelIndex_315_HangarWorkStand
315, 1179, 233, 0x7FFFFFFF, 40036, 0

;ModelIndex_002_Ywing
2, 1100, -523, 0x7FFFFFFF, 49036, 0

;ModelIndex_315_HangarWorkStand
315, 820, -705, 0x7FFFFFFF, 49036, 0

;ModelIndex_315_HangarWorkStand
315, -1065, 200, 0x7FFFFFFF, 16600, 0

;ModelIndex_001_Xwing
1, -1003, -100, -825, 16600, 0

;ModelIndex_003_Awing
3, -950, 560, 0x7FFFFFFF, 16600, 0

;ModelIndex_315_HangarWorkStand
315, -1065, 800, 0x7FFFFFFF, 16600, 0

;ModelIndex_058_CorellianTransport2
58, 965, -3600, 0x7FFFFFFF, -9500, 0

[HangarObjects]
;Replace Opts
FlightModels\Ywing.opt = FlightModels\YwingExterior.opt
FlightModels\Xwing.opt = FlightModels\XwingExterior.opt
FlightModels\Awing.opt = FlightModels\AwingExterior.opt
FlightModels\Bwing.opt = FlightModels\BwingExterior.opt
FlightModels\HangarCrane.opt = FlightModels\RebHangarCrane.opt
FlightModels\HangarDroid.opt = FlightModels\RebHangarDroid.opt
FlightModels\HangarDroid2.opt = FlightModels\RebHangarDroid2.opt
FlightModels\HangarGenerator.opt = FlightModels\RebHangarGenerator.opt
FlightModels\HangarMonitor.opt = FlightModels\RebHangarMonitor.opt
FlightModels\HangarRoofCrane.opt = FlightModels\RebHangarRoofCrane.opt
FlightModels\HangarWorkStand.opt = FlightModels\RebHangarWorkStand.opt

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

Post by Darksaber » Wed Jan 02, 2019 7:11 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
Driftwood
Admiral (Moderator)
Posts: 2174
Joined: Wed Oct 22, 2003 11:01 pm
Contact:

Post by Driftwood » Thu Jan 03, 2019 4:25 am

Nice, thanks for the ini update. The only downside is now I have to convert all my text files over. LOL, guess I can also compress all my textures too while I'm at it.
JeremyaFr wrote:
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.
Here's another weapon hook related question, and I'm going to paraphrase my thoughts here a bit since I'm tired. For example if you have laser.opt with red/yellow/blue/green lets say FG color textures and defined by ship type Star Destroyer = weaponcolorgreen, ect calling the green FG to be shown when lasers are fired. Can you instead do something along the lines of Star Destroyer = weaponcolorgreen FG color (laser.opt) = plasma.opt FG green?

I guess to put it more simply, can you set a weapon opt to be displayed plus the FG color type on a per ship basis? So instead of having the laser opt appear when fired by the star destroyer it fires an alternative opt, but displays the defined FG color?

Like, would it be possible to theoretically make a Star Destroyer literally fire X-Wings out of its hardpoints if I wanted to? I mean is it theoretically possible to basically take the opt replacer and weapon color opt and combine their function?

Am I articulating what I'm asking is possible well enough?

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

Post by JeremyaFr » Thu Jan 03, 2019 7:27 pm

No, it is not possible.

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

Post by Driftwood » Fri Jan 04, 2019 1:37 am

Okay. Hm.

Well here's another question then. Revisiting the hidden geometry function you mentioned a while back, is there a way that could be implemented in some capacity on a per-mission or conditional basis? I'm exploring the idea of using transparent textures to hide certain details of a model, but I'm curious what the limitations of that are realistically and if there's likely to be performance issues.

And a second question, is there a way to change the appearance of flares/chaff on a per ship basis? Model or texture wise?

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

Post by Driftwood » Fri Jan 04, 2019 3:12 am

Also Jeremya, I'm duplicating this part of my post from the private section.

I put FG colors using Darksabers new textures in the same order on all 6 capital ship lasers. In skirmish they still fire as Green or Red depending on which faction you've selected, even though the config is set to override defaults as Purple.

Is skirmish/capships hardcoded, or am I still missing something?

Fighters hook the FG colors correctly in skirmish and campaign as either player or AI. Capships do not seem to be, either as player or AI in campaign or skirmish. It seems IFF setting is dictating either red or green lasers.

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

Post by JeremyaFr » Fri Jan 04, 2019 2:41 pm

UPDATE
Hello,
I've updated the weapon color hook.
Setting weapon color now works for capital ships.

Please redownload xwa_hook_weapon_color.zip

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

Post by Darksaber » Fri Jan 04, 2019 4:49 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
Driftwood
Admiral (Moderator)
Posts: 2174
Joined: Wed Oct 22, 2003 11:01 pm
Contact:

Post by Driftwood » Fri Jan 04, 2019 6:09 pm

Yay, thanks for the quick fix

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

Post by Darksaber » Fri Jan 04, 2019 8:16 pm

Quick question Jeremy

If you use

WeaponColor280 = 0
WeaponColor281 = 0

Do you actually need to use

WeaponColor = 0

Thanks
“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 Jan 04, 2019 8:29 pm

Setting WeaponColor = 0 is not needed as 0 is the default value.

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

Post by Darksaber » Fri Jan 04, 2019 9:09 pm

Sorry, I'm not sure I explained my self properly

If I use
WeaponColorXXX = Value
WeaponColorXXX = Value

Do I actually need to use

WeaponColor = Value

Thanks
“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 Jan 04, 2019 9:19 pm

"WeaponColor = value" sets the default markings for all the weapons (280 to 307). It is read first. Then the "WeaponColorXXX = value" set the value for the specified weapon.

For exemple, if you have:

Code: Select all

WeaponColor = 1
WeaponColor280 = 2
The weapon 280 is set to 2. All the others weapons are set to 1.

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

Post by Darksaber » Fri Jan 04, 2019 9:24 pm

Ok thanks, I also re-read the readme again, I get it now, sorry to waste your time.
“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
Trevor
Lieutenant JG
Posts: 541
Joined: Thu Dec 04, 2014 7:11 pm

Post by Trevor » Sat Jan 05, 2019 3:48 pm

Understanding is never a waist of time :)

I would admit that

Code: Select all

[WeaponColor]
DefaultFG=0 ;Default FG for all weapons used by this craft not otherwise specified here
would have been clearer, however, its been resolved and should pose not further problems :P

Trev

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

Post by Bman » Tue Jan 08, 2019 12:57 am

Great idea to reduces all the .txt files into one .ini on a per craft basis or mission basis. Another idea, can most of the .dll's be compiled under just one master dynamic link library file?
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 » Tue Jan 08, 2019 1:31 am

If it ain't broke, don't fix it
:D :D :D :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
Trevor
Lieutenant JG
Posts: 541
Joined: Thu Dec 04, 2014 7:11 pm

Post by Trevor » Tue Jan 08, 2019 6:01 pm

Also, while the ini file is forwards compatible (assuming default values for non-existing entries) re-compiling a single patch hook would mean as more patches are made the hook will get bigger and bigger taking more time to compile and also opens up the potential of breaking older patches if Jeremy say upgrades VS. new patches would be compiled to work in new compiler and old ones would be assumed to work but would not so that means on compiling any new patch ALL patches would need re-tested.

the number of txt files far exceeds that of dll's

Trev

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

Post by Darksaber » Tue Jan 08, 2019 6:57 pm

wow nearly asphyxiated myself reading that!
“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

Post Reply