"upkeep=free" problem

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

"upkeep=free" problem

Post by serclino »

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 Moderator
Posts: 769
Joined: September 22nd, 2009, 7:48 pm
Location: Hungary

Re: "upkeep=free" problem

Post by WhiteWolf »

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]
Main UMC campaigns: The Ravagers - now for 1.16, with new bugs!
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
gfgtdf
Developer
Posts: 1432
Joined: February 10th, 2013, 2:25 pm

Re: "upkeep=free" problem

Post by gfgtdf »

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

Re: "upkeep=free" problem

Post by serclino »

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

Re: "upkeep=free" problem

Post by serclino »

One more question, guys: Can I set up base_income to 0?
User avatar
WhiteWolf
Forum Moderator
Posts: 769
Joined: September 22nd, 2009, 7:48 pm
Location: Hungary

Re: "upkeep=free" problem

Post by WhiteWolf »

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).
Main UMC campaigns: The Ravagers - now for 1.16, with new bugs!
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
serclino
Posts: 40
Joined: May 18th, 2018, 9:54 pm

Re: "upkeep=free" problem

Post by serclino »

Yes, this is what I wanted. Thanks again!
User avatar
josteph
Inactive Developer
Posts: 741
Joined: August 19th, 2017, 6:58 pm

Re: "upkeep=free" problem

Post by josteph »

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

Re: "upkeep=free" problem

Post by serclino »

josteph: Thx, good to know.
User avatar
Celtic_Minstrel
Developer
Posts: 2166
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: "upkeep=free" problem

Post by Celtic_Minstrel »

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.
Former maintainer of Steelhive.
User avatar
WhiteWolf
Forum Moderator
Posts: 769
Joined: September 22nd, 2009, 7:48 pm
Location: Hungary

Re: "upkeep=free" problem

Post by WhiteWolf »

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.
Main UMC campaigns: The Ravagers - now for 1.16, with new bugs!
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
User avatar
Celtic_Minstrel
Developer
Posts: 2166
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: "upkeep=free" problem

Post by Celtic_Minstrel »

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.
Former maintainer of Steelhive.
User avatar
WhiteWolf
Forum Moderator
Posts: 769
Joined: September 22nd, 2009, 7:48 pm
Location: Hungary

Re: "upkeep=free" problem

Post by WhiteWolf »

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?
Main UMC campaigns: The Ravagers - now for 1.16, with new bugs!
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
User avatar
Ravana
Forum Moderator
Posts: 2949
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: "upkeep=free" problem

Post by Ravana »

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 Moderator
Posts: 769
Joined: September 22nd, 2009, 7:48 pm
Location: Hungary

Re: "upkeep=free" problem

Post by WhiteWolf »

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 :)
Main UMC campaigns: The Ravagers - now for 1.16, with new bugs!
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
Post Reply