capturing munitions from an enemy

  • I am trying to add a capturable munition/suicide-unit to my game, (specifically, a nuclear bomb) but I haven't found any methods that work. isInfrastructure results in the munition being captured even when used offensively (for instance, a "nuke" munition dropped on enemy territory is instead given to that enemy) and canBeCapturedOnEnteringBy seems to be intended for use in "lend lease" style exchanges of units, and not for hostile takeovers.

    I also tried to use whenHitPointsDamagedChangesInto and gave the munition 2 hit points, so that it could change into a dummy unit after the battle that I could then transform back into a munition via a trigger. However, the unit does not survive the battle anyway, and never has a chance to change into the dummy.

    It might be possible to create a trigger to handle the entire exchange, but I cannot find a way to do it without making a separate condition/trigger for every single province on the map where the munition capture might happen.

    Any ideas on how I could make this work?

  • Admin

    @elreigh I'm assuming you want to be able to attack with nukes but if the enemy conquers the territory the nuke is sitting in then its captured? Did you try using isSuicideOnHit and isInfrastructure with 6 attack and 0 defense. That way the nuke always hits on attack and blows up but doesn't do anything on defense and should then be captured.

    You should also be able to use isSuicide and set the property where suicide units don't actively defend so it should then be captured.

  • @redrum Yes, that's what I'd like to happen, ideally. I already did what you suggested, but I tried it again just now to make sure. The result is that the enemy being attacked by the nuke captures it instead of being attacked. For instance, Americans dropping a nuke on Japan results in zero Japanese casualties, no battle occurs during the combat phase, and at the end of America's turn the bomb stays in Japan and is transferred to Japanese ownership.

    I also have "Defending Suicide and Munition Units Do Not Fire" set to "true" but defenders can still select nukes and other suicide units as casualties. Is that intended behavior? Is there any way to make it so that a munition unit cannot be selected as a defensive casualty? I would prefer it if munitions were either destroyed or captured in a bunch at the end of combat, rather than acting as shields for infantry et al to hide behind.

  • Here is the code I am presently using. This variant of the bomb cannot be captured, and can be selected as a casualty while defending. I would like to make it so that it can be captured, and cannot be a defending casualty.

                    <attachment name="unitAttachment" attachTo="nuke" javaClass="games.strategy.triplea.attachments.UnitAttachment" type="unitType">
                         <option name="movement" value="0"/> <!-- Receives movement from bombers(3) and carriers(2) -->
                         <option name="attack" value="0"/>
                         <option name="defense" value="0"/>
                         <option name="offensiveAttackAA" value="4"/>
                         <option name="maxAAattacks" value="8"/>
                         <option name="isAAforCombatOnly" value="true"/>
                         <option name="typeAA" value="nukeAA"/>
                         <option name="targetsAA" value="infantry:artillery:tank:fighter:bomber:transport:destroyer:submarine:carrier:battleship:rocket:holdout:cargo_plane:heavyTank:zealot:tankHunter:katyusha:conscript:marine"/>
                         <option name="isStrategicBomber" value="true"/>
    		 <option name="bombingBonus" value="10"/>
                         <option name="carrierCost" value="1"/>
                         <option name="isAir" value="true"/>
                         <option name="isKamikaze" value="true"/>
                         <option name="isSuicide" value="true"/>

  • Admin

    @elreigh So probably the only way to make that work is have a trigger that changes nuke to "isInfra=true" after battle phase then turns it back to "isInfra=false" at the start of the player's next turn. As you need it to have HP and not be isInfra in order to attack by itself but then to allow it to be captured you need it to be isInfra.

  • @redrum But then the isInfra change would only occur after the battle, after the nuke is killed on defense. That could work if I had a different nuke unit for every player... which means means ten extra units to the roster. That feels like a very inefficient code, but I'll work with what I've got.

  • Moderators

    @elreigh That does work. It's a bit of work up front, but once its set up you fine.

  • Admin

    @elreigh Yeah. I'd recommend checking out Total World War XML as it already does some similar things for making air transports isInfra true then false.

Log in to reply