欧陆风云4吧 关注:333,470贴子:10,278,743
  • 6回复贴,共1

对于自动化殖民,传教,建筑脚本的一点研究

取消只看楼主收藏回复

EU4后期或许会对部分人群来说存在着某种高频的重复操作,如建造和传教。如果把殖民者修改过多,也会存在手操殖民比较烦的问题。当然,对我来说正专心致志打架呢就告诉我殖民完成,需要把鼠标挪到合适的省份点几下是有些恼火的。自动造建筑同决议一键造建筑最大的不同就是,决议内想计算出最终总的花费有些麻烦(我不会),决议一键造建筑前需要保存,否则也许点完会贷款。攒够很多钱再一键造是很方便,但是攒钱过程中的钱不能自动生钱很浪费。所以自动造建筑就有了一定的意义,能造一个就造一个。自动传教就不用说了,就3-7个传教士,操作重复性太大。当然,如果把传教士改成数十个,那么自动传教同决议一键传教相比没什么优势。思考自动化操作也有一定时日了,今天总算在某位大佬的点拨下有点结果。若有考虑不周或者明显破坏游戏原本的地方欢迎指出。


IP属地:比利时来自Android客户端1楼2021-02-02 02:27回复
    自动化操作的开关是决议的形式,毕竟也不能强制自动化。开关可以开启后关闭,关闭后再开启
    country_decisions = {
    Auto_manufactories = {
    potential = {
    ai = no
    NOT = { has_country_flag = AutoManufactories }
    }
    allow = {
    always = yes
    }
    effect = {
    set_country_flag = AutoManufactories
    }
    ai_will_do = {factor = 0}
    }
    Stop_manufactories = {
    potential = {
    ai = no
    has_country_flag = AutoManufactories
    }
    allow = {
    always = yes
    }
    effect = {
    clr_country_flag = AutoManufactories
    }
    ai_will_do = {factor = 0}
    }
    Auto_Mission = {
    potential = {
    ai = no
    NOT = { has_country_flag = AutoMission }
    }
    allow = {
    always = yes
    }
    effect = {
    set_country_flag = AutoMission
    }
    ai_will_do = {factor = 0}
    }
    Stop_Mission = {
    potential = {
    ai = no
    has_country_flag = AutoMission
    }
    allow = {
    always = yes
    }
    effect = {
    clr_country_flag = AutoMission
    }
    ai_will_do = {factor = 0}
    }
    Auto_Colony = {
    potential = {
    ai = no
    NOT = { has_country_flag = AutoColony }
    }
    allow = {
    always = yes
    }
    effect = {
    set_country_flag = AutoColony
    }
    ai_will_do = {factor = 0}
    }
    Stop_Colony = {
    potential = {
    ai = no
    has_country_flag = AutoColony
    }
    allow = {
    always = yes
    }
    effect = {
    clr_country_flag = AutoColony
    }
    ai_will_do = {factor = 0}
    }
    }


    IP属地:比利时来自Android客户端2楼2021-02-02 02:31
    回复
      最后是不完善的自动殖民,开启后会在 正在被殖民城市少于殖民者数量 的时候发送50个人口去一个空白的,且殖民距离之内的城市殖民。不过暂时没有任何办法送殖民者过去,这个城市只能用基础的年殖民者增长来殖民。当然,这时候玩家也能继续派殖民者去这个城市,同手操一样。如果有大佬知道怎么能发送殖民者去或者取巧的办法,欢迎告知啊。当然,如果一个国家殖民者数量多余15,这个脚本无法执行,我暂时还不知道怎么直接用殖民者数量和殖民地数量进行比较。这一上限可以随意修改。
      namespace = AutoColony
      country_event = {
      id = AutoColony.1
      title = AutoColony.1.t
      desc = AutoColony.1.d
      picture = none
      trigger = {
      ai = no
      has_country_flag = AutoColony
      OR = {
      AND = {
      num_of_colonists = 1
      NOT = {num_of_colonies = 1}
      }
      AND = {
      num_of_colonists = 2
      NOT = {num_of_colonies = 2}
      }
      AND = {
      num_of_colonists = 3
      NOT = {num_of_colonies = 3}
      }
      AND = {
      num_of_colonists = 4
      NOT = {num_of_colonies = 4}
      }
      AND = {
      num_of_colonists = 5
      NOT = {num_of_colonies = 5}
      }
      AND = {
      num_of_colonists = 6
      NOT = {num_of_colonies = 6}
      }
      AND = {
      num_of_colonists = 7
      NOT = {num_of_colonies = 7}
      }
      AND = {
      num_of_colonists = 8
      NOT = {num_of_colonies = 8}
      }
      AND = {
      num_of_colonists = 9
      NOT = {num_of_colonies = 9}
      }
      AND = {
      num_of_colonists = 10
      NOT = {num_of_colonies = 10}
      }
      AND = {
      num_of_colonists = 11
      NOT = {num_of_colonies = 11}
      }
      AND = {
      num_of_colonists = 12
      NOT = {num_of_colonies = 12}
      }
      AND = {
      num_of_colonists = 13
      NOT = {num_of_colonies = 13}
      }
      AND = {
      num_of_colonists = 14
      NOT = {num_of_colonies = 14}
      }
      AND = {
      num_of_colonists = 15
      NOT = {num_of_colonies = 15}
      }
      }
      any_province = {
      has_discovered = ROOT
      is_empty = yes
      range = ROOT
      NOT = { colonysize = 50 }
      }
      }
      mean_time_to_happen = {
      days = 1
      }
      immediate = {
      hidden_effect = {
      random_owned_province = {
      random_province = {
      limit = {
      has_discovered = ROOT
      is_empty = yes
      range = ROOT
      NOT = { colonysize = 50 }
      }
      save_event_target_as = random_colony_province
      create_colony = 50
      }
      }
      }
      }
      option = {
      name = AutoColony.1.a
      goto = random_colony_province
      }
      }


      IP属地:比利时6楼2021-02-02 02:49
      收起回复
        开始殖民会告诉玩家,可以直接关掉也可以点击右下的爪子跳到目标城市看看


        IP属地:比利时来自Android客户端7楼2021-02-02 02:52
        回复
          接下来是自动造建筑。我选择了工厂,这个涉及的科技和产物限制多一些。当然,我自己玩的时候是市政建筑排第一位,因此我设置为有两个建筑空位或者市政+一个建筑空位才会造工厂。一个工厂500基础花费。我设置为只要有600块就会随机一个可以造农场的城市造一个农场。1200块会额外随机一个城市造另一种工厂,接下来是每600块就能随机一个城市造另一种工厂。花费和时间同手动一样。显然,这个脚本只在目标城市超过50时候才有意义。
          namespace = AutoBuilding
          country_event = {
          id = AutoBuilding.1
          title = none
          desc = none
          picture = none
          hidden = yes
          trigger = {
          ai = no
          has_country_flag = AutoManufactories
          NOT = {num_of_loans = 1}
          OR = {
          AND = {
          adm_tech = 6
          treasury = 600
          any_owned_province = {
          OR = {
          trade_goods = grain
          trade_goods = livestock
          trade_goods = wine
          }
          NOT = {has_building = farm_estate }
          NOT = { has_construction = building }
          is_city = yes
          OR = {
          AND = {
          OR = {
          has_building = courthouse
          has_building = town_hall
          }
          num_free_building_slots = 1
          }
          num_free_building_slots = 2
          }
          }
          }
          AND = {
          adm_tech = 11
          treasury = 1200
          any_owned_province = {
          OR = {
          trade_goods = wool
          trade_goods = cloth
          trade_goods = silk
          trade_goods = dyes
          }
          NOT = {has_building = textile }
          NOT = { has_construction = building }
          is_city = yes
          OR = {
          AND = {
          OR = {
          has_building = courthouse
          has_building = town_hall
          }
          num_free_building_slots = 1
          }
          num_free_building_slots = 2
          }
          }
          }
          AND = {
          dip_tech = 11
          treasury = 1800
          any_owned_province = {
          OR = {
          trade_goods = naval_supplies
          trade_goods = fish
          trade_goods = salt
          }
          NOT = {has_building = wharf }
          NOT = { has_construction = building }
          is_city = yes
          OR = {
          AND = {
          OR = {
          has_building = courthouse
          has_building = town_hall
          }
          num_free_building_slots = 1
          }
          num_free_building_slots = 2
          }
          }
          }
          AND = {
          mil_tech = 11
          treasury = 2400
          any_owned_province = {
          OR = {
          trade_goods = copper
          trade_goods = iron
          }
          NOT = {has_building = weapons }
          NOT = { has_construction = building }
          is_city = yes
          OR = {
          AND = {
          OR = {
          has_building = courthouse
          has_building = town_hall
          }
          num_free_building_slots = 1
          }
          num_free_building_slots = 2
          }
          }
          }
          AND = {
          adm_tech = 14
          treasury = 3000
          any_owned_province = {
          OR = {
          trade_goods = coffee
          trade_goods = cotton
          trade_goods = sugar
          trade_goods = tobacco
          trade_goods = tea
          trade_goods = cocoa
          }
          NOT = {has_building = plantations }
          NOT = { has_construction = building }
          is_city = yes
          OR = {
          AND = {
          OR = {
          has_building = courthouse
          has_building = town_hall
          }
          num_free_building_slots = 1
          }
          num_free_building_slots = 2
          }
          }
          }
          AND = {
          dip_tech = 14
          treasury = 3600
          any_owned_province = {
          OR = {
          trade_goods = ivory
          trade_goods = slaves
          trade_goods = spices
          trade_goods = fur
          trade_goods = incense
          }
          NOT = {has_building = tradecompany }
          NOT = { has_construction = building }
          is_city = yes
          OR = {
          AND = {
          OR = {
          has_building = courthouse
          has_building = town_hall
          }
          num_free_building_slots = 1
          }
          num_free_building_slots = 2
          }
          }
          }
          AND = {
          adm_tech = 16
          treasury = 4200
          any_owned_province = {
          OR = {
          trade_goods = paper
          trade_goods = gems
          trade_goods = tropical_wood
          trade_goods = glass
          trade_goods = chinaware
          }
          NOT = {has_building = mills }
          NOT = { has_construction = building }
          is_city = yes
          OR = {
          AND = {
          OR = {
          has_building = courthouse
          has_building = town_hall
          }
          num_free_building_slots = 1
          }
          num_free_building_slots = 2
          }
          }
          }
          }
          }
          mean_time_to_happen = {
          days = 1
          }
          immediate = {
          hidden_effect = {
          if = {
          limit = {
          adm_tech = 6
          treasury = 600
          }
          random_owned_province = {
          limit = {
          OR = {
          trade_goods = grain
          trade_goods = livestock
          trade_goods = wine
          }
          NOT = {has_building = farm_estate }
          NOT = { has_construction = building }
          is_city = yes
          OR = {
          AND = {
          OR = {
          has_building = courthouse
          has_building = town_hall
          }
          num_free_building_slots = 1
          }
          num_free_building_slots = 2
          }
          }
          add_building_construction = {
          building = farm_estate
          speed = 1
          cost = 1
          }
          }
          }
          if = {
          limit = {
          adm_tech = 11
          treasury = 1200
          }
          random_owned_province = {
          limit = {
          OR = {
          trade_goods = wool
          trade_goods = cloth
          trade_goods = silk
          trade_goods = dyes
          }
          NOT = { has_construction = building }
          is_city = yes
          OR = {
          AND = {
          OR = {
          has_building = courthouse
          has_building = town_hall
          }
          num_free_building_slots = 1
          }
          num_free_building_slots = 2
          }
          NOT = {has_building = textile }
          }
          add_building_construction = {
          building = textile
          speed = 1
          cost = 1
          }
          }
          }
          if = {
          limit = {
          dip_tech = 11
          treasury = 1800
          }
          random_owned_province = {
          limit = {
          OR = {
          trade_goods = naval_supplies
          trade_goods = fish
          trade_goods = salt
          }
          NOT = { has_construction = building }
          is_city = yes
          OR = {
          AND = {
          OR = {
          has_building = courthouse
          has_building = town_hall
          }
          num_free_building_slots = 1
          }
          num_free_building_slots = 2
          }
          NOT = {has_building = wharf }
          }
          add_building_construction = {
          building = wharf
          speed = 1
          cost = 1
          }
          }
          }
          if = {
          limit = {
          mil_tech = 11
          treasury = 2400
          }
          random_owned_province = {
          limit = {
          OR = {
          trade_goods = copper
          trade_goods = iron
          }
          NOT = { has_construction = building }
          is_city = yes
          OR = {
          AND = {
          OR = {
          has_building = courthouse
          has_building = town_hall
          }
          num_free_building_slots = 1
          }
          num_free_building_slots = 2
          }
          NOT = {has_building = weapons }
          }
          add_building_construction = {
          building = weapons
          speed = 1
          cost = 1
          }
          }
          }
          if = {
          limit = {
          adm_tech = 14
          treasury = 3000
          }
          random_owned_province = {
          limit = {
          OR = {
          trade_goods = coffee
          trade_goods = cotton
          trade_goods = sugar
          trade_goods = tobacco
          trade_goods = tea
          trade_goods = cocoa
          }
          NOT = { has_construction = building }
          is_city = yes
          OR = {
          AND = {
          OR = {
          has_building = courthouse
          has_building = town_hall
          }
          num_free_building_slots = 1
          }
          num_free_building_slots = 2
          }
          NOT = {has_building = plantations }
          }
          add_building_construction = {
          building = plantations
          speed = 1
          cost = 1
          }
          }
          }
          if = {
          limit = {
          dip_tech = 14
          treasury = 3600
          }
          random_owned_province = {
          limit = {
          OR = {
          trade_goods = ivory
          trade_goods = slaves
          trade_goods = spices
          trade_goods = fur
          trade_goods = incense
          }
          NOT = { has_construction = building }
          is_city = yes
          OR = {
          AND = {
          OR = {
          has_building = courthouse
          has_building = town_hall
          }
          num_free_building_slots = 1
          }
          num_free_building_slots = 2
          }
          NOT = {has_building = tradecompany }
          }
          add_building_construction = {
          building = tradecompany
          speed = 1
          cost = 1
          }
          }
          }
          if = {
          limit = {
          adm_tech = 16
          treasury = 4200
          }
          random_owned_province = {
          limit = {
          OR = {
          trade_goods = paper
          trade_goods = gems
          trade_goods = tropical_wood
          trade_goods = glass
          trade_goods = chinaware
          }
          NOT = { has_construction = building }
          is_city = yes
          OR = {
          AND = {
          OR = {
          has_building = courthouse
          has_building = town_hall
          }
          num_free_building_slots = 1
          }
          num_free_building_slots = 2
          }
          NOT = {has_building = mills }
          }
          add_building_construction = {
          building = mills
          speed = 1
          cost = 1
          }
          }
          }
          }
          }
          option = {
          }
          }


          IP属地:比利时9楼2021-02-02 03:06
          回复


            IP属地:比利时来自Android客户端12楼2021-02-02 03:43
            回复
              经过数千秒紧张地测试,发现自动殖民不会去内陆空白殖民地(即使邻省是你的)殖民。原因是range=root很可能不包含内陆,虽然有点难以置信但还是对自动殖民做出修正和注释。修正后的代码已测试。


              IP属地:比利时来自Android客户端27楼2021-02-03 02:11
              回复