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

[Trigger] A spell misbehaving

Status
Not open for further replies.
Level 8
Joined
Sep 10, 2013
Messages
372
I made a spell based on the Goblin Tinker's 'Cluster Rockets' spell, and it was A OK unless I changed the buff to anything but 'Cluster Rockets', because then it dealt no damage. I knew that, the spell was fine and dealing damage normally.

Later, I decided to spice it up and make the spell deal damage based on the hero's primary attribute (Strength) (I learned how somewhere on the hive, don't remember where)... So I altered the spell's damage to 0.01 in the object editor and did what I could with the trigger editor... And this was the result:


  • FlameShower
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Flame Shower
    • Actions
      • Set FlameShowerLoc = (Target point of ability being cast)
      • Set FlameShowerLevel = (Level of Flame Shower for (Casting unit))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Flame Shower for (Casting unit)) Equal to 1
        • Then - Actions
          • Special Effect - Create a special effect at FlameShowerLoc using Abilities\Spells\Human\FlameStrike\FlameStrikeTarget.mdl
          • Unit - Cause (Casting unit) to damage circular area after 0.50 seconds of radius 220.00 at FlameShowerLoc, dealing (((Real(WillStr)) x ((Real(FlameShowerLevel)) x 3.00)) / 2.00) damage of attack type Spells and damage type Universal
          • Wait 0.50 seconds
          • Unit - Cause (Casting unit) to damage circular area after 0.50 seconds of radius 220.00 at FlameShowerLoc, dealing (((Real(WillStr)) x ((Real(FlameShowerLevel)) x 3.00)) / 2.00) damage of attack type Spells and damage type Universal
          • Special Effect - Destroy (Last created special effect)
          • Custom script: call RemoveLocation(udg_FlameShowerLoc)
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Flame Shower for (Casting unit)) Equal to 2
        • Then - Actions
          • Special Effect - Create a special effect at FlameShowerLoc using Abilities\Spells\Human\FlameStrike\FlameStrikeTarget.mdl
          • Unit - Cause (Casting unit) to damage circular area after 0.50 seconds of radius 240.00 at FlameShowerLoc, dealing (((Real(WillStr)) x ((Real(FlameShowerLevel)) x 3.00)) / 3.00) damage of attack type Spells and damage type Universal
          • Wait 0.50 seconds
          • Unit - Cause (Casting unit) to damage circular area after 0.50 seconds of radius 240.00 at FlameShowerLoc, dealing (((Real(WillStr)) x ((Real(FlameShowerLevel)) x 3.00)) / 3.00) damage of attack type Spells and damage type Universal
          • Wait 0.50 seconds
          • Unit - Cause (Casting unit) to damage circular area after 0.50 seconds of radius 240.00 at FlameShowerLoc, dealing (((Real(WillStr)) x ((Real(FlameShowerLevel)) x 3.00)) / 3.00) damage of attack type Spells and damage type Universal
          • Special Effect - Destroy (Last created special effect)
          • Custom script: call RemoveLocation(udg_FlameShowerLoc)
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Flame Shower for (Casting unit)) Equal to 3
        • Then - Actions
          • Special Effect - Create a special effect at FlameShowerLoc using Abilities\Spells\Human\FlameStrike\FlameStrikeTarget.mdl
          • Unit - Cause (Casting unit) to damage circular area after 0.50 seconds of radius 260.00 at FlameShowerLoc, dealing (((Real(WillStr)) x ((Real(FlameShowerLevel)) x 3.00)) / 4.00) damage of attack type Spells and damage type Universal
          • Wait 0.35 seconds
          • Unit - Cause (Casting unit) to damage circular area after 0.50 seconds of radius 260.00 at FlameShowerLoc, dealing (((Real(WillStr)) x ((Real(FlameShowerLevel)) x 3.00)) / 4.00) damage of attack type Spells and damage type Universal
          • Wait 0.35 seconds
          • Unit - Cause (Casting unit) to damage circular area after 0.50 seconds of radius 260.00 at FlameShowerLoc, dealing (((Real(WillStr)) x ((Real(FlameShowerLevel)) x 3.00)) / 4.00) damage of attack type Spells and damage type Universal
          • Wait 0.35 seconds
          • Unit - Cause (Casting unit) to damage circular area after 0.50 seconds of radius 260.00 at FlameShowerLoc, dealing (((Real(WillStr)) x ((Real(FlameShowerLevel)) x 3.00)) / 4.00) damage of attack type Spells and damage type Universal
          • Special Effect - Destroy (Last created special effect)
          • Custom script: call RemoveLocation(udg_FlameShowerLoc)
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Flame Shower for (Casting unit)) Equal to 4
        • Then - Actions
          • Special Effect - Create a special effect at FlameShowerLoc using Abilities\Spells\Human\FlameStrike\FlameStrikeTarget.mdl
          • Unit - Cause (Casting unit) to damage circular area after 0.50 seconds of radius 280.00 at FlameShowerLoc, dealing (((Real(WillStr)) x ((Real(FlameShowerLevel)) x 3.00)) / 5.00) damage of attack type Spells and damage type Universal
          • Wait 0.35 seconds
          • Unit - Cause (Casting unit) to damage circular area after 0.50 seconds of radius 280.00 at FlameShowerLoc, dealing (((Real(WillStr)) x ((Real(FlameShowerLevel)) x 3.00)) / 5.00) damage of attack type Spells and damage type Universal
          • Wait 0.35 seconds
          • Unit - Cause (Casting unit) to damage circular area after 0.50 seconds of radius 280.00 at FlameShowerLoc, dealing (((Real(WillStr)) x ((Real(FlameShowerLevel)) x 3.00)) / 5.00) damage of attack type Spells and damage type Universal
          • Wait 0.35 seconds
          • Unit - Cause (Casting unit) to damage circular area after 0.50 seconds of radius 280.00 at FlameShowerLoc, dealing (((Real(WillStr)) x ((Real(FlameShowerLevel)) x 3.00)) / 5.00) damage of attack type Spells and damage type Universal
          • Wait 0.35 seconds
          • Unit - Cause (Casting unit) to damage circular area after 0.50 seconds of radius 280.00 at FlameShowerLoc, dealing (((Real(WillStr)) x ((Real(FlameShowerLevel)) x 3.00)) / 5.00) damage of attack type Spells and damage type Universal
          • Special Effect - Destroy (Last created special effect)
          • Custom script: call RemoveLocation(udg_FlameShowerLoc)
        • Else - Actions
          • Do nothing
