"upkeep=free" problem

The place to post your WML questions and answers.

Moderators: Forum Moderators, Developers

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.
serclino
Posts: 9
Joined: May 18th, 2018, 9:54 pm

"upkeep=free" problem

Post by serclino » September 26th, 2019, 10:12 am

Hi, I'm developing my first campaign and I would like to set some of my units to zero upkeep cost. I don't want to use {TRAIT_LOYAL}, because it will cost me one slot of unit's attributes.

So instead of that I tried "upkeep=free". It works fine until the unit levels up. Then it starts pay his/her upkeep.

Any tips, please?

User avatar
WhiteWolf
Forum Regular
Posts: 557
Joined: September 22nd, 2009, 7:48 pm
Location: Hungary

Re: "upkeep=free" problem

Post by WhiteWolf » September 26th, 2019, 10:26 am

The upkeep key is generally not for the coder to mess with, as far as I know. Other background mechanisms access it, that's why it resets. Instead, you could use an object set a unit to loyal "silently" (without the visible trait).

Code: Select all

		[unit]
			# unit values
			[modifications]
				[object]
					id=loyalty
					[effect]
						apply_to=loyal
					[/effect]
				[/object]
			[/modifications]
		[/unit]
Author of the Underness Series, consisting of V parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
Standalone works: The Ravagers - now for 1.14, with new bugs!

gfgtdf
Developer
Posts: 1189
Joined: February 10th, 2013, 2:25 pm

Re: "upkeep=free" problem

Post by gfgtdf » September 26th, 2019, 11:06 am

serclino wrote:
September 26th, 2019, 10:12 am
I don't want to use {TRAIT_LOYAL}, because it will cost me one slot of unit's attributes.
Yes what white wolf said does work, but I'm curious why is it a problem for you if it costs one of the units "attributes"? There is no limit on how many attributes a unit can have.
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.

serclino
Posts: 9
Joined: May 18th, 2018, 9:54 pm

Re: "upkeep=free" problem

Post by serclino » September 26th, 2019, 12:45 pm

WhiteWolf: Thank you, sir! This is exactly what I was looking for.

gfgtdf: I know. It's just cosmetic thing for me. I don't like unit's description, where there are more than two attributes, because then the game displays three dots ("...") - due to the long text.
Last edited by serclino on October 11th, 2019, 5:38 pm, edited 2 times in total.

serclino
Posts: 9
Joined: May 18th, 2018, 9:54 pm

Re: "upkeep=free" problem

Post by serclino » September 26th, 2019, 12:51 pm

One more question, guys: Can I set up base_income to 0?

User avatar
WhiteWolf
Forum Regular
Posts: 557
Joined: September 22nd, 2009, 7:48 pm
Location: Hungary

Re: "upkeep=free" problem

Post by WhiteWolf » September 26th, 2019, 1:27 pm

I'm not sure what you mean. base_income is a key inside game_config.cfg (described here), not in scenarios. If you want to set a side's income to 0, use [side] income=-2 instead. (since base income is +2, and side income is added to that).
Author of the Underness Series, consisting of V parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
Standalone works: The Ravagers - now for 1.14, with new bugs!

serclino
Posts: 9
Joined: May 18th, 2018, 9:54 pm

Re: "upkeep=free" problem

Post by serclino » September 26th, 2019, 1:33 pm

Yes, this is what I wanted. Thanks again!

User avatar
josteph
Developer
Posts: 738
Joined: August 19th, 2017, 6:58 pm

Re: "upkeep=free" problem

Post by josteph » September 26th, 2019, 2:27 pm

serclino wrote:
September 26th, 2019, 12:45 pm
gfgtdf: I know. It's just cosmetic thing for me. I don't like unit's description, where there are more than two attributes, because then the game displays three dots ("...") - due to the long text.
You're right about the sidebar, but having the extra trait (what you call "attributes" is actually called "traits" in English) is important in the recall dialog. In the recall dialog, you can type loyal in the textbox to filter for units that have the loyal trait. The filter doesn't look in objects, only in the unit name, type name, level and traits, so if you give units the object and the overlay only, it'll be harder to recall them.

serclino
Posts: 9
Joined: May 18th, 2018, 9:54 pm

Re: "upkeep=free" problem

Post by serclino » September 27th, 2019, 12:37 pm

josteph: Thx, good to know.

User avatar
Celtic_Minstrel
Developer
Posts: 1522
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: "upkeep=free" problem

Post by Celtic_Minstrel » October 3rd, 2019, 4:20 am

WhiteWolf wrote:
September 26th, 2019, 1:27 pm
I'm not sure what you mean. base_income is a key inside game_config.cfg (described here), not in scenarios. If you want to set a side's income to 0, use [side] income=-2 instead. (since base income is +2, and side income is added to that).
Doesn't base_income= also work in the scenario tag? As I understand it, the MP creation screen directly injects keys like this into the scenario based on the settings you choose, so it should work? (Though it's always possible the key is different than it would be in the game config file.)
Author of The Black Cross of Aleron campaign and Default++ era.
Maintainer of Steelhive.

User avatar
WhiteWolf
Forum Regular
Posts: 557
Joined: September 22nd, 2009, 7:48 pm
Location: Hungary

Re: "upkeep=free" problem

Post by WhiteWolf » October 7th, 2019, 7:34 pm

Celtic_Minstrel wrote:
October 3rd, 2019, 4:20 am
Doesn't base_income= also work in the scenario tag?
Well, it is not mentioned in the scenario wiki, and I never tried to use such key there, so I honestly don't know. I could test it some time if I don't forget.
Author of the Underness Series, consisting of V parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
Standalone works: The Ravagers - now for 1.14, with new bugs!

User avatar
Celtic_Minstrel
Developer
Posts: 1522
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: "upkeep=free" problem

Post by Celtic_Minstrel » October 8th, 2019, 12:44 pm

It's not documented in the schema either, so I could be wrong... maybe the MP creation screen just injects the income key into every side.
Author of The Black Cross of Aleron campaign and Default++ era.
Maintainer of Steelhive.

User avatar
WhiteWolf
Forum Regular
Posts: 557
Joined: September 22nd, 2009, 7:48 pm
Location: Hungary

Re: "upkeep=free" problem

Post by WhiteWolf » October 8th, 2019, 2:52 pm

I tried it today on 1.14.5, base_income does nothing inside [scenario], so the MP screen probably works differently. Could it be a room for improvement then, that the [scenario] tag should accept base_income?
Author of the Underness Series, consisting of V parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
Standalone works: The Ravagers - now for 1.14, with new bugs!

User avatar
Ravana
Forum Moderator
Posts: 2242
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: "upkeep=free" problem

Post by Ravana » October 8th, 2019, 3:04 pm

wesnoth.game_config says base_income: integer (read/write). That does not work then?

That changes base_income. If you say what your goal is, doing that might be possible with WML too.

User avatar
WhiteWolf
Forum Regular
Posts: 557
Joined: September 22nd, 2009, 7:48 pm
Location: Hungary

Re: "upkeep=free" problem

Post by WhiteWolf » October 8th, 2019, 6:05 pm

It doesn't seem to be recognized inside [scenario].
I don't have goals here, and we strayed way off the original topic, I was just merely wondering if having the option to set base_income in [scenario] could be more convenient than having to set income for each side one by one, if for example, someone wants all sides to have +8 income :)
Author of the Underness Series, consisting of V parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
Standalone works: The Ravagers - now for 1.14, with new bugs!

Post Reply