Can I prevent mod data from being saved?

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

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

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

Can I prevent mod data from being saved?

Post by user1679 »

If I want to temporarily spawn an NPC, is there a way to prevent this NPC from being saved to the game save file?

I don't want to remove it because I want it to be available for the player's entire session but I don't want it saved because it's supposed to be a random spawn.


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

Re: Can I prevent mod data from being saved?

Post by euclid »

Obviously you need a mod to spawn the NPC. This mod will leave traces in your saved game. However, once you've removed (disabled) the mod it is possible to create a "clean" saved game. The NPC (and everything you've spawned) will still be there unless you despwn those before saving. Also note that you need to stop all your mod-related scripts as they also will be stored in the saved game.

Hope that helps.

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: 1088
Joined: Fri, 20. Jul 18, 23:20

Re: Can I prevent mod data from being saved?

Post by user1679 »

euclid wrote: Thu, 4. Mar 21, 14:54 Obviously you need a mod to spawn the NPC. This mod will leave traces in your saved game. However, once you've removed (disabled) the mod it is possible to create a "clean" saved game. The NPC (and everything you've spawned) will still be there unless you despwn those before saving. Also note that you need to stop all your mod-related scripts as they also will be stored in the saved game.

Hope that helps.

Cheers Euclid
Thank you. What I was looking for was exactly that, despawn before saving. I haven't been able to identify the event (probably md.Save ?) that fires before the save so I can do the despawn.

I think alternatively I can use the Start event instead of GameStart and despawn the NPC at that time too. I found the Start event by accident while trying to trace where and when variables are loaded.

Return to “X4: Foundations - Scripts and Modding”