• 🏆 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!

[Spell] Abilities Help (Will probably add to this a lot)

Status
Not open for further replies.
Level 5
Joined
Dec 11, 2010
Messages
101
Hi, okay so my problem is that

  • ManaOverload1
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • ((Ability being cast) Equal to Mana Overload ) and ((Level of Mana Overload for (Casting unit)) Equal to 1)
    • Actions
      • Wait 4.00 seconds
      • Unit - Set mana of (Target unit of ability being cast) to ((Mana of (Target unit of ability being cast)) + 60.00)
The spell is supposed to give a debuff to a target unit, be it ally or enemy, and slow them for 4 seconds. After the 4 seconds is up, it gives them +mana.
Problem is, the mana addition is never added. Did i do something wrong? I know its simple, I'm not too great with triggers abilities.

The spell is based off of Shadow Strike, if that helps any.

Thanks :eek:
 
Well first of all, you're using waits, which are inaccurate. And if multiple units cast that spell, they will overwrite the variables, causing it to not work.

But if it's only one unit casting it, the reason it doesn't work might be because the mana of the target unit +60 is greater than the maximum mana of the unit, which means the trigger won't work, because you can't set the mana of a unit to something greater than its maximum mana.

You'd have to do something like,

If Mana of Target Unit +60 is greater than max mana of the unit,

set mana of unit to maximum mana

else

set mana to mana of unit +60
 
Level 5
Joined
Dec 11, 2010
Messages
101
I had it work a different way.

If i remove the delay on the +60 mana, it works perfectly fine, and the unit will gain +60 mana. It also wont go over the cap limit either if the Wait command is removed.

Example: This works, the unit gets mana instantly, doesn't exceed cap limit.
But i need a delay :(

  • ManaOverload1
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • ((Ability being cast) Equal to Mana Overload ) and ((Level of Mana Overload for (Casting unit)) Equal to 1)
    • Actions
      • Unit - Set mana of (Target unit of ability being cast) to ((Mana of (Target unit of ability being cast)) + 60.00)
Edit: Only 1 hero has the ability, not multiple units.
 
Last edited:
Level 23
Joined
Apr 16, 2012
Messages
4,041
it may be that the "target unit of ability being cast" is lost after wait.
Try to save the unit before hand into variable.
You could make a simple indexing system using 2 indexes, which should work with the wait.

very correct. Only one(maybe few more) callback is saved locally to the running execution, which is GetTriggerUnit, which is Get Triggering Unit. This will return the triggering unit even after Wait. Im pretty sure all other event callbacks are lost(Event Responses)
 
Level 5
Joined
Dec 11, 2010
Messages
101
Thanks :eek:

  • ManaOverload1
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • ((Ability being cast) Equal to Mana Overload ) and ((Level of Mana Overload for (Casting unit)) Equal to 1)
    • Actions
      • Set Unit = (Target unit of ability being cast)
      • Wait 4.00 seconds
      • Unit - Set mana of Unit to ((Mana of Unit) + 60.00)
I think I'm starting to understand variables now
 
Status
Not open for further replies.
Top