骑马与砍杀中文站论坛

 找回密码
 注册(Register!)

QQ登录

只需一步,快速开始

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

[功能与代码] 中心人口+每周人头税(py代码)

[复制链接]

25

主题

184

回帖

188

积分

见习骑士

Rank: 3

UID
3225805
第纳尔
1442
精华
0
互助
25
荣誉
0
贡献
0
魅力
196
注册时间
2021-3-14
鲜花(46) 鸡蛋(0)
发表于 2024-3-4 21:44:37 | 显示全部楼层 |阅读模式
本帖最后由 快乐风猫 于 2024-3-9 00:16 编辑

重新优化了代码并解决了bug,人头税设置中心的领主每周获得中心人口同等的第纳尔,就是人头税,可以根据自己喜好更改,至于玩家的城堡如果交不上钱欠税的部分,这部分有很多种用处,所以我就不贴上来了,每周欠缴的税存在slot_town_fuzhai里,可以按照自己的想法来调用


2个新的slot
  1. slot_town_renkou         = 700
  2. slot_town_fuzhai         = 701
复制代码



3个主体脚本
  1. #中心人口
  2.   ("cf_center_renkou",
  3.     [
  4.       (store_script_param_1, ":center_no"),
  5.       
  6.       (party_get_slot, ":renkou", ":center_no", slot_town_renkou),
  7.       (party_get_slot, ":prosperity", ":center_no", slot_town_prosperity),
  8.       (store_div,":fanrong",":prosperity",20),
  9.       
  10.      (try_begin),
  11.       (party_slot_eq, ":center_no", slot_party_type, spt_town),
  12.       (store_random_in_range, ":shu1", 200, 500),
  13.      (try_begin),
  14.       (eq,":fanrong",0),
  15.       (val_mul,":shu1",5),
  16.       (val_sub,":renkou",":shu1"),
  17.       (party_set_slot, ":center_no", slot_town_renkou, ":renkou"),
  18.      (else_try),
  19.       (eq,":fanrong",1),
  20.       (val_mul,":shu1",3),
  21.       (val_sub,":renkou",":shu1"),
  22.       (party_set_slot, ":center_no", slot_town_renkou, ":renkou"),
  23.      (else_try),
  24.       (eq,":fanrong",2),
  25.       (val_mul,":shu1",1),
  26.       (val_add,":renkou",":shu1"),
  27.       (party_set_slot, ":center_no", slot_town_renkou, ":renkou"),
  28.      (else_try),
  29.       (eq,":fanrong",3),
  30.       (val_mul,":shu1",3),
  31.       (val_add,":renkou",":shu1"),
  32.       (party_set_slot, ":center_no", slot_town_renkou, ":renkou"),
  33.      (else_try),
  34.       (gt,":fanrong",3),
  35.       (val_mul,":shu1",5),
  36.       (val_add,":renkou",":shu1"),
  37.       (party_set_slot, ":center_no", slot_town_renkou, ":renkou"),
  38.      (try_end),
  39.      (else_try),
  40.       (party_slot_eq, ":center_no", slot_party_type, spt_castle),
  41.       (store_random_in_range, ":shu2", 50, 100),
  42.      (try_begin),
  43.       (eq,":fanrong",0),
  44.       (val_mul,":shu2",5),
  45.       (val_sub,":renkou",":shu2"),
  46.       (party_set_slot, ":center_no", slot_town_renkou, ":renkou"),
  47.      (else_try),
  48.       (eq,":fanrong",1),
  49.       (val_mul,":shu2",3),
  50.       (val_sub,":renkou",":shu2"),
  51.       (party_set_slot, ":center_no", slot_town_renkou, ":renkou"),
  52.      (else_try),
  53.       (eq,":fanrong",2),
  54.       (val_mul,":shu2",1),
  55.       (val_add,":renkou",":shu2"),
  56.       (party_set_slot, ":center_no", slot_town_renkou, ":renkou"),
  57.      (else_try),
  58.       (eq,":fanrong",3),
  59.       (val_mul,":shu2",3),
  60.       (val_add,":renkou",":shu2"),
  61.       (party_set_slot, ":center_no", slot_town_renkou, ":renkou"),
  62.      (else_try),
  63.       (gt,":fanrong",3),
  64.       (val_mul,":shu2",5),
  65.       (val_add,":renkou",":shu2"),
  66.       (party_set_slot, ":center_no", slot_town_renkou, ":renkou"),
  67.      (try_end),
  68.      (else_try),
  69.       (party_slot_eq, ":center_no", slot_party_type, spt_village),
  70.       (store_random_in_range, ":shu3", 10, 20),
  71.      (try_begin),
  72.       (eq,":fanrong",0),
  73.       (val_mul,":shu3",5),
  74.       (val_sub,":renkou",":shu3"),
  75.       (party_set_slot, ":center_no", slot_town_renkou, ":renkou"),
  76.      (else_try),
  77.       (eq,":fanrong",1),
  78.       (val_mul,":shu3",3),
  79.       (val_sub,":renkou",":shu3"),
  80.       (party_set_slot, ":center_no", slot_town_renkou, ":renkou"),
  81.      (else_try),
  82.       (eq,":fanrong",2),
  83.       (val_mul,":shu3",1),
  84.       (val_add,":renkou",":shu3"),
  85.       (party_set_slot, ":center_no", slot_town_renkou, ":renkou"),
  86.      (else_try),
  87.       (eq,":fanrong",3),
  88.       (val_mul,":shu3",3),
  89.       (val_add,":renkou",":shu3"),
  90.       (party_set_slot, ":center_no", slot_town_renkou, ":renkou"),
  91.      (else_try),
  92.       (gt,":fanrong",3),
  93.       (val_mul,":shu3",5),
  94.       (val_add,":renkou",":shu3"),
  95.       (party_set_slot, ":center_no", slot_town_renkou, ":renkou"),
  96.      (try_end),
  97.      (try_end),
  98.   ]),



  99. #每周上交人头税
  100.   ("cf_get_center_shui_npc",
  101.     [
  102.       (try_for_range, ":center_no", centers_begin, centers_end),
  103.       (try_for_range, ":lord", active_npcs_begin, active_npcs_end),
  104.       (party_slot_eq, ":center_no", slot_town_lord, ":lord"),
  105.       (troop_get_slot, ":cur_wealth", ":lord", slot_troop_wealth),
  106.       (troop_slot_eq, ":lord", slot_troop_occupation, slto_kingdom_hero),
  107.       
  108.       (party_get_slot, ":center_wealth", ":center_no", slot_town_wealth),#获取中心财产
  109.       (party_get_slot, ":center_renkou", ":center_no", slot_town_renkou),#获取中心人口
  110.       (gt,":center_wealth",0),#是有财产的
  111.       (gt,":center_renkou",0),#是有人口的
  112.      
  113.      (try_begin),
  114.       (ge,":center_wealth",":center_renkou"),#如果中心有足够的钱交税
  115.       (val_add,":cur_wealth",":center_renkou"),
  116.       (troop_set_slot, ":center_no", slot_troop_wealth, ":cur_wealth"),#领主获得税钱
  117.       (val_sub,":center_wealth",":center_renkou"),
  118.       (party_set_slot, ":center_no", slot_town_wealth, ":center_wealth"),#中心减去税钱
  119.      (else_try),
  120.       (lt,":center_wealth",":center_renkou"),#如果中心没有足够的钱交税
  121.       (store_sub,":qiankuan",":center_renkou",":center_wealth"),#获取交不起的税款部分
  122.       (val_add,":cur_wealth",":center_wealth"),
  123.       (troop_set_slot, ":lord", slot_troop_wealth, ":cur_wealth"),#领主收走所有税
  124.       (val_div,":qiankuan",2),
  125.       (party_set_slot, ":center_no", slot_town_renkou, ":qiankuan"),#中心失去未交税的50%人口
  126.       (party_set_slot, ":center_no", slot_town_wealth, 0),
  127.      (try_end),
  128.      (try_end),
  129.      (try_end),
  130.   ]),



  131. #每周上交人头税
  132.   ("cf_get_center_shui",
  133.     [
  134.       (try_for_range, ":center_no", centers_begin, centers_end),
  135.       (party_slot_eq, ":center_no", slot_town_lord, "trp_player"),
  136.       
  137.       (party_get_slot, ":center_wealth", ":center_no", slot_town_wealth),#获取中心财产
  138.       (party_get_slot, ":center_renkou", ":center_no", slot_town_renkou),#获取中心人口
  139.       (party_get_slot, ":center_fuzhai", ":center_no", slot_town_fuzhai),#获取中心负债
  140.       (gt,":center_wealth",0),#是有财产的
  141.       (gt,":center_renkou",0),#是有人口的
  142.      
  143.      (try_begin),
  144.       (ge,":center_wealth",":center_renkou"),#如果中心有足够的钱交税
  145.       (troop_add_gold,"trp_player",":center_renkou"),
  146.       (val_sub,":center_wealth",":center_renkou"),
  147.       (party_set_slot, ":center_no", slot_town_wealth, ":center_wealth"),
  148.       (str_store_party_name_link,s10,":center_no"),
  149.       (assign,reg1,":center_renkou"),
  150.       (display_message,"@{s10}上 交 了 {reg1}的 税 款 。",0xFFAAFFAA),
  151.      (else_try),
  152.       (lt,":center_wealth",":center_renkou"),#如果中心的钱不够交税
  153.       (store_sub,":qiankuan",":center_renkou",":center_wealth"),#获取交不起的税款部分
  154.       (troop_add_gold,"trp_player",":center_wealth"),#玩家收走中心所有的钱
  155.       (val_add,":center_fuzhai",":qiankuan"),#开始累计欠税
  156.       (party_set_slot, ":center_no", slot_town_fuzhai, ":center_fuzhai"),
  157.       (party_set_slot, ":center_no", slot_town_wealth, 0),
  158.       (assign,reg1,":qiankuan"),
  159.       (assign,reg2,":center_wealth"),
  160.       (assign,reg3,":center_fuzhai"),
  161.       (str_store_party_name_link,s10,":center_no"),
  162.       (display_message,"@{s10}上 交 了 {reg2}的 税 款 ,还 剩 余 {reg1}的 税 款 未 交 ,{s10}现 在 已 经 累 计 拖 欠 了 {reg3}的 税 款 。",0xFFFF0000),
  163.      (try_end),
  164.      (try_end),
  165.   ]),
