Page 1 of 1

Impossible to set secondary warheads other than Concussion Missile?

Posted: Sun Sep 29, 2019 11:24 am
by Turgidson
It seems that when a second set of warhead launchers is added, its always a (standard) Concussion Missile launcher. It just seems impossible to set it to anything else (Advanced Missile, Torpedo, Advanced Torpedo...) - editing the OPT, editing the weaponry with MXvTED... have no effect on this.
Of course, there's no interface to select the secondary weapons type in-game... and I don't think this one absolutely needs to change. But at least, in TIE Fighter for example, the Missile Boat had Advanced CMs (not the near-useless standard CMs).

I'd assume this behavior hard-coded. Would there be a way (through a new Hook?) to make the game read the ship information; so that the weapons type of this second launcher becomes editable?

Re: Impossible to set secondary warheads other than Concussion Missile?

Posted: Sun Sep 29, 2019 2:42 pm
by Jaeven
This would be a really interesting idea. CC: Jeremya :D

Re: Impossible to set secondary warheads other than Concussion Missile?

Posted: Sun Sep 29, 2019 3:07 pm
by JeremyaFr
I will have a look.

Re: Impossible to set secondary warheads other than Concussion Missile?

Posted: Sun Sep 29, 2019 4:44 pm
by JeremyaFr
Turgidson wrote:
Sun Sep 29, 2019 11:24 am
I'd assume this behavior hard-coded.
You are right.

At address 0041BBF0, there is this code:

Code: Select all

if( s_ExeCraftTable[esp18].WarheadTypeId[1] != ModelIndex_000__1_0 )
{
    s_pXwaCurrentCraft->WarheadsModelIndex[0] = ModelIndex_287_1_25_ConcussionMissile;
    s_pXwaCurrentCraft->WarheadsModelIndex[1] = s_XwaTieWarheadTypeToModelIndex[s_XwaTieFlightGroups[s_V0x09E9708].FlightGroup.WarheadType];
}
else
{
    s_pXwaCurrentCraft->WarheadsModelIndex[0] = s_XwaTieWarheadTypeToModelIndex[s_XwaTieFlightGroups[s_V0x09E9708].FlightGroup.WarheadType];
    s_pXwaCurrentCraft->WarheadsModelIndex[1] = ModelIndex_000__1_0;
}
When 2 warheads are defined, one is replaced with a Concussion Missile.

Re: Impossible to set secondary warheads other than Concussion Missile?

Posted: Sun Sep 29, 2019 8:57 pm
by Turgidson
Wow! Thanks for the quick analysis and confirmation. :god:

Now the question is, could this be modified so it reads the "real" value (patched to the EXE with MXvTED and/or read from the OPT) instead of the default replacement? Or have an an external config file that'd determine what the weapons replacement should be... :)

Re: Impossible to set secondary warheads other than Concussion Missile?

Posted: Sun Sep 29, 2019 9:37 pm
by Trevor
Wow, Jeremy, it looks like you are doing a full decompile of xwa, eventually we wont need hooks :lachtot:

Trev

Re: Impossible to set secondary warheads other than Concussion Missile?

Posted: Mon Sep 30, 2019 4:27 am
by Bman
Turgidson, have you tried using the AlliED mission editor? The Ship Tab and Options tab? I would think if the .opt model and offsets are setup already (try BHE) this would allow you achieve the second load of 40 adv. mis. so Missible Boat would have it's 80 adv. mis. or whatever. I don't recall how many of payload you can specify. Maybe I'm wrong but thought this was already do-able.

Re: Impossible to set secondary warheads other than Concussion Missile?

Posted: Wed Oct 02, 2019 7:19 am
by Mark_Farlander
With BinHexEdit or MXvTED v4.2 you can specify 2 warhead loads with their respective per-launcher payloads. Fighters usually have 2 launchers for each warhead load.
However, as soon as the mission or skirmish is loaded, if the craft has only 1 warhead load in MXvTED it is replaced with the load set in AlliED for that Flight Group.
If the craft has 2 warhead loads in MXvTED the first load is replaced with standard concussion missiles and the second one is replaced with the load set in AlliED.
I suspected this logic, but now the code posted by Jeremy leaves without any doubt.

Re: Impossible to set secondary warheads other than Concussion Missile?

