Mission help.

Freeform discussion about anything related to modding Transcendence.
Post Reply
F50
Fleet Officer
Fleet Officer
Posts: 1004
Joined: Sat Mar 11, 2006 5:25 pm

Somehow, I cannot get a freighter to perform a shipping route. I can get it to gate out, and to dock with gSource, but I cannot get it to find a Korolov-friendly station and dock with it.

The problem code is in the Charon Pirate cache: StaticData: "mission 0b" a particular section of which is reproduced below.

Code: Select all

	
	(setq testDest Nil) ;  This next bit seems to be the problem code
	(setq Dest Nil)	
	(setq destList (sysFindObject chosenKorolov "T:populated:F"))
	(enum destList testDest
		;(if (and
		;	(gr (objGetDistance chosenKorolov testDest) minDist)
		;	(ls (objGetDistance chosenKorolov testDest) bestDist))
			(block Nil
				;(setq bestDist (objGetDistance chosenKorolov testDest))
				(setq Dest testDest) ; With those lines commented out, this code simply should find *any* station that is a freind of Korolov and choose it.
			)
		;)
	)
	(if (eq Dest Nil)
		(block Nil
			;Can't seem to find a way to stop the mission, but that is not the main problem.
		)
	) ; End problem code
								(setq ship (sysCreateShip &scEI100; chosenKorolov &svCommonwealth;))
								(shpOrderDock ship Dest)
Note that if the line:

Code: Select all

								(shpOrderDock ship Dest)
is changed to:

Code: Select all

								(shpOrderDock ship gSource)
It works perfectly, it just doesn't do what I want him to do.

The entire program is on xelarus if you want to test things out:

http://xelerus.de/index.php?s=mod&id=95
F50
Fleet Officer
Fleet Officer
Posts: 1004
Joined: Sat Mar 11, 2006 5:25 pm

SOLUTION:

Code: Select all

				(setq bestDist 10000)
				(setq testDest Nil)
				(setq Dest Nil)	
				(setq destList (sysFindObject gSource "T"))
				(enum destList testDest
					(if (and
						(and	(ls (objGetDistance chosenKorolov testDest) bestDist)
							(or	(gr (objGetDistance chosenKorolov testDest) (divide (objGetDistance chosenKorolov gSource) 3))
							(gr (objGetDistance chosenKorolov testDest) (divide (objGetDistance Dest gSource) 3)) ))
							(or (eq (objGetSovereign testDest) &svCorporate;) 
							(eq (objGetSovereign testDest) &svCommonwealth;)) )
						(block Nil
							(setq bestDist (objGetDistance chosenKorolov testDest))
							(setq Dest testDest)
						)
					)
				)
				(if (eq Dest Nil)
					(block Nil
						(setq Dest gSource) ; to be replaced by something that actually stops the mission
					)
				)
				; Create the freighter
				(setq freighter (sysCreateShip &scEI100; chosenKorolov &svCommonwealth;))
				(shpOrderDock freighter Dest)
				(shpOrderDock freighter chosenKorolov)
its hard to get (sysFindObj) to work properly. (note, the mod on xelerus has not changed)
george moromisato
Developer
Developer
Posts: 2998
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

This may or may not help, but to test sysFindObject, you could bring up the debug console (F9) and try out various finds:

Code: Select all

(enum (sysFindObject gPlayerShip "T") theObj
     (dbgOutput (objGetName theObj 0))
     )
You might even package that up in a function so that you can test out various options.

p.s.: I didn't actually test the above--there may be bugs.
Post Reply