[MOD] Choose the race of your crew V2.2

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

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

chh2tx
Posts: 15
Joined: Mon, 15. Mar 21, 05:13
x4

Re: Which script handles what crew you get on player shipyards

Post by chh2tx » Sat, 3. Apr 21, 04:35

BlackRain wrote:
Tue, 30. Mar 21, 17:59
This does in fact work but yeah, it isn't the best solution. Of course, people can just edit it to put in whatever faction they want. You could also expand it to include other factions or randomly select factions, etc.
Any hope of seeing this inelegant solution work as a temporary method? I don't have the knowledge to implement, but would certainly like it if it does work. Right now I just go through the tedious task of offloading captain and hiring a new crew at the appropriate faction docks.

BlackRain
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 7406
Joined: Mon, 15. Dec 03, 18:53
x4

Re: Which script handles what crew you get on player shipyards

Post by BlackRain » Sat, 3. Apr 21, 04:54

chh2tx wrote:
Sat, 3. Apr 21, 04:35
BlackRain wrote:
Tue, 30. Mar 21, 17:59
This does in fact work but yeah, it isn't the best solution. Of course, people can just edit it to put in whatever faction they want. You could also expand it to include other factions or randomly select factions, etc.
Any hope of seeing this inelegant solution work as a temporary method? I don't have the knowledge to implement, but would certainly like it if it does work. Right now I just go through the tedious task of offloading captain and hiring a new crew at the appropriate faction docks.
Sure, I can upload something for ya in a bit.

BlackRain
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 7406
Joined: Mon, 15. Dec 03, 18:53
x4

Re: [MOD] Choose the race of your crew

Post by BlackRain » Sat, 3. Apr 21, 05:06

Okay, I uploaded it

User avatar
scrab21
Posts: 26
Joined: Fri, 28. Aug 15, 23:40
x4

Re: [MOD] Choose the race of your crew

Post by scrab21 » Sat, 3. Apr 21, 22:07

thank you so much for this and your work, this is a must have mod, tired of seeing paranid in my ships with only for example argon habitat

LoneStargazer
Posts: 10
Joined: Sun, 2. Dec 18, 12:10

Re: [MOD] Choose the race of your crew

Post by LoneStargazer » Sat, 3. Apr 21, 23:16

Thank you for this mod, I have been looking for something like this for a long time. One thing though it resets all shipyard settings (trade rules, discount etc) and transfers all funds both from manager and build storage to my account every time it finishes building a ship I ordered. Ships ordered by NPCs don't cause this.

BlackRain
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 7406
Joined: Mon, 15. Dec 03, 18:53
x4

Re: [MOD] Choose the race of your crew

Post by BlackRain » Sun, 4. Apr 21, 01:12

LoneStargazer wrote:
Sat, 3. Apr 21, 23:16
Thank you for this mod, I have been looking for something like this for a long time. One thing though it resets all shipyard settings (trade rules, discount etc) and transfers all funds both from manager and build storage to my account every time it finishes building a ship I ordered. Ships ordered by NPCs don't cause this.
Hmm, are you using any other mods, like maybe FE?

chh2tx
Posts: 15
Joined: Mon, 15. Mar 21, 05:13
x4

Re: [MOD] Choose the race of your crew

Post by chh2tx » Sun, 4. Apr 21, 01:39

LoneStargazer wrote:
Sat, 3. Apr 21, 23:16
Thank you for this mod, I have been looking for something like this for a long time. One thing though it resets all shipyard settings (trade rules, discount etc) and transfers all funds both from manager and build storage to my account every time it finishes building a ship I ordered. Ships ordered by NPCs don't cause this.
I noticed this too, I'm not using any economic mods. I've only built one ship but noticed a couple traders being built from NPCs. I thought I had screwed something up but yeah the stock levels, trade restrictions (I had these set per ware, switched now to set for the overall station and will see if that sticks better), and balance were all set to 0 at some point for both station balance and construction balance.

chh2tx
Posts: 15
Joined: Mon, 15. Mar 21, 05:13
x4

Re: [MOD] Choose the race of your crew

Post by chh2tx » Sun, 4. Apr 21, 02:01

I tried enabling logging but not really seeing anything pertinent.

Code: Select all

