1. Firaxis celebrates the "Asian American and Pacific Islander Heritage Month", and offers a give-away of a Civ6 anthology copy (5 in total)! For all the details, please check the thread here. .
    Dismiss Notice
  2. We have selected the winners of the Old World random draw and competition. For the winning entries, please check this thread.
    Dismiss Notice
  3. Old World has finally been released on GOG and Steam, besides also being available in the Epic store . Come to our Old World forum and discuss with us!
    Dismiss Notice

Civ2units 1453 scenario with LUA and ToTPP 0.15

Discussion in 'Civ2 - Scenario League' started by civ2units, Nov 2, 2020.

  1. civ2units

    civ2units Emperor

    Joined:
    Feb 1, 2009
    Messages:
    1,031
    Location:
    Somewhere in nowhere
    What could be the reason why only the Ottomans building tons of defence units even if there are more units available? I noticed this during my own playtest.
    upload_2021-5-25_22-16-37.png

    These are the units the Ottomans can build. I've ensured that there are different units available
    upload_2021-5-25_22-17-56.png

    Unfortunately I have a lot of troubles with the units stats. I'm aware about the Musketeer/Knight slot bug but it seems more complicated then I thought.
     
  2. civ2units

    civ2units Emperor

    Joined:
    Feb 1, 2009
    Messages:
    1,031
    Location:
    Somewhere in nowhere
    I would like to ask for some advice with the units stats, especially attack, defence, and so on.
    Currently I'm using in the later game these three Cavalry types: Cuirassiers, Cavalry and Harquebusiers.
    The units stats are as followed:
    Cuirassiers => Movement 3, Attack 8, Defence 6, Hitpoints 2, Firepoints 3, Costs 9
    Cavalry => Movement 3, Attack 9, Defence 7, Hitpoints 3, Firepoints 2, Costs 11
    Harquebusiers => Movement 3, Attack 10, Defence 4, Hitpoints 2, Firepoints 5, Costs 12

    Unfortunatelly the AI can only build the Harquebusiers, even if all available and buildable. I know that the game has some issues with units stats with movements beyond 2+ but I don't know how to solve this.

    Does anyone have an advice or ideas?
     
  3. Prof. Garfield

    Prof. Garfield Deity Supporter

    Joined:
    Mar 6, 2004
    Messages:
    3,818
    Location:
    Ontario
    I have this vague memory of reading that if a unit's movement is >=2, the AI will only build the unit with the strongest attack, or something. I don't know where to find this to confirm, however.

    One of the canBuild settings is

    Code:
    --      .overrideDefaultBuildFunction = boolean or nil
    --          if true, the in game function for determining if the item can be built is ignored
    --          for improvements and wonders, a check will be made if the item has already been built
    --          false, nil, absent means the game's regular conditions must also be met
    
    I'm not sure if this will override the limitations on what the AI can build, but it might be worth a try. (You'll also have to use allTechs and forbiddenTechs to re-create tech requirement and expiration.)

    I don't know what is causing the issue, but you might be able to stop them from building defensive units if there are already a lot nearby.

    Use the conditionFunction

    Code:
    --      .conditionFunction = function(defaultBuildFunction,city,item) --> bool
    --          if function returns true, item can be built if other conditions are met, if false, item can't be built
    --          absent means no extra condition
    
    Create a function that counts the number of "defensive" units nearby. The gen.nearbyUnits function might be useful. Return false if there are "too many" defensive units nearby, and true otherwise.
     
  4. Knighttime

    Knighttime Prince

    Joined:
    Sep 20, 2002
    Messages:
    336
    I'm not sure how the AI determines what role of units to build -- i.e., when does it try to build a "role 0" (attack) unit vs. a "role 1" (defense) unit. In my Medieval Millennium mod, I feel like the the AI often builds too many offensive units (and not enough defensive ones), so please let me know if you uncover any details about this AI behavior. I'm also interested in this topic!

    If you're dealing with units that all have the same role, there's a little more info available. This Scenario League article says, in part: "The computer will not build a ground unit under any circumstances when another ground unit with the same role and movement allowance (1 or 2+) is available with better attack and defense statistics. The computer ignores cost, special abilities, hit points and firepower." So if all 3 of the unit types you listed are "role 0" (attack) then it does seem like the AI is only going to build Harquebusiers since they have the best attack rating (10), and will never build Cavalry or Cuirassiers. I suspect that when trying to build an attack unit, the AI looks at the attack rating and ignores the defense rating, and vice versa. (Besides considering movement points, of course, as the article says.)

    The article goes on to list several examples and provide some suggestions that are at least worth testing, such as setting a land unit to be "role 3" (air superiority). The only thing I can add to that is, I'm not sure if all units with at least 2 MP are treated as a single set, or if units that have 2 MP and those that have 3 MP are considered separately. You could try reducing Harquebusiers to 2 MP and see if that induces the AI to build any Cavalry or Cuirassiers.

    One trick that I used in Medieval Millennium was to create two identical unit type entries, one with role 0 and the other with role 1 (but all other stats the same) in order for the AI to see it as both an offensive and defensive unit. Then I just hid one of them from appearing in the build list for the human player, to avoid confusion. But this does take up an extra unit type slot, which might be problematic -- at the very least it's an idea that has to be used sparingly.
     
    Last edited: May 27, 2021
  5. civ2units

    civ2units Emperor

    Joined:
    Feb 1, 2009
    Messages:
    1,031
    Location:
    Somewhere in nowhere
    Many thanks for your suggestions, @Knighttime and @Prof. Garfield

    The LUA codes sounds interesting and I will try to use it.

    According to the SL article I've made some mistakes putting together the units. I've reranged them so that the Musketeer and Knight slot now only used by the Barbarians. And after some minor tweaks the stats working now.
    I will observe the AI, what kind of units they will build when I'm making further playtests.
     
    Knighttime likes this.
  6. civ2units

    civ2units Emperor

    Joined:
    Feb 1, 2009
    Messages:
    1,031
    Location:
    Somewhere in nowhere
  7. civ2units

    civ2units Emperor

    Joined:
    Feb 1, 2009
    Messages:
    1,031
    Location:
    Somewhere in nowhere
    Another screenshot from the scenario
    upload_2021-9-16_19-36-29.png
    Dutch rebels are fighting the Spanish Habsburgs and conquered Antwerp and Amsterdam
     
  8. civ2units

    civ2units Emperor

    Joined:
    Feb 1, 2009
    Messages:
    1,031
    Location:
    Somewhere in nowhere
    You can also hire mercenaries which will be available within the Holy Roman Empire
    upload_2021-9-16_19-40-5.png
     
    JPetroski likes this.
  9. JPetroski

    JPetroski Deity

    Joined:
    Jan 24, 2011
    Messages:
    4,506
    Really looking forward to this one. The screenshots are gorgeous! That's a very clean way to handle mercs.
     
    civ2units likes this.
  10. Prof. Garfield

    Prof. Garfield Deity Supporter

    Joined:
    Mar 6, 2004
    Messages:
    3,818
    Location:
    Ontario
    I don't think you can change the name of a wiki page, but I created one for you with the appropriate title:

    http://sleague.civfanatics.com/index.php?title=The_Age_of_Reformation
     
    civ2units likes this.
  11. civ2units

    civ2units Emperor

    Joined:
    Feb 1, 2009
    Messages:
    1,031
    Location:
    Somewhere in nowhere
    Many thanks @JPetroski :)
    The scenario is ready and the events working fine. Currently I'm updating some ingame graphics. I will upload the scenario when I'm done with it.

    The scenario is designed 100% with LUA. I've added some events where you have a choice option. In this example you can interfere into the French Religious Wars if you would like to pay 800 Thaler.
    If you support the Calvinists, three cities in southern France will change ownership to the Protestant League and a larger Rebel (Barbarian) army rises within France.
    If you don't support them, only a few Rebels will appear in France.

    upload_2021-9-17_15-14-43.png

    Changing ownership of the cities are a thing I borowed from your Cold War scenario. For me it's a very powerful tool and giving a lot of possibilities. The complete Reformation Progress is based on this technic.
     
    Knighttime and JPetroski like this.
  12. civ2units

    civ2units Emperor

    Joined:
    Feb 1, 2009
    Messages:
    1,031
    Location:
    Somewhere in nowhere
  13. civ2units

    civ2units Emperor

    Joined:
    Feb 1, 2009
    Messages:
    1,031
    Location:
    Somewhere in nowhere
    The choice option is something, I'm trying to use in the AWI scenario too.
     
  14. Konig15

    Konig15 Warlord

    Joined:
    Nov 4, 2007
    Messages:
    229
    I have an idea! Knighttime has an algorithm that makes maps, so what you COULD do is once you have a map of Europe you're happy with, there are a couple I could recommend aside from the one you've created, is maybe see if he is willing to whip up an American map, and use the secondary map function although I don't where you are on the unit counter because even the 125 unit limit is starting to drag on me as I try and assemble a pared-down list. Just for reference, if you've ever played Colonialism I as opposed to IV, it takes place in 1492, and playing that opens up ALL KINDS of emergent stories. I was playing as the French and like they did IRL later, they were mostly interested in trade rather than conquest so I was imagining all these French friars going around studying the Indians learning their trade routes and languages and what they valued and all the stuff the Spanish were gonna burn in a generation, what they couldn't know the disease was gonna start wiping out in 20 years they were recording like crazy they could figure out how best teach the future missionaries to give their version of Paul's speech to the Athenians on the unknown God.

    If you want to consider it, that option for lateral play and emergent storytelling.

    If I might ask, did you create those units or did you find someone to create them or did you endlessly search other scenarios until you found just the right ones? I've been doing the latter off and on for the last few weeks and would like to know what my options might be.

    But yeah, looks promising.
     
  15. techumseh

    techumseh Deity SLeague Staff

    Joined:
    Mar 12, 2002
    Messages:
    2,121
    Location:
    BC wine country
    Yeah, it does. Tell you what, why don't you make your own scenario? Once you're finished, we can all pitch our far out ideas about what you could have done differently.
     
    civ2units likes this.
  16. Fairline

    Fairline Emperor

    Joined:
    Mar 21, 2002
    Messages:
    1,411
    Gender:
    Male
    Location:
    UK
    What's with the constant CAPS LOCK SHOUTING Konig? It reads like a deranged ransom note or perhaps more appropriately alt-right edgelord ranting.
     
    civ2units likes this.
  17. Konig15

    Konig15 Warlord

    Joined:
    Nov 4, 2007
    Messages:
    229
    Hey, I'm sorry again, I'm trying to be helpful. And I am making my own scenario! I'm compiling graphics right now! I rankle you a alot, and never quite know why, cause in this cause, the OP seems to be looking for feedback and well obviously is the map can't be made long enough, there's a four map function, I wish you were a little more clear as to why you find my last post in something of poor taste. See I'm autistic, and one of the things that got me back to Civ2 modding instead of what I'd been trying for much of last year my understanding of rules is very context-specific. It's why I can't learn scripting as of yet because rules have to be explained to ME, in my context, in order for me to understand what going on. Otherwise, a lot of rules and social norms simply don't make sense, ruleset dyslexia. It works for like this for grammar, scripting logic, math, render window controls, social cues, rhythm in poetry, all the stuff autistics are stereotypically good at (minus social cues), I struggle with terribly, it's why I got diagnosed so late.

    I'd like to not step on your toes so much, but I need more elaboration so I can communicate better/less abrasively?
     
  18. techumseh

    techumseh Deity SLeague Staff

    Joined:
    Mar 12, 2002
    Messages:
    2,121
    Location:
    BC wine country
    OK. When someone spends a lot of time making something they hope will be enjoyed by their community (in this case, the scenario league members) you express appreciation. You do not tell them that they should have, or could have, done something significantly different.
     
    civ2units likes this.
  19. civ2units

    civ2units Emperor

    Joined:
    Feb 1, 2009
    Messages:
    1,031
    Location:
    Somewhere in nowhere
    You should wait until I released the scenario and then play it. Maybe you like it in the way I designed it. If not, you will be free to change everything you want for your own use.
     
  20. civ2units

    civ2units Emperor

    Joined:
    Feb 1, 2009
    Messages:
    1,031
    Location:
    Somewhere in nowhere
    The units are all from Fairline. Some are available here on the forum, others are new and made for the scenario.
     

Share This Page