How to Remove Items from the Place Queue

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

How to Remove Items from the Place Queue

The Red Baron
This post was updated on .
Hello All,
A while ago, I was working on a more intuitive and flexible Lend-Lease system, hoping to coincide it with convoy routes to allow for a more immersive economic aspect of the game. The way I have been coding it is that a power that wishes to send a unit to another must wait until a phase right after the end of the turn which works like Daimyo promotion in Feudal Japan. Placed units (for example "infantryLL" ) consume normal units (like "infantry" ). The idea is that the "LL" unit can travel to the destination before turning into, say a Russian infantry. Therefore, I have a trigger to add five or so "infantryLL" to the production queue. However, I was wondering if there is a way to, after the phase is over, empty the production queue while keeping the "Unplaced units live when not placed" property false. Here is what I tried:

XML wrote
<attatchment name="triggerAttachmentAmericansLLFill" attatchTo="Americans" javaClass="games.strategy.triplea.attatchments.TriggerAttachment" type="player">
        <option name="conditions" value="conditionAttachmentAmericansLLAvailable"/>
        <option name="purchase" value="infantryLL" count="5"/>
        <option name="purchase" value="artilleryLL" count="5"/>
        <option name="purchase" value="armourLL" count="5"/>
        <option name="purchase" value="fighterLL" count="5"/>
        <option name="purchase" value="bomberLL" count="5"/>
        <option name="purchase" value="transportLL" count="5"/>
        <option name="purchase" value="cruiserLL" count="5"/>
        <option name="purchase" value="destroyerLL" count="5"/>
        <option name="purchase" value="submarineLL" count="5"/>
        <option name="purchase" value="aaGunLL" count="5"/>
        <option name="players" value="Americans"/>
        <option name="when" value="before:americanLLPlace"/>
</attatchment>

<attatchment name="triggerAttachmentAmericansLLEmpty" attatchTo="Americans" javaClass="games.strategy.triplea.attatchments.TriggerAttachment" type="player">
        <option name="conditions" value="conditionAttachmentAmericansLLAvailable"/>
        <option name="purchase" value="infantryLL" count="-5"/>
        <option name="purchase" value="artilleryLL" count="-5"/>
        <option name="purchase" value="armourLL" count="-5"/>
        <option name="purchase" value="fighterLL" count="-5"/>
        <option name="purchase" value="bomberLL" count="-5"/>
        <option name="purchase" value="transportLL" count="-5"/>
        <option name="purchase" value="cruiserLL" count="-5"/>
        <option name="purchase" value="destroyerLL" count="-5"/>
        <option name="purchase" value="submarineLL" count="-5"/>
        <option name="purchase" value="aaGunLL" count="-5"/>
        <option name="players" value="Americans"/>
        <option name="when" value="after:americanLLPlace"/>
</attatchment>
Obviously, if there is no way to do this, I am back to the drawing board, since I need the unplaced units to live in the regular placement phase for other features. Thanks for any help that is provided.

BTW, I am back to working on the website, and am hoping to close out a few of the outstanding issues in the following weeks, so shout out if you find any other bugs.
"The aggressive spirit, the offensive, is the chief thing everywhere in war, and the air is no exception." - Manfred von Richthofen
Reply | Threaded
Open this post in threaded view
|

Re: How to Remove Items from the Production Queue

Zim Xero
here is a sample trigger requiring a condition, which removes a unit from the production queue and replaces it with another unit:

<attatchment name="triggerAttachmentIndustrialMight3" attatchTo="Japanese" javaClass="games.strategy.triplea.attatchments.TriggerAttachment" type="player">
<option name="conditions" value="conditionAttachmentIndustrialMight"/>
<option name="productionRule" value="jproduction:-buyHarbour"/>
<option name="productionRule" value="jproduction:buyHarbourX"/>
<option name="uses" value="1"/></attatchment>

___________________________________________________
(note that any new unit must have its own pics and be fully created in the xml including the units list, except not listed in the starting production list)
'thats the way it is' makes it neither desireable nor inevitable
Reply | Threaded
Open this post in threaded view
|

Re: How to Remove Items from the Production Queue

The Red Baron
@Zim Xero Thanks for the response. I think that you don't quite understand what I am looking for. I didn't make a productionRule for the Lend-Lease units, because I didn't plan on being able to buy them. They were to be given for free each turn to convert, say, an American "armour" to a American "armourLL" that can be sent to Russia. The trigger was to give 5 armourLL each turn. The Lend-Lease phase is called americanLLPlace, and here is the trigger to give the unit before the phase:

XML wrote
<attatchment name="triggerAttachmentAmericansLLFill" attatchTo="Americans" javaClass="games.strategy.triplea.attatchments.TriggerAttachment" type="player">
        <option name="conditions" value="conditionAttachmentAmericansLLAvailable"/>
        <option name="purchase" value="infantryLL" count="5"/>
        <option name="purchase" value="artilleryLL" count="5"/>
        <option name="purchase" value="armourLL" count="5"/>
        <option name="purchase" value="fighterLL" count="5"/>
        <option name="purchase" value="bomberLL" count="5"/>
        <option name="purchase" value="transportLL" count="5"/>
        <option name="purchase" value="cruiserLL" count="5"/>
        <option name="purchase" value="destroyerLL" count="5"/>
        <option name="purchase" value="submarineLL" count="5"/>
        <option name="purchase" value="aaGunLL" count="5"/>
        <option name="players" value="Americans"/>
        <option name="when" value="before:americanLLPlace"/>
</attatchment>
Your trigger would work perfectly if I was allowing the purchase of LL units. However, I am not. I wanted to automatically give them to use to consume current units and then allow for the "capture" of them by the Russians. Therefore, I probably misspoke. I wanted to remove them from the place queue, not the production queue. Because, with my current setup, if the Americans did not Lend-Lease five of every unit every turn, the unplaced units would begin to pile up. Therefore, my question was if there was a way to remove specific units from the place queue, a reverse of the "purchase" action. The "removeUnits" action seems to only work for units that have already been placed. This may be a long shot, but I would like to at least try to code it this way, before I try a different way.
"The aggressive spirit, the offensive, is the chief thing everywhere in war, and the air is no exception." - Manfred von Richthofen
Reply | Threaded
Open this post in threaded view
|

Re: How to Remove Items from the Place Queue

The Red Baron
In reply to this post by The Red Baron
I'm going to ask again, to see if anyone, or maybe the devs know the answer to this question. Basically, I am looking for a reverse of the "purchase" trigger option, basically an "un-purchase." I have tried purchasing negative units in the XML (as documented above) to no avail. There doesn't seem to be this option in POS 2. Can "removeUnits" remove units that have not been placed yet? Or, do I need to do something else? Or is there no solution besides removing all unplaced units. No problem if there is, I can work this another way, but I would like to figure out if this is possible. Thanks for any help provided.
"The aggressive spirit, the offensive, is the chief thing everywhere in war, and the air is no exception." - Manfred von Richthofen
Reply | Threaded
Open this post in threaded view
|

Re: How to Remove Items from the Place Queue

aaalafayette
Administrator
Sounds like it might require a new feature/code to support
Reply | Threaded
Open this post in threaded view
|

Re: How to Remove Items from the Place Queue

crazy_german
In reply to this post by The Red Baron
I believe it is currently impossible to manipulate unplaced units in any way (other than just placing them). This includes triggers, and conditions cannot detect them.

The one thing you could try would be setting the following property
                <property name="Unplaced units live when not placed" value ="true" editable="false">
                        <boolean/>
                </property>
to false, so all unplaced units are removed each turn
Correctly crazy, disingenuously German