[Scripts] 350432.86 *** aicontext<trade.station,0x17ed0>: build added. building: null. start time: 350432.862
[Scripts] 350432.86 *** aicontext<trade.station,0x17ed0>: build started. building: 0xe34d2. total time: 360
....
[Scripts] 350562.90 *** aicontext<trade.station,0x17ed0>: build XP. object built: Bolo (Mineral) 0xe34d2. XP category: station_build_shipbuilt
elapsed time: 130.039. efficiency: 1. start time: 350432.862. optimal time: 360.
[Scripts] 350562.90 *** aicontext<trade.station,0x17ed0>: num remaining builds: 2
[Scripts] 350562.94 *** aicontext<trade.station,0x17ed0>: build started. building: 0x2f4b. total time: 120
It just shows the Bolo I ordered getting completed, then behind the scenes the trade rules were reset to the global rules (clearing the faction restriction rule I had set) and all credits transferred back to player account. In the brief time my ship finished, the AI ordered a ship that started construction. It only affects the ship wharf and no other station or account.

I am still building Habitat modules on the wharf, some are completed but total workforce is 74/1000 currently, though MREs and med supplies have not been filled yet. I only ordered a captain and ordered no crew. Just mentioning in case in any way workforce availability or supply impacts being able to provision ships using that workforce? It does however seem to give the proper crew -- but not sure why it's affecting station settings and appears it only does so for player built ships and not AI built ships at the player wharf.

BlackRain
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 7406
Joined: Mon, 15. Dec 03, 18:53
x4

Re: [MOD] Choose the race of your crew

Post by BlackRain » Sun, 4. Apr 21, 02:13

chh2tx wrote:
Sun, 4. Apr 21, 02:01
I tried enabling logging but not really seeing anything pertinent.

Code: Select all

[Scripts] 350432.86 *** aicontext<trade.station,0x17ed0>: build added. building: null. start time: 350432.862
[Scripts] 350432.86 *** aicontext<trade.station,0x17ed0>: build started. building: 0xe34d2. total time: 360
....
[Scripts] 350562.90 *** aicontext<trade.station,0x17ed0>: build XP. object built: Bolo (Mineral) 0xe34d2. XP category: station_build_shipbuilt
elapsed time: 130.039. efficiency: 1. start time: 350432.862. optimal time: 360.
[Scripts] 350562.90 *** aicontext<trade.station,0x17ed0>: num remaining builds: 2
[Scripts] 350562.94 *** aicontext<trade.station,0x17ed0>: build started. building: 0x2f4b. total time: 120
It just shows the Bolo I ordered getting completed, then behind the scenes the trade rules were reset to the global rules (clearing the faction restriction rule I had set) and all credits transferred back to player account. In the brief time my ship finished, the AI ordered a ship that started construction. It only affects the ship wharf and no other station or account.

I am still building Habitat modules on the wharf, some are completed but total workforce is 74/1000 currently, though MREs and med supplies have not been filled yet. I only ordered a captain and ordered no crew. Just mentioning in case in any way workforce availability or supply impacts being able to provision ships using that workforce? It does however seem to give the proper crew -- but not sure why it's affecting station settings and appears it only does so for player built ships and not AI built ships at the player wharf.
I will try something later, can't check yet if it affects the shipyard or not, but can you tell me what mods you are using please? Just want to make sure there isn't anything conflicting.

chh2tx
Posts: 15
Joined: Mon, 15. Mar 21, 05:13
x4

Re: [MOD] Choose the race of your crew

Post by chh2tx » Sun, 4. Apr 21, 02:34

BlackRain wrote:
Sun, 4. Apr 21, 02:13
I will try something later, can't check yet if it affects the shipyard or not, but can you tell me what mods you are using please? Just want to make sure there isn't anything conflicting.
better_kill_credit
chooseracecrew
infocenter
JP_AbandonedShipExplorer
JP_AnotherExplorerV3
JP_CollectDroppedInventory
JP_CollectPlaceables
JP_SatelliteDropper
kuertee_ui_extensions (dependency for infocenter)
learningallthethings
Manager_CreditTransfer
Mules-and-Warehouses-Extended-Public
RenameFleetShips
sn_mod_support_apis (dependency for infocenter)
TaterTrader-master
Vanilla-Icons-Stable

Would be good to see a comparison of what the other user has running to compare similarities.

BlackRain
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 7406
Joined: Mon, 15. Dec 03, 18:53
x4

Re: [MOD] Choose the race of your crew

Post by BlackRain » Sun, 4. Apr 21, 06:05

