## 射击概率回复箭矢
**箭矢击中触发器:**
1. 每次射击后,30%概率回复1箭矢,10%概率回复2支箭矢.
```python
#配置部分 注意 低概率 不要设置 超过 高概率------------------------
(assign,":recover_arrow_num_less",1), # 回复1支箭矢
(assign,":recover_arrow_chance_less",30), # 30%概率
(assign,":recover_arrow_num_more",2), # 回复2支箭矢
(assign,":recover_arrow_chance_more",10), # 10%概率
#--------------------------------------------------------------
(assign,":ammo_type",itp_type_arrows), # 设置弹药类型为箭矢 这里设定为箭矢 如果你需要其他类型的弹药 请修改这里.
(store_trigger_param_1, ":user"),
(assign,":ammo_id",0),
(assign,":ammo_id_curammo_nums",0),
(try_for_range, ":slot_item_carry", 0, 4), #正序获取弹药ID
(eq,":ammo_id_curammo_nums",0), #没有获取到弹药时才继续获取
(agent_get_item_slot, ":equipped", ":user", ":slot_item_carry"),
(neq,":equipped", -1),
(item_get_type, ":item_weapon_type", ":equipped"),
(eq, ":item_weapon_type", ":ammo_type"), #获取武器类型
(agent_get_ammo_for_slot, ":slot_ammo", ":user", ":slot_item_carry"), #获取弹药数量,如果数量大于0,则说明当前武器有弹药,退出循环。
(gt, ":slot_ammo", 0),
(assign, ":ammo_id", ":equipped"),
(assign, ":ammo_id_curammo_nums", ":slot_ammo"),
(try_end),
(neq,":ammo_id_curammo_nums",0),
(neq, ":ammo_id", 0),
(assign,":ammo_add",0),
(store_random_in_range,":random_no",1,100),
(try_begin),
(lt,":random_no",":recover_arrow_chance_more"),
(assign,":ammo_add",":recover_arrow_num_more"),
(else_try),
(lt,":random_no",":recover_arrow_chance_less"),
(assign,":ammo_add",":recover_arrow_num_less"),
(try_end),
(neq,":ammo_add",0), # 判断是否回复箭矢数量大于0,如果大于0,则进行回复操作。否则不进行回复操作。
(val_add,":ammo_id_curammo_nums",":ammo_add"),
(agent_set_ammo, ":user", ":ammo_id", ":ammo_id_curammo_nums"),
```
**箭矢击中触发器:**
2. 根据强弓等级回复箭矢
```python
#配置部分
(assign,":recover_chance_per_power_draw_lv",2), #每级强弓等级增加2%概率回复箭矢
(assign,":recover_arrow_nums",2), #每次回复几只箭矢
#--------------------------------------------
(assign,":ammo_type",itp_type_arrows), # 设置弹药类型为箭矢
(store_trigger_param_1, ":user"), # 获取射手agent
(assign,":ammo_id",0),
(assign,":ammo_id_curammo_nums",0),
(try_for_range, ":slot_item_carry", 0, 4), #正序获取弹药ID
(eq,":ammo_id_curammo_nums",0), #没有获取到弹药时才继续获取
(agent_get_item_slot, ":equipped", ":user", ":slot_item_carry"),
(neq,":equipped", -1),
(item_get_type, ":item_weapon_type", ":equipped"),
(eq, ":item_weapon_type", ":ammo_type"), #获取武器类型
(agent_get_ammo_for_slot, ":slot_ammo", ":user", ":slot_item_carry"), #获取弹药数量,如果数量大于0,则说明当前武器有弹药,退出循环。
(gt, ":slot_ammo", 0),
(assign, ":ammo_id", ":equipped"),
(assign, ":ammo_id_curammo_nums", ":slot_ammo"),
(try_end),
(neq,":ammo_id_curammo_nums",0),
(neq, ":ammo_id", 0),
(agent_get_troop_id,":user_trp_id",":user"),
(store_skill_level, ":skill_bow", "skl_power_draw", ":user_trp_id"),
(val_mul, ":skill_bow", ":recover_chance_per_power_draw_lv"),
(store_random_in_range,":random_no",1,100),
(lt,":random_no",":skill_bow"),
(val_add,":ammo_id_curammo_nums",":recover_arrow_nums"),
(agent_set_ammo, ":user", ":ammo_id", ":ammo_id_curammo_nums"),
```
***
附一个网址(若打不开请使用chrome或用steam++等加速github):
https://b1inkie.github.io/b1note.github.io/
装备某件物品时增加属性点;添加书籍;全自动武器;自爆步兵;光环:移速BUFF(光写了 没测);散弹 但是每一个弹头都是自瞄;自定义战利品等等功能都可以在这里找到.
若依旧有疑问或需要视频讲解,可以加下面群:
附加1个交流群: 855512521
|