[Spell] Charge ability help

Status
Not open for further replies.
Level 6
Joined
May 13, 2023
Messages
72
Hello hive I have this charge ability that needs some modifications. I looked through the Spell section and didn't find any abilities that fulfilled my needs so I'm trying to make my own one.
Here's the Spell.
Initialization Trigger
  • Hellcharge Init
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Hell Charge
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in HellchargeGroup1[1]) Equal to 0
        • Then - Actions
          • Trigger - Turn on Hellcharge End <gen>
        • Else - Actions
      • Set HellchargeIndex = (HellchargeIndex + 1)
      • Set HellchargeCaster[HellchargeIndex] = (Triggering unit)
      • Set HellchargePos[1] = (Position of HellchargeCaster[HellchargeIndex])
      • Set HellchargePos[2] = (Target point of ability being cast)
      • Set HellchargeDeg[HellchargeIndex] = (Angle from HellchargePos[1] to HellchargePos[2])
      • Unit - Turn collision for HellchargeCaster[HellchargeIndex] Off
      • Unit Group - Add HellchargeCaster[HellchargeIndex] to HellchargeGroup1[1]
      • Unit Group - Add HellchargeCaster[HellchargeIndex] to HellchargeGroup2[HellchargeIndex]
      • Custom script: call RemoveLocation (udg_HellchargePos[1])
      • Custom script: call RemoveLocation (udg_HellchargePos[2])
Run Trigger
  • Hellcharge End
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 0 to HellchargeIndex, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (HellchargeCaster[(Integer A)] is in HellchargeGroup1[1]) Equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (HellchargeCaster[(Integer A)] is alive) Equal to True
                  • HellchargeCounter[(Integer A)] Less than or equal to 50
                • Then - Actions
                  • Set HellchargeCounter[(Integer A)] = (HellchargeCounter[(Integer A)] + 1)
                  • Set HellchargePos[1] = (Position of HellchargeCaster[(Integer A)])
                  • Set HellchargePos[2] = (HellchargePos[1] offset by 50.00 towards HellchargeDeg[(Integer A)] degrees)
                  • Unit - Move HellchargeCaster[(Integer A)] instantly to HellchargePos[2], facing HellchargeDeg[(Integer A)] degrees
                  • Set HellchargeGroup1[2] = (Units within 150.00 of HellchargePos[2] matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) belongs to an enemy of (Owner of HellchargeCaster[(Integer A)])) Equal to True) and (((
                  • Unit Group - Pick every unit in HellchargeGroup1[2] and do (Actions)
                    • Loop - Actions
                      • Set HellchargePos[3] = (Position of (Picked unit))
                      • Unit - Cause HellchargeCaster[(Integer A)] to damage (Picked unit), dealing (Real((Base Damage of HellchargeCaster[(Integer A)] for weapon index 1))) damage of attack type Spells and damage type Normal
                      • Custom script: call RemoveLocation (udg_HellchargePos[3])
                  • Custom script: call RemoveLocation (udg_HellchargePos[1])
                  • Custom script: call RemoveLocation (udg_HellchargePos[2])
                  • Custom script: call DestroyGroup (udg_HellchargeGroup1[2])
                • Else - Actions
                  • Unit Group - Remove HellchargeCaster[(Integer A)] from HellchargeGroup1[1]
                  • Unit Group - Remove all units from HellchargeGroup2[(Integer A)]
                  • Unit Group - Remove all units from HellchargeGroup1[3]
                  • Unit - Turn collision for HellchargeCaster[(Integer A)] On
                  • Set HellchargeCaster[(Integer A)] = No unit
                  • Set HellchargeCounter[(Integer A)] = 0
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Number of units in HellchargeGroup1[1]) Equal to 0
                    • Then - Actions
                      • Trigger - Turn off (This trigger)
                      • Set HellchargeIndex = 0
                    • Else - Actions
                      • Do nothing
            • Else - Actions
              • Do nothing
Ability works fine but I want few things implemented in it. Which I couldn't do

1st I want the ability to stop when it reaches a terrain thats higher than the caster's currently on meaning if it hits a wall the charge would stop and stun the caster
2nd I want it to push back units caught in it's path by a small amount and stun them for a bit
Any assitance is much obliged
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
This is where the caster currently is:
  • Set HellchargePos[1] = (Position of HellchargeCaster[(Integer A)])
This is where the caster is going to move to:
  • Set HellchargePos[2] = (HellchargePos[1] offset by 50.00 towards HellchargeDeg[(Integer A)] degrees)[
So what you do is test these Points for whatever information you want.

Is the cliff level at Point[2] greater than the cliff level at Point[1]? If true, Stun the caster and end the charge.


For knockback and stun, this is where you're dealing damage:
  • Unit - Cause HellchargeCaster[(Integer A)] to damage (Picked unit), dealing (Real((Base Damage of HellchargeCaster[(Integer A)] for weapon index 1))) damage of attack type Spells and damage type Normal
So this is where you would implement the Stun and Knockback as well.


Stunning a unit is simple, Create a Dummy unit, Add Storm Bolt to it, Order it to cast Storm Bolt on the target. Make sure Storm Bolt is setup to be instant and capable of being cast from anywhere at anytime. You can use this method for both the cliff stun and the knockback stun.

For a Knockback, you use the same logic you're using to move the caster. Point With Polar Offset towards whatever angle you want. I assume you want to get the Angle between the Caster and the target and use that as your degrees.


Also, on a side note, the design of these triggers is sort of bad. It's a less good version of Dynamic Indexing. The caster doesn't need to be in a Unit Group nor should you be using (Integer A) in your For Loop among a few other mistakes.
 
Last edited:
Status
Not open for further replies.
Top