Posted: Wed Oct 02, 2019 7:42 am
by Mark_Farlander
As I just wrote, the code posted by Jeremy essentially means that the warhead types set with MXvTED v4.2 do not matter.
It's the load you set with AlliED, Ship menu, or in the simulator that determines the only (or the second) warhead load.

As far as I know the Options menu in AlliED only serves to allow the player to REPLACE what's set in the Ship menu.
Player can change craft with an optional one, or he can load another warhead type, beam system or countermeasure.
But any selection he will do in the hangar, it will remove the default one (the one set in the Ship menu).

Any changes done while player's craft is in the hangar will only affect player's craft, not the other crafts in his FG.

Re: Impossible to set secondary warheads other than Concussion Missile?

Posted: Wed Oct 02, 2019 10:09 pm
by Turgidson
So without a hook, no chance to set the other warhead load on the type written in MXvTED (or in any other external file).

Re: Impossible to set secondary warheads other than Concussion Missile?

Posted: Thu Oct 03, 2019 1:50 am
by Driftwood
As I'm reading it can only be changed on a "per mission basis" in allied.

Correct me if I'm wrong.

Re: Impossible to set secondary warheads other than Concussion Missile?

Posted: Thu Oct 03, 2019 5:14 am
by Mark_Farlander
No, if a craft has 2 warhead loads then the first one is always set to standard concussion missiles regardless of the warhead load set in MXvTED or AlliED.
JeremyaFr wrote:
Sun Sep 29, 2019 4:44 pm
Turgidson wrote:
Sun Sep 29, 2019 11:24 am
I'd assume this behavior hard-coded.
You are right.

At address 0041BBF0, there is this code:

Code: Select all

if( s_ExeCraftTable[esp18].WarheadTypeId[1] != ModelIndex_000__1_0 )
{
    s_pXwaCurrentCraft->WarheadsModelIndex[0] = ModelIndex_287_1_25_ConcussionMissile;
    s_pXwaCurrentCraft->WarheadsModelIndex[1] = s_XwaTieWarheadTypeToModelIndex[s_XwaTieFlightGroups[s_V0x09E9708].FlightGroup.WarheadType];
}
else
{
    s_pXwaCurrentCraft->WarheadsModelIndex[0] = s_XwaTieWarheadTypeToModelIndex[s_XwaTieFlightGroups[s_V0x09E9708].FlightGroup.WarheadType];
    s_pXwaCurrentCraft->WarheadsModelIndex[1] = ModelIndex_000__1_0;
}
When 2 warheads are defined, one is replaced with a Concussion Missile.
Mark_Farlander wrote:
Wed Oct 02, 2019 7:19 am
With BinHexEdit or MXvTED v4.2 you can specify 2 warhead loads with their respective per-launcher payloads. Fighters usually have 2 launchers for each warhead load.
However, as soon as the mission or skirmish is loaded, if the craft has only 1 warhead load in MXvTED it is replaced with the load set in AlliED for that Flight Group.
If the craft has 2 warhead loads in MXvTED the first load is replaced with standard concussion missiles and the second one is replaced with the load set in AlliED.
I suspected this logic, but now the code posted by Jeremy leaves without any doubt.

Re: Impossible to set secondary warheads other than Concussion Missile?

Posted: Thu Oct 03, 2019 5:51 am
by Mark_Farlander
There is a thing that needs to be tested: as I wrote in the file "Orders (Basic)" for the AlliED modding wiki, the third box (No Effect?) of the order "Attack targets" is warhead usage.
0 is default: the FG fires concussion missiles (standard or advanced) only against fighters, proton torpedoes or heavy rockets only against transports, capital ships and stations.
[See the values in the Warhead - Behavior section in BinHexEdit to get the default usage for every warhead type]
1 is "All targets": the FG fires warheads against every target regardless of target category while performing such order.
2 is "Never": the FG never fires warheads while performing such order.

However, this is true (has been tested many times) for crafts set to carry only one load of warheads in MXvTED, and that load is replaced with the one set in AlliED.
But how does that logic work for crafts set to carry 2 loads of warheads such as the Missile Boat or the Skipray Blastboat?
I mean if the second warhead load is proton torpedoes (the first load is always standard concussion missiles) and you set the third box to 1, how do crafts behave?
The most logic thing would be to use missiles against fighters and proton torpedoes against capital ships, transports and stations just like default, but this needs to be tested.