1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

[TOT] Klll counter for unit effects?

Discussion in 'Civ2 - Scenario Creation' started by Konig15, Feb 9, 2020.

  1. Konig15

    Konig15 Warlord

    Joined:
    Nov 4, 2007
    Messages:
    152
    I know it's possible to have multiple units span from the same trigger with the count function, but is it possible to have trigger that depends on units killed?

    Like say you want battlefield salvage to be a thing. In this case, pikemen, but you could have foreign tanks in a world war II setting or finding a hero unit among the attacking troops

    Ideally, there would be a counter that every four pikemen units you kill, you get one. Like clockwork.
    Less optimally is 25% percent chance every pikeman killed will trigger an event that will produce a pikeman. I have a Massive problem with save-scumming and the less I have to wrestle with the Random Number God the less I am tempted to savescum.

    And then you could have more events so that for particularly hard units, like killer bots in a Fallout game, you might get a small platter of options, which in theory if you can make them mutually exclusive you can create a de facto goody hut where you can control the outcome percentages.
     
  2. Prof. Garfield

    Prof. Garfield Deity Supporter

    Joined:
    Mar 6, 2004
    Messages:
    2,631
    Location:
    Ontario
    What you want is fairly easy in Lua, but rather difficult in the macro text system, which I believe you are using.

    I was asked to show how to do this event in Lua, so it is an example of a 'counter' in the macro system.

    Here is an example where I wanted to give the Union the Emancipation Proclamation advance only after they were able to kill 5 Confederate CSA Infantry units:
    Code:
    @IF
    TURN
    turn=12
    @THEN
    Flag
    Continuous
    Who=Union
    State=On
    Flag=12 ; Activates Antietam Unit KIA Counter
    JUSTONCE
    TEXT
    LINCOLN REQUIRES MILTIARY SUCCESS ON THE BATTLEFIELD TO AVERT EUROPEAN INTERVENTION!
    ^
    As the Commander-in-chief, you need to demonstrate to the European powers that you are
    fighting for more then the preservation of the Union but for a higher moral cause, i.e. the
    abolition of slavery on the continent through the Emancipation Proclamation.
    ^
    But you cannot emit the Proclamation without gaining a victory on the battlefield and
    thereby demonstrating that your ability to emancipate the slaves is backed by more than
    words...
    ENDTEXT
    @ENDIF
    
    @IF
    TURN
    turn=12
    @THEN
    TEXT
    ... As such you have till the end of September 1862 to defeat 5 CSA Infantry units. Failure to
    do so will prevent you from emitting the Proclamation in a timely manner and bring France and
    England on the side of the Confederacy.
    ENDTEXT
    @ENDIF
    
    @IF
    UNITKILLED
    unit=CSA Infantry
    attacker=Union
    defender=Confederates
    @AND
    CheckFlag
    Who=Union
    Flag=12 ;
    State=On
    @THEN
    Flag
    Continuous
    Who=Union
    State=On
    Flag=13 ;
    JUSTONCE
    TEXT
    1st CSA Infantry killed!
    ENDTEXT
    @ENDIF
    
    @IF
    UNITKILLED
    unit=CSA Infantry
    attacker=Union
    defender=Confederates
    @AND
    CheckFlag
    Who=Union
    Flag=13 ; 1st CSA Infantry Killed
    State=On
    @THEN
    Flag
    Continuous
    Who=Union
    State=On
    Flag=14 ;
    JUSTONCE
    TEXT
    2nd CSA Infantry killed!
    ENDTEXT
    @ENDIF
    
    @IF
    UNITKILLED
    unit=CSA Infantry
    attacker=Union
    defender=Confederates
    @AND
    CheckFlag
    Who=Union
    Flag=14 ; 2nd CSA Infantry Killed
    State=On
    @THEN
    Flag
    Continuous
    Who=Union
    State=On
    Flag=15 ;
    JUSTONCE
    TEXT
    3rd CSA Infantry killed!
    ENDTEXT
    @ENDIF
    
    @IF
    UNITKILLED
    unit=CSA Infantry
    attacker=Union
    defender=Confederates
    @AND
    CheckFlag
    Who=Union
    Flag=15 ; 3rd CSA Infantry Killed
    State=On
    @THEN
    Flag
    Continuous
    Who=Union
    State=On
    Flag=16 ;
    JUSTONCE
    TEXT
    4th CSA Infantry killed!
    ENDTEXT
    @ENDIF
    
    @IF
    UNITKILLED
    unit=CSA Infantry
    attacker=Union
    defender=Confederates
    @AND
    CheckFlag
    Who=Union
    Flag=16 ; 4th CSA Infantry Killed
    State=On
    @THEN
    Flag
    Continuous
    Who=Union
    State=On
    Flag=17 ; Emancipation Proclamation Given
    JUSTONCE
    TEXT
    5th CSA Infantry killed!
    ENDTEXT
    @ENDIF
    
    @IF
    CheckFlag
    Who=Union
    Flag=17 ; Union kills 5th CSA Infantry starting January 1862
    State=On
    @THEN
    GIVETECHNOLOGY
    technology=82
    receiver=Union
    JUSTONCE
    TEXT
    EMANCIPATION PROCLAMATION ISSUED!
    ^
    President Abraham Lincoln issues the Emancipation Proclamation, which declares the
    freedom of all slaves in any state of the Confederate States of America.
    ENDTEXT
    @ENDIF
    
     
    Konig15 likes this.
  3. Konig15

    Konig15 Warlord

    Joined:
    Nov 4, 2007
    Messages:
    152
    I figured the Antetim counter from house divided is the only way to have a counter in macro.

    That said is the a way to have an event trigger 20% of the time you kill a lineman to make one?

    I'm tweaking Blood and Sieges so I have to use macro. Way I figure it I want to reward myself for aggressive play and also if possible make it so the AI gets more dangerous the more it takes out Your units so you can't really break an AI enemy and the whole theory of being a cornered animal comes into play .
     
  4. Prof. Garfield

    Prof. Garfield Deity Supporter

    Joined:
    Mar 6, 2004
    Messages:
    2,631
    Location:
    Ontario
    How about this. You have one square where you expect the 'captured' lineman to appear. Choose 4 other squares that are out of the way, but where units can be created. Possibly an island in the corner of the map. Then, you have a 1 in 5 chance of the unit appearing where it would be useful, and a 4 in 5 chance of it appearing where the only thing to do is disband it. I believe that changing terrain can kill a unit, so you might possibly automate the entire thing by having an action that changes the terrain of the island right after the create unit action (possibly as a second event).

    If you want to discourage save-scumming, maybe delay the creation of the unit until the next turn.
     
    Konig15 likes this.

Share This Page