Finding all the Korolov Stations and choosing *one*

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

Code: Select all

(block Nil
	; find all stations in the system and put them into listofstations 
	(setq listofstations (sysFindObject gPlayerShip "t"))
	;flip through the list of stations and use the variable station_x to refer to each one
	(enum listofstations station_x
		;Then find the stations that are Korolov Shipping and choose one of them
		(if (eq (staGetType station_x) &stKorolovShipping;)
   			(block Nil    
       				(setq chosenKorolov *HELP*)
       			)
		)
	)
)
This code *should* find all the Korolov stations, but I don't know how to choose one of the found korolov stations, or to figure out if there are no Korolov stations.

The goal of all this is to be able to create a ship at that Korolov station, and make that ship do a shipping route (probably going to be the next question) so the player can blow it up. :twisted:
F50
Fleet Officer
Fleet Officer
Posts: 1004
Joined: Sat Mar 11, 2006 5:25 pm

Here is some working code:

Code: Select all

(block (chosenKorolov station_x)
	; find all stations in the system and put them into listofstations
	(setq listofstations (sysFindObject gPlayerShip "t"))
	;flip through the list of stations and use the variable station_x to refer to each one
	(enum listofstations station_x
		;Then find the stations that are Korolov Shipping and choose one of them
		(block Nil 
			(if (eq (staGetType station_x) &stKorolovShipping;)
               			(setq chosenKorolov station_x)
			)
			(if (eq chosenKorolov Nil)
               			;insert failure code here
			)
		)
	)
)
now I just need to get the a freighter to travel a shipping route between this Korolov station and another station. Unfortunately, I can't make anything of the Korolov Shipping code.
Bobby
Militia Captain
Militia Captain
Posts: 675
Joined: Wed Jul 25, 2007 7:39 pm

here's what i found in the xmls, this is the part that sends the freighter on it's way.


the first part, the shporders make it follow the route, assuming the ship is "transport" and "destination" is where you want it to go.

te second part, the sysaddencounters create the pirate ambush.

the last part makes it show up on the player's enhanced visual display.

Code: Select all

(lambda (transport destination)
	(block Nil
	(shpCancelOrders transport)
	(shpOrderDock transport destination)
	(shpOrderDock transport gSource)
								(sysAddEncounterEventAtDist (add 600 (random 0 100)) transport &etPirateAmbush1; (random 60 100))
								(sysAddEncounterEventAtDist (add 1200 (random 0 200)) transport &etPirateAmbush1; (random 60 100))

	(shpOrderEscort gPlayerShip transport)
	(objSetIdentified transport)
	)
)
F50
Fleet Officer
Fleet Officer
Posts: 1004
Joined: Sat Mar 11, 2006 5:25 pm

the first part, the shporders make it follow the route, assuming the ship is "transport" and "destination" is where you want it to go.

Code: Select all

   (shpCancelOrders transport)
   (shpOrderDock transport destination)
   (shpOrderDock transport chosenKorolov) 
so it works on an order queue? Way too easy!

Thanks again Bobby!

How would I know when the ship has docked with Korolov (pointed to by the variable chosenKorolov)?
Bobby
Militia Captain
Militia Captain
Posts: 675
Joined: Wed Jul 25, 2007 7:39 pm

you may be able to use staGetDockedShips and a timer to see if it has docked.

EDIT: there is a <OnObjDocked> event that may help you.
Post Reply