- 好友
- 0
- 在线时间
- 0 小时
- 最后登录
- 2024-10-18
扈从
- UID
- 3645558
- 第纳尔
- 125
- 精华
- 0
- 互助
- 8
- 荣誉
- 0
- 贡献
- 0
- 魅力
- 50
- 注册时间
- 2024-4-15
鲜花( 5) 鸡蛋( 0)
|
## 战场触发器
本篇使用markdown撰写,源网页:
https://b1inkie.github.io/b1note.github.io/#/MB_Note/mb_3
如有疑问,交流群: 855512521
**我们不以源码,而以txt文件的角度来看战场文件.**
战场文件位置:```mission_templates.txt```
```mst_```开头的就是场景的名字,例如```mst_lead_charge```指代野战场景,我这里整理了几个常用战斗场景,如果你想自己写的触发器在大部分战斗中都生效,那么需要在以下几个场景中进行添加:
mst_lead_charge lead_charge
mst_village_attack_bandits
mst_village_raid
mst_besiege_inner_battle_castle
mst_besiege_inner_battle_town_center
mst_castle_attack_walls_defenders_sally
mst_castle_attack_walls_belfry
mst_castle_attack_walls_ladder
我们任意一个场景往下看,可以找到一堆```.000000```这样的数字,最上面的数字就是触发器总数,我们每加一个触发器,就需要加1.
```.000000```这样的数字,就是一个一个的触发器了
我们拉一条触发器来看看:
```python
-28.000000 0.000000 0.000000 1 2147483679 2 144115188075857435 1 5 2133 2 1224979098644774912 72057594037927936 2071 1 1224979098644774913 2072 1 1224979098644774914 2073 1 1224979098644774915 1 5 936748722493064015 1224979098644774912 1224979098644774913 1224979098644774914 1224979098644774915
```
纯数字有点懵,解析一下:
```<正数:触发间隔;负数:触发类型> <延迟多少秒执行> <执行后冷却时间> <判断条件的代码行数> <判断条件> <执行代码的行数> <执行代码>```
例如我们想写一个每0.1秒触发1次的触发器可以这样写:
```python
0.100000 0.000000 0.000000 0 0
```
由于没有判断条件和执行的部分,所以填两个0,全自动武器就是这样实现的,检测是否按下攻击键,然后让零点几秒触发一次的一个触发器,一直发射投掷物```add_missile```
当第一个参数为正数时,如上所示,很容易理解;那么当是负数时,什么是触发类型?我们有哪些触发类型呢:
以下内容在头文件中可以找到:
```python
#可能不全,具体请于头文件中查阅
# Trigger Param 1: player_no
ti_before_mission_start = -19.0 #can only be used in module_mission_templates triggers
ti_after_mission_start = -20.0 #can only be used in module_mission_templates triggers
ti_tab_pressed = -21.0 #can only be used in module_mission_templates triggers
ti_inventory_key_pressed = -22.0 #can only be used in module_mission_templates triggers
ti_escape_pressed = -23.0 #can only be used in module_mission_templates triggers
ti_battle_window_opened = -24.0 #can only be used in module_mission_templates triggers
ti_on_agent_spawn = -25.0 #can only be used in module_mission_templates triggers
ti_on_agent_killed_or_wounded = -26.0 #can only be used in module_mission_templates triggers
ti_on_agent_knocked_down = -27.0 #can only be used in module_mission_templates triggers
ti_on_agent_hit = -28.0 #can only be used in module_mission_templates triggers
# Trigger Param 1: damage inflicted agent_id - 受害者
# Trigger Param 2: damage dealer agent_id - 攻击者
# Trigger Param 3: inflicted damage - 造成的伤害
# Register 0: damage dealer item_id - 使用的武器
# Position Register 0: position of the blow
# rotation gives the direction of the blow
# Trigger result: if returned result is greater than or equal to zero, inflicted damage is set to the value specified by the module.
ti_on_player_exit = -29.0 #can only be used in module_mission_templates triggers
# Trigger Param 1: player_id
ti_on_leave_area = -30.0 #can only be used in module_mission_templates triggers
ti_on_item_picked_up = -53.0 #can only be used in module_mission_templates triggers
# Trigger Param 1: agent id
# Trigger Param 2: item id
# Trigger Param 3: scene prop id (will be deleted after this trigger)
ti_on_item_dropped = -54.0 #can only be used in module_mission_templates triggers
# Trigger Param 1: agent id
# Trigger Param 2: item id
# Trigger Param 3: scene prop id
ti_on_agent_mount = -55.0 #can only be used in module_mission_templates triggers
# Trigger Param 1: agent id
# Trigger Param 2: horse agent id
ti_on_agent_dismount = -56.0 #can only be used in module_mission_templates triggers
# Trigger Param 1: agent id
# Trigger Param 2: horse agent id
ti_on_item_wielded = -57.0 #can only be used in module_mission_templates triggers
# Trigger Param 1: agent id
# Trigger Param 2: item id
ti_on_item_unwielded = -58.0 #can only be used in module_mission_templates triggers
# Trigger Param 1: agent id
# Trigger Param 2: item id
```
例如我们想写一个进入战斗后任何agent受到伤害时就触发的触发器可以用 **-28** 号的这个触发器,可以这样写:
```python
-28.000000 0.000000 0.000000 0 0
```
目前判断条件和执行代码都为空白,我们来写点什么,比如当某agent装备某件物品例如短链甲```itm_haubergeon```时,受到伤害减少一半
我们把判断条件留白,判断部分写在执行代码中:
```python
# 注意到ti_on_agent_hit有几个可以用的参数,我们获取一下
(assign, ":itm_id", reg0),
(store_trigger_param_1, ":victim"),
(store_trigger_param_2, ":ataacker"),
(store_trigger_param_3, ":deal_dmg"),
#
(assign, ":dmg", ":deal_dmg"), #备份一下伤害值
(agent_is_alive, ":victim"),
(agent_is_human, ":victim"),
(agent_has_item_equipped, ":victim", "itm_haubergeon"),
(val_div,":dmg",2),
# ti_on_agent_hit最后还有个输出值,告诉系统这1次攻击的最后伤害是多少
(set_trigger_result, ":dmg"),
```
例如我想把这个触发器添加到野战场景中,可以在这里添加:
```python
mst_lead_charge lead_charge 65538 8
You_lead_your_men_to_battle.
...
...
...
...
#以上是野战场景
#在最后一行去添加这个触发器 注意触发器总数变化
```
但是如果我们需要在其他场景也触发的话,那么每一个你需要的场景都要去加这个触发器,这里就涉及到了代码维护问题.如果你想进行更改,那么每一处都要进行更改,这非常麻烦.(当然源码是没有这个烦恼的,因为源码本身也是将写好触发器封装起来,在需要的场景直接调用;而我们拿到的大部分MOD是不开源的,所以我们可以也将写好的触发器封装起来到scripts.txt中,直接调用即可,并且以后修改时只需要修改封装好的函数即可,不需要去修改每一个触发器)
有没有什么办法可以解决这个问题呢?
其实只需要在```scripts.txt```里把函数封装好,然后在战场触发器中调用这个函数即可.例如刚才写的触发器:
```python
(assign, ":itm_id", reg0),
(store_trigger_param_1, ":victim"),
(store_trigger_param_2, ":atacker"),
(store_trigger_param_3, ":deal_dmg"),
(call_script,"script_b1_dmg_calc_sys",":itm_id",":victim",":atacker",":deal_dmg"),#调用函数,并传入参数
```
以上代码编译好,我们直接塞到战场触器中(注意每个人scripts文件中的函数总数不一样,请自行编译成txt后,写入,不要照抄下面的):
```python
-28.000000 0.000000 0.000000 0 5 2133 2 1224979098644774912 72057594037927936 2071 1 1224979098644774913 2072 1 1224979098644774914 2073 1 1224979098644774915 1 5 936748722493064015 1224979098644774912 1224979098644774913 1224979098644774914 1224979098644774915
```
如上所示,我们将这个触发器给的4个参数,获取一下,传到 **b1_dmg_calc_sys** 这个函数中,
执行代码我们只需要以上这段就ok了,然后我们来封装```b1_dmg_calc_sys```这个函数:
```python
#获取传进来的4个参数-------------
(store_script_param, ":item_id", 1),
(store_script_param, ":victim", 2),
(store_script_param, ":attacker", 3),
(store_script_param, ":get_dmg", 4),
#----------------------------------
(assign, ":dmg", ":deal_dmg"), #备份一下伤害值
#-----------这段是要实现的功能-----------------
(agent_is_alive, ":victim"),
(agent_is_human, ":victim"),
(agent_has_item_equipped, ":victim", "itm_haubergeon"),
(val_div,":dmg",2),
#------------------------------------------
(set_trigger_result, ":dmg"), #不要忘了设置输出
```
编译好放入```scripts.txt```中即可,注意```scripts.txt```文件次行的函数总数要+1,因为我们添加了一个函数.
```python
b1_dmg_calc_sys -1
10 23 2 1224979098644774912 1 23 2 1224979098644774913 2 23 2 1224979098644774914 3 23 2 1224979098644774915 4 2133 2 1224979098644774916 1224979098644774917 1702 1 1224979098644774913 1704 1 1224979098644774913 1729 2 1224979098644774913 288230376151712151 2108 2 1224979098644774916 2 2075 1 1224979098644774916
```
我们给常见的几个战斗场景(文章最上面提到的8个)中,都一一进行添加.
然后我们可以再给常用的几个战场触发器例如刚才的这个受击触发还有agent死亡或击晕触发器;agent出生触发器等等,都按照上面的方式,一一封装好,以后需要进行修改时,只需要修改封装好的函数即可,不需要去修改每一个触发器.这是一个一劳永逸的操作.
***
如上所示,咱们就自己添加了一个 **伤害计算系统** ,这个系统可以计算伤害,并且可以自定义计算方式,例如我们想让某个agent受到伤害时,伤害减少一半,只需要在 **b1_dmg_calc_sys** 这个函数中,写入我们的计算方式即可.你可以大胆发散思维,写一些有趣的计算方式.
以下是我写的一些有趣的计算方式,你可以参考一下:
我的 **b1_dmg_calc_sys** 函数:
```python
# 战场触发器,击中触发器
(store_script_param, ":item_id", 1),
(store_script_param, ":victim", 2),
(store_script_param, ":attacker", 3),
(store_script_param, ":get_dmg", 4),
(assign,":dmg",":get_dmg"),
(agent_is_alive, ":victim"),
(agent_is_human, ":victim"),
(assign,":victim_is_heroorplayer",0), # 初始化受害者是否为英雄或玩家的标志.
(assign,":attacker_is_heroorplayer",0), # 初始化攻击者是否为英雄或玩家的标志.
(try_begin),
(try_begin),
(agent_get_troop_id, ":agent_trp_id", ":victim"), # 获取受害者所属的troop_id.
(this_or_next|troop_is_hero, ":agent_trp_id"), # 检查troop_id是否为英雄. 如果不是英雄,则不进行计算.
(eq,":agent_trp_id","trp_player"), # 检查troop_id是否为玩家. 如果不是玩家,则不进行计算.
(assign,":victim_is_heroorplayer",1), # 受害者是英雄或玩家. 进行计算.
(try_end),
(try_begin),
(agent_get_troop_id, ":agent_trp_id", ":attacker"),
(this_or_next|troop_is_hero, ":agent_trp_id"),
(eq,":agent_trp_id","trp_player"),
(assign,":attacker_is_heroorplayer",1),
(try_end),
(try_end),
# 领域崩坏----------------------
(try_begin), # 领域崩坏
(eq,":attacker_is_heroorplayer",1), # 攻击者是英雄或玩家. 进行计算.
(eq,":item_id","itm_qb_treasure_ebonys_sword"), # 判断是否为领域崩坏. 不是领域崩坏,则不进行计算.
(assign,":dmg_increase_per",5), #敌人每损失1%hp 提升5%伤害
(store_agent_hit_points, ":percent_hp", ":victim", 0), #[0..100]
(store_sub,":lost_hp_percent",100,":percent_hp"),
(val_mul,":lost_hp_percent",":dmg_increase_per"),
(val_add,":lost_hp_percent",100),
(val_mul,":dmg",":lost_hp_percent"),
(val_div,":dmg",100),
(try_end),
# 重击-----------------------------
(try_begin),
(eq,":attacker_is_heroorplayer",1), # 攻击者是英雄或玩家. 进行计算.
(assign,":agent_slot_to_store_notblow_buff",1100), # 初始化agent存储BUFF的槽位. 1100是存储BUFF的槽位. 可以根据需要进行修改.
(agent_get_slot, ":buff_nums", ":attacker", ":agent_slot_to_store_notblow_buff"),
(try_begin), #初始化slot值为0
(le,":buff_nums",0),
(agent_set_slot,":attacker",":agent_slot_to_store_notblow_buff",0),
(try_end),
(assign,":wear_blow_armor",0), # 是否穿戴重击装备
(assign,":total_not_blow_bonus",0), # 初始化未重击时,BUFF的伤害倍率
(try_begin),
(agent_has_item_equipped, ":victim", "itm_qb_treasure_armorrune_blow"), #赫姆
(assign,":not_blow_bonus",9), #未重击时,BUFF的伤害倍率为1.09倍.
(val_add,":total_not_blow_bonus",":not_blow_bonus"), # 累加BUFF的伤害倍率.
(assign,":wear_blow_armor",1),
(try_end),
(try_begin),
(agent_has_item_equipped, ":victim", "itm_qb_treasure_bootsnate_blow"), #提尔
(assign,":not_blow_bonus",6),
(val_add,":total_not_blow_bonus",":not_blow_bonus"), # 累加BUFF的伤害倍率.
(assign,":wear_blow_armor",1),
(try_end),
(try_begin),
(agent_has_item_equipped, ":victim", "itm_qb_treasure_glove_sor_blow"), #索尔
(assign,":not_blow_bonus",7),
(val_add,":total_not_blow_bonus",":not_blow_bonus"), # 累加BUFF的伤害倍率.
(assign,":wear_blow_armor",1),
(try_end),
(try_begin),
(agent_has_item_equipped, ":victim", "itm_qb_treasure_dbhelmet_blow"), #尼米亚
(assign,":not_blow_bonus",11),
(val_add,":total_not_blow_bonus",":not_blow_bonus"), # 累加BUFF的伤害倍率.
(assign,":wear_blow_armor",1),
(try_end),
(eq,":wear_blow_armor",1), # 穿戴重击装备. 进行计算.
(val_mul,":dmg",80),(val_div,":dmg",100), # 重击初始伤害倍率设为80%
(store_random_in_range, ":random", 1, 21), # 1d20
(try_begin),
(eq,":random",1), #大失败扣除1层BUFF
(try_begin),
(le,":buff_nums",0), # 检查BUFF次数是否小于等于0. 如果小于等于0,则不进行计算.
(else_try),
(val_sub,":buff_nums",1), # 减少BUFF次数.
(try_end),
(agent_set_slot,":attacker",":agent_slot_to_store_notblow_buff",0),
(else_try),
(eq,":random",20), #大成功清空BUFF
(agent_set_slot,":attacker",":agent_slot_to_store_notblow_buff",0),
(val_mul,":dmg",":buff_nums"),# 大成功本次伤害 = 伤害 x BUFF层数 x total_not_blow_bonus%
(val_mul,":dmg",":total_not_blow_bonus"),(val_div,":dmg",100),
(else_try), # 普通情况,BUFF层数+1
(val_add,":buff_nums",1), # 增加BUFF次数.
(agent_set_slot,":attacker",":agent_slot_to_store_notblow_buff",":buff_nums"),
(try_end),
# 再获取一次BUFF层数
(agent_get_slot, ":buff_nums", ":attacker", ":agent_slot_to_store_notblow_buff"),
(gt,":buff_nums",0), # 如果BUFF层数大于0,则进行计算.
(try_for_range,":i",0,":buff_nums"),
(val_mul,":dmg",":total_not_blow_bonus"),(val_div,":dmg",100),
(try_end),
(try_end),
# 暴怒 暴击------------------------------
(try_begin),
(eq,":attacker_is_heroorplayer",1), # 攻击者是英雄或玩家. 进行计算.
(assign,":num_range",0),
(assign,":range_mul",80), # 初始化暴击倍率设为1.8
(assign,":range_bonus_per",20), # 每多穿一件暴怒装备,暴击倍率增加20%
(assign,":range_chance",0), # 初始化暴击概率设为0%
(try_begin),
(agent_has_item_equipped, ":victim", "itm_qb_treasure_valkhelmet_range"),#女武神
(val_add,":num_range",1),
(val_add,":range_chance",20),
(else_try),
(agent_has_item_equipped, ":victim", "itm_qb_treasure_sgboots_range"),#阿瑞斯
(val_add,":num_range",1),
(val_add,":range_chance",6),
(else_try),
(agent_has_item_equipped, ":victim", "itm_qb_treasure_scorpglove_range"),#厄里斯
(val_add,":num_range",1),
(val_add,":range_chance",8),
(else_try),
(agent_has_item_equipped, ":victim", "itm_qb_treasure_ircparmor_range"),#塞壬
(val_add,":num_range",1),
(val_add,":range_chance",13),
(try_end),
(gt,":num_range",0), # 穿戴暴怒装备. 进行计算.
(store_random_in_range, ":random", 1, 101), # 1d100
(le,":random",":range_chance"), # 判断是否暴击. 如果随机数小于等于暴击概率,则进行计算.
(try_begin),
(gt,":num_range",1),#仅穿1件不触发套装效果
(val_sub,":num_range",1),
(store_mul,":total_bonus",":range_bonus_per",":num_range"),
(val_add,":range_mul",":total_bonus"),
(try_end),
(val_add,":range_mul",100),
(val_mul,":dmg",":range_mul"),
(val_div,":dmg",100),
(try_end),
# 要塞 减伤-------------------
(try_begin),
(eq,":victim_is_heroorplayer",1), # 受害者是英雄或玩家. 进行计算.
(assign,":num_fortress",0), # 初始化要塞数量为0.
(assign,":reduce_mul_per",15), #每多穿一件要塞装备,减伤倍率增加15%
(assign,":dmg_suffer_mul",100), #初始化承伤倍率为100%
(try_begin),
(agent_has_item_equipped, ":victim", "itm_qb_treasure_db_armor"), #珍 藏 · 龙 裔 链 甲 · 要 塞
(assign,":dmg_reduce_mul",30), # 减伤倍率设
(store_sub,":temp",100,":dmg_reduce_mul"), # 计算承伤倍率,例如100-30=70,即承伤倍率为70%
(val_mul,":dmg_suffer_mul",":temp"), (val_div,":dmg_suffer_mul",100),(val_add,":num_fortress",1),
(try_end),
(try_begin),
(agent_has_item_equipped, ":victim", "itm_qb_treasure_crown"), #珍 藏 · 王冠 · 要 塞
(assign,":dmg_reduce_mul",22), # 减伤倍率设
(store_sub,":temp",100,":dmg_reduce_mul"), # 计算承伤倍率,例如100-30=70,即承伤倍率为70%
(val_mul,":dmg_suffer_mul",":temp"), (val_div,":dmg_suffer_mul",100),(val_add,":num_fortress",1),
(try_end),
(try_begin),
(agent_has_item_equipped, ":victim", "itm_qb_treasure_aspboots_f"), #珍 藏 · 角奎 · 要 塞
(assign,":dmg_reduce_mul",17), # 减伤倍率设
(store_sub,":temp",100,":dmg_reduce_mul"), # 计算承伤倍率,例如100-30=70,即承伤倍率为70%
(val_mul,":dmg_suffer_mul",":temp"), (val_div,":dmg_suffer_mul",100),(val_add,":num_fortress",1),
(try_end),
(try_begin),
(agent_has_item_equipped, ":victim", "itm_qb_treasure_glove_hourglass_f"), #珍 藏 · 提丰 · 要 塞
(assign,":dmg_reduce_mul",14), # 减伤倍率设
(store_sub,":temp",100,":dmg_reduce_mul"), # 计算承伤倍率,例如100-30=70,即承伤倍率为70%
(val_mul,":dmg_suffer_mul",":temp"), (val_div,":dmg_suffer_mul",100),(val_add,":num_fortress",1),
(try_end),
(try_begin),
(gt,":num_fortress",1), #只穿1件 不触发额外减伤
(try_for_range, ":i_fortress", 1, ":num_fortress"), # 循环次数为要塞数量-1
(val_mul,":dmg_suffer_mul",":reduce_mul_per"), (val_div,":dmg_suffer_mul",100), # 每次循环,承伤倍率增加15%
(try_end),
(try_end),
(val_mul,":dmg",":dmg_suffer_mul"),
(val_div,":dmg",100),
(try_end),
(set_trigger_result, ":dmg"),
```
以上只是举个例子,告诉大家可以写很多有趣的伤害计算方式,具体代码就不用看了(注释大多是AI打的,看看就好).你可写成任何你想要的样子,例如远程减伤,重甲减伤,暴击回血,都可以写在这里.
## 自助添加骑射AI步射AI
有了上一篇的基础,大家就可以自己给自己的MOD添加骑射步射AI了.(你大可以直接将代码直接粘贴到需要的战斗场景中)
以下两个AI,应该也是中文站的兄弟写的,具体出处时间太久无从考证了,本人骑砍龄比较短,很多大佬我不认识,所以请见谅.
由于源码实在是太长了,我这里直接封装好,大家粘贴进scripts.txt中即可,注意函数总数自行修改:
```python
extra_riding_shoot_ai -1
309 2124 1 1000 12 1 1224979098644774912 1702 1 1224979098644774912 1704 1 1224979098644774912 1707 1 1224979098644774912 2147484193 3 1224979098644774912 1003 1 1714 2 1224979098644774913 1224979098644774912 2133 2 1224979098644774914 -1 4 0 545 3 1224979098644774912 15 0 1770 2 1224979098644774915 1224979098644774912 32 2 1224979098644774913 -1 2133 2 1224979098644774916 0 2133 2 1224979098644774917 -1 6 3 1224979098644774918 0 4 1804 3 1224979098644774919 1224979098644774912 1224979098644774918 32 2 1224979098644774919 0 1570 2 1224979098644774920 1224979098644774919 4 0 31 2 1224979098644774920 10 1825 3 1224979098644774921 1224979098644774912 1224979098644774918 2105 2 1224979098644774916 1224979098644774921 5 0 1073741855 2 1224979098644774920 8 1073741855 2 1224979098644774920 9 1073741855 2 1224979098644774920 16 31 2 1224979098644774920 17 2133 2 1224979098644774917 1224979098644774919 5 0 1073741855 2 1224979098644774920 2 1073741855 2 1224979098644774920 3 31 2 1224979098644774920 4 2133 2 1224979098644774914 1224979098644774919 3 0 3 0 32 2 1224979098644774917 -1 2147486371 2 1224979098644774917 1048576 2147486371 2 1224979098644774917 268435456 1727 3 1224979098644774922 1224979098644774912 0 2106 2 1224979098644774922 1224979098644774916 32 2 1224979098644774922 0 505 3 1224979098644774912 1003 2 1773 2 1224979098644774923 1224979098644774912 1787 3 1224979098644774924 1224979098644774915 1224979098644774923 1785 3 1224979098644774925 1224979098644774915 1224979098644774923 1784 3 1224979098644774926 1224979098644774915 1224979098644774923 2147483679 2 1224979098644774926 1 2147483679 2 1224979098644774924 2 2147483679 2 1224979098644774924 1 31 2 1224979098644774925 2 1710 2 1 1224979098644774912 1689 2 0 1224979098644774912 727 2 1224979098644774927 0 2133 2 1224979098644774928 100000 2133 2 1224979098644774929 -1 12 1 1224979098644774930 1702 1 1224979098644774930 1704 1 1224979098644774930 1710 2 2 1224979098644774930 1770 2 1224979098644774931 1224979098644774930 1788 2 1224979098644774915 1224979098644774931 710 3 1224979098644774932 1 2 4 0 545 3 1224979098644774930 15 1 2105 2 1224979098644774932 10000 3 0 4 0 1714 2 1224979098644774933 1224979098644774930 32 2 1224979098644774933 -1 1689 2 0 1224979098644774930 727 2 1224979098644774934 0 2121 3 1224979098644774935 1224979098644774934 1224979098644774927 717 3 0 1 2 740 2 1224979098644774936 0 2130 1 1224979098644774936 2128 2 1224979098644774937 1224979098644774936 2127 2 1224979098644774938 1224979098644774936 726 2 1224979098644774939 0 727 2 1224979098644774940 0 741 2 1224979098644774941 0 2122 3 1224979098644774942 1224979098644774939 1224979098644774937 2122 3 1224979098644774943 1224979098644774940 1224979098644774938 2120 3 1224979098644774944 1224979098644774942 1224979098644774943 2107 2 1224979098644774944 1224979098644774934 2108 2 1224979098644774944 1224979098644774941 2131 1 1224979098644774944 2113 1 1224979098644774944 4 0 2147483678 2 1224979098644774944 3000 2123 3 1224979098644774945 1224979098644774935 5 2111 2 1224979098644774945 0 2105 2 1224979098644774945 500 2106 2 1224979098644774932 1224979098644774945 5 0 2105 2 1224979098644774932 5000 3 0 5 0 1726 3 1224979098644774946 1224979098644774930 1 2147483680 2 1224979098644774946 1 2106 2 1224979098644774932 500 3 0 2147483678 2 1224979098644774932 1224979098644774928 2133 2 1224979098644774928 1224979098644774932 2133 2 1224979098644774929 1224979098644774930 3 0 2147483679 2 1224979098644774929 -1 1710 2 3 1224979098644774929 710 3 1224979098644774947 1 3 2133 2 1224979098644774948 1000 4 0 1726 3 1224979098644774946 1224979098644774912 0 32 2 1224979098644774946 0 1570 2 1224979098644774949 1224979098644774946 1073741855 2 1224979098644774949 8 1073741855 2 1224979098644774949 9 1073741855 2 1224979098644774949 16 31 2 1224979098644774949 17 2076 4 4 1224979098644774912 8 1 2076 4 5 1224979098644774929 9 1 707 2 4 5 1714 2 1224979098644774950 1224979098644774929 4 0 2147483679 2 1224979098644774950 -1 1713 2 1224979098644774912 1224979098644774950 5 0 1713 2 1224979098644774912 1224979098644774929 3 0 4 0 2133 2 1224979098644774951 4000 1763 2 1224979098644774952 1224979098644774912 31 2 1224979098644774952 1 4 0 32 2 1224979098644774928 700 2147483680 2 1224979098644774928 1224979098644774951 2123 3 1224979098644774948 1224979098644774927 2000 2111 2 1224979098644774948 0 3 0 31 2 1224979098644774949 8 4 0 2147483680 2 1224979098644774947 1224979098644774951 1746 3 1224979098644774912 -2 1 1745 3 1224979098644774912 3 0 5 0 32 2 1224979098644774947 1224979098644774951 1745 3 1224979098644774912 -2 1 1746 3 1224979098644774912 3 1 3 0 5 0 31 2 1224979098644774949 8 2147483680 2 1224979098644774947 1224979098644774951 1739 2 1224979098644774953 1224979098644774912 2147483679 2 1224979098644774953 8 1745 3 1224979098644774912 3 1 3 0 3 0 1736 2 1224979098644774912 1224979098644774948 4 0 545 3 1224979098644774929 15 0 2147483678 2 1224979098644774928 12000 4 0 1799 2 6 7 717 3 0 6 1 726 2 1224979098644774954 0 727 2 1224979098644774955 0 717 3 0 6 7 726 2 1224979098644774956 0 727 2 1224979098644774957 0 2121 3 1224979098644774958 1224979098644774956 1224979098644774954 2121 3 1224979098644774959 1224979098644774957 1224979098644774955 717 3 0 1 3 726 2 1224979098644774960 0 727 2 1224979098644774961 0 2133 2 1224979098644774962 0 2133 2 1224979098644774963 1500 4 0 2147483680 2 1224979098644774928 1000 2133 2 1224979098644774962 -78 5 0 32 2 1224979098644774928 2500 717 3 0 6 3 726 2 1224979098644774964 0 727 2 1224979098644774965 0 2121 3 1224979098644774966 1224979098644774956 1224979098644774964 2121 3 1224979098644774967 1224979098644774957 1224979098644774965 2133 2 1224979098644774968 1224979098644774963 2110 2 1224979098644774968 1224979098644774964 2110 2 1224979098644774968 1224979098644774967 2110 2 1224979098644774968 1224979098644774966 2110 2 1224979098644774968 1224979098644774965 4 0 2147483678 2 1224979098644774968 1224979098644774963 2133 2 1224979098644774962 90 5 0 2133 2 1224979098644774962 45 3 0 3 0 2130 1 1224979098644774962 2133 2 1224979098644774968 1224979098644774963 2110 2 1224979098644774968 1224979098644774954 2110 2 1224979098644774968 1224979098644774959 2110 2 1224979098644774968 1224979098644774958 2110 2 1224979098644774968 1224979098644774955 4 0 2147483678 2 1224979098644774928 1000 2147483678 2 1224979098644774968 1224979098644774963 545 3 1224979098644774929 15 0 2123 3 1224979098644774969 1224979098644774956 20 2123 3 1224979098644774970 1224979098644774957 20 719 2 10 6 720 3 10 1224979098644774969 1 721 3 10 1224979098644774970 1 710 3 1224979098644774971 10 1 717 3 0 1 10 726 2 1224979098644774969 0 727 2 1224979098644774970 0 2107 2 1224979098644774969 100 2107 2 1224979098644774970 100 2107 2 1224979098644774960 100 2107 2 1224979098644774961 100 2123 3 1224979098644774972 1224979098644774969 1224979098644774971 2123 3 1224979098644774973 1224979098644774970 1224979098644774971 2123 3 1224979098644774974 1224979098644774960 1224979098644774947 2123 3 1224979098644774975 1224979098644774961 1224979098644774947 2141 2 1224979098644774976 1224979098644774972 2140 2 1224979098644774977 1224979098644774973 2141 2 1224979098644774978 1224979098644774974 2140 2 1224979098644774979 1224979098644774975 4 0 2147483678 2 1224979098644774977 0 2107 2 1224979098644774976 -1 2105 2 1224979098644774976 360000 3 0 4 0 2147483678 2 1224979098644774979 0 2107 2 1224979098644774978 -1 2105 2 1224979098644774978 360000 3 0 2121 3 1224979098644774943 1224979098644774976 1224979098644774978 2106 2 1224979098644774943 270000 2106 2 1224979098644774943 1224979098644774962 2120 3 1224979098644774962 1224979098644774943 1224979098644774962 4 0 2147483678 2 1224979098644774976 1224979098644774978 2105 2 1224979098644774962 360000 3 0 2112 3 1224979098644774962 -210000 15000 1745 3 1224979098644774912 -2 1 1746 3 1224979098644774912 3 1 3 0 4 0 31 2 1224979098644774949 16 2107 2 1224979098644774962 -1 2105 2 1224979098644774962 180000 3 0 2128 2 1224979098644774937 1224979098644774962 2127 2 1224979098644774938 1224979098644774962 2122 3 1224979098644774980 1224979098644774937 1224979098644774961 2122 3 1224979098644774981 1224979098644774938 1224979098644774960 2122 3 1224979098644774982 1224979098644774938 1224979098644774961 2122 3 1224979098644774983 1224979098644774937 1224979098644774960 2120 3 1224979098644774984 1224979098644774980 1224979098644774981 2121 3 1224979098644774985 1224979098644774982 1224979098644774983 720 3 1 1224979098644774984 0 721 3 1 1224979098644774985 0 3 0 1730 3 1224979098644774912 1 1 5 0 1735 1 1224979098644774912 1732 1 1224979098644774912 3 0 4 0 545 3 1224979098644774929 15 0 32 2 1224979098644774947 500 1747 2 1224979098644774912 1224979098644774917 5 0 2147483680 2 1224979098644774947 500 32 2 1224979098644774914 -1 1714 2 1224979098644774933 1224979098644774929 32 2 1224979098644774933 -1 1747 2 1224979098644774912 1224979098644774914 1745 3 1224979098644774912 -2 1 1730 3 1224979098644774912 3 1 3 0 5 0 4 0 545 3 1224979098644774912 1003 0 505 3 1224979098644774912 1003 1 5 0 545 3 1224979098644774912 1003 2 1073742369 3 1224979098644774912 15 1 3221225502 2 1224979098644774913 0 1073741855 2 1224979098644774922 0 1073741855 2 1224979098644774926 1 1073741855 2 1224979098644774924 2 1073741855 2 1224979098644774924 1 1073741855 2 1224979098644774929 -1 2147483679 2 1224979098644774925 2 1735 1 1224979098644774912 1736 2 1224979098644774912 100 1732 1 1224979098644774912 1745 3 1224979098644774912 -2 1 505 3 1224979098644774912 1003 3 1073741855 2 1224979098644774926 1 31 2 1224979098644774922 0 32 2 1224979098644774914 -1 1747 2 1224979098644774912 1224979098644774914 3 0 3 0 3 0
extra_shoot_ai -1
151 12 1 1224979098644774912 1702 1 1224979098644774912 1704 1 1224979098644774912 1707 1 1224979098644774912 1718 2 1224979098644774913 1224979098644774912 2147484193 3 1224979098644774912 1004 1 1714 2 1224979098644774914 1224979098644774912 2133 2 1224979098644774915 -1 4 0 545 3 1224979098644774912 15 0 2147483678 2 1224979098644774914 0 2133 2 1224979098644774916 0 2133 2 1224979098644774917 -1 6 3 1224979098644774918 0 4 1804 3 1224979098644774919 1224979098644774912 1224979098644774918 32 2 1224979098644774919 0 1570 2 1224979098644774920 1224979098644774919 4 0 31 2 1224979098644774920 10 1825 3 1224979098644774921 1224979098644774912 1224979098644774918 2105 2 1224979098644774916 1224979098644774921 5 0 1073741855 2 1224979098644774920 8 1073741855 2 1224979098644774920 9 1073741855 2 1224979098644774920 16 31 2 1224979098644774920 17 2133 2 1224979098644774917 1224979098644774919 5 0 1073741855 2 1224979098644774920 2 1073741855 2 1224979098644774920 3 31 2 1224979098644774920 4 2133 2 1224979098644774915 1224979098644774919 3 0 3 0 32 2 1224979098644774917 -1 1727 3 1224979098644774922 1224979098644774912 0 2106 2 1224979098644774922 1224979098644774916 32 2 1224979098644774922 0 505 3 1224979098644774912 1004 2 1770 2 1224979098644774923 1224979098644774912 1773 2 1224979098644774924 1224979098644774912 1787 3 1224979098644774925 1224979098644774923 1224979098644774924 1785 3 1224979098644774926 1224979098644774923 1224979098644774924 1784 3 1224979098644774927 1224979098644774923 1224979098644774924 2147483679 2 1224979098644774927 1 2147483679 2 1224979098644774925 2 2147483679 2 1224979098644774925 1 1710 2 1 1224979098644774912 2133 2 1224979098644774928 100000 2133 2 1224979098644774929 -1 12 1 1224979098644774930 1702 1 1224979098644774930 1704 1 1224979098644774930 1710 2 2 1224979098644774930 1770 2 1224979098644774931 1224979098644774930 1788 2 1224979098644774923 1224979098644774931 710 3 1224979098644774932 1 2 4 0 1726 3 1224979098644774933 1224979098644774930 1 2147483680 2 1224979098644774933 1 2106 2 1224979098644774932 3000 3 0 2147483678 2 1224979098644774932 1224979098644774928 2133 2 1224979098644774928 1224979098644774932 2133 2 1224979098644774929 1224979098644774930 3 0 2147483679 2 1224979098644774929 -1 1710 2 3 1224979098644774929 710 3 1224979098644774934 1 3 1 3 936748722493063789 1224979098644774912 700 2133 2 1224979098644774935 72057594037927936 4 0 2133 2 1224979098644774936 10000 4 0 1726 3 1224979098644774937 1224979098644774912 0 32 2 1224979098644774937 0 1570 2 1224979098644774938 1224979098644774937 4 0 31 2 1224979098644774938 8 2170 3 1224979098644774939 1369094286720630817 1224979098644774913 2107 2 1224979098644774939 500 2105 2 1224979098644774936 1224979098644774939 5 0 31 2 1224979098644774938 17 2105 2 1224979098644774936 15000 3 0 3 0 4 0 1507 1 1224979098644774913 2105 2 1224979098644774936 2000 3 0 1763 2 1224979098644774940 1224979098644774912 31 2 1224979098644774940 1 4 0 2147483680 2 1224979098644774934 1224979098644774936 1739 2 1224979098644774941 1224979098644774912 31 2 1224979098644774941 1 1746 3 1224979098644774912 -2 1 1745 3 1224979098644774912 3 0 5 0 32 2 1224979098644774934 1224979098644774936 1745 3 1224979098644774912 -2 0 1746 3 1224979098644774912 3 1 3 0 5 0 2147483680 2 1224979098644774934 1224979098644774936 1726 3 1224979098644774937 1224979098644774912 0 32 2 1224979098644774937 0 2147483679 2 1224979098644774937 1224979098644774915 32 2 1224979098644774922 0 545 3 1224979098644774912 15 0 2147483679 2 1224979098644774927 1 2147483679 2 1224979098644774925 2 2147483679 2 1224979098644774925 1 1739 2 1224979098644774941 1224979098644774912 31 2 1224979098644774941 1 1745 3 1224979098644774912 3 1 3 0 4 0 31 2 1224979098644774935 0 1747 2 1224979098644774912 1224979098644774917 5 0 32 2 1224979098644774935 0 32 2 1224979098644774915 -1 1747 2 1224979098644774912 1224979098644774915 1745 3 1224979098644774912 -2 1 3 0 5 0 4 0 545 3 1224979098644774912 1004 0 505 3 1224979098644774912 1004 1 5 0 1 3 936748722493063789 1224979098644774912 700 32 2 72057594037927936 0 545 3 1224979098644774912 1004 2 1073742369 3 1224979098644774912 15 0 3221225504 2 1224979098644774922 0 1073741855 2 1224979098644774927 1 1073741855 2 1224979098644774925 2 31 2 1224979098644774925 1 1735 1 1224979098644774912 1732 1 1224979098644774912 505 3 1224979098644774912 1004 3 4 0 32 2 1224979098644774915 -1 1747 2 1224979098644774912 1224979098644774915 1745 3 1224979098644774912 -2 1 3 0 3 0 3 0 3 0
```
以上代码你可以丢进MBCE中进行反编译查看,基本是通用的.
extra_riding_shoot_ai 是骑射AI
extra_shoot_ai 是步射AI
我们依旧是在战场文件中,设置一个触发器去调用这2个函数,但是这一次,我想要给骑射AI和步射AI加一个开关,就像潘德一样.
我们在variables.txt中创建2个全局变量 **g_riding_shoot_ai** **g_shoot_ai** ,根据它的值来控制开关.
好了,我们在战场触发器中添加骑射AI:
设置一个一秒触发一次的触发器:
```python
1.000000 0.000000 0.000000 (判断条件行数) (条件代码) (执行代码行数) (执行代码)
```
判断条件可以这样写: ```(neq,"$g_riding_shoot_ai",1),``` 由于全局变量我们没有赋过值,所以肯定不等于1,也就是初始是默认开启的
执行代码可以这样写: ```(call_script, "script_extra_riding_shoot_ai"),```
编译好放进触发器中:
```python
1.000000 0.000000 0.000000 1 2147483679 2 144115188075856997 1 1 1 1 936748722493063886
```
以上这一句我们在需要的场景中添加进去即可. 步射AI也是一样的做法,略过.
那么我们还要写一个开关,点击关,再点击开.
我们可以在扎营菜单中去添加这个开关,以领军者举例,我们找到扎营菜单:
```python
menu_camp 4096 You_set_up_camp._What_do_you_want_to_do? none 2 2133 2 144115188075856138 0 2031 1 1441151880758558728 11
mno_camp_mod_opition 0 MOD_options. 1 900 1 1513209474796486707 . mno_b1_battle_ai 0 onoff. 2 2060 1 864691128455135257 1 1 936748722493063888 . mno_b1_kill_summon 0 tba. 2 2060 1 864691128455135257 1 1 936748722493063890 . mno_camp_recruit_prisoners 21 105 1 1 2319 1 1 4 0 2270 1 1224979098644774912 2106 2 1224979098644774912 24 30 2 1224979098644774912 144115188075856141 4 0 32 2 144115188075856141 0 2133 2 144115188075856139 0 2133 2 144115188075856140 0 2133 2 144115188075856141 0 3 0 5 0 2120 3 1224979098644774913 144115188075856141 24 2270 1 1224979098644774912 2147483678 2 1224979098644774912 1224979098644774913 2121 3 72057594037927937 1224979098644774913 1224979098644774912 2121 3 72057594037927938 72057594037927937 1 2320 2 1 1585267068834415439 2061 0 3 0 Recruit_some_of_your_prisoners{s1}. 54 2133 2 1224979098644774912 0 1651 2 1224979098644774913 648518346341351424 6 3 1224979098644774914 0 1224979098644774913 1656 3 1224979098644774915 648518346341351424 1224979098644774914 2147485155 1 1224979098644774915 2105 2 1224979098644774912 1 3 0 4 0 31 2 1224979098644774912 0 2060 1 864691128455135263 5 0 2270 1 144115188075856141 2170 3 1224979098644774916 1369094286720630784 360287970189639680 2122 3 1224979098644774917 1224979098644774916 3 2105 2 1224979098644774917 20 1617 1 648518346341351425 1651 2 1224979098644774913 648518346341351424 6 3 1224979098644774914 0 1224979098644774913 1656 3 1224979098644774915 648518346341351424 1224979098644774914 2147485155 1 1224979098644774915 1657 3 1224979098644774918 648518346341351424 1224979098644774914 2133 2 1224979098644774919 0 2173 2 1224979098644774920 1224979098644774915 4 0 33 3 1224979098644774920 432345564227567633 432345564227567645 522 3 1224979098644774921 1224979098644774920 99 2108 2 1224979098644774921 100 2105 2 1224979098644774919 1224979098644774921 3 0 2105 2 1224979098644774917 1224979098644774919 2133 2 1224979098644774922 100 4 0 2147483680 2 1224979098644774918 5 2133 2 1224979098644774922 50 3 0 2133 2 1224979098644774923 0 6 3 1224979098644774924 0 1224979098644774918 2136 3 1224979098644774925 0 1224979098644774922 2147483678 2 1224979098644774925 1224979098644774917 2105 2 1224979098644774923 1 3 0 32 2 1224979098644774923 0 1610 3 648518346341351425 1224979098644774915 1224979098644774923 3 0 1601 2 1224979098644774926 648518346341351425 4 0 2147483680 2 1224979098644774926 0 2060 1 864691128455135265 5 0 2060 1 864691128455135264 2133 2 144115188075855914 -1 1617 1 648518346341351715 3 0 3 0 . mno_camp_manage_bookcase 0 Manage_your_bookcase. 2 2133 2 144115188075856124 -1 900 1 1513209474796486720 . mno_camp_manage_inventory 3 1 3 936748722493063817 648518346341351424 0 2133 2 1224979098644774912 72057594037927936 32 2 1224979098644774912 1 Manage_your_party's_inventory. 46 1532 1 360287970189639683 2133 2 144115188075856142 864691128455135257 6 3 1224979098644774912 360287970189640707 360287970189640717 1532 1 1224979098644774912 3 0 1650 2 1224979098644774913 648518346341351424 6 3 1224979098644774914 0 1224979098644774913 1652 3 1224979098644774915 648518346341351424 1224979098644774914 1507 1 1224979098644774915 1509 2 1224979098644774915 0 2147483679 2 1224979098644774915 360287970189639680 6 3 1224979098644774912 360287970189640707 360287970189640717 1 3 936748722493063739 1224979098644774915 1224979098644774912 3 0 3 0 6 3 1224979098644774916 0 96 2133 2 1224979098644774917 0 2133 2 1224979098644774918 -1 2133 2 1224979098644774919 -1 6 3 1224979098644774912 360287970189640707 360287970189640717 1540 2 1224979098644774920 1224979098644774912 6 3 1224979098644774921 10 1224979098644774920 1541 3 1224979098644774922 1224979098644774912 1224979098644774921 1542 3 1224979098644774923 1224979098644774912 1224979098644774921 32 2 1224979098644774922 -1 1 3 936748722493063738 1224979098644774922 1224979098644774923 2133 2 1224979098644774924 72057594037927936 2108 2 1224979098644774924 100 2111 2 1224979098644774924 1 32 2 1224979098644774924 1224979098644774917 2133 2 1224979098644774917 1224979098644774924 2133 2 1224979098644774918 1224979098644774912 2133 2 1224979098644774919 1224979098644774921 3 0 3 0 32 2 1224979098644774917 0 1541 3 1224979098644774922 1224979098644774918 1224979098644774919 1542 3 1224979098644774923 1224979098644774918 1224979098644774919 1530 3 360287970189639683 1224979098644774922 1224979098644774923 1543 3 1224979098644774918 1224979098644774919 -1 3 0 6 3 1224979098644774912 360287970189640707 360287970189640716 2120 3 1224979098644774925 1224979098644774912 1 1 5 936748722493063790 1224979098644774912 1224979098644774925 360287970189640717 96 3 0 2060 1 864691128455135460 . mno_camp_action 0 More_and_more_actions. 1 2060 1 864691128455135260 . mno_camp_exchange_village 8 2133 2 1224979098644774912 0 2133 2 1224979098644774913 648518346341351711 6 3 1224979098644774914 648518346341351548 1224979098644774913 541 3 1224979098644774914 7 360287970189639680 2133 2 1224979098644774912 1 2133 2 1224979098644774913 0 3 0 31 2 1224979098644774912 1 Exchange_villages_with_lords. 32 2133 2 1224979098644774912 0 2133 2 1224979098644774913 648518346341351711 6 3 1224979098644774914 648518346341351548 1224979098644774913 521 3 1224979098644774915 1224979098644774914 7 30 2 1224979098644774915 0 521 3 1224979098644774916 1224979098644774914 120 521 3 1224979098644774917 1224979098644774916 7 30 2 1224979098644774917 0 2147483679 2 1224979098644774917 1224979098644774915 2133 2 1224979098644774918 648518346341351711 6 3 1224979098644774919 648518346341351548 1224979098644774918 2147483679 2 1224979098644774919 1224979098644774914 521 3 1224979098644774920 1224979098644774919 7 31 2 1224979098644774920 1224979098644774917 521 3 1224979098644774921 1224979098644774919 120 521 3 1224979098644774922 1224979098644774921 7 30 2 1224979098644774922 0 2147483679 2 1224979098644774922 1224979098644774917 1073741855 2 1224979098644774915 360287970189639680 31 2 1224979098644774920 360287970189639680 2133 2 1224979098644774913 0 2133 2 1224979098644774918 0 2133 2 1224979098644774912 1 2133 2 144115188075856110 1224979098644774914 3 0 3 0 4 0 31 2 1224979098644774912 0 2060 1 864691128455135267 5 0 2060 1 864691128455135266 3 0 . mno_camp_wait_here 0 Wait_here_for_some_time. 13 2133 2 144115188075856143 1 2133 2 144115188075856144 0 2133 2 144115188075856138 1 4 0 132 1 648518346341351424 1608 2 1224979098644774912 648518346341351424 4 0 31 2 1224979098644774912 5 372 1 28 3 0 3 0 1031 3 8760 5 1 2040 0 . mno_camp_cheat 1 30 2 144115188075856120 1 CHEAT_MENU! 1 2060 1 864691128455135258 . mno_resume_travelling 0 Resume_travelling. 1 2040 0 .
```
以上我已经添加过了,由于这部分不是本篇重点,所以简单说一下:
**menu_camp** 是扎营菜单 **mno_**开头是各个选项
**menu_camp**最后一个数字是总选项的数量,我们加一个选项就要加1
我将我写的选项拉出来解析一下:
```python
<选项ID> <出现条件代码行数> <出现条件代码> <显示的信息> <触发结果代码行数> <触发结果代码>
mno_b1_battle_ai 0 onoff. 2 2060 1 864691128455135257 1 1 936748722493063888
```
我们看一下触发结果代码即可:
```python
(jump_to_menu, "mnu_camp"),
(call_script, "script_extra_ai_switch"),
```
好了突然发现又是封装好的函数,那我们看一下函数怎么写的:
```python
(try_begin),
(neq,"$g_riding_shoot_ai",1),
(assign,"$g_riding_shoot_ai",1),
(assign,"$g_shoot_ai",1),
(display_message,"str_riding_shoot_ai_off",16711680), #提示关闭信息为红色
(else_try),
(eq,"$g_shoot_ai",1),
(assign,"$g_riding_shoot_ai",0),
(assign,"$g_shoot_ai",0),
(display_message,"str_shoot_ai_on",65280), #提示开启信息为绿色
(try_end),
```
以上函数的封装调用,在没有源码,纯用txt来写的时候,还是很重要的.
***
附一个网址(若打不开应该chrome或用steam++等加速github):
https://b1inkie.github.io/b1note.github.io/
装备某件物品时增加属性点;添加书籍;全自动武器;自爆步兵;光环:移速BUFF(光写了 没测);散弹 但是每一个弹头都是自瞄;自定义战利品等等功能都可以在这里找到.
若依旧有疑问或需要视频讲解,可以加下面群:
附加1个交流群: 855512521
|
|