How do I remove a crew member?

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

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

User avatar
Reisser
Posts: 764
Joined: Mon, 28. Feb 05, 15:39
x4

How do I remove a crew member?

Post by Reisser »

I've been tinkering with my new mod here for quite a while, but am now stuck on the little thing of how to remove (kill) a crew member.
There doesn't seem to be a command for this (other than people_transfer) so I tried to get through the list. It starts in an AI-script.

Code: Select all

<set_value name="$Ship"    exact="this.ship"/>
<do_for_each in="$Ship.people.{entityrole.marine}.list" name="$Trainee" comment="In Trainee is the ID of the crewman">	

  <do_if value="$Debug">
    <debug_to_file directory="$BugD" name="$BugF" text="'  Removed: '+$Ship.people.{$Trainee}.name"/>
  </do_if>
	
   <remove_from_list name="$Ship.people.{entityrole.marine}.list" exact="$Trainee" multiple="false"/>

</do_for_each>
This should actually remove all marines - I can also access the crew members individually in any form - just not remove them.

Of course I tried a bunch of approaches to the list (which I won't list all of them here - they don't work anyway and I was also a bit desperate *g*)

Does anyone here have a tip for me please?
Meine Mods bei NexusMods: RS Loss Report RS Bribe for Scandata RS Colors RS Marine Special Training
Meine Mod-Collection bei NexusMods: X4 7.0 VRO Hard Times
User avatar
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13486
Joined: Sun, 15. Feb 04, 20:12
x4

Re: How do I remove a crew member?

Post by euclid »

It removes it from the list but not from the crew ;-) I'd try dismiss_control_entity or simply destroy_object

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
User avatar
Reisser
Posts: 764
Joined: Mon, 28. Feb 05, 15:39
x4

Re: How do I remove a crew member?

Post by Reisser »

The two didn't really work for me - maybe I called it wrong - with X it's all possible :D

But at least - that's how it worked - the crew is dying like flies with it... I haven't noticed any interactions yet.

Code: Select all

<remove_npc_template object="$Ship" template="$Trainee"/>
Meine Mods bei NexusMods: RS Loss Report RS Bribe for Scandata RS Colors RS Marine Special Training
Meine Mod-Collection bei NexusMods: X4 7.0 VRO Hard Times

Return to “X4: Foundations - Scripts and Modding”