Just a little information sorry, the reason the settings are defaulted and u get your money back is because the code makes your shipyard owned by terrans and than gives it back to you.

I am trying to find an easy way to make it so this isn't necessary but no luck yet

Exitialis101
Posts: 104
Joined: Mon, 29. Mar 10, 11:47

Re: [MOD] Choose the race of your crew

Post by Exitialis101 » Sun, 4. Apr 21, 11:33

Been looking forward to a mod like this, thank you and Mackan.

Hope you find a fix to the small bug.

Edit: Just a thought for a potential fix, maybe there is a way to save all budget/ware and station settings then once the station has been given back to the player, reload that info?
I know nothing about modding, so no idea if this helps.
Hammerhead Launched
Support NPC Friendly FIre Tweaks:
viewtopic.php?f=146&t=435850

monze
Posts: 88
Joined: Fri, 8. Aug 03, 23:13
x4

Re: [MOD] Choose the race of your crew

Post by monze » Sun, 4. Apr 21, 14:35

Fantastic. Thank you very much.... exactly what I wanted...

Happy little vegemite here.

Mackan
Posts: 143
Joined: Thu, 1. Aug 13, 05:59
xr

Re: [MOD] Choose the race of your crew

Post by Mackan » Sun, 4. Apr 21, 15:00

Potentially found a different method. This one skips transfer_people for event_build_finished and instead queues up a new upgrade order with a custom people definition. This lets you define whatever race you want and should even be able to be expanded to handle multiple races. I cba to write up a logic for that though, I'm smooth-brained when it comes to math funcs.

This method is not without problems either (when is it ever when it comes to crew...) as it will select not just rookies but any characters of the specified race, even faction representatives lol. So you'll likely end up with a bunch of elite pilots, managers etc mingled in with your 0 star pleb crew. There's also a skills attribute, but it doesn't seem to do anything. But even if it did it wouldn't help as it's a numeric value of combinedskill meaning you can still roll expert pilots etc as long as they are rookies in the desired role.

