骑马与砍杀中文站论坛

 找回密码
 注册(Register!)

QQ登录

只需一步,快速开始

搜索
购买CDKEY 小黑盒加速器
查看: 1320|回复: 0

[功能与代码] 射击概率回复箭矢;根据强弓等级回复箭矢

[复制链接]

10

主题

7

回帖

45

积分

扈从

Rank: 2Rank: 2

UID
3645558
第纳尔
140
精华
0
互助
8
荣誉
0
贡献
0
魅力
51
注册时间
2024-4-15
鲜花(6) 鸡蛋(0)
发表于 2024-4-15 21:10:18 | 显示全部楼层 |阅读模式


## 射击概率回复箭矢

**箭矢击中触发器:**
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



评分

参与人数 1第纳尔 +10 互助 +1 魅力 +10 收起 理由
Aomine Daiki + 10 + 1 + 10 您的帖子很有价值!

查看全部评分

您需要登录后才可以回帖 登录 | 注册(Register!)

本版积分规则

Archiver|手机版|小黑屋|骑马与砍杀中文站

GMT+8, 2024-12-27 12:04 , Processed in 0.104829 second(s), 18 queries , Gzip On, MemCached On.

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表