Docking Ports unavailable to NPCs..

Freeform discussion about anything related to modding Transcendence.
Post Reply
Fleet Officer
Fleet Officer
Posts: 1483
Joined: Tue Mar 22, 2011 8:43 pm
Location: Alaska

Thu Jan 25, 2018 7:15 am

We have all been there :
An Armor Dealer with traffic backed up so bad it makes LA look like it doesn't have any issues.

What I did was give the &baCorporateStation a traffic code that changes out the guards and during that time frees up the ports.

Good Side Effect : it can give Corporate Stations or station using the &ba guards they didn't have before.

Negative Side Effects : It doesn't always play as well with others as I would like.

However, IF you would like to give it a go and see if you think it's worth having in Your Extensions :

Code: Select all

	<!-- Corporate Hierarchy Station Base Class
	USAGE: Corporate stations should inherit from this class. Derrived classes
		should manually call OnCreate and OnDestroy in case they need to override
		those events.
	<StationType unid="&baCorporateStation;"
			name=			"(Corporate station base class)"
			virtual=		"true"

				(block Nil
					; Behavior event 
				; This only applies to corporate stations
				(objMatches gSource Nil "sTAV +corporate; +corporateArms; +corporateCustoms; +populated; -korolovShipping;")
				 (objMatches gSource Nil "sTAV +corporate; +corporateArms; +corporateCustoms; +majorStation; +populated; -korolovShipping;")
					(sysAddObjRecurringTimerEvent 90 gSource "OnBehavior")
				(block (escorts escortCount portsLeft)
				; Initialize some variables
					(setq escorts (sysFindObject gSource "sHZ O:guard;"))
					(setq dockedFreighters (sysFindObject gSource "sHZ O:docked; +commonwealth;"))
					(setq freightersInFlight (objGetData gSource "freightersInFlight"))
					(setq freighterCount (add (count dockedFreighters) freightersInFlight))
					(setq escortCount (add (count escorts) freightersInFlight))

					; Exclude freighters being escorted by the player
					(setq dockedFreighters (filter dockedFreighters theFreighter
						(not (objGetData theFreighter "korolovPlayerEscort"))

					; See if we have any docking ports free
					(setq portsLeft (gr (objGetOpenDockingPortCount gSource) 0))

					; If we don't have enough escorts, then we better get some more
					(if (and portsLeft
								(and (ls escortCount 1) (eq (random 1 2) 1))
								(and (objGetData gSource "needEscorts") (eq (random 1 2) 1))
						(block (newShip)
							(setq newShip
									(random '(&scAsterionHeavyGunship; &scBritannia; &scManticore; &scCenturion; &scRoninC; &scWolfen; &scRoninB; &scRoninA; &scArmstrongTransport; &scManticore;))
									(objGetNearestStargate gSource) 
							(shpOrder newShip "guard" gSource)
							(objSetData gSource "needEscorts" Nil)

					; Send out a freighter to a random station
						; If we have no ports left, then send some escorts away
						(and (not portsLeft) escorts)
							(block (theCount)
								(setq theCount (max 2 (subtract (count escorts) 2)))
								(for i 1 theCount
									(block (theEscort)
										(setq theEscort (item escorts (subtract i 1)))
										(shpCancelOrders theEscort)
										(shpOrder theEscort 'gate)

						; Must have freighters
						(not dockedFreighters)
						; If we don't have enough freighters, then don't worry
						(and (ls (count dockedFreighters) 1) portsLeft)

						; Random interval
						(and (gr (random 1 6) 3) portsLeft)
				(block Nil
					; we scare any sister ships
				(block (targets)
					(setq targets (sysFindObject gSource "sAN:25; B:commonwealth;"))
					(enum targets target
						(block Nil
							(shpCancelOrders target)
							(shpOrder target 'gate)
					(sysCancelTimerEvent gSource "OnBehavior")
					(sysCancelTimerEvent gSource "OnTrafficControl")
			<Text id="customs.chargedForDecon">
					"Corporate security stops your ship for decontamination. "
					"You are automatically charged " (@ gData 'cost) " for decontaminating your ship."
			<Text id="customs.cantAffordDecon">
					"Corporate security stops your ship for decontamination. "
					"Unfortunately, you do not have " (@ gData 'cost) " to pay for decontamination."
Flying Irresponsibly In Eridani......

I don't like to kill pirates in cold blood ..I do it.. but I don't like it..

Post Reply