复制代码



2个简单触发器,给中心额外收入是我自己测试用的
  1. #中心每周额外收入
  2.   (24*7,
  3.    [
  4.      (try_for_range, ":centers", centers_begin, centers_end),
  5.      (party_get_slot, ":cur_wealth", ":centers", slot_town_wealth),
  6.      (party_get_slot, ":prosperity", ":centers", slot_town_prosperity),
  7.      (val_mul,":prosperity",10),
  8.      (val_add,":cur_wealth",":prosperity"),
  9.      (party_set_slot, ":centers", slot_town_wealth, ":cur_wealth"),
  10.     (try_end),
  11.     ]),

  12. #中心每周更新人口+上人头税
  13.   (24*7,
  14.    [
  15.      (try_for_range, ":centers", centers_begin, centers_end),
  16.      (call_script, "script_cf_center_renkou", ":centers"),
  17.     (try_end),
  18.    
  19.      (call_script, "script_cf_get_center_shui_npc"),
  20.      (call_script, "script_cf_get_center_shui"),
  21.     ]),
复制代码


1个查看状况的脚本,加在game_context_menu_get_buttons最下面
  1. (try_begin),
  2.        (is_between, ":party_no", centers_begin, centers_end),
  3.        (party_get_slot, ":center_renkou", ":party_no", slot_town_renkou),
  4.        (assign,reg1,":center_renkou"),
  5.        (context_menu_add_item, "@常 住 人 口 : {reg1}"),
  6.      (try_end),
  7.      
  8.      (try_begin),
  9.        (is_between, ":party_no", centers_begin, centers_end),
  10.        (party_get_slot, ":center_fuzhai", ":party_no", slot_town_fuzhai),
  11.        (gt,":center_fuzhai",1),
  12.        (assign,reg2,":center_fuzhai"),
  13.        (context_menu_add_item, "@未 缴 税 款 : {reg2}"),
  14.      (try_end),
