nightstormer
Regular

I am new to Python and Warband, but I am not new to scripting as a concept as I have done mods for other games before. Though, I find it wee bit harder to get used to Python but I guess that's something I will overcome. But....I decided to start with something apparently simple, as I've read people have done it with M&B. I want to add a simple trigger to make Mills add 5% every month and not just one time. I know it has already been done, but I can't seem to find any code for it, so I do this for learning purposes and humbly ask the people here which approach (if any) is correct.
I have used the #Schools entry as a template, in simple_triggers
First option:
I am not sure, but I feel this would just add 5 every month and not 5% so next option was this:
In my mind, at the moment, it looks like it divides the current prosperity by 100 and multiplies that with 5. Which sounds better, but I am not familiar with how this game handles the numbers, yet.
Also, as I used #Schools as a template I still have (val_min, ":prosperity", 100), there, but I am not quite sure if it is needed or what it does?
I am sorry if this is a very trivial question, but I really would like to learn how to write scripts and mod this excellent game. I look forward, and hope, to any feedback anyone can offer.
I have used the #Schools entry as a template, in simple_triggers
First option:
Code:
# Mill
(30 * 24,
[(try_for_range, ":cur_village", villages_begin, villages_end),
(party_slot_eq, ":cur_village", slot_town_lord, "trp_player"),
(party_slot_eq, ":cur_village", slot_center_has_fish_pond, 1),
(party_get_slot, ":prosperity", ":cur_village", slot_town_prosperity),
(val_add, ":prosperity", 5),
(val_min, ":prosperity", 100),
(party_set_slot, ":cur_village", slot_town_prosperity, ":prosperity"),
(try_end),
]),
I am not sure, but I feel this would just add 5 every month and not 5% so next option was this:
Code:
# Mill
(30 * 24,
[(try_for_range, ":cur_village", villages_begin, villages_end),
(party_slot_eq, ":cur_village", slot_town_lord, "trp_player"),
(party_slot_eq, ":cur_village", slot_center_has_fish_pond, 1),
(party_get_slot, ":prosperity", ":cur_village", slot_town_prosperity),
(val_div, ":prosperity", 100),
(val_mul, ":prosperity", 5),
(val_min, ":prosperity", 100),
(party_set_slot, ":cur_village", slot_town_prosperity, ":prosperity"),
(try_end),
]),
In my mind, at the moment, it looks like it divides the current prosperity by 100 and multiplies that with 5. Which sounds better, but I am not familiar with how this game handles the numbers, yet.
Also, as I used #Schools as a template I still have (val_min, ":prosperity", 100), there, but I am not quite sure if it is needed or what it does?
I am sorry if this is a very trivial question, but I really would like to learn how to write scripts and mod this excellent game. I look forward, and hope, to any feedback anyone can offer.