Hooks

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

Moderators: Darksaber, General_Trageton, Forceflow, JeremyaFr, DTM

Post Reply

Re: Hooks

User avatar
Darksaber

Fleet Admiral (Administrator)
Posts: 10316
Joined: Mon Jan 10, 2000 12:01 am
Contact:

Post by Darksaber » Fri Feb 01, 2019 7:25 am

Which hangar are we talking about? The pilot proving grounds which uses the main "Hangar.opt" or another in a different mission

The only *txt files the LoadDroids = 0 or LoadDroids = 1 should appear in is the either one of these
- "[MissionDir]\[Mission]_HangarObjects.txt"
- "[MissionDir]\[Mission].ini", section "[HangarObjects]"
- "FlightModels\[Model]HangarObjects.txt"
- "FlightModels\[Model].ini", section "[HangarObjects]"
- "FlightModels\HangarObjects.txt"

The main file you should have a look at is "FlightModels\HangarObjects.txt" as this controls what will appear in all "[Model]Hangar.opt" including the main "Hangar.opt" if a "FlightModels\[Model]HangarObjects.txt" is not present
“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
Ensign
Posts: 274
Joined: Tue Jan 02, 2018 6:41 am

Post by keiranhalcyon7 » Fri Feb 01, 2019 9:08 am

Actually I've found the problem. In HangarLoadDroidsHook(), the hook defaults to LoadDroids = 0 when the value is unspecified in the relevant configuration file:

Code: Select all

	const int value = GetFileKeyValueInt(lines, "LoadDroids"); // implicit default of 0
Adding a default of 1 resolves the issue. (Attn: Jeremy - I tried to create a pull request, but I'm afraid I haven't quite grokked git.)

JeremyaFr
Lieutenant Commander
XWAU Member
Posts: 1605
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Fri Feb 01, 2019 9:19 am

Hello,
I've fixed the default value of LoadDroids in the hangars hook.

Please redownload xwa_hook_hangars.zip

User avatar
Darksaber

Fleet Admiral (Administrator)
Posts: 10316
Joined: Mon Jan 10, 2000 12:01 am
Contact:

Post by Darksaber » Fri Feb 01, 2019 10:14 am

Thanks Jeremy

@keiranhalcyon7 - Please redownload the SatCom installer
“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
Lieutenant Commander
XWAU Member
Posts: 1711
Joined: Wed Oct 22, 2003 11:01 pm
Contact:

Post by Driftwood » Fri Feb 01, 2019 12:29 pm

Good find, I was wondering why the droids went missing all of a sudden.

Thanks for fixing this Jeremya.

evilmark
Cadet 4th Class
Posts: 16
Joined: Tue Feb 05, 2019 12:43 am

Post by evilmark » Sun Feb 10, 2019 8:05 pm

I'm having some trouble with the weapon color hook. I'm using the laser opts Darksaber posted back on page 4, but each ship I try to use it with the lasers stay at the default. I edited Darksaber's opts to make the yellow texture blue, but even when I try to use the purple color it still doesn't work.

XwingWeaponColor.txt

WeaponColor = 3

evilmark
Cadet 4th Class
Posts: 16
Joined: Tue Feb 05, 2019 12:43 am

Post by evilmark » Sun Feb 10, 2019 9:20 pm

Well, idk what was up with that but it suddenly started working.

XDragon
Cadet 2nd Class
Posts: 62
Joined: Tue Jan 29, 2008 12:01 am
Contact:

Post by XDragon » Tue Feb 12, 2019 6:04 pm

So I've been trying to look for a tutorial on the craft replacement hook and I can't seem to find it. I would love to take advantage of the multiple Corvettes and Frigates that everyone has so diligently been working on, but I have no idea how to actually go about changing which ship is in which mission. Also, is it possible to have multiple versions per mission? IE: a medical frigate ad a carrier frigate?
Glory to the Empire

User avatar
Darksaber

Fleet Admiral (Administrator)
Posts: 10316
Joined: Mon Jan 10, 2000 12:01 am
Contact:

