Leadership style charge ability

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
User avatar
Nyanyanyan
Posts: 41
Joined: May 11th, 2018, 10:40 pm

Leadership style charge ability

Post by Nyanyanyan »

Hi, I've been trying to make an ability that let's adjacent allies behave as if they had the charge weapon special on their attacks.

After trying it with objects, which seemed very cumbersome and event intensive I settled on doing it with a combination of [leadership] and [resistance], to mixed results.

In general my code works, but because of the different approaches for the allied an enemy damage, it seems to not be 100% consistent. As an example, sometimes, when an opponent would deal 4 damage without my unit being affected by the ability, the opponent will deal 7 damage with the ability in play, instead of the expected 8.

So far at least I have not seen a case where the same unit on both sides will deal different amounts of damage.

Here's my code:

Code: Select all

#define ABILITY_CRUEL_OFFENSIVE
    [leadership]
        id=crueloffensive
		[filter]
		side=$side_number
		[/filter]
        value=100
        cumulative=no
        name= _ "cruel offensive"
        female_name= _ "female^cruel offensive"
        description= _ "Adjacent allied units deal and receive double damage when attacking."
        affect_self=no
        [affect_adjacent]
            [filter]
			side=$other_unit.side
            [/filter]
        [/affect_adjacent]
    [/leadership]
	[resistance] 
		[filter]
		side=$side_number
		[/filter]
        id=crueldefensive
		multiply=2
		sub=50
		[affect_adjacent]
			side=$other_unit.side
		[/affect_adjacent]
    [/resistance]
	
#enddef
Any and all suggestions appreciated.
Author of Age of Lords and the Revolution and Civil War and Expendable Leaders 2 multiplayer mods.

User avatar
Ravana
Forum Moderator
Posts: 2440
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Leadership style charge ability

Post by Ravana »

1.15 supports [damage] as ability.

This resistance change will not double damage. Instead of multiplying resistance it would need to multiply vulnerability.

User avatar
lhybrideur
Posts: 129
Joined: July 9th, 2019, 1:46 pm

Re: Leadership style charge ability

Post by lhybrideur »

You can also look at charge_leadership of LotI
Here is the WML part of the code

Code: Select all

#define ABILITY_CHARGE_LEADERSHIP
	[dummy]
		id=charge_leadership
		name= _ "warlord's rule"
		female_name= _ "female^warlord's rule"
		description= _ "All nearby allies deal and take 50% more damage."
	[/dummy]
#enddef
The lua part is in stats.lua

newfrenchy83
Code Contributor
Posts: 77
Joined: October 6th, 2017, 12:57 pm

Re: Leadership style charge ability

Post by newfrenchy83 »

in 1.15.3 you can use this

Code: Select all

#define LEADERSHIP_SPECIAL_CHARGE
    # Canned definition of the Charge ability to be included in a
    # [specials] clause.
    [damage]
        id=charge
        name= _ "warlord's rule"
        female_name= _ "female^warlord's rule"
        description= _ "All nearby allies deal and take 50% more damage."
		[filter_student]
		    [filter_weapon]
			range=melee
		    [/filter_weapon]
		[/filter_student]
		active_on=offense
        multiply=2
		cumulative=no
		affect_self=no
		affect_allies=yes
		apply_to=both
		[affect_adjacent]
        [/affect_adjacent]
    [/damage]
#enddef

User avatar
Nyanyanyan
Posts: 41
Joined: May 11th, 2018, 10:40 pm

Re: Leadership style charge ability

Post by Nyanyanyan »

Thanks a lot, that [damage] ability is exactly what I've been looking for.

Is 1.15.3 the official current release that I should make my add-ons for?
Author of Age of Lords and the Revolution and Civil War and Expendable Leaders 2 multiplayer mods.

User avatar
lhybrideur
Posts: 129
Joined: July 9th, 2019, 1:46 pm

Re: Leadership style charge ability

Post by lhybrideur »

No it is a develop release.
Stable releases are even releases and develop releases are odd releases.
Latest stable is 1.14.11

Post Reply