Early finish bonus

The place to post your WML questions and answers.

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.
Post Reply
white_haired_uncle
Posts: 1223
Joined: August 26th, 2018, 11:46 pm
Location: A country place, far outside the Wire

Early finish bonus

Post by white_haired_uncle »

Two part question here. First, how do you set the amount of the early finish bonus? Or are we just stuck with

Code: Select all

const int finishing_bonus_per_turn = map.villages().size() * t.village_gold() + t.base_income();
Second, maybe answered by the first, why do the objectives say there's and early finish bonus here, but it's 0 per turn? Because there's no gold/village and no base income?

Code: Select all

const int finishing_bonus = t.carryover_bonus() * finishing_bonus_per_turn * turns_left;

Code: Select all

   [/objectives]
          [gold_carryover]
                carryover_percentage=40
                bonus=yes
            [/gold_carryover]
        [/objectives]

...

        [endlevel]
            result=victory
            bonus=yes
            {NEW_GOLD_CARRYOVER 40}
        [/endlevel]
Speak softly, and carry Doombringer.
gfgtdf
Developer
Posts: 1432
Joined: February 10th, 2013, 2:25 pm

Re: Early finish bonus

Post by gfgtdf »

I don't really understand the question (maybe i'm just tired not sure) but i want to point out that i'm currently trying to move the bonus calculation to lua see https://github.com/wesnoth/wesnoth/pull/7610 (so any input/suggestions on it is welcome)
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
white_haired_uncle
Posts: 1223
Joined: August 26th, 2018, 11:46 pm
Location: A country place, far outside the Wire

Re: Early finish bonus

Post by white_haired_uncle »

In some UMC scenarios, I noticed that the objectives said "early finish bonus", but I got a bonus of 0 per turn. So I went looking for where you set the amount of gold per turn for finishing early, but could not find it. Searching the code for the bonus message led me to the formula where it is calculated, which is based on gold per village and base income. Both are 0 in this case, so I guess this makes sense. But I was surprised that there was apparently no way to specify the value, only bonus=yes to enable it.

So I'm just wondering if I missed something, or if bonus= is the only option available.

At this point, I think the answer is to set bonus=no if you're going to have base income = gold/village = 0. But that seems odd to me, so I just want to make sure I'm not missing something.
Speak softly, and carry Doombringer.
gnombat
Posts: 710
Joined: June 10th, 2010, 8:49 pm

Re: Early finish bonus

Post by gnombat »

It's not likely a scenario designer would want to make any changes to the formula:
  1. It probably doesn't make sense to make the bonus less than what the formula gives, because a player could just grab all villages and then wait until the final turn to kill the enemy leader (or whatever the victory condition is for that scenario).
  2. It's also probably not a good idea to give more than what the formula gives, as large gold bonuses tend to be unbalancing.
Nevertheless, if a scenario designer really wanted to give the player a different bonus, I suppose it could be done using [gold]. (Also [endlevel] allows you to specify a "bonus multiple".)
white_haired_uncle wrote: July 28th, 2023, 2:06 am At this point, I think the answer is to set bonus=no if you're going to have base income = gold/village = 0. But that seems odd to me, so I just want to make sure I'm not missing something.
Yes, I think specifying bonus=no would make sense in that case. It seems that the scenario designers deliberately gave the player no income per turn, so it is likely that they do not want the player to get any early finish bonus either.
User avatar
lhybrideur
Posts: 369
Joined: July 9th, 2019, 1:46 pm

Re: Early finish bonus

Post by lhybrideur »

I had this problem in a scenario of my campaign with a bonus objective but no turn limit, so, as gnombat said, I used a [gold] at the end of the level.
Post Reply