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>
Any ideas on why this is being insistent on not working the way it looks like it should?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
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.