Removing units after battle

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

Removing units after battle

m3tan
I'm trying to devise a way to remove a "supply" unit after each battle. The idea is that the supply unit provides combat bonuses when brought into battle but is consumed afterwards. The only way I've figured out how to accomplish this is with the following condition and trigger attachments for EACH player and EACH territory;

                                <attatchment name="conditionAttachment_Battle_Warsaw" attatchTo="Germans" javaClass="games.strategy.triplea.attatchments.RulesAttachment" type="player">
                <option name="battle" value="any:any:any:currentRound:Warsaw"/>
                                </attatchment>
                                 <attatchment name="triggerAttachmentKillSupply" attatchTo="Germans" javaClass="games.strategy.triplea.attatchments.TriggerAttachment" type="player">
                <option name="trigger" value="conditionAttachment_Battle_Warsaw"/>
                                        <option name="removeUnits" value="Warsaw:supply" count="1"/>
                                        <option name="when" value="after:germansBattle"/>                                       
                                </attatchment>

This works but is very crude and would require hundreds of these attachments to handle every combination of player and territory. Is there an easier way to accomplish this?
Reply | Threaded
Open this post in threaded view
|

Re: Removing units after battle

wc_sumpton
Maybe making the "supply" unit suicidal with 0 attack and 0 defense.  That way it should be consumed during the battle.
Reply | Threaded
Open this post in threaded view
|

Re: Removing units after battle

m3tan
Suicide units die before battle so therefore wouldn't be able to give bonuses.
Reply | Threaded
Open this post in threaded view
|

Re: Removing units after battle

m3tan
I solved this by making the "supply" unit a 1 movement kamikaze air unit that is not allowed in sea zones. Subtle distinction between suicide and kamikaze...
Reply | Threaded
Open this post in threaded view
|

Re: Removing units after battle

The Red Baron
@m3tan: There is an easier way to accomplish what you are looking for. Frostion's Age of Tribes map has a system for removing unused rockets before the non-combat move of each turn. This trigger looks like it would take place exactly when you need it, so all you would have to do is change the names, and make a trigger for each player. That way, you would not be limited in what unit attachments you would need.

Age of Tribes XML: Lines 4645 - 4663 wrote
        <attatchment name="conditionAttachmentRemove-Rockets" attatchTo="AI-Barbarians" javaClass="games.strategy.triplea.attatchments.RulesAttachment" type="player">
            <option name="turns" value="1-+"/>
        </attatchment>
        <attatchment name="triggerAttachment_Unused_Brittonic_rockets_are_stowed" attatchTo="Brittonic" javaClass="games.strategy.triplea.attatchments.TriggerAttachment" type="player">
            <option name="conditions" value="conditionAttachmentRemove-Rockets"/>
            <option name="when" value="after:BrittonicBattle"/>
            <option name="removeUnits" value="all:Rocket" count="9999"/>
        </attatchment>
"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: Removing units after battle

panguitch
In reply to this post by m3tan
m3tan wrote
I solved this by making the "supply" unit a 1 movement kamikaze air unit that is not allowed in sea zones. Subtle distinction between suicide and kamikaze...
Clever. I might have to use this somehow.

Greyhawk Wars
TripleA in the original Dungeons & Dragons world

Reply | Threaded
Open this post in threaded view
|

Re: Removing units after battle

m3tan
panguitch wrote
Clever. I might have to use this somehow.
Unfortunately it's listed as an air unit in production and you get the annoying reminder before every battle that it is going to die...
Reply | Threaded
Open this post in threaded view
|

Re: Removing units after battle

m3tan
In reply to this post by The Red Baron
Age of Tribes XML: Lines 4645 - 4663 wrote
        <attatchment name="conditionAttachmentRemove-Rockets" attatchTo="AI-Barbarians" javaClass="games.strategy.triplea.attatchments.RulesAttachment" type="player">
            <option name="turns" value="1-+"/>
        </attatchment>
        <attatchment name="triggerAttachment_Unused_Brittonic_rockets_are_stowed" attatchTo="Brittonic" javaClass="games.strategy.triplea.attatchments.TriggerAttachment" type="player">
            <option name="conditions" value="conditionAttachmentRemove-Rockets"/>
            <option name="when" value="after:BrittonicBattle"/>
            <option name="removeUnits" value="all:Rocket" count="9999"/>
        </attatchment>
