Global Library

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

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

Post Reply
teleportationwars
Posts: 158
Joined: Fri, 12. Jul 19, 14:03

Global Library

Post by teleportationwars » Tue, 6. Aug 19, 23:16

Most events need some object, group, or space to be attached to.
<event_object_destroyed group="global.$Ships_all" />
The above is completely fine until someone has 20 mods in their game that all wanted to reinvent the wheel.

We are making a library to solve this problem. What groups/events do you want to use?

Here is the Current list.
global.$X4_SectorAdjacencyTable
global.$X4_All_Clusters
global.$X4_All_Sectors
global.$X4_All_Zones
global.$X4_All_Gates
global.$X4_Player_Ships
global.$X4_Player_Stations
global.$X4_All_Ships
global.$X4_All_Constructors
global.$X4_All_Resupply
global.$X4_All_Stations
global.$X4_Stations_shipyards
global.$X4_Stations_wharfs
global.$X4_Stations_equipmentdocks
global.$X4_Stations_headquarters
global.$X4_Stations_trading
global.$X4_Stations_pirate
global.$X4_Stations_defence
Here is a use case:

Code: Select all

        <cue name="Init" instantiate="true">
                    <conditions>
                        <event_cue_signalled cue="md.Setup.GameStart" />
                    </conditions>
                    <actions>
                        <create_group groupname="$DockedPlayerShips" />
                    </actions>
                    <cues>
                        <cue name="ExampleSliceDock" instantiate="true">
                            <conditions>
                                <event_object_docked group="global.$X4_Player_Ships" />
                            </conditions>
                            <actions>
                                <do_if value="event.object.owner == faction.player">
                                    <add_to_group groupname="$DockedPlayerShips" />
                                </do_if>
                            </actions>
                        </cue>
                        <cue name="ExampleSliceUndock" instantiate="true">
                            <conditions>
                                <event_object_undocked group="$DockedPlayerShips" />
                            </conditions>
                            <actions>
                                <do_if value="event.object.owner == faction.player">
                                    <remove_from_group group="$DockedPlayerShips" object="event.object" />
                                </do_if>
                            </actions>
                        </cue>
                    </cues>
                </cue>
Last edited by teleportationwars on Wed, 7. Aug 19, 21:24, edited 1 time in total.

Vectorial1024
Posts: 222
Joined: Mon, 30. Jul 18, 04:16
x4

Re: Global Library

Post by Vectorial1024 » Wed, 7. Aug 19, 20:43

Hey there!

Realized I may need to use something similar to what you are suggesting, so here's my 2 cents to kickstart the project.
  • Ship docked: Fired when a ship docks at a docking bay; preferrably, this is fired the moment when the ship touched the ground
  • Ship recently assigned: Fired when a ship had just been assigned to another commander
These two should be simple enough.

And add oil in your efforts!
The future awaits.

X4 Foundations mods:
Civilian Fleets: Managing your civilian ships has never been easier.
Station Logistics: Managing your station networks has never been easier.
Scrap Delivery Coordination: No more starving scrap processors.

teleportationwars
Posts: 158
Joined: Fri, 12. Jul 19, 14:03

Re: Global Library

Post by teleportationwars » Wed, 7. Aug 19, 22:59

Vectorial1024 wrote:
Wed, 7. Aug 19, 20:43
Hey there!

Realized I may need to use something similar to what you are suggesting, so here's my 2 cents to kickstart the project.
  • Ship docked: Fired when a ship docks at a docking bay; preferrably, this is fired the moment when the ship touched the ground
  • Ship recently assigned: Fired when a ship had just been assigned to another commander
These two should be simple enough.

And add oil in your efforts!
I updated the op with an example and a working list of groups

teleportationwars
Posts: 158
Joined: Fri, 12. Jul 19, 14:03

Re: Global Library

Post by teleportationwars » Sun, 25. Aug 19, 11:47

Anyone have a use for detecting and maybe categorizing mod factions?

Post Reply

Return to “X4: Foundations - Scripts and Modding”