Stargate problem.

Freeform discussion about anything related to modding Transcendence.
Post Reply
User avatar
AssumedPseudonym
Fleet Officer
Fleet Officer
Posts: 1212
Joined: Thu Aug 29, 2013 5:18 am
Location: On the other side of the screen.

 And rather an ugly one, at that.
 Basically, I am trying to use Majellen stargates through The Backroads instead of the bog standard variety. I don’t, strictly speaking, need to do so, at least for reasons other than vanity. And, as of now, stubbornness.
 I can think of two real ways to go about this. One is to basically copypasta all of the vanilla systems and change their stargate lookup table, and create a new lambda for said new table. That’s probably the easier (and lazier) way to go about it. And so naturally I’m not doing it that way.
 The way I’m trying to do this is to replace all of the stargates in TBR systems by destroying the existing stargates and replacing them with Majellen stargates, taking the data from the original stargates to apply to the replacement stargates upon their creation. Here’s the code I’m using:

Code: Select all

			<OnGlobalSystemCreated>
				(block (aeGateIDList)

			; Run this only if its a system from The Backroads.

					(if (sysHasAttribute (sysGetNode) "theBackroads")
						(block nil

			; Get rid of the stargate beacons.

							(enum (sysFindObject nil "t +unid:&stStargateBeacon;") aeNoBeacons (objDestroy aeNoBeacons))

			; Create a list of all stargates in the current system.

							(enum (sysGetStargates (sysGetNode)) aeGateID
								(setq aeGateIDList (append aeGateIDList aeGateID))
							)

			; Preparations to start replacing stargates.

							(for aeNewGate 0 (subtract (count aeGateIDList) 1)
								(block (aeGatePosition aeGateDestinationNode aeGateDestinationGate)

			; Match the physical and topological aspects of the stargate.

									(enum (sysFindObject nil "G") aeSpecifyGate
										(if (eq (cat (sysGetName (sysGetStargateDestinationNode (@ aeGateIDList aeNewGate))) " Stargate") (objGetName aeSpecifyGate))
											(block nil

			; Verify to Debug.log that we have the right gate.

												(printTo 'log "We have a match.")

			; Gather info for use in the replacement stargate.

												(setq aeGatePosition (objGetPos aeSpecifyGate))
												(setq aeGateDestinationNode (@ (sysGetStargateDestination (@ aeGateIDList aeNewGate)) 0))
												(setq aeGateDestinationGate (@ (sysGetStargateDestination (@ aeGateIDList aeNewGate)) 1))

			; Verify to Debug.log that the required information is present.

												(printTo 'log (list aeGatePosition (cat "to" aeGateDestinationNode) aeGateDestinationNode aeGateDestinationGate))

			; Remove the original stargate.

												(objDestroy aeSpecifyGate)

			; Create the replacement stargate with data gathered from the original.

												(sysCreateStargate &stMajellenStargate; aeGatePosition (cat "to" aeGateDestinationNode) aeGateDestinationNode aeGateDestinationGate)
												(printTo 'log (list aeGatePosition (cat "to" aeGateDestinationNode) aeGateDestinationNode aeGateDestinationGate))
											)
										)
									)
								)
							)

			; Verify to Debug.log stargates and gateIDs.

							(enum (sysFindObject nil "G") aeWhatIsThis (printTo 'log (objGetName aeWhatIsThis)))
							(enum (sysGetStargates (sysGetNode)) aeThisHereGate (printTo 'log aeThisHereGate))
						)
					)
				)
			</OnGlobalSystemCreated>
 As near as I can tell from what I’ve had outputted to Debug.log, this should work. The fact that I’m posting here is probably a good indication that it does not. In fact, entering any system in The Backroads is grounds for an immediate crash to desktop, with the following output to Debug.log:
Debug.log wrote:12/13/2014 22:59:34 Games\AssumedPseudonym-1772.sav: System 1c: Save file error: Unable to find named object: toAEA [3a5d] [Stannis (3a66)]
12/13/2014 22:59:35 Unable to continue due to program error.

program state: OnAnimate
program state: enter stargate, loading destination system
game state: entering stargate


Please contact [email protected] with a copy of Debug.log and your save file. We are sorry for the inconvenience.

12/13/2014 22:59:36 End logging session
 Any ideas on why this is being insistent on not working the way it looks like it should?

ADDENDUM: Changing from <OnGlobalSystemCreated> to <OnGlobalSystemStarted> results in being able to enter the system with the new stargates properly positioned and functional. …Once. Leaving the system and returning to it results in the same crash and error message.
Image

Mod prefixes: 0xA010 (registered) and 0xDCC8 (miscellaneous)

My mods on Xelerus: Click here!

Of all the things I’ve lost in life, I miss my mind the least. (I’m having a lot more fun without it!)
bzm3r
Militia Lieutenant
Militia Lieutenant
Posts: 100
Joined: Tue Oct 23, 2012 2:38 pm

Did you end up finding a solution to this problem?
User avatar
AssumedPseudonym
Fleet Officer
Fleet Officer
Posts: 1212
Joined: Thu Aug 29, 2013 5:18 am
Location: On the other side of the screen.

 Yes and no. I haven’t figured out exactly what’s causing the crash (though I suspect that it may be looking at a deeper level than just the gate’s gateID and destination details). I do have a workaround of sorts, though it’s fairly kludgetastic (like a lot of my stuff seems to be). Basically, I shunted the stargate creation lambda into a different variable, made a copy of the lambda to customize a bit, made sure to set the lambda to the original in <OnGlobalTopologyCreated> but with a conditional to switch to the custom version in the next system if it’s one of mine. …Which I just had to fix because had done it wrong. The upshot is that it doesn’t require any overwrites.
Image

Mod prefixes: 0xA010 (registered) and 0xDCC8 (miscellaneous)

My mods on Xelerus: Click here!

Of all the things I’ve lost in life, I miss my mind the least. (I’m having a lot more fun without it!)
Post Reply