Read out current missile after change

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

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

Post Reply
Trajan von Olb
Posts: 545
Joined: Wed, 4. Feb 04, 21:39
x3tc

Read out current missile after change

Post by Trajan von Olb » Wed, 30. Nov 22, 00:40

Hi, with "event_player_cycled_active_weapon_ammo" I can start an event when the missile is changed. For example with the code:

Code: Select all

    <cue name="MBetty_TargetRemoveBaseGame" instantiate="true">
      <conditions>
        <event_player_cycled_active_weapon_ammo/>
		<check_value value="event.param == null"/>
      </conditions>
      <actions>
		[...]
      </actions>
    </cue>
But how do I get out WHICH missile exactly is loaded now? In the end, I need the text code of the "ware" to have a text output.... (with "speak") - as in the following example, where "page" and "line" should automatically be those of the missile as "ware".

Code: Select all

<speak actor="player.computer" page="10002" line="900" priority="90" />
How do I do that? Does anyone have an idea?

Thanks for answers.

lg. Trajan from Olb



PS: I'm trying to have VRO announce the missiles to me like "wasp" or "mosquito". The sounds are not present in X4, so I extracted them from X3 and have already managed to have them announced with "speak". In case someone is interested :-)
Mein Traum vom Glück ist der Traum von einer anderen Menschheit. (S. Lem)

kuertee
EGOSOFT
EGOSOFT
Posts: 789
Joined: Sun, 14. Dec 03, 13:05
x4

Re: Read out current missile after change

Post by kuertee » Wed, 30. Nov 22, 04:38

It looks like "event_object_activated_weapon" may provide more data:
"Event for when a Controllable object activates a weapon (object = Controllable, param = Weapon, param2 = ammo type (null if unlimited), param3 = ammo amount (not set if unlimited))"

I've not used it, so I don't know if that is sufficient for what you want. I've also not used "event_player_cycled_active_weapon_ammo".
Mods: RPG: Reputations and Professions, Social Standings and Citizenships, Crime has Consequences, Alternatives to Death. Missions/NPCs: Emergent Missions, NPC Reactions, Mod Parts Trader, High-sec Rooms are Locked, Hacking Outcomes, More Generic Missions, Waypoint Fields for Deployment. Others: Auto-cam, Friendly Fire Tweaks, Teleport From Transporter Room, Wear and Tear. QoL: Trade Analytics, Loot Mining, Ship Scanner, Signal Leak Hunter, Station Scanner, Surface Element Targeting, etc.

User avatar
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13293
Joined: Sun, 15. Feb 04, 20:12
x4

Re: Read out current missile after change

Post by euclid » Wed, 30. Nov 22, 14:40

Line 900 is longrange scanner activated. I'm not sure Betty has any missile names in the db (voice-1044 > 10002 > comm). However, if you manage to find them there then you may be able to use param2 (see kuertee's post above) to find out which missile it is and then determine the corresponding ogg file.

Cheers Euclid
"In any special doctrine of nature there can be only as much proper science as there is mathematics therein.”
- Immanuel Kant (1724-1804), Metaphysical Foundations of the Science of Nature, 4:470, 1786

Trajan von Olb
Posts: 545
Joined: Wed, 4. Feb 04, 21:39
x3tc

Re: Read out current missile after change

Post by Trajan von Olb » Wed, 30. Nov 22, 16:39

Hi, thank you very much for the answers!

@kuertee: Yes, that looks better, only unfortunately I'm all about reacting when the missiles are switched through, not when activating and not when changing weapons per se.
Could it be that event_player_cycled_active_weapon_ammo also has param2? Where can I find out?
And then how do I extract the t-number from this param2? Again questions over questions, sorry...

