Ship Vendor Fix

By Vollmetal Verified

Free Mod

Community Rating

No ratings yet

Simple edit to the ShipVendorScript script used by all vendors so they properly take care of ships that are removed whenever their inventories reset.

This will prevent any pointer handle leaks related to ship vendor inventory resets and probably several other bugs related to old supposedly cleaned up ships randomly reappearing on landing pads. The fix is experimental and I've done the most testing make sure it's doing things properly but testing for specific ref handle leaks is a really long and laborious process to do so your mileage may vary.

What Normally Happens With Ship Vendors:

  1. When you sell a ship, that ship is simply placed back into the vendor's "inventory" array to be displayed in the buy/sell screen.
  2. Every 7 days (week) the vendor runs the Delete() command on all ships in it's inventory then clears it's inventory array.
  3. New ships are spawned on the landing pad disabled and linked to the landing pad.
  4. Repeat

The Problem:

  • When ships are supposed to be cleared, the link to the local landing pad/docking port isn't cleared, potentially keeping the ship loaded at all times or at minimum preventing it from being cleaned by the game's garbage collector.
  • When ships are supposed to be cleared they are not sent anywhere. There is no holding cell they're placed in. This means that so long as the cell, usually a persistent or city cell, is loaded or not reset garbage collection either can't or rarely will clear out the disabled ships.
  • Delete() is called instead of using DisableNoWait() and clearing all references and links. Delete() does nothing to ship references as they're a complex group of multiple references layered on top of each other. Instead you need to disable the ship or kill it and leave it in an unloaded cell until the game's garbage collector comes through and cleans it up, which the engine does properly so long as the ship isn't spawned in as a persistent ship.

The Solution:

This mod does a couple small things:

  1. It creates an empty "trash" cell to place ships to be killed or cleaned up. That way no scripts, quests, etc can scan them and the engine doesn't try to load them. The player cannot get to this cell.
  2. When ship vendors go through their list for cleaning it places the ship in the trash cell.
  3. The ship is then disabled.
  4. Finally to make absolutely sure the engine knows to clean it up, the ship is killed.
  5. After all that's done to every ship in the array, the array is forcibly cleared as it is in vanilla.

Starfield News - Are Paid Mods Worth It? Plus 6 More Stories

By Richard Presents Starfield Essentials • 1 year ago

More Staryards | Starfield Mod Trailer

By TheMilkArtist • 1 year ago

#Starfield Creation Kit Tutorial 11 - Create a Mod with Vendors that Sell your Custom Built Ships

By JRamosWorks Gaming • 2 years ago

Explore more Starfield creations for Ships. Browse all Ships mods →

Craftable Weightless Containers

By Mad_Tod

Adds new craftable containers, that have no weight limit.

Avontech Stardust

By kaos_nyrb • 400 Credits

Analogue ships. Digital stars.

Rising Star Ship Habs

By ShadowWeaver_82 • 300 Credits

Habs that make the final frontier feel like home!

Constellation Action Figures Set

By justinn724 • 300 Credits

Brought to you by Chunks and Constellation! The all-new [Constellation Action Figures Set] is ready to decorate your outposts and starships!

Sensible Starting Ship

Want a better starting ship? This mod puts the ship in the bag, bruh.

DarkStar Integration - Watchtower: Orbital.Strike\\Fleet.Command

Fully integrates DarkStar and Watchtower