• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Why doesn't this work?

Status
Not open for further replies.
Level 6
Joined
Jul 21, 2019
Messages
168
Hey there, i made an ability that reduces the armor of the target for a set amount of seconds, i'm using a trick where i add a negative armor bonus to the target in order to reduce its armor, then i place a wait before removing it, but for some reason the ability stays forever

Here is the trigger:
  • Pierce LVL 1
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Pierce
      • (Level of Pierce for (Triggering unit)) Equal to 1
    • Actions
      • Unit - Add Pierce LVL 1 Spellbook to (Target unit of ability being cast)
      • Wait 3.00 game-time seconds
      • Unit - Remove Pierce LVL 1 Spellbook from (Target unit of ability being cast)
The trigger adds the neagtive ability to the unit, but it never removes it, i have no idea why

Help please
 
Level 7
Joined
Apr 17, 2017
Messages
316
Things like Target unit of ability being cast, trained unit and so on lose their reference after waits. so you need to save that target unit of ability being cast to a variable. If you want it to be MUI, you can use local variables.
 
Level 4
Joined
Feb 11, 2020
Messages
61
Event Response Myths explains which work after waits and in what capacity.

This spell would be more simply achieved by creating a dummy Inner Fire-based ability that reduces armor for 3 seconds, then dummy casting it on the target.

This 100% I have had so many problems with
  • Wait 3.00 game-time seconds
for some reason, it seems that some of the actions are called in a strange order per the actual selection in-game,
 
Level 12
Joined
Feb 5, 2018
Messages
521
  • Melee Initialization
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Level of YourSpell for (Triggering unit)) Equal to 1
      • (Ability being cast) Equal to YourSpell
    • Actions
      • Custom script: local unit udg_YourTarget
      • Custom script: local real udg_YourTime
      • Custom script: set udg_YourTarget = GetSpellTargetUnit()
      • Custom script: set udg_YourTime = 3
      • Unit - Add Item Armor Bonus (+3) to YourTarget
      • Wait YourTime game-time seconds
      • Unit - Remove Item Armor Bonus (+3) from YourTarget
      • Custom script: set udg_YourTarget = null
This should work, if you didn't make it already.
 
Level 12
Joined
Feb 5, 2018
Messages
521
Triggering Unit is wait-safe and there’s no reason to use a local to store the duration. The trigger can be done without any of the locals.

Only that here he wants to refer to target unit of ability being cast and not triggering unit. You don't want to give the poor caster -3 armor now, do you? :)

Also done with locals like this it's MUI. Which I think was one of the things he wanted to achieve.
 
Level 38
Joined
Feb 27, 2007
Messages
4,951
You're correct that I didn't read the line properly. However, this armor reduction can still be done without the locals and waiting by:
  • a dummy unit that can instantly attack (see dummies that can instantly cast) with an orb of corruption ability
  • dummy casting a modified Faerie Fire on the target (FF can reduce armor).
Sometimes the simplest solution is best. This way will provide a buff to show their armor has been reduced.
 
Level 12
Joined
Feb 5, 2018
Messages
521
@Pyrogasm Does buffs outside of auras stack now?

Creating abilities 1, 2 and 3 with Faerie Fire

Ability 1: Reduces armor by 5
Ability 2: Reduces armor by 3
Ability 3: Reduces armor by 2

So now if the unit had all the negative buffs would the unit have -10 armor?

If my memory is not horribly failing, people used to use aura abilities and hide them, because a buff wouldn't stack, even if you changed the buff field in the object editor.

If they made some improvements regarding this manner and you can actually now stack buffs (outside of auras), then great! :D
 
Status
Not open for further replies.
Top