Recruting an agent through mod

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

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

Mystershow
Posts: 95
Joined: Tue, 11. Feb 20, 18:56
x4

Recruting an agent through mod

Post by Mystershow »

Hello everyone !

I've been redoing the great mod "Recruitment Service Extended" from user2046 and LitauenLitauen. https://www.nexusmods.com/x4foundations/mods/1892

It does work like I have intended to with some faces I like and a bit a variability and mixity.


I've been able to add the recruitment of an agent after the quests has been completed, but they can only go work as a Manager, Marine, Service Crew or Pilot. I have try to fire them after buying them to then re-hire them as an agent but it doesn't work.

So I've been looking through an another way which doesn't work either.


So far, in the base game file I can see the following for the argon agent in charactergroups.xml:

Code: Select all

  <!-- AGENT -->
  <character name="argon.agent">
    <select character="argon.agent.male" />
    <select character="argon.agent.female" />
  </character>
  <character name="argon.agent.male">
    <select character="argon.commander.male"/>
  </character>
  <character name="argon.agent.female">
    <select character="argon.commander.female"/>
  </character>
Which lead to:

Code: Select all

  <!-- COMMANDER -->
  <character name="argon.commander">
    <select character="argon.commander.male" />
    <select character="argon.commander.female" />
  </character>
  <character name="argon.commander.male">
    <select macro="character_argon_male_cau_crew_02_macro" />
    <select macro="character_argon_male_afr_crew_02_macro" />
    <select macro="character_argon_male_asi_crew_02_macro" />
  </character>
  <character name="argon.commander.female">
    <select macro="character_argon_female_cau_crew_02_macro" />
    <select macro="character_argon_female_afr_crew_02_macro" />
    <select macro="character_argon_female_asi_crew_02_macro" />
  </character>
So my idea was to create custom macro and the code like that:

Code: Select all

	<replace sel="//character[@name='argon.agent']">
		<character name="argon.agent">
			<select macro="character_arg_m_agent_macro"/>
			<select macro="character_arg_f_agent_macro"/>
		</character>
	</replace>
or acting a bit later in the selection like that:

Code: Select all

<replace sel="//character[@name='argon.agent.male']">
    <character name="argon.agent.male">
        <select macro="character_arg_m_agent_macro"/>
    </character>
</replace>

<replace sel="//character[@name='argon.agent.female']">
    <character name="argon.agent.female">
        <select macro="character_arg_f_agent_macro"/>
    </character>
</replace>
I even try some command like <remove sel="//character[@name='XXX']" />to be sure that my macro would take over but it doesn't work so far unfortunately. I've tried to create some custom <select character as well.

But the agent is always a vanilla one and I don't understand why it doesn't work ? Could someone give an idea ? Thanks a lot !
Mystershow
Posts: 95
Joined: Tue, 11. Feb 20, 18:56
x4

Re: Recruting an agent through mod

Post by Mystershow »

I haven't found a solution yet

I've tried modyfying character_macros in libraries, I've tried playing around the diplomacy.xml in md or npc_agent.xml

But nothing works and I don't understand why, I can easily create custom characters to replace them in custom start or create macro for recruitment.


But here nothing work so far.

The game must go check somewhere else to bring some characters macro.

I mean I can only see a macro for Argon agent but some of the agents have Riptide clothes which do not appear in any agent macro so it's propably randomised but I can find the code lines :)
Mystershow
Posts: 95
Joined: Tue, 11. Feb 20, 18:56
x4

Re: Recruting an agent through mod

Post by Mystershow »

Found a solution by creating a custom macro for the manager since the agent take this one as a basis

But I have to create a custom macro with a lot of variability in order not to have a clome effect which isn't what I want to do

But it's moving forward

I did this in charactergroups.xml

Code: Select all

  <replace sel="/characters/character[@name='terran.manager.male']/select[@macro='character_terran_male_cau_manager_01_macro']/@macro">character_terran_spacesuit_macro</replace>
  <replace sel="/characters/character[@name='terran.manager.male']/select[@macro='character_terran_male_afr_manager_01_macro']/@macro">character_terran_spacesuit_macro</replace>
  <replace sel="/characters/character[@name='terran.manager.male']/select[@macro='character_terran_male_asi_manager_01_macro']/@macro">character_terran_spacesuit_macro</replace>
  
  <replace sel="/characters/character[@name='terran.manager.female']/select[@macro='character_terran_female_cau_manager_01_macro']/@macro">character_terran_f_manager1_macro</replace>
  <replace sel="/characters/character[@name='terran.manager.female']/select[@macro='character_terran_female_afr_manager_01_macro']/@macro">character_terran_f_manager2_macro</replace>
  <replace sel="/characters/character[@name='terran.manager.female']/select[@macro='character_terran_female_asi_manager_01_macro']/@macro">character_terran_f_manager3_macro</replace>
that reference a custom macro in characers.xml with the following example for a male terran

Code: Select all

<!-- Terran Male -->
		<macro name="character_terran_spacesuit_macro" class="npc">
			<component ref="character_argon_male_01"/>
			<properties>
				<identification name="@random" race="terran" female="false"/>
				<models>
					<model type="head" ref="assets/characters/argon/heads/char_arg_m_dyn_blend_head" />
					
					<!-- Add a rifle in the hand
					<model type="head" selection="random">
						<select index="1" weight="100" ref="assets/characters/pmc_bodies/pmc_military_male_01"/>
					</model> 
					
					If you want the rifle, simply replace "<model type="head" ref="assets/characters/argon/heads/char_arg_m_dyn_blend_head" />" 
					by 
					"<model type="head" selection="random">
						<select index="1" weight="100" ref="assets/characters/pmc_bodies/pmc_military_male_01"/>
					</model> "
					
					-->
					
					<model type="torso" selection="random">
						<select index="1" weight="100" ref="assets/characters/argon/bodies/char_arg_m_body_marine_01"/>
					</model>
					<model type="props" selection="random">
						<select index="1" weight="100" ref="assets/characters/argon/heads/char_arg_m_helmet_marine_01"/>
					</model>
				</models>
			</properties>
		</macro>
Mystershow
Posts: 95
Joined: Tue, 11. Feb 20, 18:56
x4

Re: Recruting an agent through mod

Post by Mystershow »

it seems to be a random pool of characters and I haven't found a way to do it

<spoiler>I'll look into Sobert since he can be recruitable after the DLC mission</spoiler>

Return to “X4: Foundations - Scripts and Modding”