Woden87
Recruit

I tweaked the food_consumption_display_message script to make it factor in foraging. Quite simply, it just subtracts the amount of food foraged from the :num_men divisor (and makes sure that the value is at least one), which has seemed to be accurate upon testing.
scripts.txt version:
The 14 is the number of hours between meals; you'll want to change that number if you've modified the timing with TweakMB or otherwise edited it.
module_scripts.py version:
The red lines are the ones that have been added.
scripts.txt version:
food_consumption_display_message -1
28 23 2 1224979098644774912 1 2133 2 72057594037927937 1224979098644774912 2133 2 1224979098644774913 0 1540 2 1224979098644774914 360287970189639680 6 3 1224979098644774915 0 1224979098644774914 1541 3 1224979098644774916 360287970189639680 1224979098644774915 4 0 33 3 1224979098644774916 288230376151711853 288230376151711868 1542 3 1224979098644774917 360287970189639680 1224979098644774915 2147483679 2 1224979098644774917 41 1537 3 1224979098644774918 360287970189639680 1224979098644774915 2105 2 1224979098644774913 1224979098644774918 3 0 3 0 2133 2 1224979098644774919 1224979098644774913 2107 2 1224979098644774919 14 2108 2 1224979098644774919 24 2106 2 1224979098644774912 72057594037927940 2111 2 1224979098644774912 1 2108 2 1224979098644774919 1224979098644774912 2133 2 1224979098644774920 1224979098644774919 2133 2 72057594037927938 1224979098644774920 4 0 2147483678 2 72057594037927938 4 1106 2 1585267068834415953 16711680 5 0 1106 1 1585267068834415953 3 0
The 14 is the number of hours between meals; you'll want to change that number if you've modified the timing with TweakMB or otherwise edited it.
module_scripts.py version:
插入代码块:
("food_consumption_display_message",
[
(store_script_param, ":num_men", 1),
(assign, reg1, ":num_men"),
# Display day of food left with current amount and party size
(assign, ":available_food", 0),
(troop_get_inventory_capacity, ":capacity", "trp_player"),
(try_for_range, ":cur_slot", 0, ":capacity"),
(troop_get_inventory_slot, ":cur_item", "trp_player", ":cur_slot"),
(try_begin),
(is_between, ":cur_item", food_begin, food_end),
(troop_get_inventory_slot_modifier, ":item_modifier", "trp_player", ":cur_slot"),
(neq, ":item_modifier", imod_rotten),
(troop_inventory_slot_get_item_amount, ":cur_amount", "trp_player", ":cur_slot"),
(val_add, ":available_food", ":cur_amount"),
(try_end),
(try_end),
(assign, ":num_food_hours", ":available_food"),
(val_mul, ":num_food_hours", 12),
(val_div, ":num_food_hours", 24),
[color=red][b](val_sub, ":num_men", reg4), # Factor in foraged food
(val_max, ":num_men", 1), # There will always be at least one unit consumed per day[/b][/color]
(val_div, ":num_food_hours", ":num_men"),
(assign, ":num_food_days", ":num_food_hours"),
(assign, reg2, ":num_food_days"),
(try_begin),
(lt, reg2, 4),
(display_message, "@Your party consumed {reg1} units of food{reg4?, {reg4} from foraging : }({reg2} days left).", 0xFF0000),
(else_try),
(display_message, "@Your party consumed {reg1} units of food{reg4?, {reg4} from foraging : }({reg2} days left)."),
(try_end),
]),
The red lines are the ones that have been added.