One Time PU Capture For Certain Events



  • In my map/mod, I would like to have the attacker capture a set number of PUs from the defender when certain events occur, namely:

    • When a factory is captured
    • When a victory city is captured

    I’d also like this to only happen once per factory/victory city if possible.

    I’m looking for suggestions about how to accomplish this. Let me know if you have any suggestions or if you’ve seen something similar.



  • Here is something similar from the Pact of Steel mod

        <attachment name="objectiveAttachmentRussians3_HardAdvance" attachTo="Russians" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
          <option name="objectiveValue" value="2"/>
          <option name="directOwnershipTerritories" value="Norway:East Balkans" count="1"/>
          <option name="uses" value="1"/>
        </attachment>
    
    

    In this case, the Russians receive a bonus of 2 once if they take Norway or East Balkans. Note that objectives can have negative values.

    If you want to make this a general feature, look at the discussion of variables in the Pact of Steel mod.



  • @RogerCooper

    Here are a few things I’m still not clear on:

    1. I could set these up individually or try to use the variables, however even with only 1 “use” that would be one use per nation right? Since I would need to set up one National Objective for each nation.
    2. For the nation losing the PUs, I’m not sure using a National Objective would work because it wouldn’t be their turn when the event occurs, and I believe National Objectives are awarded only on the current nation’s end turn.
    3. I think in principal this could work for cities, since their location is known at the beginning of the game, however don’t think it would work for factories since they can be purchased in new locations during the game. (Although it could at least be set up for locations that start the game with a factory)


  • @Contango said in One Time PU Capture For Certain Events:

    @RogerCooper

    Here are a few things I’m still not clear on:

    1. I could set these up individually or try to use the variables, however even with only 1 “use” that would be one use per nation right? Since I would need to set up one National Objective for each nation.
      The 1 use is per objective. You could have multiple objectivs
    1. For the nation losing the PUs, I’m not sure using a National Objective would work because it wouldn’t be their turn when the event occurs, and I believe National Objectives are awarded only on the current nation’s end turn.
      That would be a separate objective to lose PUs. You should be able to set the time when the objective/conditon fires.
    1. I think in principal this could work for cities, since their location is known at the beginning of the game, however don’t think it would work for factories since they can be purchased in new locations during the game. (Although it could at least be set up for locations that start the game with a factory)
      I don't think that you could have this work for new factories.


  • Could you use us a whencapturedchangesinto? Make it change into a slightly different factory (name only) so that it can only be captured once?



  • Here is an example from the Global game of a factory changing when captured.

        <attachment name="unitAttachment" attachTo="factory_major" javaClass="games.strategy.triplea.attachments.UnitAttachment" type="unitType">
          <option name="isFactory" value="true"/>
          <option name="unitPlacementRestrictions" value="Ceylon:Sumatra:Java:Borneo:Hainan:Philippines:Celebes:Dutch New Guinea:Paulau Island:New Guinea:New Britain:Solomon Islands:New Hebrides:New Zealand:Fiji:Samoa:Line Islands:Johnston Island:Hawaiian Islands:Midway:Iwo Jima:Aleutian Islands:Gilbert Islands:Marshall Islands:Caroline Islands:Wake Island:Marianas:Guam:Formosa:Okinawa:West Indies:Greenland:Iceland:Sardinia:Sicily:French Madagascar:Crete:Cyprus"/>
          <option name="canOnlyBePlacedInTerritoryValuedAtX" value="3"/>
          <option name="destroyedWhenCapturedBy" value="Chinese"/>
          <option name="isAAforBombingThisUnitOnly" value="true"/>
          <option name="canProduceXUnits" value="10"/>
          <option name="maxDamage" value="20"/>
          <option name="whenCapturedChangesInto" value="any:any:true:factory_minor:1"/>
        </attachment>
    
    

    You might be able to achieve what you want by creating a large number of conditions, one for every area that could have a factory, testing whether it has a factory when control changes, but it will still not work perfectly, if a factory is build in an area captured from the enemy. TripleA does not have a condition that specifically covers capturing or destroying a unit.

    When designing scenarios, you often need to modify what you want to work within the constraints of the TripleA engine. To give a bonus or penalty using the original factory locations is not hard. Covering newly-built factories is either impossible or requires elaborate workarounds.



  • @ff03k64 said in One Time PU Capture For Certain Events:

    Could you use us a whencapturedchangesinto? Make it change into a slightly different factory (name only) so that it can only be captured once?

    What you said actually gave me a different idea…

    Is there any known way to convert units into PUs? (i.e. like salvaging damaged material or something similar)

    If so, I could create a hidden, immovable unit in each city and with each factory that could potentially be triggered into converting to PUs if owned by the opposite side. That would at least take care of it only happening once.



  • @RogerCooper said in One Time PU Capture For Certain Events:

    When designing scenarios, you often need to modify what you want to work within the constraints of the TripleA engine. To give a bonus or penalty using the original factory locations is not hard. Covering newly-built factories is either impossible or requires elaborate workarounds.

    Yeah, I hear you on designing scenarios for the TripleA engine. Unfortunately what I’m working on already exists real-world so I’m trying to backwards cram it in to TripleA in order to make it more available to people.

    I had no idea how things worked when I started, so it was basically just a “let’s give this a try and see how far we get”. But now that I’ve gotten 90% of the way I’m just trying to get as close to the real thing as possible.

    I think I’m going to put the PU capture on the backburner for now to spend time on lower hanging fruit. Unless you have any ideas on converting units to PUs, since I feel like that might be a breakthrough.

    At least with this one it’s something that the user can handle easily with edit mode, although I’d prefer to avoid that if I can.



  • @Contango @Frostion's Warcraft map does it. It is kind of hacked in. I think he changes units into something else when they die, and then those get captured and give resources every turn, but he has them get removed before they do it a second time. Look at his unit loot-level-1 for how he did it.


  • Moderators

    Most of this is (reasonably) achievable. The only real complicated part is the negative PU's to the looser.

    It becomes fairly complex to try and subtract PU's from a player who's not actively playing (their own turn).

    Moreover... it also becomes a question of how drastic this measure is as it relates to the game... it seems to me that loosing a territory which contains a factory is already a significant loss... stripping a nation of more PU while also rewarding your opponent for capturing it seems a fairly steep penalty.



  • @Hepps

    It’s meant as a replacement for the PU transfer when taking capitals. I wanted my map/mod to be without capitals, such that, powers can continue with income and purchasing so long as they retain one major city. So, instead of getting one large transfer of cash for taking a capital, you get several smaller ones as a reward for aggression. It's not quite as steep when balanced against the loss of the capital capture ability and knocking out all of the opposing nation's future income.

    Here’s where I’m at with this now:

    The positive side of the cash transfer is 100% handled with something similar to the loot in the Warcraft map @Frostion made.

    For the negative side I’m creating a trigger for each territory that begins the game with a factory or a city that will give the original holder -PUs one time if they lose it.

    So, the only gap currently is that any newly created factory after the start of the game would not trigger the lost PUs, only the positive ones.



  • @Contango You could make one's capital uncapturable by putting it in an impassable territory and then normal game mechanics will reward a player for capturing TTys and still allowing the opponent to collect PUs and build.

    Actually this may be done different now but you should still be able to do it.

    Ahh...you want part of the entire purse captured, not just the TTy value. Hmm...yea...Idk. You could trigger an arbitrary extra amount if a certain TTy was captured. 5 bucks or something or whatever would average out to most likely. Have it trigger a PU loss to the owner as well.

    Idk, seems a bit sloppy, but might work.

    Sorry a bit slow tonight 🙂 You just need the negative PUs to kick in ? I think I did that somewhere at one time. Ahh I remember now. I made an objective. Actually I think Hepps already explained it. Only works for negative when it's your turn. 🙂

    At any rate, you should be able to come close to what you want.


  • Moderators

    @Contango said in One Time PU Capture For Certain Events:

    @Hepps

    So, the only gap currently is that any newly created factory after the start of the game would not trigger the lost PUs, only the positive ones.

    You could make 2 types of Factory.

    Unconquered Factroy would be all your existing factories at game start as well as any newly built ones by players. This is the unit that would be in the production frontier for every player.

    Conquered Factory would be what the above turns into if captured. It cannot be bought and would be what all Unconquered Factory is turned into if and when they are captured.

    You could then also have the Unconquered Factory produce a unit (at the time it is captured) that has a maintenance cost of 2 PU and is removed automatically at the end of the players next turn.

    You could do the exact same thing with Victory Cities... just have an unmovable "Dummy" unit in each City that when the territory is captured turns into the same unit as the factory.



  • @beelee

    The uncapturable capital thing is a good idea... I actually stumbled upon that previously. I have a trigger that will turn the owner of these fake capitals over to a different owner if all of that nation's cities are captured. (in order to make them no longer collect an income)

    I also made triggers for PU penalty for all territories with a factory, and similarly with cities. The only down side is that those need to be known before the game starts, so it can't handle factories created mid-game.

    So yup, pretty close to what I wanted.



  • @Hepps said in One Time PU Capture For Certain Events:

    @Contango said in One Time PU Capture For Certain Events:

    @Hepps

    So, the only gap currently is that any newly created factory after the start of the game would not trigger the lost PUs, only the positive ones.

    You could make 2 types of Factory.

    Unconquered Factroy would be all your existing factories at game start as well as any newly built ones by players. This is the unit that would be in the production frontier for every player.

    Conquered Factory would be what the above turns into if captured. It cannot be bought and would be what all Unconquered Factory is turned into if and when they are captured.

    You could then also have the Unconquered Factory produce a unit (at the time it is captured) that has a maintenance cost of 2 PU and is removed automatically at the end of the players next turn.

    You could do the exact same thing with Victory Cities... just have an unmovable "Dummy" unit in each City that when the territory is captured turns into the same unit as the factory.

    Yup, this is nearly exactly what I did, with the exception of the bit about the maintenance cost... I used "createsResourcesList" to create the positive cash flow for the attacker. The dummy units are then removed at the end of the turn.


  • Moderators

    @Contango You can tailor that to ensure both your goals are achievable.


Log in to reply