《王权2:幻想王国》mod技术初探

奇幻游戏 2019-03-21

2009-09-25 09:26:13编辑:Viper评论(0)

一、先将游戏目录下\resource\resource.pak内文件全部解压缩到当前目录,并将文件resource.pak更名
以下分号后为注释,请请注意本人并未针对以下每项进行测试,具体效果请自己测试

二、\resource\entity\
数据和定义主要都存放在*.def文件中

以\resource\entity\buildings\castle\castle.def为例


 

;#line 18:         (include "extenders/upgrades.inc")
;#line 18: /entity/buildings/castle/extenders/upgrades.inc BEGIN
{"Upgrades"        ;升级部分
        {available
                {;1升第一级
                        {money 75}
                        {health 1000}                                ;升级增加的生命
                        {building_value 1}
                        {cost                                        ;升级消耗的金币
                        "money" 2000
                        }
                }
                {;2?囡沭彘?
                        {money 150}
                        {health 1500} ;念徉怆弪 蹊蝻铊眚钼       
                        {building_value 1}
                        {cost                                        ;羊铊祛耱?囡疸彘溧
                        "money" 5000
                        }
                }
        }
}


;#line 22:         (include "extenders/guard_point.inc")
;#line 22: /entity/buildings/castle/extenders/guard_point.inc BEGIN
{"guard_point"        ;守卫活动范围
        {ZoneRadius 15.0}
        {GuardRadius 20.0}
}
;#line 22: /entity/buildings/castle/extenders/guard_point.inc END


;#line 23:         (include "extenders/treasures_generator.inc")
;#line 23: /entity/buildings/castle/extenders/treasures_generator.inc BEGIN
{"TreasuresGenerator"
        {PerDay
                "money" 50        ;每日提供的税金
        }
}
;#line 23: /entity/buildings/castle/extenders/treasures_generator.inc END


;#line 26:         (include "extenders/spawner_extender.inc")
;#line 26: /entity/buildings/castle/extenders/spawner_extender.inc BEGIN
{"spawner_extender"        ;自动产生的建筑和单位
        {global_spawn_progs "peasant_house_spawner1 peasant_house_spawner2 peasant_house2_spawner3 peasant_house_spawner4 peasant_house2_spawner5 peasant_mill_spawner6 peasant_mill_spawner7 grave_yard sewers_spawner1 sewers_spawner2 sewers_spawner3 sewers_spawner4 sewers_spawner5 sewers_spawner6 taxer_spawner1 taxer_spawner2 taxer_spawner3 guard_spawner1 guard_spawner2 guard_spawner3 peasant_spawner"}
}


;#line 26: /entity/buildings/castle/extenders/spawner_extender.inc END

        {"FogVisor" {radius 50}}        ;建筑的视野
       

 


三、\resource\gameData
数据部分二

1.  \resource\gameData\inventions\inventions.graphml
定义各个建筑内可升级的项目
以市场上的血瓶为例

Building=market;         ;建筑
Time = 15;         ;升级时间
Building Level=1;</y:AttributeLabel>
            <y:MethodLabel/>
          </y:UML>
        </y:UMLClassNode>
      </data>
      <data key="d1"/>
    </node>
    <node id="n10">                ;估计为项目代码
      <data key="d0">
        <y:UMLClassNode>
          <y:Geometry height="146.0" width="177.0" x="2560.13279564611" y="116.22777022776273"/>
          <y:Fill color="#008000" transparent="false"/>
          <y:BorderStyle color="#000000" type="line" width="1.0"/>
          <y:NodeLabel alignment="center" autoSizePolicy="content" f f f hasBackgroundColor="false" hasLineColor="false" height="19.92626953125" modelName="internal" modelPosition="t" textColor="#000000" visible="true" width="89.0" x="44.0" y="3.0">Health potion</y:NodeLabel>
          <y:UML clipC c omitDetails="false" stereotype="" use3DEffect="true">
            <y:AttributeLabel>Cost money=150;         ;升级花费

 

