Unit stats/attributes
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.
Unit stats/attributes
Hey everyone,
I want to implement a mechanic where each unit can have a total of six stats (STR, DEX, AGI...), which will later influence other things like unit health, damage, avoid, etc. - is there a way to have each unit have its own set of such "stats", and have them assigned on recruitment, or should it be done through traits in some way?
Thanks for your help in advance.
I want to implement a mechanic where each unit can have a total of six stats (STR, DEX, AGI...), which will later influence other things like unit health, damage, avoid, etc. - is there a way to have each unit have its own set of such "stats", and have them assigned on recruitment, or should it be done through traits in some way?
Thanks for your help in advance.
Re: Unit stats/attributes
Anything that is able to apply an [effect] to units should be up for this task. This could indeed be done with a trait, or if you don't want to interfere with the existing trait system, then an [object] will do just the same.
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
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
Re: Unit stats/attributes
I think you can assign variables to units.
I don't have much experience with that, but you could look at the SyntaxWML page on the wiki.
https://wiki.wesnoth.org/SyntaxWML
Not sure how whether you could use those to affect stats or not, though. Probably, but it might take ugly hacky stuff.
I don't have much experience with that, but you could look at the SyntaxWML page on the wiki.
https://wiki.wesnoth.org/SyntaxWML
Not sure how whether you could use those to affect stats or not, though. Probably, but it might take ugly hacky stuff.
Re: Unit stats/attributes
I'm not sure what you mean. You can store a unit into a variable, and every unit contains an array of its own [variables] which can store practically anything, but those won't affect the actual stats by themselves. For that you need an [effect] applied by something, could be a trait, an object, or through [modify_unit] (not directly though, an object or an effect call is still needed inside [modify_unit], except for the list of attributes that are never reset by the game).
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
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
Re: Unit stats/attributes
That's basically what I meant.
The reason I mentioned each unit's array of [variables] (by "assign variables to units" I meant "put variables into units' arrays of variables") was that, if Arozay wants to store STR, DEX, and the rest of the values, and use them to calculate things like max movement points, max health, and damage per swing, then putting each unit's variables into its own array is probably the most organized way to do it.
If Arozay just wants to set max movement points, max health, and damage per swing to random values when a unit is recruited, then they probably just need the stuff you said.
Re: Unit stats/attributes
Thank you to you both for your accurate replies.
I'll go with Pilauli's method, as I want to put variables into arrays for further use. We'll see how it goes.
I'll go with Pilauli's method, as I want to put variables into arrays for further use. We'll see how it goes.