[REQUEST] Target Missile Hotkey

The place to discuss scripting and game modifications for X4: Foundations.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

Post Reply
argon_emperor
Posts: 1225
Joined: Mon, 12. Dec 05, 07:41
x4

[REQUEST] Target Missile Hotkey

Post by argon_emperor » Mon, 10. Dec 18, 20:22

Is this possible? Is it not a total pain to do? Currently fighters have basically 0 defence against 1 hit kill missiles (and I don't call a single use chaff 'defence', given they can usually fire off plenty more missiles than you chaff can deal with)

I know it's possible to shoot them, have done it manually on a few occasions (total pain in the rear though), and turrets are clearly capable of it, given they have a missile defence mode where they (mostly) are able to shoot down incoming missiles fairly easily.

Would just be nice to have another option as a fighter pilot to not get deaded pretty much as soon as someone packing missiles comes at you
[ external image ]
***modified***
"You can get more of what you want with kind words and a gun, than you can with just kind words" - Al Capone

Requiemfang
Posts: 3206
Joined: Thu, 16. Jul 09, 12:24
x4

Re: [REQUEST] Target Missile Hotkey

Post by Requiemfang » Tue, 11. Dec 18, 01:05

Would be nice although it would be even better if there was a mod that simply increased the amount of flares/chaff a ship can carry. Modern fighter craft carry dozen/dozens of flares/chaffs.

argon_emperor
Posts: 1225
Joined: Mon, 12. Dec 05, 07:41
x4

Re: [REQUEST] Target Missile Hotkey

Post by argon_emperor » Tue, 11. Dec 18, 01:40

Requiemfang wrote:
Tue, 11. Dec 18, 01:05
Would be nice although it would be even better if there was a mod that simply increased the amount of flares/chaff a ship can carry. Modern fighter craft carry dozen/dozens of flares/chaffs.
I can probably do this... Just might be a touch... Tedious XD But I might throw one together anyway, but would like a target nearest missile option as well :)
[ external image ]
***modified***
"You can get more of what you want with kind words and a gun, than you can with just kind words" - Al Capone

argon_emperor
Posts: 1225
Joined: Mon, 12. Dec 05, 07:41
x4

Re: [REQUEST] Target Missile Hotkey

Post by argon_emperor » Tue, 11. Dec 18, 02:49

Okay, so looks like that might be a little more... Frustrating than I expected XD Seeing as storage for "countermeasures" aren't defined in the macros (for the majority of the ships anyway), I tried using the add command for patching to see if I could get it to work, no matter what syntax I tried nothing seemed to working

Was trying this (on all the Argon fighters, and then doing new game as Young Gun to test):

Code: Select all

<diff>
	<add sel="/macros/macro/properties/storage/@countermeasure"> 20</add>
</diff>
Also tried

Code: Select all

<diff>
	<add sel="/macros/macro/properties/storage">
		<countermeasure="20"/>
	</add>
</diff>
And even

Code: Select all

<diff>
	<add sel="/macros/macro/properties">
		<storage countermeasure="20">
	</add>
</diff>
Also tried using replace instead of add for all 3 of those, yet still didn't end up with more than 1 countermeasure storage :/

If anyone reading this happens to have an idea of where I went wrong, would be appreciated to point me in the right direction :)
[ external image ]
***modified***
"You can get more of what you want with kind words and a gun, than you can with just kind words" - Al Capone

Forleyor
Posts: 40
Joined: Thu, 11. Jun 15, 19:09
x4

Re: [REQUEST] Target Missile Hotkey

Post by Forleyor » Tue, 11. Dec 18, 06:25

argon_emperor wrote:
Tue, 11. Dec 18, 02:49
If anyone reading this happens to have an idea of where I went wrong, would be appreciated to point me in the right direction :)
Hey,

Since the game is already reading the countermeasure value from somewhere (and after searching the game files this file is libraries/defaults.xml) it makes sense to use replace on the existing values rather than to add.

I tested this on small ship class in the defaults.xml with 2 small selection one for the starting storage limit and one for the max limit which i assume is used after making the counter measure mod...not entirley sure on that though, the max countermeasure value is always 4 higher than the original value so i used 20 for normal and 24 for max. (instead of the original values of 1 and max 5)

Here is what my diff file looks like

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<diff>
  <replace sel="//defaults/dataset[@class='ship_s']/properties/storage">
  	<storage countermeasure="20" deployable="50"/>
  </replace>
  <replace sel="//defaults/dataset[@class='ship_s']/properties/statistics/max/capacity">
  	<capacity crew="8" container="3156" solid="1750" liquid="0" ship_m="0" ship_s="0" unit="4" missile="28" countermeasure="24" deployable="54" />
  </replace>
</diff>
Tested in game and I could buy 20 Countermeasures on a discoverer :)

