Is there a way to change an attack's range?
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.
Is there a way to change an attack's range?
As in, change an existing ranged attack into a melee attack? Or even a user-defined range?
Re: Is there a way to change an attack's range?
This is how I did it. Within
I don't know how to literally change "an existing ranged attack into a melee attack," though.
[unit_type]
, I gave my custom unit two identical attacks, except one was range=melee
and one was range=ranged
. That way, no matter how the unit was attacked, it would counter-attack with the same weapon.I don't know how to literally change "an existing ranged attack into a melee attack," though.
Author of:
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
- beetlenaut
- Developer
- Posts: 2814
- Joined: December 8th, 2007, 3:21 am
- Location: Washington State
- Contact:
Re: Is there a way to change an attack's range?
The mechanism for doing this sort of thing is [object]. You give a unit a virtual object that can have a huge range of possible effects which are defined in the object's [effect] section. I would probably do this by defining two attack objects using a macro and adding or removing them as needed.
Working with objects this way can be a little complicated, so do it in small steps. The objects, effects, filters, attacks and so on can mostly be written and tested independently, and not combined until you have verified that each one works on its own.
Working with objects this way can be a little complicated, so do it in small steps. The objects, effects, filters, attacks and so on can mostly be written and tested independently, and not combined until you have verified that each one works on its own.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
- Celtic_Minstrel
- Developer
- Posts: 2166
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: Is there a way to change an attack's range?
It looks like it was never documented until today, but the following works in an
[object]
:Code: Select all
[effect]
apply_to=attack
# filter the attack to modify here
set_range=melee
[/effect]