1. Find your way through the deepest dungeon in the 18th Mini Mapping Contest Poll.
    Dismiss Notice
  2. A brave new world lies beyond the seven seas. Join the 34th Modeling Contest today!
    Dismiss Notice
  3. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
Hive 3 Remoosed BETA - NOW LIVE. Go check it out at BETA Hive Workshop! Post your feedback in this new forum BETA Feedback.
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[Spell] Recreating Arrow Spells' Mana Cost

Discussion in 'World Editor Help Zone' started by Kaijyuu, May 29, 2018.

  1. Kaijyuu

    Kaijyuu

    Joined:
    Jun 2, 2004
    Messages:
    848
    Resources:
    0
    Resources:
    0
    So my ultimate goal is getting Arrow spells (Searing, Black, Incinerate, Cold, Orb of Annihilation) to work with Barrage. This of course requires triggering the whole damn thing.

    I can make the toggle work. I can make the damage on hit work with a damage engine. I can check the unit's mana.

    What I can't do is the mana cost, and am needing suggestions on how to accomplish it. Ideally I'd like to somehow detect the attack launching, which is difficult to do for ranged attackers. But if I could get that, then I could hack together something that works 99% of the time.

    So yeah, suggestions? Please list implementation details and potential pitfalls if you've got any.
     
  2. Jampion

    Jampion

    JASS Reviewer

    Joined:
    Mar 25, 2016
    Messages:
    1,287
    Resources:
    0
    Resources:
    0
    At the moment there is no attack launched event.

    I don't fully understand, how you are doing it so far.
    What base spell are you using? Do you want to use the Barrage ability?

    An idea:
    use arrow ability as base
    use high missile speed, so attacking is almost instant. Use damage engine to set damage to 0, detect buff (frost arrow as base ability) and remove buff
    This emulates the attack launched event.
    You can no longer use the barrage ability, but you will trigger the missiles instead.
    Problems: how much damage will the triggered missiles do? If you base it on the damage dealt originally to the target, you have problems if the original target has spirit link, Hardened Skin or other damage modifiers. Armor can ba calculated, though I think it could be more difficult with negative armor. Anyway lots of problems.
    mana would work natively as with all arrow abilities
     
  3. Kaijyuu

    Kaijyuu

    Joined:
    Jun 2, 2004
    Messages:
    848
    Resources:
    0
    Resources:
    0
    I'm using Barrage. I feel recreating that would be harder than the other way around. Plus it would have similar problems with detecting attach launch to make the projectiles.

    I've several Barrage abilities I dynamically add to the unit to make the missile art work. I can also do the effects of the arrow spells pretty easily, since I know how many barrage missiles will fire and can just do their effects on the next X auto attack damage events.

    Unfortunately BlzGetUnitAttackCooldown doesn't include modifiers, or I could use a timer after an Attacked event and subtract the mana cost if no attack cancelling orders or death had occurred in the meantime. Keeping track of attack speed bonuses manually would be awful too. I may have to though.
     
  4. ZiBitheWand3r3r

    ZiBitheWand3r3r

    Joined:
    Nov 21, 2012
    Messages:
    919
    Resources:
    15
    Maps:
    7
    Spells:
    8
    Resources:
    15
    Subtract mana at the moment when enemies takes damage maybe?
     
  5. Kaijyuu

    Kaijyuu

    Joined:
    Jun 2, 2004
    Messages:
    848
    Resources:
    0
    Resources:
    0
    TBH that would be worse than subtracting it during the Attacked event.
     
  6. ZiBitheWand3r3r

    ZiBitheWand3r3r

    Joined:
    Nov 21, 2012
    Messages:
    919
    Resources:
    15
    Maps:
    7
    Spells:
    8
    Resources:
    15
    Depending on attack speed modifiers the time diffrence between "unit attacked" event and "mana loss" event is 0.13sec (high AS) to 0.19sec. At least on my laptop.
    When "unit attacked" is fired remember game time, then on "mana loss" event check if time diffrence is not more then 0.19sec. Also if mana loss value is ~8 (for searing arrow) we can be almost be sure then we catch the moment when mana was deducted by using searing arrow.
    Here is mana change event by Wietlol:Detect mana loss?
    Maybe this give you ideas how to accomplish your system.