[solved]order of processed traits

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
Mabuse
Posts: 2239
Joined: November 6th, 2007, 1:38 pm

[solved]order of processed traits

Post by Mabuse »

if i put two traits on a unit, one says

not_living=yes

the other

not_living=no

is that even possible?
what status will the unit finally have and what is responsible for that.

i guess whatever trait that is processed last, but how to influence which trait is processed last? Alphabetical order?

or will "not_living=yes" always override?

Background:
undead units are potencially better bc they are undrainable, unpoisionable etc.
i would simply add a trait which just set "undrainable=no", since being unpoisionable is advantage enough, and i my opinion you can also drain "power" from not living units so they get weaker. its just a matter how you define "drain" or what is actually being drained.

so question is if it is possible to just add a trait to every unit and be done with it or is more effort needed.


i already made a working solution for attacker hits /defnder hits that will drain undrainable units, or better heal the amount that drain would heal etc
but after all these workarounds wont go into the "prebattle calculations" which, as faulty they may be, are useful indicators nevertheless.

so every solution that would make these unuseable is bad. so i would need to adress the units directly.

and the simplest solution would be giving them all a trait
Last edited by Mabuse on July 31st, 2023, 5:40 am, edited 3 times in total.
The best bet is your own, good Taste.
User avatar
Ravana
Forum Moderator
Posts: 3018
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: order of processed traits

Post by Ravana »

They apply in the order that they are in array unit.modifications.trait. Either add them in suitable order, or manually sort them.
Mabuse
Posts: 2239
Joined: November 6th, 2007, 1:38 pm

Re: order of processed traits

Post by Mabuse »

Ravana wrote: July 28th, 2023, 12:06 pm They apply in the order that they are in array unit.modifications.trait. Either add them in suitable order, or manually sort them.
ok, so the last added counts.
fair enough :)
The best bet is your own, good Taste.
Mabuse
Posts: 2239
Joined: November 6th, 2007, 1:38 pm

Re: order of processed traits

Post by Mabuse »

Ravana wrote: July 28th, 2023, 12:06 pm They apply in the order that they are in array unit.modifications.trait. Either add them in suitable order, or manually sort them.
just for the books, adding a trait via [side][modifications] seeems to be applied before any [unit] stuff, so [unit] traits will override

either way, i was successful with adding [object] that modify unit status which seems also be more permanent since they will modify whatever happens later also
The best bet is your own, good Taste.
Post Reply