Wiki

effect · create_field_marshal

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

create field marshal for country

实战 · 配合 · 坑

实战内容由 AI 生成,并已对照 vanilla 命令词表校验 —— 请当作起点而非权威依据。上方的定义节才是游戏自带文档原文。

实战用法

create_field_marshal 常用于 mod 中为特定国家动态生成历史名将,或在某事件触发后赋予该国一位新的元帅角色。例如在国家事件中,当完成某条国策或达成特定条件后,为玩家国家生成一位带有初始特质的元帅:

country_event = {
    id = my_mod.1
    immediate = {
        create_field_marshal = {
            name = "Wolfgang Müller"
            portrait_path = "gfx/leaders/GER/my_general.dds"
            traits = { brilliant_strategist organizer }
            skill = 3
            attack_skill = 3
            defense_skill = 2
            planning_skill = 3
            logistics_skill = 2
        }
    }
}

配合关系

  • [add_field_marshal_role](/wiki/effect/add_field_marshal_role):若已有通过 generate_character 创建的角色,可用此命令追加元帅职位,与 create_field_marshal 形成"先建角色再赋职"的互补方案。
  • [add_trait](/wiki/effect/add_trait):在元帅创建后,通过此命令为其动态添加额外特质,实现更灵活的特质组合逻辑。
  • [has_country_leader](/wiki/trigger/has_country_leader):在触发前用于检测国家当前领导人状态,确保生成元帅的时机与国家政治情况匹配,避免重复触发。
  • [add_command_power](/wiki/effect/add_command_power):元帅创建后通常配合补充指挥点,确保玩家能立即使用新元帅的相关能力。

常见坑

  1. 遗漏必填字段导致游戏崩溃create_field_marshal 要求 name 或对应的角色数据必须完整,若 portrait_path 指向不存在的文件路径,游戏不会报错但会显示为空头像,新手常忘记将图片实际放入对应目录。
  2. add_field_marshal_role 混用职责不清create_field_marshal 是直接创建全新角色并赋予元帅职位,而 add_field_marshal_role 是为已存在角色追加职位。混淆两者会导致重复创建角色或脚本无效果。

Hands-On Notes

Hands-on notes are AI-generated and checked against the vanilla command vocabulary — treat them as a starting point, not authoritative reference. The definition above is the game's own documentation.

Hands-On Usage

create_field_marshal is commonly used in mods to dynamically generate historical generals for specific nations, or to assign a new field marshal role to a country after certain events are triggered. For example, in a country event, when a particular national focus is completed or specific conditions are met, you can generate a field marshal with initial traits for the player's nation:

country_event = {
    id = my_mod.1
    immediate = {
        create_field_marshal = {
            name = "Wolfgang Müller"
            portrait_path = "gfx/leaders/GER/my_general.dds"
            traits = { brilliant_strategist organizer }
            skill = 3
            attack_skill = 3
            defense_skill = 2
            planning_skill = 3
            logistics_skill = 2
        }
    }
}

Synergy

  • [add_field_marshal_role](/wiki/effect/add_field_marshal_role): If you already have a character created via generate_character, you can use this command to add a field marshal role, forming a complementary approach with create_field_marshal that follows the "create character first, then assign role" pattern.
  • [add_trait](/wiki/effect/add_trait): After creating the field marshal, use this command to dynamically add additional traits, enabling more flexible trait composition logic.
  • [has_country_leader](/wiki/trigger/has_country_leader): Before triggering, use this to check the current leader status of a nation, ensuring the timing of field marshal generation aligns with the country's political situation and avoiding duplicate triggers.
  • [add_command_power](/wiki/effect/add_command_power): After field marshal creation, typically pair this with supplementing command power to ensure the player can immediately utilize the new field marshal's abilities.

Common Pitfalls

  1. Missing required fields causing game crashes: create_field_marshal requires name or corresponding character data to be complete. If portrait_path points to a non-existent file path, the game won't error but will display an empty portrait—beginners often forget to actually place the image file in the corresponding directory.
  2. Confusion between create_field_marshal and add_field_marshal_role: create_field_marshal directly creates a brand new character and assigns them a field marshal role, while add_field_marshal_role adds a field marshal role to an existing character. Mixing these two up can result in duplicate character creation or scripts having no effect.