@euclid: That is absolutely correct and just an example. That's why in the "PS" I already wrote above that I'll supply the sounds (which I even succeeded in doing :-) ) by extracting them from the huge sound file of X3. There are at least the rocket types "Wasp", "Mosquito" etc.. - and for now that's my goal, because I play VRO. But if that works out, I should certainly be able (that's my job at Film&TV, among other things) to cut together a "missile MK1" or something like that from the masses of MAterial, if I want to. I don't know what missiles exist in Vanilla, I haven't done that for too long.
But first I have to manage to trigger some announcement during the missile change (it works!) and to read out which missile is active after the change and to name exactly THIS missile. Unfortunately, it fails at the moment :-(

Can you help me? Is there perhaps any system variable that contains the currently activated missile (waffen-Ammo is that)?

Would be really cool, I'm working on a MOD "more Betty" anyway, so that it becomes a bit more talkative, this fits in well.

Thanks for answers :-)

Greetings Trajan von Olb
Mein Traum vom Glück ist der Traum von einer anderen Menschheit. (S. Lem)

kuertee
EGOSOFT
EGOSOFT
Posts: 789
Joined: Sun, 14. Dec 03, 13:05
x4

Re: Read out current missile after change

Post by kuertee » Thu, 1. Dec 22, 07:13

The parameters that get sent with the events are listed with the event documentation in the XSDs. And it looks like that no parameter is sent with event_player_cycled_active_weapon_ammo.

You can try the Lua way. But you'll need to use my UI Extensions mod:
1. create a callback to your own lua function at the point when the ammo selector is created in "kuertee_menu_docked.lua". ie: line 406 looks the luas for ammo selectors.

Code: Select all

row[1]:createText("    " .. ReadText(1001, 2800) .. ReadText(1001, 120))	-- Ammunition, :
row[2]:setColSpan(10):createDropDown(dropdowndata, { startOption = function () return menu.getDropDownOption(weapon) end, active = dropdownactive })
2. you can get send the ammo data to your md by calling AddUITriggeredEvent() in your lua and listening for it with "event_ui_triggered" in your MD.

Of course, there's a lot more to it that those 2 steps.
But that's the gist of the process.
Mods: RPG: Reputations and Professions, Social Standings and Citizenships, Crime has Consequences, Alternatives to Death. Missions/NPCs: Emergent Missions, NPC Reactions, Mod Parts Trader, High-sec Rooms are Locked, Hacking Outcomes, More Generic Missions, Waypoint Fields for Deployment. Others: Auto-cam, Friendly Fire Tweaks, Teleport From Transporter Room, Wear and Tear. QoL: Trade Analytics, Loot Mining, Ship Scanner, Signal Leak Hunter, Station Scanner, Surface Element Targeting, etc.

Trajan von Olb
Posts: 545
Joined: Wed, 4. Feb 04, 21:39
x3tc

Re: Read out current missile after change

Post by Trajan von Olb » Sat, 3. Dec 22, 23:22

Oh dear Kuertee, thank you as always. However, this is unfortunately far above my competence class... I don't understand anything about it and can't add necessary other things to it.

But who knows, maybe this is incentive to develop when I have more time here and there around Christmas....

But as an idea another way: couldn't one (without Lua) first read out the weapons of the current weapon group and there read out the ammo in case of missile launchers?
At least I found in the scriptproperties under "weapons" the subitem "ammo.ware", which seems logical to me, but so don't know at all how to deal with it, even with formatting.... Last but not least: what do I get then? And how do I make the t-value out of the "ware" to output the language?

Greetings Trajan
Mein Traum vom Glück ist der Traum von einer anderen Menschheit. (S. Lem)

User avatar
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13293
Joined: Sun, 15. Feb 04, 20:12
x4

Re: Read out current missile after change

Post by euclid » Sun, 4. Dec 22, 01:22

Have you tried to write param2 (see post above) to the player's logbook? I'd do it directly, as param2.knownname and as param2.macro, then see what is best to trigger Betty's voice. Unfortunately I'm not able to test that myself as none of my ships are using launchers.

Cheers Euclid
"In any special doctrine of nature there can be only as much proper science as there is mathematics therein.”
- Immanuel Kant (1724-1804), Metaphysical Foundations of the Science of Nature, 4:470, 1786

Post Reply

Return to “X4: Foundations - Scripts and Modding”