Post by Darksaber » Tue Feb 12, 2019 7:33 pm

There aren't any tutorials on the Hooks, the closest you'll get to a tutorial is to read the readme files that come with the Hooks or to read the Modding Wiki/Hooks
“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

XDragon
Cadet 2nd Class
Posts: 62
Joined: Tue Jan 29, 2008 12:01 am
Contact:

Post by XDragon » Wed Feb 13, 2019 3:13 am

That's helpful for the other hooks, but not specifically the craft selection/replacement as I don't see it there. Sorry for being a pain
Glory to the Empire

User avatar
keiranhalcyon7
Ensign
Posts: 274
Joined: Tue Jan 02, 2018 6:41 am

Post by keiranhalcyon7 » Wed Feb 13, 2019 6:39 am

Usage is described near the end of Xwa_Hook_Mission_Objects_Readme.txt

What you describe isn't supported, though. Replacement is done by ship type, not by flight group.

JeremyaFr
Lieutenant Commander
XWAU Member
Posts: 1605
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Fri Apr 05, 2019 4:18 pm

Hello,
I've updated the Hooks page in the Wiki to include information about the .ini files.

User avatar
Darksaber

Fleet Admiral (Administrator)
Posts: 10316
Joined: Mon Jan 10, 2000 12:01 am
Contact:

Post by Darksaber » Thu May 30, 2019 9:27 am

Hi Jeremy,

I keep getting a crash when entering skirmish mode, a skipray against a skipray, not sure if that has anything to do with it,

This is the error report from event viewer

Code: Select all

Faulting application name: XwingAlliance.exe, version: 2.0.0.2, time stamp: 0x3765a9b7
Faulting module name: Hook_Shield.dll, version: 1.0.0.1, time stamp: 0x5ca798b1
Exception code: 0xc0000005
Fault offset: 0x00006d1f
Faulting process id: 0x159c
Faulting application start time: 0x01d516c86268023d
Faulting application path: C:\Program Files (x86)\LucasArts\X-Wing Alliance\XwingAlliance.exe
Faulting module path: C:\Program Files (x86)\LucasArts\X-Wing Alliance\Hook_Shield.dll
Report Id: a95b793c-82bb-11e9-9345-001d7d002f67


From that it looks like it's the new Shield Hook might be the problem, if I remove or delete the hook, skirmish loads fine

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

JeremyaFr
Lieutenant Commander
XWAU Member
Posts: 1605
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Thu May 30, 2019 12:50 pm

Hello,
I've fixed the crash.

Please redownload the hook.

User avatar
Darksaber

Fleet Admiral (Administrator)
Posts: 10316
Joined: Mon Jan 10, 2000 12:01 am
Contact:

Post by Darksaber » Thu May 30, 2019 2:14 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
Lieutenant Commander
XWAU Member
Posts: 1711
Joined: Wed Oct 22, 2003 11:01 pm
Contact:

Post by Driftwood » Sat Jun 29, 2019 5:10 am

Jeremya, I'm having an issue with additional FG colors not showing for ships beyond FG color 3.

Is this code still functional?

Code: Select all

\\Flight Group, FG Color number (0-127) IE: 0 = Red, 1 = Gold, 2 = Blue, 3 = Green, ect.

fg, 1, markings, 0
fg, 2, markings, 4
Shows FG 0 by default.

JeremyaFr
Lieutenant Commander
XWAU Member
Posts: 1605
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Sat Jun 29, 2019 8:10 am

Hello,
It's still functional.

Note that fg count start with 0.
Also, how have you named the file?
Suppose that the mission is "[MissionDir]\[Mission].tie".
To override the mission data, create a file named "[MissionDir]\[Mission].txt" or create a section named "[mission_tie]" in "[MissionDir]\[Mission].ini".

User avatar
Driftwood
Lieutenant Commander
XWAU Member
Posts: 1711
Joined: Wed Oct 22, 2003 11:01 pm
Contact:

