Fleet wingman behavior help please

Freeform discussion about anything related to modding Transcendence.
Post Reply
relanat
Militia Captain
Militia Captain
Posts: 789
Joined: Tue Nov 05, 2013 9:56 am

Fri Aug 30, 2019 4:13 am

Looking to upgrade the Binary System Stargates mod. This mod puts a small stargate near each star in binary systems. The player can use the gates to jump to the other gate rather than fly all the way between stars.

I have the next version already jumping autons and character wingmen to the other gate but Fleet wingmen are quite erratic. I believe the 'fleet' controller code is hard-coded so I have no idea how it works.

This code:

Code: Select all

(enum shipObjectList theObj
	(block Nil
		(objSetPos theObj destGate)
		(objSetVel theObj Nil)
		(shpOrderImmediate theObj 'wait 2)
	)
)
works fine for autons and Volkov. They wait for the specified time and then deploy to their escorting positions.
But Fleet wingmen just stay frozen at the gate. They do not end the 'wait' order and also no longer appear in the 'Communications' menu.

Code: Select all

(setq fleetShips (sysFindObject gPlayerShip "sJ:&svCommonwealthFleet;; O:escort;"))
I have tried various things like setting behavior to 'escorting, setting the ship controller to Nil then back to 'fleet, canceling the orders then re-ordering them, plus combinations of all of these but nothing works.
The Fleet ships either don't gate with the player and fly to the other gate, disappear or gate and stay waiting forever.

Has anyone got any tips on how to make the Fleet ships jump with the player, stay in position for the specified time and then deploy to their normal formation?

Mod attached where the Fleet ships just stay at the gate waiting forever.
Also an override mod which makes C1 a binary system for every game.
Attachments
BinarySystemStargates dev 16.zip
(282.11 KiB) Downloaded 5 times
Make C1 binary.xml
(17.85 KiB) Downloaded 3 times
Stupid code. Do what I want, not what I typed in!

NMS
Militia Captain
Militia Captain
Posts: 537
Joined: Tue Mar 05, 2013 8:26 am

Fri Aug 30, 2019 5:52 pm

Here's the code that creates Fleet wingmen:

Code: Select all

					(for i 0 (- aCount 1)
						(block (wingmanObj)
							(setq wingmanObj (sysCreateShip
								theClass
								baseObj
								&svCommonwealthFleet;
								'fleet
								))
							(shpOrder wingmanObj 'escort gPlayerShip i)
It assigns them a formation position. Maybe the Fleet controller requires that and can't remember it through another order? Try creating an event that runs when you want them to rejoin the formation and does something like:

Code: Select all

(for i 0 (- (count shipObjectList) 1)
	(block (
		(theObj (@ shipObjectList i))
		)
		(shpCancelOrders theObj)
		(shpOrder theObj 'escort gPlayerShip i)
		)
	)

relanat
Militia Captain
Militia Captain
Posts: 789
Joined: Tue Nov 05, 2013 9:56 am

Mon Sep 02, 2019 3:38 am

Thanks. I'll give it a go.
I tried 'enum'ing orders back onto the ships but not with the formation. Fingers crossed!
Stupid code. Do what I want, not what I typed in!

relanat
Militia Captain
Militia Captain
Posts: 789
Joined: Tue Nov 05, 2013 9:56 am

Mon Sep 23, 2019 4:32 am

Thanks. Using the 'i' value helped. The Fleet wingmen would deploy to the Fleet formation after gating.
It seems these positions must be defined in the controller code (maybe CFleetShipAI.cpp). Setting the controller to 'auton or Nil had position 7 out in front of the playership whereas the Fleet controller postion 7 is to the right and back.

But I can't find a way to break the 'wait order. Or 'hold either.
The ships will hold or wait indefinitely regardless of the time entered into the orders. 'shpCancelOrders' just jumps straight to the 'escort order. I tried a timer event without success but poor code probably contributed. I don't have much experience wth events.
I also tried changing the ship controller to 'auton or Nil, giving the orders, and then resetting it to 'fleet but no success there either.

Another idea for the too hard basket for a couple of years!
Stupid code. Do what I want, not what I typed in!

NMS
Militia Captain
Militia Captain
Posts: 537
Joined: Tue Mar 05, 2013 8:26 am

Mon Sep 23, 2019 6:55 am

Maybe old controllers don't have an order queue at all? So you'd have to use an event that runs when you want them to return to formation. E.g.

Code: Select all

(block Nil
	(enum theObjList theObject
		(shpOrder theObject ...)
		)
	(sysAddTypeTimerEvent delay myType myEvent)
	(typSetData myType 'objList theObjList)
	)

...

<MyType>
	<Events>	
		<MyEvent>
			(block ((i 0))
				(enum (typGetData myType 'objList) theObject
					(block Nil
						(shpOrder theObject 'escort gPlayerShip i)
						(setq i (+ i 1))
						)
					)
				)
		</MyEvent>
	</Events>
</MyType>

Post Reply