egosoft please save us. :(

Code: Select all

                <do_if value="this.object.isplayerowned and $object.isplayerowned">
                  <get_build_people build="event.param3" amounts="$testamounts" currentroles="$testcurrentroles" newroles="$testnewroles" races="$testraces" skills="$testskills" people="$testpeople" />

                  <do_if value="$testamounts.count gt 0">
                    <set_value name="$races" exact="[]" />
                    <set_value name="$workforceraces" exact="this.station.workforce.amounts.keys.list" />
                    <set_value name="$skills" exact="[]" comment="cant use tags with matching people, rip tag.rookie :(" />

                    <do_all exact="$testamounts.count" counter="$i">
                      <append_to_list name="$races" exact="$workforceraces.random" />
                      <append_to_list name="$skills" exact="0" />
                    </do_all>

                    <add_build_to_modify_ship object="this.station" buildobject="$object" immediate="true" internal="true" comment="dont know what internal does. assuming for now it hides order from the player which we want">
                      <people>
                        <add>
                          <matching_people amounts="$testamounts" newroles="$testnewroles" races="$races" skills="$skills" exact="true" force="false" />
                        </add>
                      </people>
                    </add_build_to_modify_ship>

                    <remove_value name="$races" />
                    <remove_value name="$workforceraces" />
                    <remove_value name="$skills" />
                  </do_if>

                  <remove_value name="$testamounts" />
                  <remove_value name="$testcurrentroles" />
                  <remove_value name="$testnewroles" />
                  <remove_value name="$testraces" />
                  <remove_value name="$testskills" />
                  <remove_value name="$testpeople" />
                </do_if>
                <do_else>
                  <transfer_people build="event.param3"/>
                </do_else>

BlackRain
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 7406
Joined: Mon, 15. Dec 03, 18:53
x4

Re: [MOD] Choose the race of your crew

Post by BlackRain » Sun, 4. Apr 21, 15:26

Mackan wrote:
Sun, 4. Apr 21, 15:00
Potentially found a different method. This one skips transfer_people for event_build_finished and instead queues up a new upgrade order with a custom people definition. This lets you define whatever race you want and should even be able to be expanded to handle multiple races. I cba to write up a logic for that though, I'm smooth-brained when it comes to math funcs.

This method is not without problems either (when is it ever when it comes to crew...) as it will select not just rookies but any characters of the specified race, even faction representatives lol. So you'll likely end up with a bunch of elite pilots, managers etc mingled in with your 0 star pleb crew. There's also a skills attribute, but it doesn't seem to do anything. But even if it did it wouldn't help as it's a numeric value of combinedskill meaning you can still roll expert pilots etc as long as they are rookies in the desired role.

egosoft please save us. :(

Code: Select all

                <do_if value="this.object.isplayerowned and $object.isplayerowned">
                  <get_build_people build="event.param3" amounts="$testamounts" currentroles="$testcurrentroles" newroles="$testnewroles" races="$testraces" skills="$testskills" people="$testpeople" />

                  <do_if value="$testamounts.count gt 0">
                    <set_value name="$races" exact="[]" />
                    <set_value name="$workforceraces" exact="this.station.workforce.amounts.keys.list" />
                    <set_value name="$skills" exact="[]" comment="cant use tags with matching people, rip tag.rookie :(" />

                    <do_all exact="$testamounts.count" counter="$i">
                      <append_to_list name="$races" exact="$workforceraces.random" />
                      <append_to_list name="$skills" exact="0" />
                    </do_all>

                    <add_build_to_modify_ship object="this.station" buildobject="$object" immediate="true" internal="true" comment="dont know what internal does. assuming for now it hides order from the player which we want">
                      <people>
                        <add>
                          <matching_people amounts="$testamounts" newroles="$testnewroles" races="$races" skills="$skills" exact="true" force="false" />
                        </add>
                      </people>
                    </add_build_to_modify_ship>

                    <remove_value name="$races" />
                    <remove_value name="$workforceraces" />
                    <remove_value name="$skills" />
                  </do_if>

                  <remove_value name="$testamounts" />
                  <remove_value name="$testcurrentroles" />
                  <remove_value name="$testnewroles" />
                  <remove_value name="$testraces" />
                  <remove_value name="$testskills" />
                  <remove_value name="$testpeople" />
                </do_if>
                <do_else>
                  <transfer_people build="event.param3"/>
                </do_else>
I was actually studying these yesterday but couldn't figure anything out with it yet. I will keep looking into it when I have time.

BlackRain
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 7406
Joined: Mon, 15. Dec 03, 18:53
x4

Re: [MOD] Choose the race of your crew

Post by BlackRain » Sun, 4. Apr 21, 16:19

Just a disclaimer, if you use this, please keep in mind this is sort of like a hack lol. Not really, but I mean it is not an ideal way of doing this. I also don't want to spend too much time working on this as every time I do something new I have to spend a lot of time studying the code and I am busy as it is.

So, if you use this, keep in mind that your shipyard settings will reset and the money will be returned to you every time you build ships. To me, this is only a minor inconvenience. I set the default for my shipyards to not sell to anyone (and when i want it to sell to others I just change the setting). This way, every time the shipyard resets, at least it won't make ships for anyone. I then just give the money back. It takes a few seconds at most.

SilverNixon
Posts: 31
Joined: Thu, 10. Nov 05, 19:12
x4

Re: [MOD] Choose the race of your crew

Post by SilverNixon » Mon, 5. Apr 21, 20:27

I have been experimenting with an alternate idea but cannot go further without more knowledge of xml.

==Preparation==
1. Merge all characters.xml changes from vanilla, split and Terran DLC together, ensuring to remove <add.../></add> tags from the DLC files. I did not inclued an extra part in the split characters.xml that corrects for mixed gender and just assumed it will auto patch. I just focused on DLC entries that was set up to be added to vanilla file, which is basically all entries.

2. Using notepad++ Find and replace ", faction.player" with nothing, that is delete it. This is easiest way i can think of as using <replace> to replace lines with faction.player will take ages to setup as there are many of them, from ARG, TEL, PAR and SPL.

Code: Select all

<!-- Argon -->
  <!-- Generic Argon Characters -->
  <character id="trader_argon_random" group="argon.trader">
    <category tags="[crew, pilot, aipilot, traderpilot, masstraffic]" faction="[argon, antigone, scaleplate, hatikvah, alliance, buccaneers, faction.player]" race="argon"/>

Code: Select all

<!-- Argon -->
  <!-- Generic Argon Characters -->
  <character id="trader_argon_random" group="argon.trader">
    <category tags="[crew, pilot, aipilot, traderpilot, masstraffic]" faction="[argon, antigone, scaleplate, hatikvah, alliance, buccaneers]" race="argon"/>
3. Next choose your faction for your shipyards and stations, in this case I choose Terran so I, quick as I could, pasted ", faction.player" in both POI and TER acceptable characters, similarly observed from the default original vanilla and split files. TER's file do not have any entry for faction.player.

Code: Select all

    <character id="service_pioneers_random_dlc_terran" group="pioneers.service">
      <category tags="[crew, service, regular, recruitable]" faction="[pioneers, faction.player]" race="terran"/>
==Ingame Observations==
A player owned Defence platform built with ARG admin and no habitat initially had mixed race station crew walking around, it now switched to only TER. I assume all other admins and perhaps habitats will show TER but not sure. TER only shipyard with TER habitat still had mixed service crews on ship build. (I dont recall pilots being terran as the next part will explain)

While experimenting with several other tweaks and then the roles.xml file from another mod that allowed managers and captains to be recruited similarly as the service crew and marines, I noticed that If i fill my ship with Pilots or Marines, they are all TER. On a closer observation, it seems my character.xml setup allows me to recruit Marines as TER only (here I have now removed the roles.xml file because NPC shipyards can also recruit managers and pilot on ship build, and presets distributes the crew which could cause issue for npc ships).

==Some ideas to resolve the Crew issue==
Based on the mod shared here, build.shiptrader.xml, would it be possible to code for a pause in the build, where Marine or Pilot Crews are created but assigned as Service Crews when transfered to the build ship. As I have read here, since Pilot and or Marines use the station's habitat race, perhaps we could creat them during ship build and then have them assigned to service crew. I do not know how to code this.

Alternatively, is it possible to create a ship command that switches crew roles except the pilot. That is assign all Marines in a ship to the Service Crew Role.

If we are able to do this, we can continue enjoy our games until Egosoft implements the habitation module to affect service crew.
“Not just beautiful, though - the stars are like the trees in the forest, alive and breathing. And they're watching me.”
― Haruki Murakami, Kafka on the Shore

BlackRain
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 7406
Joined: Mon, 15. Dec 03, 18:53
x4

Re: [MOD] Choose the race of your crew

Post by BlackRain » Mon, 5. Apr 21, 22:11

SilverNixon wrote:
Mon, 5. Apr 21, 20:27
I have been experimenting with an alternate idea but cannot go further without more knowledge of xml.

==Preparation==
1. Merge all characters.xml changes from vanilla, split and Terran DLC together, ensuring to remove <add.../></add> tags from the DLC files. I did not inclued an extra part in the split characters.xml that corrects for mixed gender and just assumed it will auto patch. I just focused on DLC entries that was set up to be added to vanilla file, which is basically all entries.

2. Using notepad++ Find and replace ", faction.player" with nothing, that is delete it. This is easiest way i can think of as using <replace> to replace lines with faction.player will take ages to setup as there are many of them, from ARG, TEL, PAR and SPL.

Code: Select all

<!-- Argon -->
  <!-- Generic Argon Characters -->
  <character id="trader_argon_random" group="argon.trader">
    <category tags="[crew, pilot, aipilot, traderpilot, masstraffic]" faction="[argon, antigone, scaleplate, hatikvah, alliance, buccaneers, faction.player]" race="argon"/>

Code: Select all

<!-- Argon -->
  <!-- Generic Argon Characters -->
  <character id="trader_argon_random" group="argon.trader">
    <category tags="[crew, pilot, aipilot, traderpilot, masstraffic]" faction="[argon, antigone, scaleplate, hatikvah, alliance, buccaneers]" race="argon"/>
3. Next choose your faction for your shipyards and stations, in this case I choose Terran so I, quick as I could, pasted ", faction.player" in both POI and TER acceptable characters, similarly observed from the default original vanilla and split files. TER's file do not have any entry for faction.player.

Code: Select all

    <character id="service_pioneers_random_dlc_terran" group="pioneers.service">
      <category tags="[crew, service, regular, recruitable]" faction="[pioneers, faction.player]" race="terran"/>
==Ingame Observations==
A player owned Defence platform built with ARG admin and no habitat initially had mixed race station crew walking around, it now switched to only TER. I assume all other admins and perhaps habitats will show TER but not sure. TER only shipyard with TER habitat still had mixed service crews on ship build. (I dont recall pilots being terran as the next part will explain)

While experimenting with several other tweaks and then the roles.xml file from another mod that allowed managers and captains to be recruited similarly as the service crew and marines, I noticed that If i fill my ship with Pilots or Marines, they are all TER. On a closer observation, it seems my character.xml setup allows me to recruit Marines as TER only (here I have now removed the roles.xml file because NPC shipyards can also recruit managers and pilot on ship build, and presets distributes the crew which could cause issue for npc ships).

==Some ideas to resolve the Crew issue==
Based on the mod shared here, build.shiptrader.xml, would it be possible to code for a pause in the build, where Marine or Pilot Crews are created but assigned as Service Crews when transfered to the build ship. As I have read here, since Pilot and or Marines use the station's habitat race, perhaps we could creat them during ship build and then have them assigned to service crew. I do not know how to code this.

Alternatively, is it possible to create a ship command that switches crew roles except the pilot. That is assign all Marines in a ship to the Service Crew Role.

If we are able to do this, we can continue enjoy our games until Egosoft implements the habitation module to affect service crew.
Building new ships and hiring crew after the fact are different. Changing characters.xml won't affect what people are put on the ship when built. Pretty sure some of the other things you mention is not possible through build.shiptrader. It is really npc_instantiation which is the key but the script is so confusing lol.

SilverNixon
Posts: 31
Joined: Thu, 10. Nov 05, 19:12
x4

Re: [MOD] Choose the race of your crew

Post by SilverNixon » Tue, 6. Apr 21, 01:47

BlackRain wrote:
Mon, 5. Apr 21, 22:11
SilverNixon wrote:
Mon, 5. Apr 21, 20:27

snip
Building new ships and hiring crew after the fact are different. Changing characters.xml won't affect what people are put on the ship when built. Pretty sure some of the other things you mention is not possible through build.shiptrader. It is really npc_instantiation which is the key but the script is so confusing lol.
I went back and tested this again. Disabled my mod with the character.xml. Observations in game
-The same station with Argon Admin and defence module that i mentiond before returned to vanilla behaviour. NPCs on stations were the usual TER, SPL, TEL and PAR spawns
-On my TER Shipyard, Marines on completed built ships were again vanilla default, mix of TER, SPL, TEL and PAR, same as service crew.

On a positive, my shipyard, made only of terran modules remained TER so am sure Egosoft are on their way to making station spawns faction specific.

However, as I came to write this, I remembered I edited a mod from @idragon to change my young gun appearance to TER. My edit is I changed the designation race to TER, hoping that it will affect service crew race but it did not, and I am not sure if that affects my TER shipyard. But...

Code: Select all


     <!-- Head Young Gun Start -->
	<replace sel="//macro[@name='character_player_tutorial_macro']/properties/models/model[@type='head']">
		<model type="head" ref="extensions/ego_dlc_terran/assets/characters/terran/heads/char_ter_m_cau_blend_head_darkeyes_01" />
	</replace>
    
    <!-- Body -->
    <replace sel="//macro[@name='character_player_tutorial_macro']/properties/models/model[@type='torso']">
		<model type="torso" ref="extensions/ego_dlc_terran/assets/characters/terran/bodies/char_ter_m_manager_uniform_01" />
	</replace>
    
    <!-- Props -->
    <replace sel="//macro[@name='character_player_tutorial_macro']/properties/models/model[@type='props']">
		<model type="props" ref="extensions/ego_dlc_terran/assets/characters/terran/props/Ter_m_hair_afr_01" />
	</replace>
	
    <!-- identification -->
    <replace sel="//macro[@name='character_player_tutorial_macro']/properties/identification">
		<identification name="{1021,102}" race="terran" faction="player" female="false" />
	</replace>	

    <!-- facemods --> ...
... However, I am satisfied that I figured out everything now.

With my character.xml edit as mentioned before, I can recruit Marines as TER only. It does not work for Service Crew. [Edit] Mass Reassigning crew on a ship to different roles is already built into the game [Edit end]. I just noticed. In the ship information and then crew tab, you can drag left to unnasign crew from a different role and then drag right to assign them on another role. Then confirm when down. The confirm button only lights up when all unnassigned crew has been assigned a role. Here is a screenshot.

Image

Come to think of it Lu t'Sht could be a good Methane miner. xD

Summary.
Appending faction.player to the faction you want in character.xml affects the faction of Marines that you recruit. Then reassign marines to service crew on ship.

Now I can continue playing and effortlessly crew myships and stop modding for a while.
“Not just beautiful, though - the stars are like the trees in the forest, alive and breathing. And they're watching me.”
― Haruki Murakami, Kafka on the Shore

BlackRain
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 7406
Joined: Mon, 15. Dec 03, 18:53
x4

Re: [MOD] Choose the race of your crew

Post by BlackRain » Tue, 6. Apr 21, 01:57

SilverNixon wrote:
Tue, 6. Apr 21, 01:47
BlackRain wrote:
Mon, 5. Apr 21, 22:11
SilverNixon wrote:
Mon, 5. Apr 21, 20:27

snip
Building new ships and hiring crew after the fact are different. Changing characters.xml won't affect what people are put on the ship when built. Pretty sure some of the other things you mention is not possible through build.shiptrader. It is really npc_instantiation which is the key but the script is so confusing lol.
I went back and tested this again. Disabled my mod with the character.xml. Observations in game
-The same station with Argon Admin and defence module that i mentiond before returned to vanilla behaviour. NPCs on stations were the usual TER, SPL, TEL and PAR spawns
-On my TER Shipyard, Marines on completed built ships were again vanilla default, mix of TER, SPL, TEL and PAR, same as service crew.

On a positive, my shipyard, made only of terran modules remained TER so am sure Egosoft are on their way to making station spawns faction specific.

However, as I came to write this, I remembered I edited a mod from @idragon to change my young gun appearance to TER. My edit is I changed the designation race to TER, hoping that it will affect service crew race but it did not, and I am not sure if that affects my TER shipyard. But...

Code: Select all


     <!-- Head Young Gun Start -->
	<replace sel="//macro[@name='character_player_tutorial_macro']/properties/models/model[@type='head']">
		<model type="head" ref="extensions/ego_dlc_terran/assets/characters/terran/heads/char_ter_m_cau_blend_head_darkeyes_01" />
	</replace>
    
    <!-- Body -->
    <replace sel="//macro[@name='character_player_tutorial_macro']/properties/models/model[@type='torso']">
		<model type="torso" ref="extensions/ego_dlc_terran/assets/characters/terran/bodies/char_ter_m_manager_uniform_01" />
	</replace>
    
    <!-- Props -->
    <replace sel="//macro[@name='character_player_tutorial_macro']/properties/models/model[@type='props']">
		<model type="props" ref="extensions/ego_dlc_terran/assets/characters/terran/props/Ter_m_hair_afr_01" />
	</replace>
	
    <!-- identification -->
    <replace sel="//macro[@name='character_player_tutorial_macro']/properties/identification">
		<identification name="{1021,102}" race="terran" faction="player" female="false" />
	</replace>	

    <!-- facemods --> ...
... However, I am satisfied that I figured out everything now.

With my character.xml edit as mentioned before, I can recruit Marines as TER only. It does not work for Service Crew. Reassigning crew on a ship to different roles, apart from pilot is already built into the game. I just noticed. In the ship information and then crew tab, you can drag left to unnasign crew from a different role and then drag right to assign them on another role. Then confirm when down. The confirm button only lights up when all unnassigned crew has been assigned a role. Here is a screenshot.

Image

Come to think of it Lu t'Sht could be a good Methane miner. xD

Summary.
Appending faction.player to the faction you want in character.xml affects the faction of Marines that you recruit. Then reassign marines to service crew on ship.

Now I can continue playing and effortlessly crew myships and stop modding for a while.
Sorry, but what you are saying is not clear to me at all. I am not really sure what you are doing.

Are you talking about what races show up on the station itself? This has nothing to do with what we are doing here. The NPC's which show up on your stations has to do with npc_instantiation and yes, it draws the npcs using tags which are in character.xml.

This is different from Crew which comes on your ship when you build the ship. Also, removing faction.player from other characters will mean that you can't recruit any other faction npcs from other stations, both your own and other factions. I think it might pull rookies for when you recruit staff from the upgrade menu so this may be possible to be affected by character.xml but this is not convenient at all. You would have to still do each ship individually.

It is much more convenient to just use the build.shiptrader file I put up and when you order 50 ships, they all come with the correct crew. Yeah, the shipyard settings reset but that is something you can fix quickly. Much faster than individually upgrading each ship or moving crew around. If I wanted to do that, there are even better ways like buying a ship that can hold a large crew and then having it get crew from terran stations and then just transfer crew when necessary.

The point of this mod is to be able to get the crew you want fast and as conveniently as possible.

Post Reply

Return to “X4: Foundations - Scripts and Modding”