Change production queues on condition

I've set up my construction yard so that it changes its production queues when certain conditions are met. This doesn't yet work smoothly.

Information and discussion for custom maps and mods.
Post Reply
Yoghurt
Posts: 13
Joined: Wed Apr 07, 2021 11:49 am

Change production queues on condition

Post by Yoghurt »

My conyard is set up so that it can garrison one infantry unit and depending on the type of that unit, it allows you to construct different buildings and defensive structures.

When the engineer is garrisoned inside the coyard, it enables a production queue that grants access to the tiberium refinery, power plants, repair bay and tiberium silo. When a soldier is garrisoned inside a conyard, you gain access to military production buildings and your basic defensive structures. A scientist and the Commando unit allow for the superweapons and advanced defensive structures to be constructed.

It seems that, the production queues are always active in the background since the ProductionQueue: trait doesn't have a RequiresCondition paremeter, and because off that, what I want to achieve (explained above) doesn't work smoothly.
I ran into the following problems:

- Sometimes sub-tabs are grayed out (for lack of a better term, I'm calling the numbered tabs with the icons of the buildings, defensive structures, etc. "sub-tabs")
You cannot click on those sub-tabs when they're grayed out (or greened out, rather) in which case the sub-tab doesn't open. However, the sub-tab opens when you click on the conyard unit directly.

- The sub-tabs are numbered 1, 2 or 3 even though just one production queue is available per construction yard at a time, so depending on the active production queue you might see a single sub-tab labled "2" or "3".

I'd really appreciate some help to make this work a bit better. Thanks in advance!

Yoghurt
Posts: 13
Joined: Wed Apr 07, 2021 11:49 am

Re: Change production queues on condition

Post by Yoghurt »

Below is the code:

^Pilot:
Cargo:
MaxWeight: 1
Types: Infantry
EjectOnDeath: false
LoadedCondition: pilot
PassengerConditions:
e1: pilot.e1
e2: pilot.e2
e3: pilot.e3
e4: pilot.e4
e5: pilot.e5
e6: pilot.e6
rmbo: pilot.rmbo
moebius: pilot.moebius
WithCargoPipsDecoration:
Position: BottomLeft
Margin: 3,2
RequiresSelection: true
CustomPipSequences:
gray: pip-gray
yellow: pip-yellow
red: pip-red
TooltipDescription@PILOT.E1:
Description: • Minigunner
ValidRelationships: Ally
RequiresCondition: pilot.e1
TooltipDescription@PILOT.E2:
Description: • Grenadier
ValidRelationships: Ally
RequiresCondition: pilot.e2
TooltipDescription@PILOT.E3:
Description: • Rocket Soldier
ValidRelationships: Ally
RequiresCondition: pilot.e3
TooltipDescription@PILOT.E4:
Description: • Flamethrower
ValidRelationships: Ally
RequiresCondition: pilot.e4
TooltipDescription@PILOT.E5:
Description: • Chemical Warrior
ValidRelationships: Ally
RequiresCondition: pilot.e5
TooltipDescription@PILOT.E6:
Description: • Engineer
ValidRelationships: Ally
RequiresCondition: pilot.e6
TooltipDescription@PILOT.RMBO:
Description: • Commando
ValidRelationships: Ally
RequiresCondition: pilot.rmbo
TooltipDescription@PILOT.MOEBIUS:
Description: • Scientist
ValidRelationships: Ally
RequiresCondition: pilot.moebius

^Building-Pilot:
Inherits@Pilot: ^Pilot
EngineerRepairable:
RequiresCondition: pilot

FACT:
Inherits@Building-Pilot: ^Building-Pilot
Cargo:
InitialUnits: e6
-Transforms:
-TransformsIntoMobile:
-TransformsIntoPassenger:
-TransformsIntoRepairable:
-TransformsIntoTransforms:
-Production:
Production@Basic:
Produces: Building.Basic, Defence.Basic
RequiresCondition: pilot.e6
Production@Military:
Produces: Building.Military, Defence.Military
RequiresCondition: pilot.e1 || pilot.e2 || pilot.e3 || pilot.e4 || pilot.e5
Production@Advanced:
Produces: Building.Advanced, Defence.Advanced
RequiresCondition: pilot.rmbo || pilot.moebius
-ProductionQueue@GDIBuilding:
-ProductionQueue@NodBuilding:
-ProductionQueue@GDIDefense:
-ProductionQueue@NodDefense:
ProductionQueue@BasicBuilding:
Type: Building.Basic
DisplayOrder: 0
Factions: gdi, nod
Group: Building
Sticky: false
LowPowerModifier: 150
ReadyAudio: ConstructionComplete
BlockedAudio: NoBuild
LimitedAudio: BuildingInProgress
QueuedAudio: Building
OnHoldAudio: OnHold
CancelledAudio: Cancelled
ParallelProductionQueue@MilitaryBuilding:
Type: Building.Military
DisplayOrder: 0
Factions: gdi, nod
Group: Building
Sticky: false
LowPowerModifier: 150
ReadyAudio: ConstructionComplete
BlockedAudio: NoBuild
LimitedAudio: BuildingInProgress
QueuedAudio: Building
OnHoldAudio: OnHold
CancelledAudio: Cancelled
ParallelProductionQueue@AdvancedBuilding:
Type: Building.Advanced
DisplayOrder: 0
Factions: gdi, nod
Group: Building
Sticky: false
LowPowerModifier: 150
ReadyAudio: ConstructionComplete
BlockedAudio: NoBuild
LimitedAudio: BuildingInProgress
QueuedAudio: Building
OnHoldAudio: OnHold
CancelledAudio: Cancelled
ProductionQueue@BasicDefence:
Type: Defence.Basic
DisplayOrder: 1
Factions: gdi, nod
Group: Defence
Sticky: false
LowPowerModifier: 150
ReadyAudio: ConstructionComplete
BlockedAudio: NoBuild
LimitedAudio: BuildingInProgress
QueuedAudio: Building
OnHoldAudio: OnHold
CancelledAudio: Cancelled
ParallelProductionQueue@MilitaryDefence:
Type: Defence.Military
DisplayOrder: 1
Factions: gdi, nod
Group: Defence
Sticky: false
LowPowerModifier: 150
ReadyAudio: ConstructionComplete
BlockedAudio: NoBuild
LimitedAudio: BuildingInProgress
QueuedAudio: Building
OnHoldAudio: OnHold
CancelledAudio: Cancelled
ParallelProductionQueue@AdvancedDefence:
Type: Defence.Advanced
DisplayOrder: 1
Factions: gdi, nod
Group: Defence
Sticky: false
LowPowerModifier: 150
ReadyAudio: ConstructionComplete
BlockedAudio: NoBuild
LimitedAudio: BuildingInProgress
QueuedAudio: Building
OnHoldAudio: OnHold
CancelledAudio: Cancelled
-ProductionBar@BuildingGDI:
-ProductionBar@BuildingNod:
-ProductionBar@DefenceGDI:
-ProductionBar@DefenceNod:
ProductionBar@BasicBuilding:
ProductionType: Building.Basic
RequiresCondition: pilot.e6
ProductionBar@MilitaryBuilding:
ProductionType: Building.Military
RequiresCondition: pilot.e1 || pilot.e2 || pilot.e3 || pilot.e4 || pilot.e5
ProductionBar@AdvancedBuilding:
ProductionType: Building.Advanced
RequiresCondition: pilot.rmbo || pilot.moebius
ProductionBar@BasicDefence:
ProductionType: Defence.Basic
Color: 8A8A8A
RequiresCondition: pilot.e6
ProductionBar@MilitaryDefence:
ProductionType: Defence.Military
Color: 8A8A8A
RequiresCondition: pilot.e1 || pilot.e2 || pilot.e3 || pilot.e4 || pilot.e5
ProductionBar@AdvancedDefence:
ProductionType: Defence.Advanced
Color: 8A8A8A
RequiresCondition: pilot.rmbo || pilot.moebius
WithColoredOverlay@IDISABLE:
Palette: disabled
RequiresCondition: !pilot

abcdefg30
Posts: 481
Joined: Mon Aug 18, 2014 6:00 pm

Re: Change production queues on condition

Post by abcdefg30 »

Sadly I don't think there is much you can do, that sounds more like a bug in the engine. The tab shouldn't be opened when you select the building and there are no items to build. As for the numbering, I think that works as intended. Those problems might go away when `ProductionQueue` is made conditional, as you have already noticed. Nobody is currently working on this however. :(

Yoghurt
Posts: 13
Joined: Wed Apr 07, 2021 11:49 am

Re: Change production queues on condition

Post by Yoghurt »

Thanks for the reply, appreciate it

Post Reply