Pr123
Regular
Hello!
I just got into modding and I have a question about this script:
Using common sense I understand that this script calculates the price for buying an item, but I would like that someone explains the script, because my programming/coding skills in python are rather poor.
First question: Does this script affect all the items in the game? So if I would like to make all items cheaper or more expensive, would it be easier to modify this script rather than all the items in module_items.py?
Second question: Do I have to modify this script or the get_trade_penalty script to make items more expensive or cheaper? Or both?
And third question: What do all these :price_factor, :penalty_factor, :trade_penalty_factor variables exactly do?
Also the fourth not-so important question: What is the easiest way to make all items cheaper/more expensive at once?
I am sorry if I sound like a complete n00b, but I just got into modifying mount and blade.
I just got into modding and I have a question about this script:
#script_game_get_item_buy_price_factor:
# This script is called from the game engine for calculating the buying price of any item.
# INPUT:
# param1: item_kind_id
# OUTPUT:
# trigger_result and reg0 = price_factor
("game_get_item_buy_price_factor",
[
(store_script_param_1, ":item_kind_id"),
(assign, ":price_factor", 100),
(call_script, "script_get_trade_penalty", ":item_kind_id"),
(assign, ":trade_penalty", reg0),
(try_begin),
(is_between, "$g_encountered_party", centers_begin, centers_end),
(is_between, ":item_kind_id", trade_goods_begin, trade_goods_end),
(store_sub, ":item_slot_no", ":item_kind_id", trade_goods_begin),
(val_add, ":item_slot_no", slot_town_trade_good_prices_begin),
(party_get_slot, ":price_factor", "$g_encountered_party", ":item_slot_no"),
(val_mul, ":price_factor", 100), #normalize price factor to range 0..100
(val_div, ":price_factor", average_price_factor),
(try_end),
(store_add, ":penalty_factor", 100, ":trade_penalty"),
(val_mul, ":price_factor", ":penalty_factor"),
(val_div, ":price_factor", 100),
(assign, reg0, ":price_factor"),
(set_trigger_result, reg0),
]),
# This script is called from the game engine for calculating the buying price of any item.
# INPUT:
# param1: item_kind_id
# OUTPUT:
# trigger_result and reg0 = price_factor
("game_get_item_buy_price_factor",
[
(store_script_param_1, ":item_kind_id"),
(assign, ":price_factor", 100),
(call_script, "script_get_trade_penalty", ":item_kind_id"),
(assign, ":trade_penalty", reg0),
(try_begin),
(is_between, "$g_encountered_party", centers_begin, centers_end),
(is_between, ":item_kind_id", trade_goods_begin, trade_goods_end),
(store_sub, ":item_slot_no", ":item_kind_id", trade_goods_begin),
(val_add, ":item_slot_no", slot_town_trade_good_prices_begin),
(party_get_slot, ":price_factor", "$g_encountered_party", ":item_slot_no"),
(val_mul, ":price_factor", 100), #normalize price factor to range 0..100
(val_div, ":price_factor", average_price_factor),
(try_end),
(store_add, ":penalty_factor", 100, ":trade_penalty"),
(val_mul, ":price_factor", ":penalty_factor"),
(val_div, ":price_factor", 100),
(assign, reg0, ":price_factor"),
(set_trigger_result, reg0),
]),
Using common sense I understand that this script calculates the price for buying an item, but I would like that someone explains the script, because my programming/coding skills in python are rather poor.
First question: Does this script affect all the items in the game? So if I would like to make all items cheaper or more expensive, would it be easier to modify this script rather than all the items in module_items.py?
Second question: Do I have to modify this script or the get_trade_penalty script to make items more expensive or cheaper? Or both?
And third question: What do all these :price_factor, :penalty_factor, :trade_penalty_factor variables exactly do?
Also the fourth not-so important question: What is the easiest way to make all items cheaper/more expensive at once?
I am sorry if I sound like a complete n00b, but I just got into modifying mount and blade.