1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still haven't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. Lead your forces to battle in the 15th Techtree Contest. The call is yours, commander!
    Dismiss Notice
  4. The reforging of the races is complete. Come see the 14th Techtree Contest Results.
    Dismiss Notice
  5. It's time to choose your horse in the race - the 32nd Modeling Contest Poll is up!
    Dismiss Notice
  6. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

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

Discussion in 'World Editor Help Zone' started by Impereal Gardian, Jun 4, 2014.

  1. Impereal Gardian

    Impereal Gardian

    Joined:
    Dec 11, 2010
    Messages:
    100
    Resources:
    0
    Resources:
    0
    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:
     
  2. Strikest

    Strikest

    Joined:
    Aug 27, 2012
    Messages:
    338
    Resources:
    1
    Maps:
    1
    Resources:
    1
    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
     
  3. Impereal Gardian

    Impereal Gardian

    Joined:
    Dec 11, 2010
    Messages:
    100
    Resources:
    0
    Resources:
    0
    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: Jun 4, 2014
  4. Nichilus

    Nichilus

    Joined:
    Sep 26, 2009
    Messages:
    1,994
    Resources:
    0
    Resources:
    0
    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.
     
  5. edo494

    edo494

    Joined:
    Apr 16, 2012
    Messages:
    3,846
    Resources:
    5
    Spells:
    1
    JASS:
    4
    Resources:
    5
    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)
     
  6. Impereal Gardian

    Impereal Gardian

    Joined:
    Dec 11, 2010
    Messages:
    100
    Resources:
    0
    Resources:
    0
    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