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

How do I do this?

Status
Not open for further replies.
Level 2
Joined
Dec 15, 2016
Messages
21
A friend (well, not yet actually) suggested me an ability for a goblin spell-casting type unit. Although I tried everything I can, I tried every nook and cranny I know about trigger editor but nothing seems to work, here's the ability he suggested:

Ability - Not me, YOU! - Explode target allied unit, dealing its remaining health or 50% of its remaining mana as damage in a medium-small AoE, whichever is higher.

First I tried making the targeted unit run faster and make him follow a nearby unit, which ensures that someone will get hurt. But he doesnt explode, he just follows a random unit in a 100 AoE and runs at them at high speed (scary if you ask me). So anyone if you could please help, it would mean a lot to me. :)
 
Level 39
Joined
Feb 27, 2007
Messages
5,024
Lol, you could just quote me. Do something like this
  • Events
    • Unit - A unit starts the effect of an ability
  • Conditions
    • Ability being cast equal to (Not me, YOU!)
  • Actions
    • Set TempUnit = (Target unit of ability being cast)
    • Set TempPoint = Position of TempUnit
    • Set TempGroup = Units within (100.00 of TempPoint) matching <follow target filter options>
    • Unit - Order TempUnit to smart (Random unit from TempGroup)
    • Unit - Add <some ability based on boots of movement speed> to TempUnit
    • Custom script: call DestroyGroup(udg_TempGroup)
    • Custom script: call RemoveLocation(udg_TempPoint)
    • Wait XYZ seconds
    • Set TempUnit = (Target unit of ability being cast)
    • Set TempPoint = Position of TempUnit
    • Set TempGroup = Units within (100.00 of TempPoint) matching <damage filter options>
    • Set dmg = Max(Current Life of (picked unit), 0.5 * Current Mana of (picked unit))
    • Pick every unit in TempGroup and do (Actions)
      • Loop - Actions
        • Unit - Cause TempUnit to damage (picked unit) for dmg damage of attack type Spells and damage type Normal
    • Unit - Explode TempUnit
    • Custom script: call DestroyGroup(udg_TempGroup)
    • Custom script: call RemoveLocation(udg_TempPoint)
The reason I set TempUnit again after the wait is that the variable might get un-set by the trigger running a second time for some other unit during that wait. What I did might not work because Target Unit of Ability Being Cast might not work after waits (some event responses don't). If it doesn't you'll have to use a JASS local variable to store the unit temporarily.
 
Level 2
Joined
Dec 15, 2016
Messages
21
Lol, you could just quote me. Do something like this
  • Events
    • Unit - A unit starts the effect of an ability
  • Conditions
    • Ability being cast equal to (Not me, YOU!)
  • Actions
    • Set TempUnit = (Target unit of ability being cast)
    • Set TempPoint = Position of TempUnit
    • Set TempGroup = Units within (100.00 of TempPoint) matching <follow target filter options>
    • Unit - Order TempUnit to smart (Random unit from TempGroup)
    • Unit - Add <some ability based on boots of movement speed> to TempUnit
    • Custom script: call DestroyGroup(udg_TempGroup)
    • Custom script: call RemoveLocation(udg_TempPoint)
    • Wait XYZ seconds
    • Set TempUnit = (Target unit of ability being cast)
    • Set TempPoint = Position of TempUnit
    • Set TempGroup = Units within (100.00 of TempPoint) matching <damage filter options>
    • Set dmg = Max(Current Life of (picked unit), 0.5 * Current Mana of (picked unit))
    • Pick every unit in TempGroup and do (Actions)
      • Loop - Actions
        • Unit - Cause TempUnit to damage (picked unit) for dmg damage of attack type Spells and damage type Normal
    • Unit - Explode TempUnit
    • Custom script: call DestroyGroup(udg_TempGroup)
    • Custom script: call RemoveLocation(udg_TempPoint)
The reason I set TempUnit again after the wait is that the variable might get un-set by the trigger running a second time for some other unit during that wait. What I did might not work because Target Unit of Ability Being Cast might not work after waits (some event responses don't). If it doesn't you'll have to use a JASS local variable to store the unit temporarily.

Is there anyway that I can pm or chat you in personal here? I want you to teach me everything needed to know, milord. I am a noob when it comes to triggers, the things that make the campaign a campaign.
 
Status
Not open for further replies.
Top