2.  \resource\gameData\magic\spells.xml
定义国家法术的基本属性
以治疗法术为例

                <spell name="magic_heal" cost_money="250" ;花费的金币 icon="magic_heal" ;图标 player_spell_gfx="heal" ;法术视觉效果>
                        <conditions target="friend" ;目标判断(敌/友)area="0" ;有效区域 culldownTime="1" ;冷却时间/>
                        <s_invention>magic_heal</s_invention>
                        <fliter> ;对象判断
                                <s_elem>unit</s_elem>  ;适用于单个单位
                        </fliter>
                        <Blocks>
                                <HealBlock> ;法术效果(治疗,杀伤等)
                                        <f_strength>300</f_strength>  ;法术效力(治疗效果)
                                </HealBlock>
                        </Blocks>
                </spell>

 

3.  \resource\gameData\spawn\global_spawn_settings.set
定义建筑或单位自动的产生

以老鼠与下水道为例

{"rat"  ;老鼠
        {"spawn type" units}  ;产生的类型
        {raw beast_rat}
        {Nationality Same}
        {level 0}  ;等级
        {"AI task"
                {task none}  ;生成后默认分派的任务
        }
        {postspawn}
        {postspawn_i 1}
        {gold 0}   ;产出需消耗的金币
        {count "1 2"}   ;每次的产量(1-2)
        {"spawn time" 60}  生成的间隔
        {"max count" 2}  ;每次生成的上限
}


{"sewers_spawner2"  ;第2个下水道
        {"spawn type" buildings}
        {Prerequsities_list city_value}
        {Prerequsities
                {city_value
                        {Min_city_summ 3}        ;生成所需的城市规模
                        {Max_city_summ 999}
                }
        }
        {raw sewers_l1}
        {"Rand turn" 50}
        {Nationality Enemy}
        {Remoutness 10}
        {gold 0}
        {count "1 1"}
        {"spawn time" 20}
        {"max count" 1}
}


4.  \resource\gameData\units\ask.xml
定义了各单位行动时触发语音的概率
以猎人为例

                <hunter>
                        <hero>
                                <f_prob>0.5</f_prob>
                                <s_val0>asks/#CLASS_HUNTERSOUND_ASK</s_val0>
                        </hero>
                        <fight>        ;战斗
                                <f_prob>0.5</f_prob>
                                <s_val0>asks/#ATTACK_HUNTERSOUND_ASK</s_val0>
                        </fight>
                        <level_up>         ;升级
                                <f_prob>0.6</f_prob>
                                <s_val0>asks/#NEWLEVEL_HUNTERSOUND_ASK</s_val0>
                                <b_use_skip_counter>false</b_use_skip_counter>
                        </level_up>
                        <pay_duty>         ;付款
                                <f_prob>0.5</f_prob>
                                <s_val0>asks/#PAYDUTY_HUNTERSOUND_ASK</s_val0>
                        </pay_duty>
                        <collect_duty/>     ;收税
                        <help>          ;请求帮助
                                <f_prob>0.5</f_prob>
                                <s_val0>asks/#HELP_HUNTERSOUND_ASK</s_val0>
                        </help>
                        <theft/>         ;偷窃
                        <repair/>        ;修理建筑
                        <buying>                ;购物
                                <f_prob>0.5</f_prob>
                                <s_val0>asks/#GOODSTUFF_HUNTERSOUND_ASK</s_val0>
                        </buying>
                        <purchase>        ;购物
                                <f_prob>0.5</f_prob>
                                <s_val0>asks/#BUY_HUNTERSOUND_ASK</s_val0>
                        </purchase>
                        <go_safety_building_fear>        ;因恐惧逃跑
                                <f_prob>0.5</f_prob>
                                <s_val0>asks/#FEAR_HUNTERSOUND_ASK</s_val0>
                        </go_safety_building_fear>
                        <go_safety_building_lazy>        ;回家
                                <f_prob>0.5</f_prob>
                                <s_val0>asks/#REST_HUNTERSOUND_ASK</s_val0>
                        </go_safety_building_lazy>
                        <assign_leader>                ;担任领队
                                <f_prob>0.8</f_prob>
                                <s_val0>asks/#LEADER_HUNTERSOUND_ASK</s_val0>
                        </assign_leader>
                        <collect_loot>                ;搜刮宝物
                                <f_prob>0.5</f_prob>
                                <s_val0>asks/#GOODSTUFF_HUNTERSOUND_ASK</s_val0>
                        </collect_loot>
                        <search_adventure>        ;主动外出探索
                                <f_prob>0.2</f_prob>
                                <s_val0>asks/#HUNTING_HUNTERSOUND_ASK</s_val0>
                        </search_adventure>
                        <attack_quest>                ;接受攻击任务(旗帜)
                                <f_prob>0.8</f_prob>
                                <s_val0>asks/#ATTACKQUEST_HUNTERSOUND_ASK</s_val0>
                        </attack_quest>
                        <protect_quest>
                                <f_prob>0.6</f_prob>        ;接受防守任务(旗帜)
                                <s_val0>asks/#DEFENCEQUEST_HUNTERSOUND_ASK</s_val0>
                                <f_min_pause>1</f_min_pause>
                                <f_max_pause>3</f_max_pause>
                        </protect_quest>
                        <explore_quest>
                                <f_prob>0.8</f_prob>        ;接受探索任务(旗帜)
                                <s_val0>asks/#EXPLOREQUEST_HUNTERSOUND_ASK</s_val0>
                                <f_min_pause>1</f_min_pause>
                                <f_max_pause>3</f_max_pause>
                        </explore_quest>
                        <undergo_treatment>       ;接受治疗
                                <f_prob>0.5</f_prob>
                                <s_val0>asks/#REST_HUNTERSOUND_ASK</s_val0>
                        </undergo_treatment>
                </hunter>