This removes all units. I only want to remove the units that attacked.
Reply | Threaded
Open this post in threaded view
|

Re: Removing units after battle

The Red Baron
m3tan wrote
This removes all units. I only want to remove the units that attacked.
That's an interesting problem. I know the engine keeps track of "wasInCombat" for each unit, but they did not make that available to the map-makers for triggers. This may be a feature request, if you would like to make one:

https://github.com/triplea-game/triplea/issues/new

With your method, theoretically, though you should be able to use land and air transports to carry the supplies around if you wished to have them be movable further than 1 space. This is done in TWW, I believe with trucks carrying rockets. Really, you could even have material move 0, and just be transportable, like material in TWW, depending on which way you wanted to take it.
"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: Removing units after battle

crazy_german
In reply to this post by m3tan
I don't see a reason to make it an air unit. If it using it just for ground combat, just make it a land unit. Red Baron's thoughts on transports could also be really interesting.
Correctly crazy, disingenuously German
Reply | Threaded
Open this post in threaded view
|

Re: Removing units after battle

m3tan
It would be great if "WasInCombat" was an attribute we could manipulate. I would love to be able to reset it for armor units so that they can have a special exploitation move after battle. That would be real blitzing - not this silliness they call blitzing in A&A...

It's an interesting thought to make it a transportable zero move unit. That might be useful for another game, but I'm trying to avoid loading/unloading trucks and trains and would rather keep it simple and have the focus remain on actual combat units.

@Crazy German. I tried making it a land unit and the engine crashes reporting that isKamikaze is an illegal attribute for land units...
Reply | Threaded
Open this post in threaded view
|

Re: Removing units after battle

crazy_german
Remove the Kamikaze property if its a land unit. I guess you want it as an air unit so it crashes and is destroyed after the battle, without the use of triggers. This is actually quite clever.

If you use the right software, it shouldn't be too hard to autofill that condition and trigger for every nation and territory, this would let you not deal with that "air unit will die" pop up. I wouldn't expect the developers to prioritize that new feature, since what you want is already possible.

If you want, you can give certain units an extra move phase without any new features needed. Just add another movement phase, reset the unit state for that move phase, and use triggers to set the movement of any units that can't do the new blitz to 0, set it back to whatever it should be after that move phase (be aware this will really mess up the AI though)
Correctly crazy, disingenuously German
Reply | Threaded
Open this post in threaded view
|

Re: Removing units after battle

m3tan
crazy_german wrote
If you use the right software, it shouldn't be too hard to autofill that condition and trigger for every nation and territory, this would let you not deal with that "air unit will die" pop up. I wouldn't expect the developers to prioritize that new feature, since what you want is already possible.
Actually it can be done from Notepad with careful usage of REPLACE ALL. I'm just worried all that XML will slow down game performance, or is that insignificant compared to the size of the app already...

crazy_german wrote
If you want, you can give certain units an extra move phase without any new features needed. Just add another movement phase, reset the unit state for that move phase, and use triggers to set the movement of any units that can't do the new blitz to 0, set it back to whatever it should be after that move phase (be aware this will really mess up the AI though)
Duh. I'm already doing that for winter. Not sure why that didn't occur to me for an exploitation phase. Thanks...
Reply | Threaded
Open this post in threaded view
|

Re: Removing units after battle

m3tan
In reply to this post by crazy_german
crazy_german wrote
If you use the right software, it shouldn't be too hard to autofill that condition and trigger for every nation and territory, this would let you not deal with that "air unit will die" pop up. I wouldn't expect the developers to prioritize that new feature, since what you want is already possible.
I went ahead and did this last night. I used EXCEL to concatenate a parse phrase and then used REPLACE ALL in notepad to autofill all the conditions and triggers. I works fine and doesn't seem to slow down the map too much.