[Help] Changed NPC Name In Save - Reverted When Job Changes

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

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

user1679
Posts: 841
Joined: Fri, 20. Jul 18, 23:20

[Help] Changed NPC Name In Save - Reverted When Job Changes

Post by user1679 » Sun, 5. Jul 20, 06:11

Not sure why this happens but a name changed in save file reverts to original name on job reassignment:

1. Hire an NPC named Chelle Glaser, assign to Captain
2. Save / exit game
3. Open save (XML) in notepad++
4. Search for Chelle Glaser and change to Amara
5. Search for Chelle Glaser no results found
6. Change NPC seed to force outfit change
7. Save XML file
8. Reload game and now see Captain Amara sitting in captain chair
9. Talk to my pilot and reassign her to "Service Crew"
10. She walks past me with the new title: Crewwoman Amara
11. Open ship properties
12. Look at crew list
13. See: Service Crew: Chelle Glaser

I also tried seraching the save file for the NPC's ID but only found a reference to a script file for default orders. I don't think this is related to the seed
because I can change her seed without seeing a name change. How is the game associating her original name when I assign her to a different job?

User avatar
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13307
Joined: Sun, 15. Feb 04, 20:12
x4

Re: [Help] Changed NPC Name In Save - Reverted When Job Changes

Post by euclid » Tue, 7. Jul 20, 20:59

It may be a hex involved which would be still in your saved game. Try to save before step 9. Then exit, restart and load this game. Now proceed with step 9. Please let us know if that works.

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

user1679
Posts: 841
Joined: Fri, 20. Jul 18, 23:20

Re: [Help] Changed NPC Name In Save - Reverted When Job Changes

Post by user1679 » Wed, 8. Jul 20, 10:06

euclid wrote:
Tue, 7. Jul 20, 20:59
It may be a hex involved which would be still in your saved game. Try to save before step 9. Then exit, restart and load this game. Now proceed with step 9. Please let us know if that works.

Cheers Euclid
Unfortunately this didn't work either. Her name reverts as soon as I open the UI and look at my crew list.

I also made note of her hex value for the ID=[] field, added 100,000 to it and replaced all instances of it in my save. Her name still reverts to her default name when I swtch her from Captain to Service Member.

UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Re: [Help] Changed NPC Name In Save - Reverted When Job Changes

Post by UniTrader » Sat, 11. Jul 20, 15:06

i guess its related to a random seed value many objects have, from which stuff like Name, Looks and stuff is generated. not sure about the save structure, but i think its worth a shot to try and removing it..
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

user1679
Posts: 841
Joined: Fri, 20. Jul 18, 23:20

Re: [Help] Changed NPC Name In Save - Reverted When Job Changes

Post by user1679 » Sun, 12. Jul 20, 01:03

UniTrader wrote:
Sat, 11. Jul 20, 15:06
i guess its related to a random seed value many objects have, from which stuff like Name, Looks and stuff is generated. not sure about the save structure, but i think its worth a shot to try and removing it..
Looking through the XML files, it doesn't make much sense to me how the name gets generated.

When you set the NPC as pilot when hired you get an entry below the <ship> node in your save like this:

Code: Select all

<component class="npc" macro="character_teladi_male_pilot_01_macro" connection="parentconnection" name="Gradias Deridos Libaras X" code="GZX-078" owner="player" known="1" read="0" page="10504" id="[0xa02d1]">
Under the component node you will eventually see: <npcseed seed="1958398653"/> which changes the appearance but not the name if you edit and reload the save.

Now, if you reassign the pilot to service crew, the entry in the save file changes. The NPC is removed from the component node and placed under a <people> node:

Code: Select all

<people>
<person macro="character_teladi_male_pilot_01_macro" flags="remotecommable|intransit|temporary" role="service">
<npcseed seed="1958398653"/>
<skill type="boarding" value="7"/>
<skill type="management" value="3"/>
<skill type="morale" value="3"/>
<skill type="piloting" value="2"/>
</person>
</people>
Notice the ID, name and owner attributes are no longer present. If you open character_macros.xml and look for character_teladi_male_pilot_01_macro you will find this interesting line:

Code: Select all

<identification name="@random" race="teladi" />
What doesn't make sense is no matter what you change in the save file, this macro somehow always replaces your NPC name with the original when switching back to pilot. Even if you set the seed to 0 or any other random number, the character's name is actually reverted. But, if you change nothing (hire, assign pilot, reassign service, reassign pilot), the @random doesn't suddenly generate a new random name when switching roles. Somewhere there must be a lookup that reverts the name but I can't seem to locate it.

User avatar
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13307
Joined: Sun, 15. Feb 04, 20:12
x4

Re: [Help] Changed NPC Name In Save - Reverted When Job Changes

Post by euclid » Sun, 12. Jul 20, 19:11

It is definately due to the saved game editing because if you change an NPC name via script it's permantent. Anyway, I'm not a fan of saved game editing because too much can go wrong. My suggestion is to write a short MD script that allows you to change the name of (anything is even possible) NPCs.

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

Return to “X4: Foundations - Scripts and Modding”