5.  \resource\gameData\units\perks.xml
定义了单位技能的属性

        <Perk>
                <s_name>state_rogue_poison</s_name>        ;盗贼的涂毒
                <f_liveTime>50</f_liveTime>        ;可能是持续时间
                <f_period>1</f_period>                ;可能用于判断是否为永久性作用
                <Blocks>
                        <s_type>HealthChange</s_type>        ;效用
                        <f_value>-5</f_value>                ;具体数值
                </Blocks>
                <Blocks>
                        <s_type>FX</s_type>
                        <s_headFX>state_poison</s_headFX>                ;视觉效果
                </Blocks>
        </Perk>


6.  \resource\gameData\units\rpg_params.xml
定义了英雄的基本属性

以战士为例
                <Params>
                        <s_type>hero_warrior</s_type>
                        <f_strength>14</f_strength>                ;力量
                        <f_agility>6</f_agility>                ;敏捷
                        <f_intellect>5</f_intellect>                ;智力
                        <f_stamina>15</f_stamina>                ;耐力
                        <f_maxHealth>12</f_maxHealth>        ;生命
                        <f_dps_hth>5</f_dps_hth>                ;基本攻击力(每秒)
                        <f_defence_hth>20</f_defence_hth>                ;近战防御
                        <f_defence_range>10</f_defence_range>        ;远程防御
                        <f_defence_magic>0</f_defence_magic>        ;魔法防御
                        <Distance>                                                       ;攻击或技能的有效距离(射程)
                                <f_h2hDa>3</f_h2hDa>
                                <f_h2hDe>4</f_h2hDe>
                                <f_dstDa>12</f_dstDa>
                                <f_dstDe>15</f_dstDe>
                        </Distance>
                        <Angle>
                                <f_h2hDa>10</f_h2hDa>
                                <f_h2hDe>15</f_h2hDe>
                                <f_dstDa>10</f_dstDa>
                                <f_dstDe>15</f_dstDe>
                        </Angle>
                        <AIParams>
                                <SearchAdventureTask>
                                        <f_minDistance>8</f_minDistance>
                                        <f_maxDistance>12</f_maxDistance>
                                </SearchAdventureTask>
                        </AIParams>
                </Params>

 

7.  \resource\gameData\units\unit_actions.xml
定义基本攻击方式和技能施放

