[Mod - Source Only] Build Shipyards without 3 phase system

The place to discuss scripting and game modifications for X Rebirth.

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

UnknownMod
Posts: 6
Joined: Sat, 13. Dec 14, 01:13

[Mod - Source Only] Build Shipyards without 3 phase system

Post by UnknownMod »

Good evening,

As this is my first source post here ill introduce myself :)
Im a local memory hacker from England, I prefer to stay anonymous for this reason as the code I will share here is nothing to do with hacking, nor is it intended to be use as such and I don't want people requesting access to my private hacking community due to anything I may put here.

So, that's that :) hi

Here's my method of getting your architects to build capital ship yards without the need for a 3 phase system (due to the loop crash as I call it). If I may ask for someone to spend some time to have this released on steam workshop as a working mod then it would be appreciated (ill not due to the statement above)

basically it works by adding a dummy station macro to the build list, between when the user has selected the dummy macro and the upgrade screen it replaces the dummy macro string with the real macro string - causing it to build the station. Im going to cover the Albion station here, the same method works for all. Iv not yet added any code to add the construction drones to the architects list, I believe Berserk Knight's has got a good method of this in his Build Shipyards mod.

I should also mention that 'Berserk Knight' was the one who made me think of this method, His problem solving give me quick insight into why it wasn't possible to patch the capital stations directly.

our extension folder & files layout

Code: Select all

UnknownMod\
 > content.xml
-- assets
-- -- props
-- -- -- SurfaceElements
-- -- -- -- Macros
-- -- -- -- > buildmodule_stations_albion_macro.xml
-- -- -- structures
-- -- -- -- build_trees
-- -- -- -- -- Macros
-- -- -- -- -- > struct_bt_alb_big_ships_yard_dummy_macro.xml
-- md
-- > NPC_Architect.xml
-- index
-- > macros.xml
our files:
assets/props/SurfaceElements/Macros/buildmodule_stations_albion_macro.xml

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<diff>
	<add sel="/macros/macro[@name='buildmodule_stations_albion_macro']/properties/builder">
		<macro ref="struct_bt_alb_big_ships_yard_dummy_macro" />
		<macro ref="struct_bt_alb_small_ships_complex_macro" />
		<macro ref="struct_bt_alb_small_ships_yard_macro" />
	</add>
</diff>
assets/structures/build_trees/Macros/struct_bt_alb_big_ships_yard_dummy_macro.xml

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<macros>
	<macro name="struct_bt_alb_big_ships_yard_dummy_macro" class="station">
		<component ref="struct_bt_alb_cattle_ranch" />
		<properties>
			<identification name="{20102,601}" description="{20102,602}" unique="0" />
		</properties>
	</macro>
</macros>
md/NPC_Architect.xml

Code: Select all

<?xml version="1.0" encoding="utf-8"?> 
<diff>
	<add sel="/mdscript[@name='NPC_Architect']/cues/cue[@name='Base']/cues/cue[@name='SectionHandler']/actions" pos="prepend">
		<do_if value="event.param == 'cArch_selectUpgradesMenu'">
			<do_if value="event.param2.{6} == 'struct_bt_alb_big_ships_yard_dummy_macro'">
				<set_value name="event.param2.{6}" exact="'struct_bt_alb_big_ships_yard_macro'" />
			</do_if>
		</do_if>
	</add>
</diff>
index/macros.xml

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<diff>
	<add sel="/index">
		<entry name="struct_bt_alb_big_ships_yard_dummy_macro" value="\Extensions\<REPLACE WITH MOD FOLDER NAME>\assets\structures\build_trees\macros\struct_bt_alb_big_ships_yard_dummy_macro" />
	</add>
</diff>
BlackRain
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 7465
Joined: Mon, 15. Dec 03, 18:53
x4

Post by BlackRain »

Hello. Interesting method here and thanks for contributing. I am just curious what exactly is intended. The reason I ask is that I have continued the shipyard mod (including updating it with various extra stuff).

The 3 shipyard method that Berserk came up with works well enough and it isn't that hard to set it up and actually I no longer really need to even do too much with it. What is the benefit of changing that now to do it this way? If anything, this method may require more work (you have to edit more files and if you are making more shipyards it would seem like as much work or around the same amount of work).

This method may have uses in other ways, though, beyond just doing a shipyard mod.
UnknownMod
Posts: 6
Joined: Sat, 13. Dec 14, 01:13

Post by UnknownMod »

the idea is that you don't need to have that 'middle' or second shipyard in order to be able to create further shipyards.

it was simply a finishing touch that I felt was missing, something that makes it feel more like part of a game then a work around if that makes any sence.

So if the player wants to make another shipyard, he/she does not have to
1) get the cv from the other faction (original sy/sy1)
2) remember were the first sy (I think it was referred as sy2) was placed.

he/she can use any of them

I dunno, maybe its just me being ocd, I just felt like it was cleaner. Everyone has done an amazing job, don't get me wrong - its something that should of been available as default by egosoft.

many thanks :)

[edit]
I just re-read the post you made,
the benefit would be
a) as I put above
b) it would be more update proof as it does not have use a clone of the structure build tree inside the mod, but rather uses the orgininal.

as for more files, its actually less - and a lot less code
the dummy file is simply a place holder - once done its done, for the 3 station types of albion, devries and omicron each will have 2 files - none of which need maintained unless they change the macro layout within the game.

the other two files, macro is simply to say that our dummy macro exists, that's 3 lines of code for the 3 station types, and the npc_arch just needs the 3 line if statements (or do_elseif for performance tweaking) that replace the string.

in a nut shell, less code, less files and the primary
Then the player can have 100 shipyards, buying a cv from each without the need to edit the code or the need for the player to worrie about what shipyard the cv has come from

Return to “X Rebirth - Scripts and Modding”