Trait which increases upkeep

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.
Post Reply
Velensk
Multiplayer Contributor
Posts: 3991
Joined: January 24th, 2007, 12:56 am

Trait which increases upkeep

Post by Velensk »

Is there a way to create a trait which increases upkeep?

I've been working on the devilings, and I would like to give the devilings upkeep without there being alot of upkeep, and I figure if I make it a trait so that olny two out of 5 devilings have this trait then that would not increase their upkeep as quickly while still allowing it to be a factor. This trait would also provide nice benifits, but if I can't get it to increase the upkeep then there is not much point.
"There are two kinds of old men in the world. The kind who didn't go to war and who say that they should have lived fast died young and left a handsome corpse and the old men who did go to war and who say that there is no such thing as a handsome corpse."

AI
Developer
Posts: 2394
Joined: January 31st, 2008, 8:38 pm

Re: Trait which increases upkeep

Post by AI »

It shouldn't be too hard to find the number of units with that trait in a side turn event, then divide it by something and subtract that from your gold, but it wouldn't show up in the upkeep.

Velensk
Multiplayer Contributor
Posts: 3991
Joined: January 24th, 2007, 12:56 am

Re: Trait which increases upkeep

Post by Velensk »

I'd like this trait to happen regaurdless of what map it is on, and that sounds like something I'd have to attach to the map. Also it does not sound like that implication would take into account the free upkeep that villages soak up. I could modify the equasion to take in the number of villages- other upkeep you have, but this seems pretty sloppy. Is there a way to build this into the trait?
"There are two kinds of old men in the world. The kind who didn't go to war and who say that they should have lived fast died young and left a handsome corpse and the old men who did go to war and who say that there is no such thing as a handsome corpse."

mihoshi
Posts: 52
Joined: February 16th, 2008, 10:18 pm

Re: Trait which increases upkeep

Post by mihoshi »

http://www.wesnoth.org/wiki/SingleUnitWML

upkeep: the amount of upkeep the unit costs.
...
An integer can be used to set the upkeep cost to that number.

Velensk
Multiplayer Contributor
Posts: 3991
Joined: January 24th, 2007, 12:56 am

Re: Trait which increases upkeep

Post by Velensk »

What I was asking was how do you get the trait to change the upkeep, there does not seem to be a way to do it through an effect.
"There are two kinds of old men in the world. The kind who didn't go to war and who say that they should have lived fast died young and left a handsome corpse and the old men who did go to war and who say that there is no such thing as a handsome corpse."

User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: Trait which increases upkeep

Post by zookeeper »

Code: Select all

[event]
    name=prerecruit
    first_time_only=no
    
    [filter]
        [wml_filter]
            [modifications]
                [trait]
                    id=more_upkeep
                [/trait]
            [/modifications]
        [/wml_filter]
    [/filter]
    
    # set upkeep to 2
    {VARIABLE unit.upkeep 2}
    
    [unstore_unit]
        variable=unit
        find_vacant=no
    [/unstore_unit]
[/event]

Velensk
Multiplayer Contributor
Posts: 3991
Joined: January 24th, 2007, 12:56 am

Re: Trait which increases upkeep

Post by Velensk »

Thanks
"There are two kinds of old men in the world. The kind who didn't go to war and who say that they should have lived fast died young and left a handsome corpse and the old men who did go to war and who say that there is no such thing as a handsome corpse."

Post Reply