还是跟之前的帖子一样
只是加了一些简单的东西来实现,每天出口进口价格不一样,本人技术有点菜
1.在module_game_menus.py
搜索trade_with_merchants
######################
("trade_with_merchants",
[
(party_slot_eq,"$current_town",slot_party_type, spt_town)
],
"Go to the marketplace.",
[
(try_begin),
(call_script, "script_cf_enter_center_location_bandit_check"),
(else_try),
(jump_to_menu,"mnu_town_trade"),
(try_end),
]),
########################
在这一段的下面空一行写进
######代码#####
("jinko1",
[
],
"进 口 武 器 ",
[
(jump_to_menu, "mnu_jinko"),
]
),
######代码#######
添加完以后在module_game_menus.py最底下的】上面一行添加这一段
######代码#######
("jinko", 0,
"招 募 军 事 武 器 顾 问 才 能 进 口 武 器 (需 要 等 待 2天)",
"none", [
],
[
("fanhui11", [(main_party_has_troop,"trp_jinkwuqisr"),(main_party_has_troop,"trp_jinkwuqisr1"),(call_script,"script_kaqi11")],
"进 入 进 口 武 器 面 板 ",
[
(start_presentation, "prsnt_jinko"),
], ),
("junshi", [(neg|main_party_has_troop, "trp_jinkwuqisr")],
"招 募 军 事 武 器 顾 问 (3 万)",
[
(try_begin),
(neg|main_party_has_troop, "trp_jinkwuqisr"),
(store_troop_gold, ":var_0", "trp_player"),
(ge, ":var_0", 30000),
(troop_remove_gold, "trp_player", 30000),
(party_add_members, "p_main_party", "trp_jinkwuqisr", 1),
(else_try),
(display_message, "@无_法_招 募_你_没_钱_或_已_经_拥_有_"),
(try_end),
], "."),
("junshi2", [(neg|main_party_has_troop, "trp_jinkwuqisr1")],
"招 募 运 输 接 受 人 员(10 万 包 含 船 只 运 输)",
[
(try_begin),
(neg|main_party_has_troop, "trp_jinkwuqisr1"),
(store_troop_gold, ":var_0", "trp_player"),
(ge, ":var_0", 100000),
(troop_remove_gold, "trp_player", 100000),
(party_add_members, "p_main_party", "trp_jinkwuqisr1", 1),
(else_try),
(display_message, "@无_法_招 募_你_没_钱_或_已_经_拥_有_"),
(try_end),
], "."),
("fanhui", [],
"Continue",
[
(change_screen_return),
], ),
]),
######代码#######
2.添加完以后打开module_presentations.py
在module_presentations.py最底下的】上面一行添加这一段
##############################制作学习########################
("jinko", prsntf_manual_end_only, mesh_load_window, [
(ti_on_presentation_load, [
(try_begin),
(presentation_set_duration, 99999),
(set_fixed_point_multiplier, 1000),
(assign, ":pos_x", 30),
(assign, ":pos_y", 650),
(assign, ":offset_y", 30),
(assign, reg0, "$jiag"),
(create_button_overlay, reg1, "@_进_口_马_克_沁_重_机_枪__________________今 日 价 格 {reg0}元 "),
(position_set_x, pos1, ":pos_x"),
(position_set_y, pos1, ":pos_y"),
(overlay_set_position, reg1, pos1),
(assign, "$makqin", reg1),
##############
(val_sub, ":pos_y", ":offset_y"),
(assign, reg0, "$chukojiag"),
(create_button_overlay, reg1, "@_出 口_马_克_沁_重_机_枪_________________今 日 价 格 {reg0}元 "),
(position_set_y, pos1, ":pos_y"),
(position_set_x, pos1, ":pos_x"),
(overlay_set_position, reg1, pos1),
(assign, "$chukomakqin", reg1),
##################################################################################################################################
(val_sub, ":pos_y", ":offset_y"),
(assign, reg0, "$jiag2"),
(create_button_overlay, reg1, "@_进_口_哈_奇_开_斯_重_机_枪_________________今 日 价 格 {reg0}元 "),
(position_set_y, pos1, ":pos_y"),
(position_set_x, pos1, ":pos_x"),
(overlay_set_position, reg1, pos1),
(assign, "$92shi", reg1),
##############
(val_sub, ":pos_y", ":offset_y"),
(assign, reg0, "$chukojiag2"),
(create_button_overlay, reg1, "@_出 口_哈_奇_开_斯_重_机_枪_________________今 日 价 格 {reg0}元 "),
(position_set_y, pos1, ":pos_y"),
(position_set_x, pos1, ":pos_x"),
(overlay_set_position, reg1, pos1),
(assign, "$chukomakqin2", reg1),
##############
(val_sub, ":pos_y", ":offset_y"),
(assign, reg0, "$jiag3"),
(create_button_overlay, reg1, "@_进_口_mg08重_机_枪___________________今 日 价 格 {reg0}元 "),
(position_set_y, pos1, ":pos_y"),
(position_set_x, pos1, ":pos_x"),
(overlay_set_position, reg1, pos1),
(assign, "$jinkomgo8", reg1),
##############
(val_sub, ":pos_y", ":offset_y"),
(assign, reg0, "$chukojiag3"),
(create_button_overlay, reg1, "@_出 口_mg08重_机_枪___________________今 日 价 格 {reg0}元 "),
(position_set_y, pos1, ":pos_y"),
(position_set_x, pos1, ":pos_x"),
(overlay_set_position, reg1, pos1),
(assign, "$chukomakqin3", reg1),
##############
(val_sub, ":pos_y", ":offset_y"),
(assign, reg0, "$jiag4"),
(create_button_overlay, reg1, "@_进_口_布_伦_轻_机_枪____________________今 日 价 格 {reg0}元 "),
(position_set_y, pos1, ":pos_y"),
(position_set_x, pos1, ":pos_x"),
(overlay_set_position, reg1, pos1),
(assign, "$jinkobren_prone", reg1),
##############
(val_sub, ":pos_y", ":offset_y"),
(assign, reg0, "$chukojiag4"),
(create_button_overlay, reg1, "@_出_口_布_伦_轻_机_枪____________________今 日 价 格 {reg0}元 "),
(position_set_y, pos1, ":pos_y"),
(position_set_x, pos1, ":pos_x"),
(overlay_set_position, reg1, pos1),
(assign, "$chukomakqin4", reg1),
##############
(val_sub, ":pos_y", ":offset_y"),
(assign, reg0, "$jiag5"),
(create_button_overlay, reg1, "@_进_口_苏_联_DP27____________________今 日 价 格 {reg0}元 "),
(position_set_y, pos1, ":pos_y"),
(position_set_x, pos1, ":pos_x"),
(overlay_set_position, reg1, pos1),
(assign, "$jinkp", reg1),
##############
(val_sub, ":pos_y", ":offset_y"),
(assign, reg0, "$chukojiag5"),
(create_button_overlay, reg1, "@_出_口_苏_联_DP27____________________今 日 价 格 {reg0}元 "),
(position_set_y, pos1, ":pos_y"),
(position_set_x, pos1, ":pos_x"),
(overlay_set_position, reg1, pos1),
(assign, "$chukomakqin5", reg1),
##############
(val_sub, ":pos_y", ":offset_y"),
(assign, reg0, "$jiag6"),
(create_button_overlay, reg1, "@_进_口_捷_克_式_机_枪____________________今 日 价 格 {reg0}元 "),
(position_set_y, pos1, ":pos_y"),
(position_set_x, pos1, ":pos_x"),
(overlay_set_position, reg1, pos1),
(assign, "$jinkozb26_deployed", reg1),
##############步枪出口
(val_sub, ":pos_y", ":offset_y"),
(assign, reg0, "$chukohanyanzao1"),
(create_button_overlay, reg1, "@_出_口_汉 阳 造 步 枪 20把_________________今 日 价 格 {reg0}元 "),
(position_set_y, pos1, ":pos_y"),
(position_set_x, pos1, ":pos_x"),
(overlay_set_position, reg1, pos1),
(assign, "$chukohanyanzao", reg1),
(val_sub, ":pos_y", ":offset_y"),
(assign, reg0, "$chukohan38shi1"),
(create_button_overlay, reg1, "@_出_口_38式 步 枪 20把__________________今 日 价 格 {reg0}元 "),
(position_set_y, pos1, ":pos_y"),
(position_set_x, pos1, ":pos_x"),
(overlay_set_position, reg1, pos1),
(assign, "$chukohan38shi", reg1),
(val_sub, ":pos_y", ":offset_y"),
(assign, reg0, "$chukohanlaottong1"),
(create_button_overlay, reg1, "@_出_口_老 套 筒 步 枪 20把_________________今 日 价 格 {reg0}元 "),
(position_set_y, pos1, ":pos_y"),
(position_set_x, pos1, ":pos_x"),
(overlay_set_position, reg1, pos1),
(assign, "$chukohanlaottong", reg1),
######################机枪
(val_sub, ":pos_y", ":offset_y"),
(assign, reg0, "$chuko92shizjq1"),
(create_button_overlay, reg1, "@_出_口_92式 重 机 枪___________________今 日 价 格 {reg0}元 "),
(position_set_y, pos1, ":pos_y"),
(position_set_x, pos1, ":pos_x"),
(overlay_set_position, reg1, pos1),
(assign, "$chuko92shizjq", reg1),
(val_sub, ":pos_y", ":offset_y"),
(assign, reg0, "$chukodazhengshi1"),
(create_button_overlay, reg1, "@_出_口_大 正 式 机 枪 3挺__________________今 日 价 格 {reg0}元 "),
(position_set_y, pos1, ":pos_y"),
(position_set_x, pos1, ":pos_x"),
(overlay_set_position, reg1, pos1),
(assign, "$chukodazhengshi", reg1),
(val_sub, ":pos_y", ":offset_y"),
(assign, reg0, "$chukoZB261"),
(create_button_overlay, reg1, "@_出_口_ZB26 机 枪 3挺__________________今 日 价 格 {reg0}元 "),
(position_set_y, pos1, ":pos_y"),
(position_set_x, pos1, ":pos_x"),
(overlay_set_position, reg1, pos1),
(assign, "$chukoZB26", reg1),
(val_sub, ":pos_y", ":offset_y"),
(assign, reg0, "$chukoZB2611"),
(create_button_overlay, reg1, "@_出_口_ZB26 机 枪 3挺__________________今 日 价 格 {reg0}元 "),
(position_set_y, pos1, ":pos_y"),
(position_set_x, pos1, ":pos_x"),
(overlay_set_position, reg1, pos1),
(assign, "$chukoZB2612", reg1),
(val_sub, ":pos_y", ":offset_y"),
(assign, reg0, "$chukohanyz11"),###########使用一个全局变量把价钱存入到reg0然后在武器汉化后面地方加入{reg0}显示这样就是每天发生价格变化的显示的第一步
(create_button_overlay, reg1, "@_出_口_汉 阳 造 1把____________________今 日 价 格 {reg0}元 "),
(position_set_y, pos1, ":pos_y"),
(position_set_x, pos1, ":pos_x"),
(overlay_set_position, reg1, pos1),
(assign, "$chukohanyz1", reg1),
(try_end),
(display_message, "@按 ESC 离 开 ", 0x33FFFF),
]),
(ti_on_presentation_run, [
(try_begin),
(key_clicked, key_escape),
(presentation_set_duration, 0),
(try_end),
]),
######################################################个人理解#####
(ti_on_presentation_event_state_change, [
(try_begin),###开头 判断开始
(store_trigger_param_1, ":object"),#存储调用触发器时的第1个参数。
(eq, "$makqin", ":object"),
(try_begin),##########尝试开始
(store_troop_gold, ":wuqi", "trp_player"),############把玩家的金钱存入wuqi临时变量
(ge, ":wuqi", "$jiag"),######wuqi临时变量=25000
(troop_remove_gold, "trp_player", "$jiag"),##就扣除玩家25000
(troop_add_item, "trp_player","itm_jinkomakqin",1),##然后为玩家添加物品itm_jinkomakqin
(display_message, "@购_买_成 功 "),###并提示购买成功
(try_end),########结束
(lt, ":wuqi", "$jiag"),##如果wuqi临时变量金钱数量小于25000
(display_message, "@你 没 有 钱 !"),#######提示你没有钱
(else_try),
(eq, ":object", "$92shi"),
(try_begin),
(store_troop_gold, ":wuqi1", "trp_player"),
(ge, ":wuqi1", "$jiag2"),
(troop_remove_gold, "trp_player", "$jiag2"),
(troop_add_item, "trp_player","itm_jinkhaqi",1),
(display_message, "@购_买_成 功 "),
(try_end),
(lt, ":wuqi1", "$jiag2"),
(display_message, "@你 没 有 钱 !"),
(else_try),
(eq, ":object", "$jinkomgo8"),
(try_begin),
(store_troop_gold, ":wuqi2", "trp_player"),
(ge, ":wuqi2", "$jiag3"),
(troop_remove_gold, "trp_player", "$jiag3"),
(troop_add_item, "trp_player","itm_jinkomgo8",1),
(display_message, "@购_买_成 功 "),
(try_end),
(lt, ":wuqi2", "$jiag3"),
(display_message, "@你 没 有 钱 !"),
######
(else_try),
(eq, ":object", "$jinkobren_prone"),
(try_begin),
(store_troop_gold, ":wuqi3", "trp_player"),
(ge, ":wuqi3", "$jiag4"),
(troop_remove_gold, "trp_player", "$jiag4"),
(troop_add_item, "trp_player","itm_jinkobren_prone",1),
(display_message, "@购_买_成 功 "),
(try_end),
(lt, ":wuqi3", "$jiag4"),
(display_message, "@你 没 有 钱 !"),
############
(else_try),
(eq, ":object", "$jinkp"),
(try_begin),
(store_troop_gold, ":wuqi4", "trp_player"),
(ge, ":wuqi4", "$jiag5"),
(troop_remove_gold, "trp_player", "$jiag5"),
(troop_add_item, "trp_player","itm_jinkp",1),
(display_message, "@购_买_成 功 "),
(try_end),
(lt, ":wuqi4", "$jiag5"),
(display_message, "@你 没 有 钱 !"),
##########
(else_try),
(eq, ":object", "$jinkozb26_deployed"),
(try_begin),
(store_troop_gold, ":wuqi5", "trp_player"),
(ge, ":wuqi5", "$jiag6"),
(troop_remove_gold, "trp_player", "$jiag6"),
(troop_add_item, "trp_player","itm_jinkozb26_deployed",1),
(display_message, "@购_买_成 功 "),
(try_end),
(lt, ":wuqi5", "$jiag6"),
(display_message, "@你 没 有 钱 !"),
##########
(else_try),
(eq, ":object", "$chukomakqin"),
(player_has_item,"itm_jinkomakqin"),
(try_begin),
(troop_add_gold, "trp_player", "$chukojiag"),
(troop_remove_item,"trp_player","itm_jinkomakqin",1),
(display_message, "@出 口_成 功 "),
(try_end),
(else_try),
(eq, ":object", "$chukomakqin2"),
(player_has_item,"itm_jinkhaqi"),
(try_begin),
(troop_add_gold, "trp_player", "$chukojiag2"),
(troop_remove_item,"trp_player","itm_jinkhaqi",1),
(display_message, "@出 口_成 功 "),
(try_end),
(else_try),
(eq, ":object", "$chukomakqin3"),
(player_has_item,"itm_jinkomgo8"),
(try_begin),
(troop_add_gold, "trp_player", "$chukojiag3"),
(troop_remove_item,"trp_player","itm_jinkomgo8",1),
(display_message, "@出 口_成 功 "),
(try_end),
(else_try),
(eq, ":object", "$chukomakqin4"),
(player_has_item,"itm_jinkobren_prone"),
(try_begin),
(troop_add_gold, "trp_player", "$chukojiag4"),
(troop_remove_item,"trp_player","itm_jinkobren_prone",1),
(display_message, "@出 口_成 功 "),
(try_end),
(else_try),
(eq, ":object", "$chukomakqin5"),
(player_has_item,"itm_jinkp"),
(try_begin),
(troop_add_gold, "trp_player", "$chukojiag5"),
(troop_remove_item,"trp_player","itm_jinkp",1),
(display_message, "@出 口_成 功 "),
(try_end),
(else_try),
(eq, ":object", "$chukohanyanzao"),
(player_has_item,"itm_hanyzx20"),
(try_begin),
(troop_add_gold, "trp_player", "$chukohanyanzao1"),
(troop_remove_item,"trp_player","itm_hanyzx20",1),
(display_message, "@出 口_成 功 "),
(try_end),
(else_try),
(eq, ":object", "$chukohan38shi"),
(player_has_item,"itm_38x20"),
(try_begin),
(troop_add_gold, "trp_player", "$chukohan38shi1"),
(troop_remove_item,"trp_player","itm_38x20",1),
(display_message, "@出 口_成 功 "),
(try_end),
(else_try),
(eq, ":object", "$chukohanlaottong"),
(player_has_item,"itm_laotaotong_daicidaox20"),
(try_begin),
(troop_add_gold, "trp_player", "$chukohanlaottong1"),
(troop_remove_item,"trp_player","itm_laotaotong_daicidaox20",1),
(display_message, "@出 口_成 功 "),
(try_end),
(else_try),
(eq, ":object", "$chukohanyz1"),
(player_has_item,"itm_hanyzx1"),############判断玩家是否有指定物品才能出口
(try_begin),############判断开始
(troop_add_gold, "trp_player", "$chukohanyz11"),##################并且把上面的价格变量也就是出口赚的钱存给玩家
(troop_remove_item,"trp_player","itm_hanyzx1",1),
(display_message, "@出 口_成 功 "),####然后移除指定物品提示出口成功,这就是简单的原理
(try_end),
#############################################机枪
(else_try),
(eq, ":object", "$chuko92shizjq"),
(player_has_item,"itm_zhanlp96"),
(try_begin),
(troop_add_gold, "trp_player", "$chuko92shizjq1"),
(troop_remove_item,"trp_player","itm_zhanlp96",1),
(display_message, "@出 口_成 功 "),
(try_end),
(else_try),
(eq, ":object", "$chukodazhengshi"),
(player_has_item,"itm_zhanlpdazhengshi"),
(try_begin),
(troop_add_gold, "trp_player", "$chukodazhengshi1"),
(troop_remove_item,"trp_player","itm_zhanlpdazhengshi",1),
(display_message, "@出 口_成 功 "),
(try_end),
(else_try),
(eq, ":object", "$chukoZB26"),
(player_has_item,"itm_zb26_deployed1"),
(try_begin),
(troop_add_gold, "trp_player", "$chukoZB261"),
(troop_remove_item,"trp_player","itm_zb26_deployed1",1),
(display_message, "@出 口_成 功 "),
(try_end),
(else_try),
(eq, ":object", "$chukoZB2612"),
(player_has_item,"itm_chi_zb261"),
(try_begin),
(troop_add_gold, "trp_player", "$chukoZB2611"),
(troop_remove_item,"trp_player","itm_chi_zb261",1),
(display_message, "@出 口_成 功 "),
(try_end),
(try_end),###结尾停止运行
])
]),
3.打开module_scripts.py添加一个新的脚本,用于存入价格发生变化
下面的全局变量就是前面UI里面写的那个价格变量原理是通过在指定的随机值里面给这个变量,然后再传给UI,如果我说的不对,大佬可以指正,谢谢
("jiagchuko",
[
(store_random_in_range, "$chukojiag6", 5800, 6900),#####
(store_random_in_range, "$chukojiag5", 5800, 6900),#####
(store_random_in_range, "$chukojiag4", 5800, 6900),#####
(store_random_in_range, "$chukojiag3", 13000, 15000),#####
(store_random_in_range, "$chukojiag2", 13000, 15000),#####
(store_random_in_range, "$chukojiag3", 13000, 15000),#####
(store_random_in_range, "$chukojiag", 13000, 15000),#####
(store_random_in_range, "$jiag", 13000, 15000),#####
(store_random_in_range, "$jiag2", 13000, 15000),#####
(store_random_in_range, "$jiag3", 13000, 15000),#####
(store_random_in_range, "$jiag4", 5800, 6900),#####
(store_random_in_range, "$jiag5", 5800, 6900),#####
(store_random_in_range, "$jiag6", 5800, 6900),#####
#################新的
(store_random_in_range, "$chuko92shizjq1", 13000, 14000),#####
(store_random_in_range, "$chukohanyanzao1", 7000, 8900),#####
(store_random_in_range, "$chukohan38shi1", 7000, 8900),#####
(store_random_in_range, "$chukohanlaottong1", 7000, 8900),#####
(store_random_in_range, "$chukodazhengshi1", 5800, 6600),#####
(store_random_in_range, "$chukoZB261", 5800, 6600),#####
(store_random_in_range, "$chukoZB2611", 5800, 6600),#####
(store_random_in_range, "$chukohanyz11", 1000, 2000),#####
]),
4.打开module_simple_triggers.py在上面一行添加
然后这里引用之前写的脚本
只不过刚开始进入游戏,如果没有等他两天刷新价格的话会显示零元,这个是我不会的地方,希望可以有大佬指导一下
(48,
[
(call_script,"script_jiagchuko"),
]),
这样就大功告成了
|