本帖最后由 蒋亚军1990 于 2017-11-28 15:00 编辑
我最近些研究了一下如何让领主士兵能够自动升级进阶,而不是带着100个农民之类的低级兵种到处转,虽然有很多MOD已经有这功能,但是这段代码完全是我自己手工打的,参战MS1.166代码编写,应该属于原创吧。代码功能为在设定时间内,我设为每天,领主所带的士兵和城堡驻军能够自动升级进阶,越高级越难进阶,领主带在身上的兵进阶速度是驻军两倍,目前就是简单的设定一下,没有过多考虑领主的经验和金钱,仅仅是每天固定进阶一定数量,此代码里面的兵种和阵营基于风三的兵种和阵营编写,代码如下:- (try_for_parties,":suoyoubudui"),
- (neg|eq,":suoyoubudui","p_main_party"),
- (try_begin),
- (party_slot_eq, ":suoyoubudui", slot_party_type, spt_kingdom_hero_party),
- (party_stack_get_troop_id, ":lingdaozhe", ":suoyoubudui", 0),
- (is_between,":lingdaozhe","trp_npc1","trp_knight_mod_10"),
- (assign,":beishu",2),
- (else_try),
- (this_or_next|party_slot_eq,":suoyoubudui",slot_party_type,spt_castle),
- (party_slot_eq,":suoyoubudui",slot_party_type,spt_town),
- (party_get_slot, ":suoyouz", ":suoyoubudui", slot_town_lord),
- (is_between,":suoyouz","trp_npc1","trp_knight_mod_10"),
- (assign,":beishu",1),
- (else_try),
- (assign,":beishu",0),
- (try_end),
- (party_get_num_companion_stacks, ":zhongleis", ":suoyoubudui"),
- (try_for_range_backwards, ":stack_no", 0, ":zhongleis"),
- (party_stack_get_troop_id, ":bingzhong", ":suoyoubudui",":stack_no"),
- (party_stack_get_size, ":bingzhongshu",":suoyoubudui",":stack_no"),
- (neg|troop_is_hero, ":bingzhong"),
- (store_character_level, ":dengji",":bingzhong"),
- (try_begin),
- (is_between,":dengji",0,11),
- (assign,":shengjis",10),
- (else_try),
- (is_between,":dengji",11,16),
- (assign,":shengjis",5),
- (else_try),
- (is_between,":dengji",16,30),
- (assign,":shengjis",3),
- (else_try),
- (ge,":dengji",30),
- (assign,":shengjis",1),
- (try_end),
- (try_begin),
- (is_between,":dengji",20,25),
- (store_troop_faction, ":bingzhongzy", ":bingzhong"),
- (try_begin),
- (eq,":bingzhongzy","fac_kingdom_1"),
- (store_random_in_range,":suijibz","trp_swadian_wuyingwuwei","trp_swadian_messenger"),
- (else_try),
- (eq,":bingzhongzy","fac_kingdom_2"),
- (store_random_in_range,":suijibz","trp_vaegir_wudanghubu","trp_vaegir_messenger"),
- (else_try),
- (eq,":bingzhongzy","fac_kingdom_3"),
- (store_random_in_range,":suijibz","trp_khergit_xiandengsishi","trp_khergit_messenger"),
- (else_try),
- (eq,":bingzhongzy","fac_kingdom_4"),
- (store_random_in_range,":suijibz","trp_nord_danyangjingbing","trp_nord_messenger"),
- (else_try),
- (eq,":bingzhongzy","fac_kingdom_5"),
- (store_random_in_range,":suijibz","trp_rhodok_danyangjingbing","trp_rhodok_messenger"),
- (else_try),
- (eq,":bingzhongzy","fac_kingdom_6"),
- (store_random_in_range,":suijibz","trp_gongsunzan_jingruidaofushou","trp_gongsunzan_messenger"),
- (else_try),
- (eq,":bingzhongzy","fac_kingdom_7"),
- (store_random_in_range,":suijibz","trp_xishu_dongzhoubing","trp_xishu_messenger"),
- (else_try),
- (eq,":bingzhongzy","fac_kingdom_8"),
- (store_random_in_range,":suijibz","trp_mateng_yulinjunzhen1","trp_mateng_messenger"),
- (else_try),
- (eq,":bingzhongzy","fac_kingdom_9"),
- (store_random_in_range,":suijibz","trp_yuanshu_jingruidaopaishou","trp_yuanshu_messenger"),
- (else_try),
- (eq,":bingzhongzy","fac_kingdom_10"),
- (store_random_in_range,":suijibz","trp_lvbu_xianzhenyingjiashi","trp_lvbu_messenger"),
- (else_try),
- (eq,":bingzhongzy","fac_kingdom_11"),
- (store_random_in_range,":suijibz","trp_zhanglu_jingruidaopaishou","trp_zhanglu_messenger"),
- (else_try),
- (eq,":bingzhongzy","fac_kingdom_12"),
- (store_random_in_range,":suijibz","trp_lijue_feixiongjun","trp_lijue_messenger"),
- (else_try),
- (eq,":bingzhongzy","fac_kingdom_13"),
- (store_random_in_range,":suijibz","trp_gongsundu_jingruidaofushou","trp_gongsundu_messenger"),
- (else_try),
- (eq,":bingzhongzy","fac_kingdom_14"),
- (store_random_in_range,":suijibz","trp_hansui_yulinjunzhen1","trp_hansui_messenger"),
- (else_try),
- (eq,":bingzhongzy","fac_kingdom_15"),
- (store_random_in_range,":suijibz","trp_liuyao_jingruidaopaishou","trp_liuyao_messenger"),
- (else_try),
- (eq,":bingzhongzy","fac_kingdom_16"),
- (store_random_in_range,":suijibz","trp_yanbaihu_jingruidaopaishou","trp_yanbaihu_messenger"),
- (else_try),
- (eq,":bingzhongzy","fac_player_supporters_faction"),
- (store_random_in_range,":suijibz","trp_swadian_hubaoqi_new","trp_looter"),
- (try_end),
- (store_mul, ":sjizs", ":shengjis", ":beishu"),
- (party_add_members, ":suoyoubudui", ":suijibz", ":sjizs"),
- (party_remove_members, ":suoyoubudui", ":bingzhong", ":sjizs"),
- (else_try),
- (store_mul, ":sjizs", ":shengjis", ":beishu"),
- (store_random_in_range,":suijis",0,2),
- (troop_get_upgrade_troop,":sjbingzhong",":bingzhong",":suijis"),
- (ge,":sjbingzhong",1),
- (party_add_members, ":suoyoubudui", ":sjbingzhong", ":sjizs"),
- (party_remove_members, ":suoyoubudui",":bingzhong", ":sjizs"),
- (try_end),
- (try_end),
- (try_end),
复制代码 TXT文档下载地址:
|