复制代码


评分

参与人数 1第纳尔 +20 互助 +1 魅力 +20 收起 理由
Aomine Daiki + 20 + 1 + 20 多来点这样的好贴!!!

查看全部评分

鲜花鸡蛋

815208129  在2024-3-20 19:02  送朵鲜花  并说:我非常同意你的观点,送朵鲜花鼓励一下
FacelessVoid  在2024-3-4 23:33  送朵鲜花  并说:我非常同意你的观点,送朵鲜花鼓励一下

25

主题

184

回帖

188

积分

见习骑士

Rank: 3

UID
3225805
第纳尔
1442
精华
0
互助
25
荣誉
0
贡献
0
魅力
196
注册时间
2021-3-14
鲜花(46) 鸡蛋(0)
 楼主| 发表于 2024-3-4 23:50:44 | 显示全部楼层
修改了一下 原先的全局变量废除,改成一个新的slot,忘了全局变量不能分配,已经在顶楼更新了

6

主题

17

回帖

7

积分

平民

Rank: 1

UID
2431031
第纳尔
191
精华
0
互助
0
荣誉
0
贡献
0
魅力
0
注册时间
2015-1-24
鲜花(0) 鸡蛋(0)
发表于 2024-3-20 14:33:17 | 显示全部楼层
请问,是战团吗?还是骑砍2?