如牧师的治疗
        <Action>
                <s_name>cleric_heal</s_name>
                <s_alignment>help</s_alignment>        ;技能用途(攻击辅助等)
                <s_type>heal</s_type>                ;类型(伤害或治疗等)
                <s_used_skill>magic</s_used_skill>        ;基本攻击方式(近战/远程/魔法)
                <f_skill_mod>6.0</f_skill_mod>        ;倍数
                <b_ranged>true</b_ranged>                ;判断是否为远程
                <f_missile_velocity>50</f_missile_velocity>        ;远程投射物的速度
                <f_mana_cost>15</f_mana_cost>        ;消耗的魔法
                <s_location>target</s_location>
                <Effects/>
                <Target>
                        <Group>
                                <s_type>ally_unit</s_type>                ;目标判断
                        </Group>
                </Target>
                <Units>
                        <s_name>hero_cleric</s_name>        ;所属单位
                </Units>
        </Action>

另,守卫的基本攻击

        <Action>
                <s_name>tower_guard_attack</s_name>
                <s_alignment>harm</s_alignment>
                <s_type>attack</s_type>
                <s_used_skill>missile</s_used_skill>
                <b_ranged>true</b_ranged>
                <f_cool_down>1.5</f_cool_down>        ;冷却时间(攻击频率)
                <s_location>target</s_location>
                <Effects/>
                <Target>
                        <Group>
                                <s_type>enemy_unit</s_type>
                                <s_type>enemy_building</s_type>
                        </Group>
                </Target>
        </Action>

 


8.  \resource\gameData\units\unit_decour.xml
定义了英雄的基本装备

如战士用剑第二级
                        <Weapon>
                                <s_name>hero_warrior_sword_02</s_name>
                                <f_cost>30</f_cost>        ;消费
                                <f_timeDiff>1</f_timeDiff>
                                <s_soundtype>metal_light</s_soundtype>
                                <s_gui_name>img_sell_swords_1</s_gui_name>
                                <s_gui_name_loc>swords_1</s_gui_name_loc>
                                <Params>
                                        <f_dps_hth>4</f_dps_hth>                ;杀伤附加值(每秒)
                                </Params>

 

 

三、\resource\set
数据部分三

1. \resource\set\inventory\bottles.set
定义了药瓶的基本属性
{bottle_wrap {bottle_type "HealthPotion"}        ;血瓶
        {concrete_bottle {bottle_base {inventory_base {active 0}
                                {effectorparams
                                        {dps "" "" ""}
                                        {defence "" "" ""}
                                }
                                {editorname "healthpotion_0"}
                        }
                        {cost "money" 5                ;售价
                                "wood" 0
                        }
                }
                {effect 50}        ;效力
        }
}
{bottle_wrap {bottle_type "ManaPotion"}        ;魔法瓶
        {concrete_bottle {bottle_base {inventory_base {active 0}
                                {effectorparams
                                        {dps "" "" ""}
                                        {defence "" "" ""}
                                }
                                {editorname "manapotion_1"}
                        }
                        {cost "money" 5                ;售价
                                "wood" 0
                        }
                }
                {effect 25}        ;效力
        }
}


2.  \resource\set\trading\shops.set
定义了建筑与单位的基本属性

以市场为例
                {"market"
                        {enabled}
                        {Cost
                                {money}
                                {"count money" 500}        ;造价
                        }
                        {Entity market}
                        {"Max count" 1}                ;建造数量上限
                        {"Max upgrade" 3}                ;可升级次数
                        {Prerequesities                ;建造的条件
                                {gold 0}
                                {"heroes count" 0}
                        }
                        {"Upgrades prerequsity"        ;升级的条件
                                {"1"
                                        {buildings castle_2}
                                }
                                {"2"
                                        {buildings castle_3}
                                }
                        }
                }
另以战士为例
{"guild_warrior"
        {entity_id guild_warrior}
        {units
                {"hero_warrior"
                        {enabled}
                        {Cost
                                {money}
                                {"count money" 200}        ;训练所需费用
                        }
                        {Entity hero_warrior}
                        {"Max count" 3}                ;每个工会能训练的人数上限
                        {"Production time" 10}        ;训练所需时间
                }
        }

  • 星际海盗 将领关闭 http://ag8qs.com
  • 版权声明

    本文仅代表作者观点,不代表本站立场。
    本文系作者授权发表,未经许可,不得转载。