Help with making abilities
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.
Help with making abilities
I've never made abilities before but I would like to try and make some for my Rise of Empires add-on. But the effects of the abilities seem to be mostly hard coded. For example I wanted to create an ability 'Legendary Aura'. Any unit attacking or being attacked by a unit with that ability that did not also have the ability would be immediately slowed however I see no way of doing this. No idea where to even begin.
Seems simple
Here's some pseudocode
Here's some pseudocode
Code: Select all
Event - attack
if
unit filter
ability=legendary aura
then
if
not
unit filter
second unit
ability=legendary aura
then
store second unit
modify stored unit variable
status=slowed
unstore unit
else
if
unit filter
second unit
ability=legendary aura
then
store unit
modify stored unit variable
status=slowed
unstore unit
- Ken_Oh
- Moderator Emeritus
- Posts: 2178
- Joined: February 6th, 2006, 4:03 am
- Location: Baltimore, Maryland, USA
A lot of abilities are hard-coded, but you can make new abilities with many effects by using [event]s.
What you want to do is make an attack event that filters for if the unit attacking or being attacked has the ability and then filters for if the second unit has the ability.
If you need wml spelled out for you and someone else doesn't just go ahead and do it for you, try looking at the Abilities Era for many event-driven abilities.
What you want to do is make an attack event that filters for if the unit attacking or being attacked has the ability and then filters for if the second unit has the ability.
If you need wml spelled out for you and someone else doesn't just go ahead and do it for you, try looking at the Abilities Era for many event-driven abilities.
Yeah, but the problem with that is that it won't show the correct damage calculations, because the damage calculations wouldn't know the unit will get slowed immediately when the fight starts.Ken Oh wrote:What you want to do is make an attack event that filters for if the unit attacking or being attacked has the ability and then filters for if the second unit has the ability.
Ideally, it'd work like this:
1. Invisible weapon specials on all the unit's attacks which halves opponent's damage. This makes damage calculations show the opponent's damage halved.
2. An attack event which slows the opponent, and deactivates the aforementioned weapon special (otherwise the opponent would only deal a quarter of its normal damage, instead of half).
3. An attack_end event which reactivates the weapon special.
4. A dummy ability tag which makes the whole feature look like an ability.
- Ken_Oh
- Moderator Emeritus
- Posts: 2178
- Joined: February 6th, 2006, 4:03 am
- Location: Baltimore, Maryland, USA
Yeah, I totally wish there was a "consider attack" event (that would necessarily need a "un-consider attack" event) to handle stuff like that.zookeeper wrote:Yeah, but the problem with that is that it won't show the correct damage calculations, because the damage calculations wouldn't know the unit will get slowed immediately when the fight starts.
You can simplify this, I think. You should be able to have the invisible weapon special filter on the opponent to check for the slow status (via a wml_filter). Then you'd only need one event to slow the opponent (which should work as either an attack or attack_end event, since either way their damage is getting halved) and wouldn't have to activate and deactivate your weapon special manually.zookeeper wrote:Ideally, it'd work like this:
1. Invisible weapon specials on all the unit's attacks which halves opponent's damage. This makes damage calculations show the opponent's damage halved.
2. An attack event which slows the opponent, and deactivates the aforementioned weapon special (otherwise the opponent would only deal a quarter of its normal damage, instead of half).
3. An attack_end event which reactivates the weapon special.
Performancewise, I'm not sure which would work better, but I suspect in either case it's probably not going to be game-killing.
True, that should work and would simplify it a bit.TL wrote:You can simplify this, I think. You should be able to have the invisible weapon special filter on the opponent to check for the slow status (via a wml_filter). Then you'd only need one event to slow the opponent (which should work as either an attack or attack_end event, since either way their damage is getting halved) and wouldn't have to activate and deactivate your weapon special manually.zookeeper wrote:Ideally, it'd work like this:
1. Invisible weapon specials on all the unit's attacks which halves opponent's damage. This makes damage calculations show the opponent's damage halved.
2. An attack event which slows the opponent, and deactivates the aforementioned weapon special (otherwise the opponent would only deal a quarter of its normal damage, instead of half).
3. An attack_end event which reactivates the weapon special.
Usually this kind of stuff doesn't really affect performance at all. Events are run pretty fast, and it's mostly the cases where you're regularly doing changes to a big number of units (like all units, or all units of your side, etc) which need some thinking.TL wrote:Performancewise, I'm not sure which would work better, but I suspect in either case it's probably not going to be game-killing.