25

主题

184

回帖

188

积分

见习骑士

Rank: 3

UID
3225805
第纳尔
1442
精华
0
互助
25
荣誉
0
贡献
0
魅力
196
注册时间
2021-3-14
鲜花(46) 鸡蛋(0)
 楼主| 发表于 2024-3-20 18:20:50 | 显示全部楼层
狼骑舞者 发表于 2024-3-20 14:33
请问,是战团吗?还是骑砍2?

是战团的代码

鲜花鸡蛋

狼骑舞者  在2024-3-20 20:22  送朵鲜花  并说:感谢大佬,送朵鲜花鼓励一下

15

主题

740

回帖

367

积分

子爵[版主]

汉[Han]
联机ID:Han_DongHai

Rank: 7Rank: 7Rank: 7

UID
3033293
第纳尔
10331
精华
0
互助
24
荣誉
2
贡献
360
魅力
184
注册时间
2018-10-3

第十届战团中国联赛征战勋章汉匈决战正版勋章战团正版勋章霸主正版勋章

QQ
鲜花(37) 鸡蛋(0)
发表于 2024-3-20 19:02:17 | 显示全部楼层

2

主题

10

回帖

4

积分

平民

Rank: 1

UID
3632759
第纳尔
0
精华
0
互助
0
荣誉
0
贡献
0
魅力
0
注册时间
2024-3-11
鲜花(0) 鸡蛋(0)
发表于 7 天前 | 显示全部楼层
大佬我拿去用了,十分感谢
您需要登录后才可以回帖 登录 | 注册(Register!)

本版积分规则

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

GMT+8, 2024-4-28 03:06 , Processed in 0.125179 second(s), 27 queries , Gzip On, MemCached On.

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

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