The Variables are: WillStr [Integer](The Strength of the hero), FlameShowerLevel [Integer](The level of the ability :p) and FlameShowerLoc
 
Last edited:
Level 8
Joined
Sep 10, 2013
Messages
372
Oh my God how did I miss this!! Thanks a lot.

Still one more thing, how do I exclude friendlies from the spell damage?
 
  • Set Temp_Point = (Point(0.00, 0.00))
  • Unit Group - Pick every unit in (Units within AoE of Temp_Point matching (((Owner of (caster)) is an ally of (Owner of (Picked unit))) Equal to False)) and do (Actions)
    • Loop - Actions
      • Unit - Cause caster to damage (Picked unit), dealing x damage of attack type Hero and damage type Normal
  • -------- remove leaks --------
  • Custom script: call DestroyGroup(GetLastCreatedGroup())
  • Custom script: call RemoveLocation(udg_Temp_Point)
 
  • Custom script: set bj_wantDestroyGroup = true
  • Set Temp_Targets = (Units within 512.00 of FlameShowerLoc matching (((Owner of (Matching unit)) is an ally of (Owner of (Triggering unit))) Equal to False))
  • Unit Group - Pick every unit in (Units within 512.00 of (Center of (Playable map area)) matching (((Owner of (Picked unit)) is an ally of (Owner of (Triggering unit))) Equal to False)) and do (Actions)
    • Loop - Actions
      • Unit - Cause (Triggering unit) to damage (Picked unit), dealing 500.00 damage of attack type Hero and damage type Normal
Just a few tips:
Triggering unit is more efficient than casting unit so use triggering unit instead.

If you call a function to get a value more than 3 times (Casting unit in your case) then it is better to store the triggering unit in a variable because the computer can access data faster in a variable than asking a function for the data.

You have redundant code. Use the function below to execute repetitive functions
  • For each (Integer Config_MeatHlvl) from 1 to n, do (Actions)
    • Loop - Actions
    • *insert code here*
how to make MUI spells...
 
Status
Not open for further replies.
Top