I want to create a simple spell, which does something to a unit, whenever it casts a spell.
Lets say, it applies a buff. Whenever the target casts a spell and has this buff, it should take damage.
This does not seem to be as simple, as it sounds. Trigger-wise, there is a "unit casts ability" - event, but it does not work for any ability; you have to select a specific one.
In data, I did not find a way to check for a spell cast at all.
As far as workarounds go, I can think of following options:
Check for an order given to a unit: Whenever a unit is ordered anything besides move, attack and stop orders, it is probably a spell. However, this triggers the moment, the order was issued, not when the spell is actually casted. This also means, it triggers when you are out of range and not even able to cast the spell.
Add every individual spell to a trigger event: I would like to avoid this; because obviously, it is a huge amount of work, very messy and hopefully unnecessary.
Add an identifying effect to each spell: Whenever a spell is cast, this effect will be executed first. This can be used as an indicator for a trigger or to execute the damage effect directly. Again, I would like to avoid this, because it would require modifying all existing spells.
Check for instances of spell damage: This would be very unclean, because some spells will cause damage multiple times, some do not cause damage at all, some might not cause spell damage or spell damage could be caused without actually casting an active ability.
Am I missing an obvious alternative? Please, let me know, if you know a different way of realizing this, data or trigger.
Could have it that all spells have a component that damages the caster and has a validator which checks for that buff. That would mean if the unit does not have the buff the self damage is prevented.
Rollback Post to RevisionRollBack
Contribute to the wiki (Wiki button at top of page) Considered easy altering of the unit textures?
Still would require to modify every single ability. Also, I might want different effects and possibly multiple spells triggering on cast, which would require to add every single one of those spell effects to all existing spells.
Make a set effect for every ability, which includes a second set effect and the ability effect.
Put anything you want into this second set, as it will proc every time any ability is used without having to resort to triggers or having to alter existing spells.
Basically;
Ability -> Ability specific set -> Generic set + ability effects
So you are saying, to avoid altering all existing spells, I should alter all existing spells? ;)
I am aware of this possibility, but as mentioned, I would like to avoid it. If there is no other way, I will use one of the mentioned possibilities, but I would like to know, if there is another one I missed.
Could always get the spells to add a buff which tells other stuff that a spell has been cast which other buffs can count via validators and the buff has a low duration.
All it needs is to throw in a Set effect at the start of the effect tree of each spell that then uses Apply Behavior to apply the has been cast buff.
Hey.
I want to create a simple spell, which does something to a unit, whenever it casts a spell.
Lets say, it applies a buff. Whenever the target casts a spell and has this buff, it should take damage.
This does not seem to be as simple, as it sounds. Trigger-wise, there is a "unit casts ability" - event, but it does not work for any ability; you have to select a specific one.
In data, I did not find a way to check for a spell cast at all.
As far as workarounds go, I can think of following options:
Am I missing an obvious alternative? Please, let me know, if you know a different way of realizing this, data or trigger.
Could have it that all spells have a component that damages the caster and has a validator which checks for that buff. That would mean if the unit does not have the buff the self damage is prevented.
Contribute to the wiki (Wiki button at top of page) Considered easy altering of the unit textures?
https://www.sc2mapster.com/forums/resources/tutorials/179654-data-actor-events-message-texture-select-by-id
https://media.forgecdn.net/attachments/187/40/Screenshot2011-04-17_09_16_21.jpg
Still would require to modify every single ability. Also, I might want different effects and possibly multiple spells triggering on cast, which would require to add every single one of those spell effects to all existing spells.
Make a set effect for every ability, which includes a second set effect and the ability effect.
Put anything you want into this second set, as it will proc every time any ability is used without having to resort to triggers or having to alter existing spells.
Basically;
Ability -> Ability specific set -> Generic set + ability effects
So you are saying, to avoid altering all existing spells, I should alter all existing spells? ;)
I am aware of this possibility, but as mentioned, I would like to avoid it. If there is no other way, I will use one of the mentioned possibilities, but I would like to know, if there is another one I missed.
Added the bolded parts, and yes, that's what I'm saying. There's no other clean way of doing it to my knowledge.
Could always get the spells to add a buff which tells other stuff that a spell has been cast which other buffs can count via validators and the buff has a low duration.
All it needs is to throw in a Set effect at the start of the effect tree of each spell that then uses Apply Behavior to apply the has been cast buff.
Contribute to the wiki (Wiki button at top of page) Considered easy altering of the unit textures?
https://www.sc2mapster.com/forums/resources/tutorials/179654-data-actor-events-message-texture-select-by-id
https://media.forgecdn.net/attachments/187/40/Screenshot2011-04-17_09_16_21.jpg