Post by Driftwood » Sat Jun 29, 2019 3:16 pm

JeremyaFr wrote:
Sat Jun 29, 2019 8:10 am
Hello,
It's still functional.

Note that fg count start with 0.
Also, how have you named the file?
Suppose that the mission is "[MissionDir]\[Mission].tie".
To override the mission data, create a file named "[MissionDir]\[Mission].txt" or create a section named "[mission_tie]" in "[MissionDir]\[Mission].ini".
I had the FG color wrong somehow. I started at 0 and counted up like the flight group, instead of 1, 2, 3, 4, 5.

I originally 3 and 4, and I got FGs Green and "Five", but it was loading Blue and Green, not "five". This gave me the impression it wasn't working. I was wrong, it was working but loading the textures I was not expecting.

JeremyaFr
Lieutenant Commander
XWAU Member
Posts: 1605
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Sat Jun 29, 2019 4:20 pm

OK

User avatar
Driftwood
Lieutenant Commander
XWAU Member
Posts: 1711
Joined: Wed Oct 22, 2003 11:01 pm
Contact:

Post by Driftwood » Sat Jun 29, 2019 4:28 pm

I also realized that I had the section header as "FG Color Hook" Not "Mission_TIE" which also broke the hook.

Since It's already in a missionname.ini file does it need to be called "Mission_TIE?" since that doesn't exactly clarify what the section does? (obviously as is, to call the hook it does)

JeremyaFr
Lieutenant Commander
XWAU Member
Posts: 1605
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Sat Jun 29, 2019 4:39 pm

The section name is needed to distinguish the sections from different hooks.

User avatar
Driftwood
Lieutenant Commander
XWAU Member
Posts: 1711
Joined: Wed Oct 22, 2003 11:01 pm
Contact:

Post by Driftwood » Sat Jun 29, 2019 7:15 pm

Can weapon laser color also be changed to be associated with a given FG color by either ship type or FG sequence number?

User avatar
Driftwood
Lieutenant Commander
XWAU Member
Posts: 1711
Joined: Wed Oct 22, 2003 11:01 pm
Contact:

Post by Driftwood » Sun Jun 30, 2019 3:00 am

The other thought I've been tossing around lately is, could it be possible to define hull, maneuverability, ect. stats via the craft specific .ini file on a per-opt basis, overwriting whatever is stored in the EXE being called? Say in the instance you have an X-Wing utilized in the editor, but you overwrite it with the object replacer hook with something else, so it pulls the stats from the Othercraft.ini rather than the data in the EXE or the X-Wing.ini file?

Hypothetically.

User avatar
keiranhalcyon7
Ensign
Posts: 274
Joined: Tue Jan 02, 2018 6:41 am

Post by keiranhalcyon7 » Sun Jun 30, 2019 3:36 am

Driftwood wrote:
Sun Jun 30, 2019 3:00 am
The other thought I've been tossing around lately is, could it be possible to define hull, maneuverability, ect. stats via the craft specific .ini file on a per-opt basis, overwriting whatever is stored in the EXE being called? Say in the instance you have an X-Wing utilized in the editor, but you overwrite it with the object replacer hook with something else, so it pulls the stats from the Othercraft.ini rather than the data in the EXE or the X-Wing.ini file?

Hypothetically.
I've kicked around an even more ambitious idea - based on a mission ini, overwrite in-memory info for replaced ships (stats, icons, strings) with info read from the replacement ship's .shp file. It's potentially a lot of internal structures to find and edit, though. The location of the stats should be easy enough, since these are part of the exe's data segment, but I think the strings and icons are loaded into dynamically allocated spaces.

JeremyaFr
Lieutenant Commander
XWAU Member
Posts: 1605
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Tue Jul 09, 2019 4:55 pm

UPDATE

Hello,
I've updated the opt limit hook.

I've reverted the last change as I think it is no longer needed. It was used to fix a crash.
Let me know if the game crashes with this updated hook.

Post Reply