weaker versions of fearless trait

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
Numero
Posts: 58
Joined: August 7th, 2018, 2:11 pm

weaker versions of fearless trait

Post by Numero »

How can I implement a weaker version of fearless? that only reduces the penalty by 5 percent (so if the time of day says -15 it would become -10)? if it helps, the trait will only effect units that have a penalty during day time

Code: Select all

            [trait]
                id=lionhearted
                male_name=_ "lionhearted"
                description=_ "Day-time fighting penalty is reduced by 5 percent"
                help_text=_ "Having seen a long time fighting companion die, these individuals took heart and started fighting with even more valor no matther the circumstance."
                [effect]
                    apply_to="fearless"
                [/effect]
            [/trait]
Author of 'An Orcish Might' viewtopic.php?t=57032
User avatar
Lord-Knightmare
Discord Moderator
Posts: 2460
Joined: May 24th, 2010, 5:26 pm
Location: Somewhere in the depths of Irdya, gathering my army to eventually destroy the known world.
Contact:

Re: weaker versions of fearless trait

Post by Lord-Knightmare »

I do not think this is possible with just trait WML as fearless is done at the engine level

Code: Select all

	/** Gets whether this unit is fearless - ie, unaffected by time of day. */
	bool is_fearless() const
	{
		return is_fearless_;
	}
What I can suggest instead is adding custom illumination ability to adjust the ToD bonus to your preference.
Creator of "War of Legends"
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
Numero
Posts: 58
Joined: August 7th, 2018, 2:11 pm

Re: weaker versions of fearless trait

Post by Numero »

hmm I've tried this now, but I am not entirely happy

Code: Select all

            [trait]
                id=lionhearted
                male_name=_ "lionhearted"
                description=_ "Day-time fighting penalty is reduced by 5 percent"
                help_text=_ "Having seen a long time fighting companion die, these individuals took heart and started fighting with even more valor no matter the circumstance."
                [effect]
                    apply_to=new_ability
                    [abilities]
                        [leadership]
                            [filter_condition]
                                [lua]
                                    code=<< return ((wesnoth.get_variable(("turn_number" mod 24) < 4)) || wesnoth.get_variable(("turn_number" mod 24) > 13) ) >>
                                [/lua]
                            [/filter_condition]
                            id=motivated_v1
                            value=5
                            cumulative=no
                            name= _ ""
                            description= _ ""
                            affect_self=yes
                            affect_allies=no
                        [/leadership]
                    [/abilities]
                [/effect]                
                [effect]
                    apply_to=remove_ability
                    [experimental_filter_ability]
                        id=motivated_v2
                    [/experimental_filter_ability]
                [/effect]                
                [effect]
                    apply_to=remove_ability
                    [experimental_filter_ability]
                        id=motivated_v3
                    [/experimental_filter_ability]
                [/effect]
            [/trait]
Author of 'An Orcish Might' viewtopic.php?t=57032
Post Reply