inventory mod code queries

Freeform discussion about anything related to modding Transcendence.
Post Reply
Militia Captain
Militia Captain
Posts: 725
Joined: Tue Nov 05, 2013 9:56 am

Tue Aug 14, 2018 11:55 pm

Working on a mod that duplicates the Captain's Log station inventory feature.

There are a number of things I don't know how to do.

1. A way of updating the station's stored items data on undocking from the station.

The mod stores a list of items (if any) from any station that has been docked at by the playership.
This can be used out of the system to refer back to what items were available in what system.
The list is updated ATM whenever the player enters the mod's stations dockscreen and also in <OnGlobalPlayerLeftSystem>
This works fine but doesn't handle the time between when the player undocks from a station and either enters the mod's stations dockscreen or gates out of the system. Automatic ammo restocking and salvagers looting stations can happen in this time making the item list inaccurate.
What I think is needed is a way of updating the item list as the player undocks from the station. But I can't find an event which covers this.

I can think of a couple of very messy ways to do this but am hoping there is a simple way to detect when the playership has undocked from a station and then run code. There are a couple of mission "undock" events but I don't know if they could be used here. An OnUpdate event would work but may cause lag.
Anyone got any ideas? The mod will be so much simpler if the items can be updated on undocking.

2. Showing a star image in the carouselSelector list entry.

See image. It would be good if the star image as seen in the galactic map (or the plain white image used in unnamed systems) could be shown as the icon just above Eridani and the other system names. But stars seem to be an effect not an image so I'm not sure if this can be done (only the red stars have an image UNID in their code). Is it possible to do this and if so how is it done? And does it handle the binary systems?
Here's the code for the carouselSelector list from <OnDisplayInit> (copied from RPGShipBroker.xml).
Code is needed in the "icon:" section to make a star image appear.

Code: Select all

(map (filter (sysGetNodes) theNode (sysIsKnown theNode)) nodeID
	(block Nil
		title: (cat (sysGetName nodeID) "\n"
				(@ (typGetData &evD789LogInventory; 'visit) nodeID)
		icon: Nil
		largeIcon: Nil
		details: (rpgD789ShowSystemDetails nodeID)
		shipObj: Nil
3. Find stations set as known by 'unvSetObjectKnown' using code.

Several stations are made known at game start (Battle Arena, Point Juno, etc) by using 'unvSetObjectKnown' in <OnGlobalUniverseCreated>. Ideally these would be known by the 'log' at game start because they already appear in the galactic map but I can't work out how to get a list of these stations. Filtering an unvFindObject list for known stations only returns stations in the current system. Does anyone know if this can be done or will they have to be manually added to the code?
inventory mod use.JPG
inventory mod use.JPG (63.25 KiB) Viewed 499 times

Militia Captain
Militia Captain
Posts: 522
Joined: Tue Mar 05, 2013 8:26 am

Wed Aug 15, 2018 9:06 am

Some of these issues are related to features being discussed for the trade computer. It doesn't appear there's an event when the player undocks. In the next beta version it will be possible to check whether the player has docked with an object, but not yet. How about just including all known objects (with appropriate characteristics) in the system?

Post Reply