Adding Station to Vanilla - Workaround

Freeform discussion about anything related to modding Transcendence.
Post Reply
robotarozum
Miner
Miner
Posts: 35
Joined: Sat Nov 30, 2013 10:05 pm

I have read that adding a station to specific systems requires overwriting the systems, which is both crude and liable to cause problems later.

Is it possible to create a trigger within a player ship that will check every entrance in a system against a specific list, and when matched create a station?

I'm still not totally sure how to use these things, but here's what I've found so far that I think could help:

(sysGetProperty [nodeID] property) -> value

property:

'level The level of the system
'name The name of the system
'pos Node position on map (x y)

...would give us the name when called and we could check that against our list, but I'm not sure how to get nodeID, and "typfind n = system node UNID (currently returns nothing?)" doesn't make me too hopeful.

<OnPlayerEnteredSystem>

...seems like a useful event for these purposes.

I have been using the Galactic Omni Device for testing purposes, and if I can get the first bits to work I'm reasonably confident I can appropriate that code to create a specific station, but my ability to combine events and functions so far is not great, so I thought I'd start there.

Will the combination of <OnPlayerEnteredSystem> and (sysGetProperty [nodeID] property) -> value work, or am I off my rocker?
RPC
Fleet Admiral
Fleet Admiral
Posts: 2876
Joined: Thu Feb 03, 2011 5:21 am
Location: Hmm... I'm confused. Anybody have a starmap to the Core?

Here is what I do:
-> have a virtual station
--> in <OnSystemCreated>, sysCreate the virtual station in that system
--> in <OnCreate>I have a block that looks like this:

Code: Select all

(block nil
	(switch
		(eq (sysGetName) "sytem name")
			(block NIl
				(syscreatestation [the station you want to add in the system])
				)
		)
	)
HOW IT WORKS:
Okay, so every time a system is created, it creates the virtual station. The virtual station is undetectable by the player, so they don't know it's there. When the virtual station is created (which is when every system is created), it will check if it's the right system with the switch function, and then sysCreate the appropriate station. The arguments for SysCreateStation might be a bit tricky, but I feel comfortable using this method.

NOTES:
I don't like using <OnPlayerEnteredSystem> because since systems are generated on game start, your station isn't in the system it's supposed to be until the player enters. You can still use it but if you want to do missions (like say, go to X station in Y system) your station (and whatever data you want to put on it) won't exist and you'll have to find another way to manipulate data.
Tutorial List on the Wiki and Installing Mods
Get on Discord for mod help and general chat
Image
Image
Der Tod ist der zeitlose Frieden und das leben ist der Krieg
Wir müssen wissen — wir werden wissen!
I don't want any sort of copyright on my Transcendence mods. Feel free to take/modify whatever you want.
george moromisato
Developer
Developer
Posts: 2997
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

I think a better approach is to use <OnGlobalSystemCreated>, which will get called whenever a system is created. You can do something like:

Code: Select all

<OnGlobalSystemCreated>
   ...
   ; If we just created Eridani (SE) then create some station

   (if (eq (sysGetNode) 'SE)
      ...
      ; create a station
      )
</OnGlobalSystemCreated>
See also: http://transcendence.kronosaur.com/wiki ... temcreated
RPC
Fleet Admiral
Fleet Admiral
Posts: 2876
Joined: Thu Feb 03, 2011 5:21 am
Location: Hmm... I'm confused. Anybody have a starmap to the Core?

Actually George's reply is better. I'm used using the virtual station method because I run other events on it as well >.<

Quick question: Will <OnGlobalSystemCreated> on any type run when systems are created? Like, for example, an itemtype has OnGlobalSystemCreated, will its OnGlobalSystemCreated event run?

EDIT: its NOT it's
Tutorial List on the Wiki and Installing Mods
Get on Discord for mod help and general chat
Image
Image
Der Tod ist der zeitlose Frieden und das leben ist der Krieg
Wir müssen wissen — wir werden wissen!
I don't want any sort of copyright on my Transcendence mods. Feel free to take/modify whatever you want.
george moromisato
Developer
Developer
Posts: 2997
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

RPC wrote:Quick question: Will <OnGlobalSystemCreated> on any type run when systems are created? Like, for example, an itemtype has OnGlobalSystemCreated, will it's OnGlobalSystemCreated event run?
Yes. In general, any event of the form OnGlobal... can be put on any type (even a generic type like <Type ...>) and it will get executed at the proper time.
robotarozum
Miner
Miner
Posts: 35
Joined: Sat Nov 30, 2013 10:05 pm

Worked like a charm, thanks! :)
Post Reply