For the other ships classes you would need to add a few more replacements and change the values, for example to select for ship class XL would be:

Code: Select all

  <replace sel="//defaults/dataset[@class='ship_xl']/properties/storage">
  	<storage countermeasure="50" deployable="450"/>
  </replace>
  <replace sel="//defaults/dataset[@class='ship_xl']/properties/statistics/max/capacity">
        <capacity crew="220" container="20400" solid="0" liquid="0" ship_m="10" ship_s="40" unit="104" missile="400" countermeasure="54" deployable="454" />
  </replace>
Hope this helps.

argon_emperor
Posts: 1225
Joined: Mon, 12. Dec 05, 07:41
x4

Re: [REQUEST] Target Missile Hotkey

Post by argon_emperor » Tue, 11. Dec 18, 08:51

Forleyor wrote:
Tue, 11. Dec 18, 06:25
argon_emperor wrote:
Tue, 11. Dec 18, 02:49
If anyone reading this happens to have an idea of where I went wrong, would be appreciated to point me in the right direction :)
Hey,

Since the game is already reading the countermeasure value from somewhere (and after searching the game files this file is libraries/defaults.xml) it makes sense to use replace on the existing values rather than to add.

I tested this on small ship class in the defaults.xml with 2 small selection one for the starting storage limit and one for the max limit which i assume is used after making the counter measure mod...not entirley sure on that though, the max countermeasure value is always 4 higher than the original value so i used 20 for normal and 24 for max. (instead of the original values of 1 and max 5)

Here is what my diff file looks like

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<diff>
  <replace sel="//defaults/dataset[@class='ship_s']/properties/storage">
  	<storage countermeasure="20" deployable="50"/>
  </replace>
  <replace sel="//defaults/dataset[@class='ship_s']/properties/statistics/max/capacity">
  	<capacity crew="8" container="3156" solid="1750" liquid="0" ship_m="0" ship_s="0" unit="4" missile="28" countermeasure="24" deployable="54" />
  </replace>
</diff>
Tested in game and I could buy 20 Countermeasures on a discoverer :)

For the other ships classes you would need to add a few more replacements and change the values, for example to select for ship class XL would be:

Code: Select all

  <replace sel="//defaults/dataset[@class='ship_xl']/properties/storage">
  	<storage countermeasure="50" deployable="450"/>
  </replace>
  <replace sel="//defaults/dataset[@class='ship_xl']/properties/statistics/max/capacity">
        <capacity crew="220" container="20400" solid="0" liquid="0" ship_m="10" ship_s="40" unit="104" missile="400" countermeasure="54" deployable="454" />
  </replace>
Hope this helps.
Thanks for that, much appreciated!

So my issues was that I was looking at the complete wrong file XD Was looking in assests/units/size_s ect ect.
[ external image ]
***modified***
"You can get more of what you want with kind words and a gun, than you can with just kind words" - Al Capone

Forleyor
Posts: 40
Joined: Thu, 11. Jun 15, 19:09
x4

Re: [REQUEST] Target Missile Hotkey

Post by Forleyor » Tue, 11. Dec 18, 09:13

Anytime!

Im pretty sure everything in assets directory is 3D model/texture files, atleast...I know the ship files are lol.

morbideth
Posts: 391
Joined: Sun, 9. Nov 08, 03:07
x3tc

Re: [REQUEST] Target Missile Hotkey

Post by morbideth » Tue, 11. Dec 18, 09:20

can you use expressions? just replace countermeasure=" with countermeasure="50*

argon_emperor
Posts: 1225
Joined: Mon, 12. Dec 05, 07:41
x4

Re: [REQUEST] Target Missile Hotkey

Post by argon_emperor » Tue, 11. Dec 18, 09:23

Forleyor wrote:
Tue, 11. Dec 18, 09:13
Anytime!

Im pretty sure everything in assets directory is 3D model/texture files, atleast...I know the ship files are lol.
Nah, if you follow it to the macros folder in each of the size folders for the units, that's where each ship's stats are defined (each in a separate file XD) That's where I had to go to alter the crew for all ships, which is why I thought this would be there too as I'd already messed around in there XD

And now uploaded on Nexus: https://www.nexusmods.com/x4foundations/mods/100/
[ external image ]
***modified***
"You can get more of what you want with kind words and a gun, than you can with just kind words" - Al Capone

Forleyor
Posts: 40
Joined: Thu, 11. Jun 15, 19:09
x4

Re: [REQUEST] Target Missile Hotkey

Post by Forleyor » Tue, 11. Dec 18, 09:26

argon_emperor wrote:
Tue, 11. Dec 18, 09:23
Nah, if you follow it to the macros folder in each of the size folders for the units, that's where each ship's stats are defined
Ah, Thats good to know :D

Post Reply

Return to “X4: Foundations - Scripts and Modding”