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

Thunderstruck

Status
Not open for further replies.
Level 2
Joined
Jun 9, 2018
Messages
10
I made a spell like frost nova from WC3


  • Thunderstruck Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Thunderstuck
    • Actions
      • Set Unit_TS_Caster = (Casting unit)
      • Set Unit_TS_Target = (Target unit of ability being cast)
      • Set Point_TS_TargetPoint = (Position of Unit_TS_Target)
      • -------- >>>>> SET DAMAGE <<<<< --------
      • Set Real_TS_Damage[1] = (100.00 + ((Real((Intelligence of Unit_TS_Caster (Include bonuses)))) x 2.00))
      • Set Real_TS_Damage[2] = (175.00 + ((Real((Intelligence of Unit_TS_Caster (Include bonuses)))) x 2.00))
      • Set Real_TS_Damage[3] = (250.00 + ((Real((Intelligence of Unit_TS_Caster (Include bonuses)))) x 2.00))
      • Set Real_TS_Damage[4] = (325.00 + ((Real((Intelligence of Unit_TS_Caster (Include bonuses)))) x 2.00))
      • Set Real_TS_Damage[5] = (400.00 + ((Real((Intelligence of Unit_TS_Caster (Include bonuses)))) x 2.00))
      • -------- >>>>> SET AoE <<<<< --------
      • Set Real_TS_AoE[1] = 300.00
      • Set Real_TS_AoE[2] = 350.00
      • Set Real_TS_AoE[3] = 400.00
      • Set Real_TS_AoE[4] = 450.00
      • Set Real_TS_AoE[5] = 500.00
      • -------- >>>>> FUNCTION <<<<< --------
      • Unit - Cause Unit_TS_Caster to damage Unit_TS_Target, dealing Real_TS_Damage[(Level of (Ability being cast) for Unit_TS_Caster)] damage of attack type Spells and damage type Lightning
      • Set UnitGroup_TS_Targets = (Units within Real_TS_AoE[(Level of (Ability being cast) for Unit_TS_Caster)] of Point_TS_TargetPoint)
      • Unit Group - Pick every unit in UnitGroup_TS_Targets and do (Actions)
        • Loop - Actions
          • Set Unit_TS_TempUnit = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit_TS_TempUnit is A structure) Equal to False
              • (Unit_TS_TempUnit is alive) Equal to True
              • (Unit_TS_TempUnit belongs to an enemy of (Owner of Unit_TS_Caster)) Equal to True
              • Unit_TS_TempUnit Not equal to Unit_TS_Target
            • Then - Actions
              • Unit - Cause Unit_TS_Caster to damage Unit_TS_TempUnit, dealing (Real_TS_Damage[(Level of (Ability being cast) for Unit_TS_Caster)] / 2.00) damage of attack type Spells and damage type Lightning
              • Special Effect - Create a special effect attached to the origin of Unit_TS_TempUnit using Abilities\Weapons\Bolt\BoltImpact.mdl
              • Special Effect - Destroy (Last created special effect)
            • Else - Actions
      • Game - Display to (All players) the text: ((String(Real_TS_AoE[(Level of (Ability being cast) for Unit_TS_Caster)])) + (String(Real_TS_Damage[(Level of (Ability being cast) for Unit_TS_Caster)])))
      • Custom script: call DestroyGroup(udg_UnitGroup_TS_Targets)
      • Custom script: call RemoveLocation( udg_Point_TS_TargetPoint )


And now I want the damage received by nearby units to be based on how close they are from the target
the closer the unit = the closer the damage received by the target

However, I don't know how :p
Need help guys

EDIT:
fixed the format :)
 
Level 39
Joined
Feb 27, 2007
Messages
5,016
  • Set LEVEL = Level of (Ability being cast) for (Unit_TS_Caster)
  • -------- -------- --------
  • Unit Group - Pick every unit in UnitGroup_TS_Targets and do (Actions)
    • Loop - Actions
      • If (all conditions) then (actions) else (actions)
        • If - Conditions
        • Then - Actions
          • Set TempPoint = Position of (Unit_TS_TempUnit)
          • Set DAMAGE = Max(MIN_DAMAGE, (Real_TS_Damage[LEVEL] x (1 - (Distance between TempPoint and Point_TS_TargetPoint) / ZERO_DAMAGE_DISTANCE)))
          • -------- do the rest of your shit here -------
        • Else - Actions
The above formula I used is this: FULL_DAMAGE * (1 - (DISTANCE / ZERO_DAMAGE_DISTANCE)), and the thing you should know is that it doesn't go to MIN_DAMAGE when DISTANCE = ZERO_DAMAGE_DISTANCE without the Max() call... it goes to 0. If you want it to go to 0 at the edge of the frost nova area then just remove the Max() or change the formula

You can make it so that the value would be capped at a certain minimum range. To do that, you'll need to use the minimum between two numbers, which are the damage to be dealt, and the same but dividing it by distance and multiplying it by the minimum range.
Actually we use max to set a min damage, and min to set a max damage, see above. But I feel you know that.
 
Level 2
Joined
Jun 9, 2018
Messages
10
The above formula I used is this: FULL_DAMAGE * (1 - (DISTANCE / ZERO_DAMAGE_DISTANCE)), and the thing you should know is that it doesn't go to MIN_DAMAGE when DISTANCE = ZERO_DAMAGE_DISTANCE without the Max() call... it goes to 0. If you want it to go to 0 at the edge of the frost nova area then just remove the Max() or change the formula

Thank you Pyrogasm :pgrin:
 
Status
Not open for further replies.
Top