Can't get sides' income.
Moderator: Forum Moderators
Forum rules
- Please use [code] BBCode tags in your posts for embedding WML snippets.
- To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Can't get sides' income.
I couldn't figure out how to retrieve the income modifier information of a side. The only way I know to do it is by using [store_side], but I get a income number that varies with the captured village number.
I was merely trying to do some simple things like modify a side's income by a permanent number, say +4. But I can't make it.
I was merely trying to do some simple things like modify a side's income by a permanent number, say +4. But I can't make it.
Re: Can't get sides' income.
[store_side] and [modify_side]'s incomes seem to behave differently. [store_side] gets TOTAL income, and [modify_side] seems to require "BASE income minus 2" (set it to 0 and you have 2 income). If what I did for my mod can help...Xara wrote:I couldn't figure out how to retrieve the income modifier information of a side. The only way I know to do it is by using [store_side], but I get a income number that varies with the captured village number.
I was merely trying to do some simple things like modify a side's income by a permanent number, say +4. But I can't make it.
[store_side] gets those income_related variables;
- side.income: the side's total income.
- side.village_gold: the side's gold per village (2 in most of MP games, 1 in most of campaigns)
- side.village_support: the side's upkeep support per village (almost always 1)
I couldn't get the side's base income, so I used [store_villages] and location.owner_side (there could be a better solution). I'm not sure this would work with upkeep.
Here's a (modified) copy of the relevant part.
Code: Select all
[store_side]
side=$side_number
variable=current_side
[/store_side]
{VARIABLE current_income $current_side.income}
{VARIABLE current_village_gold $current_side.village_gold}
{VARIABLE current_village_support $current_side.village_support}
{VARIABLE village_gold_neg $current_village_gold}
{VARIABLE_OP village_gold_neg multiply -1}
[store_villages]
variable=villages_map
[/store_villages]
{FOREACH villages_map i}
[if]
[variable]
name=villages_map[$i].owner_side
equals=$current_side.side
[/variable]
[then]
{VARIABLE_OP current_income add $village_gold_neg}
[/then]
[/if]
{NEXT i}
My MP Eras and Mods with core units and unusual gameplay (version 1.3.1 for Wesnoth 1.12)
Re: Can't get sides' income.
Many thanks! I thought about calculating the true value, but I think it's too troublesome. Very nice to be able to use your codes.