• 🏆 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] Summoning unit and setting custom / changing numbers?

Status
Not open for further replies.
Level 5
Joined
Feb 5, 2021
Messages
89
Greetings to the masterminds of the Hive Workshop!

So i am trying to create a spell that when triggered it summons a minion and changes its base damage, health and mana, depending on the level of ability being cast, i came up with something like this, how can i do this better? :p

Dont worry, i still consider myself quite the noob even though i have learnt many things.

Context:
The spell is based on the Archmage - Summon Water Elemental, i made it so we dont actually see the water elemental spawning (Cause i might want to add more "summons" than just the one, and then i want to just remove the summoned one, and spawn in the amount of minions i would need)
The spell will have 100 Levels and i had thought maybe every 10th level to add another minion spawned.

  • Summon Whatever
    • Events
      • Unit - A unit Spawns a summoned unit
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Summoned unit)) Equal to Water Elemental (Level 1)
          • (Unit-type of (Summoning unit)) Equal to Necromancer
        • Then - Actions
          • Set VariableSet SummonWhateverSpot[(Player number of (Triggering player))] = (Position of (Summoned unit))
          • Unit - Create 1 Lesser Dark Minion for (Owner of (Summoning unit)) at SummonWhateverSpot[(Player number of (Triggering player))] facing Default building facing degrees
          • Custom script: call RemoveLocation (udg_SummonWhateverSpot[GetConvertedPlayerId(GetTriggerPlayer())])
          • Unit - Remove (Summoned unit) from the game
          • Unit - Add a (20.00 + (SummonWhateverTime[(Player number of (Triggering player))] x 1.00)) second Generic expiration timer to (Last created unit)
          • Unit - Set Max HP of (Last created unit) to (SummonWhateverStatBlock[(Player number of (Triggering player))] x 50)
          • Unit - Set Max Mana of (Last created unit) to (SummonWhateverStatBlock[(Player number of (Triggering player))] x 10)
          • Unit - Set mana of (Last created unit) to 100.00%
          • Unit - Set life of (Last created unit) to 100.00%
          • Unit - Set Base Damage of (Last created unit) to ((SummonWhateverStatBlock[(Player number of (Triggering player))] x 2) - 1) for weapon index: 0
          • Unit - Set Dice Number of (Last created unit) to 1 for weapon index: 0
          • Unit - Set Dice Sides of (Last created unit) to 1 for weapon index: 0
        • Else - Actions
 
Level 24
Joined
Feb 9, 2009
Messages
1,787
Looks good, pretty much what I'd do.
One thing!
If you wish to keep game accuracy in mind, be sure to add the "summoned" classification so that "Summon damage" spells like dispel or purge can interact with it:

  • Unit - Add classification of Summoned to (Last created unit)
EDIT:
I LIED I WOULD DO MORE
Since you have variables, and arrays to boot I'd do away with Summon water elemental as a base and just do an extra variable to get the offset and do the summoning yourself!
Add some special effect and since it's a skeleton add the birth animation!
  • Actions
    • Set VariableSet SummonWhateverSpot[0] = (Position of (Triggering unit))
    • Set VariableSet SummonWhateverSpot[1] = (SummonWhateverSpot[0] offset by 200.00 towards (Facing of (Triggering unit)) degrees.)
    • Special Effect - Create a special effect at SummonWhateverSpot[1] using Abilities\Spells\Undead\RaiseSkeletonWarrior\RaiseSkeleton.mdl
    • Special Effect - Destroy (Last created special effect)
    • Unit - Create 1 Dark Minion for (Triggering player) at SummonWhateverSpot[1] facing (Facing of (Triggering unit)) degrees
    • Animation - Play (Last created unit)'s birth animation
    • Animation - Queue (Last created unit)'s stand animation
    • Custom script: call RemoveLocation(udg_SummonWhateverSpot[0])
    • Custom script: call RemoveLocation(udg_SummonWhateverSpot[1])
 
Last edited:
Level 5
Joined
Feb 5, 2021
Messages
89
If i were to make the trigger create 2 or 3 minions instead of 1, would this still work then kr would only 1 minion be "scaled" ?
 
Level 24
Joined
Feb 9, 2009
Messages
1,787
And you lost me there..

How would i loop this to work with multiple minions?
Much like my resource teeth that on one cast creates 10 projectiles, I use a "Loop".
But it's important to note that you still need to keep the location removal scripts (call removelocation blah blah) inside the loop, and using any references like (Triggering_Unit)/(Casting_Unit)/(Last_Created_Unit) will be lost after the first loop:
  • TeNe Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to TeNe_C_Ability
    • Actions
      • Set VariableSet TeNe_A_Unit[1] = (Triggering unit)
      • -------- ============================= --------
      • Custom script: set udg_TeNe_A_Temp_Group = CreateGroup()
      • -------- ============================= --------
      • Set VariableSet TeNe_B_Total_Teeth = (TeNe_C_Count + (TeNe_C_Count_PerLVL x (Level of TeNe_C_Ability for TeNe_A_Unit[1])))
      • Set VariableSet TeNe_A_FirstIndex = (TeNe_A_Index + 1)
      • Set VariableSet TeNe_A_Count[TeNe_A_FirstIndex] = TeNe_B_Total_Teeth
      • Set VariableSet TeNe_A_Point[1] = (Position of TeNe_A_Unit[1])
      • Set VariableSet TeNe_A_Point[2] = (Target point of ability being cast)
      • -------- ============================= --------
      • For each (Integer TeNe_A_Cast_LOOP) from 1 to TeNe_B_Total_Teeth, do (Actions)
        • Loop - Actions
          • Set VariableSet TeNe_A_Index = (TeNe_A_Index + 1)
          • Set VariableSet TeNe_B_Caster[TeNe_A_Index] = TeNe_A_Unit[1]
          • Set VariableSet TeNe_A_Point[3] = (TeNe_A_Point[2] offset by ((TeNe_C_Width x 0.50) - ((TeNe_C_Width / (Real((TeNe_B_Total_Teeth + 1)))) x (Real(TeNe_A_Cast_LOOP)))) towards ((Angle from TeNe_A_Point[2] to TeNe_A_Point[1]) - 90.00) degrees.)
          • Set VariableSet TeNe_A_Point[4] = (TeNe_A_Point[1] offset by TeNe_C_Offset[1] towards (Angle from TeNe_A_Point[1] to TeNe_A_Point[2]) degrees.)
          • -------- ============================= --------
          • Special Effect - Create a special effect at TeNe_A_Point[4] using TeNe_C_EffectPath[1]
          • Custom script: call RemoveLocation(udg_TeNe_A_Point[4])
          • Special Effect - Set Yaw of (Last created special effect) to: (Radians((Angle from TeNe_A_Point[2] to TeNe_A_Point[3])))
          • Special Effect - Set Height of (Last created special effect) to: TeNe_C_Height[1]
          • -------- ============================= --------
          • Set VariableSet TeNe_B_TeethGroup[TeNe_A_Index] = TeNe_A_Temp_Group
          • Set VariableSet TeNe_B_TeethCountPointer[TeNe_A_Index] = TeNe_A_FirstIndex
          • Set VariableSet TeNe_B_Effect[TeNe_A_Index] = (Last created special effect)
          • Set VariableSet TeNe_B_Facing[TeNe_A_Index] = (Angle from TeNe_A_Point[1] to TeNe_A_Point[3])
          • Set VariableSet TeNe_B_Distance[TeNe_A_Index] = TeNe_C_Distance[1]
          • Set VariableSet TeNe_B_Size_Effect[TeNe_A_Index] = TeNe_C_Size_Value[1]
          • Special Effect - Set Scale of TeNe_B_Effect[TeNe_A_Index] to TeNe_B_Size_Effect[TeNe_A_Index]
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Random real number between 0.00 and 1.00) Less than or equal to TeNe_B_Crit_Chance[(Level of TeNe_C_Ability for TeNe_B_Caster[TeNe_A_Index])]
            • Then - Actions
              • Set VariableSet TeNe_B_Damage[TeNe_A_Index] = ((TeNe_C_DMG_Base[1] + TeNe_C_DMG_PerLVL[(Level of TeNe_C_Ability for TeNe_B_Caster[TeNe_A_Index])]) x TeNe_C_Crit_Percentage[(Level of TeNe_C_Ability for TeNe_B_Caster[TeNe_A_Index])])
              • Set VariableSet TeNe_B_Crit[TeNe_A_Index] = True
            • Else - Actions
              • Set VariableSet TeNe_B_Damage[TeNe_A_Index] = (TeNe_C_DMG_Base[1] + TeNe_C_DMG_PerLVL[(Level of TeNe_C_Ability for TeNe_B_Caster[TeNe_A_Index])])
              • Set VariableSet TeNe_B_Crit[TeNe_A_Index] = False
          • -------- ============================= --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • TeNe_A_Index Equal to 1
            • Then - Actions
              • Trigger - Turn on Tene Periodic <gen>
            • Else - Actions
          • -------- ============================= --------
          • Custom script: call RemoveLocation(udg_TeNe_A_Point[3])
          • -------- ============================= --------
      • Custom script: call RemoveLocation(udg_TeNe_A_Point[1])
      • Custom script: call RemoveLocation(udg_TeNe_A_Point[2])


It's important not to use :
1652123228966.png

As it can lead to memory leaks so the safer bet is using the loop that uses an integer variable like so:
  • Actions
    • Set VariableSet Reference_Owner = (Triggering player)
    • For each (Integer Summon_Loop_Variable) from 1 to 3, do (Actions)
      • Loop - Actions
        • -------- Your actions --------
        • -------- INCLUDING Location removals "call RemoveLocation(udg_XYZ_Variable[2557])" --------
EDIT:
Example
  • Example
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Summon 'da bones bruddahs'
    • Actions
      • Set VariableSet Reference_Owner = (Triggering player)
      • Set VariableSet Point[0] = (Position of (Triggering unit))
      • Set VariableSet Point[1] = (Point[0] offset by 200.00 towards (Facing of (Triggering unit)) degrees.)
      • For each (Integer Summon_Loop_Variable) from 1 to 3, do (Actions)
        • Loop - Actions
          • Unit - Create 1 Dark Minion for Reference_Owner at Point[1] facing Default building facing degrees
          • Animation - Play (Last created unit)'s birth animation
          • Animation - Queue (Last created unit)'s stand animation
          • Set VariableSet Point[2] = (Position of (Last created unit))
          • Special Effect - Create a special effect at Point[2] using Abilities\Spells\Undead\RaiseSkeletonWarrior\RaiseSkeleton.mdl
          • Special Effect - Destroy (Last created special effect)
          • Unit - Set Max HP of (Last created unit) to (160 + (20 x (Integer(XYz))))
          • Unit - Set Max Mana of (Last created unit) to (30 + (20 x (Integer(XYZ))))
          • Unit - Set Base Damage of (Last created unit) to (10 + (5 x (Integer(XYZ)))) for weapon index: 0
          • Unit - Set Attack Interval of (Triggering unit) to (2.00 x (2.00 / (0.01 x (Real(XYZ))))) for weapon index: (1 - 1)
          • Unit - Set Armor of (Last created unit) to (3.00 + (0.15 x (Real(XYZ))))
          • Unit - Add classification of Summoned to (Last created unit)
          • Unit - Set life of (Last created unit) to 100.00%
          • Unit - Set mana of (Last created unit) to 100.00%
          • Custom script: call RemoveLocation(udg_Point[2]
      • Custom script: call RemoveLocation(udg_Point[0]
      • Custom script: call RemoveLocation(udg_Point[1]
 
Last edited:
Level 5
Joined
Feb 5, 2021
Messages
89
Much like my resource teeth that on one cast creates 10 projectiles, I use a "Loop".
But it's important to note that you still need to keep the location removal scripts (call removelocation blah blah) inside the loop, and using any references like (Triggering_Unit)/(Casting_Unit)/(Last_Created_Unit) will be lost after the first loop:
  • TeNe Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to TeNe_C_Ability
    • Actions
      • Set VariableSet TeNe_A_Unit[1] = (Triggering unit)
      • -------- ============================= --------
      • Custom script: set udg_TeNe_A_Temp_Group = CreateGroup()
      • -------- ============================= --------
      • Set VariableSet TeNe_B_Total_Teeth = (TeNe_C_Count + (TeNe_C_Count_PerLVL x (Level of TeNe_C_Ability for TeNe_A_Unit[1])))
      • Set VariableSet TeNe_A_FirstIndex = (TeNe_A_Index + 1)
      • Set VariableSet TeNe_A_Count[TeNe_A_FirstIndex] = TeNe_B_Total_Teeth
      • Set VariableSet TeNe_A_Point[1] = (Position of TeNe_A_Unit[1])
      • Set VariableSet TeNe_A_Point[2] = (Target point of ability being cast)
      • -------- ============================= --------
      • For each (Integer TeNe_A_Cast_LOOP) from 1 to TeNe_B_Total_Teeth, do (Actions)
        • Loop - Actions
          • Set VariableSet TeNe_A_Index = (TeNe_A_Index + 1)
          • Set VariableSet TeNe_B_Caster[TeNe_A_Index] = TeNe_A_Unit[1]
          • Set VariableSet TeNe_A_Point[3] = (TeNe_A_Point[2] offset by ((TeNe_C_Width x 0.50) - ((TeNe_C_Width / (Real((TeNe_B_Total_Teeth + 1)))) x (Real(TeNe_A_Cast_LOOP)))) towards ((Angle from TeNe_A_Point[2] to TeNe_A_Point[1]) - 90.00) degrees.)
          • Set VariableSet TeNe_A_Point[4] = (TeNe_A_Point[1] offset by TeNe_C_Offset[1] towards (Angle from TeNe_A_Point[1] to TeNe_A_Point[2]) degrees.)
          • -------- ============================= --------
          • Special Effect - Create a special effect at TeNe_A_Point[4] using TeNe_C_EffectPath[1]
          • Custom script: call RemoveLocation(udg_TeNe_A_Point[4])
          • Special Effect - Set Yaw of (Last created special effect) to: (Radians((Angle from TeNe_A_Point[2] to TeNe_A_Point[3])))
          • Special Effect - Set Height of (Last created special effect) to: TeNe_C_Height[1]
          • -------- ============================= --------
          • Set VariableSet TeNe_B_TeethGroup[TeNe_A_Index] = TeNe_A_Temp_Group
          • Set VariableSet TeNe_B_TeethCountPointer[TeNe_A_Index] = TeNe_A_FirstIndex
          • Set VariableSet TeNe_B_Effect[TeNe_A_Index] = (Last created special effect)
          • Set VariableSet TeNe_B_Facing[TeNe_A_Index] = (Angle from TeNe_A_Point[1] to TeNe_A_Point[3])
          • Set VariableSet TeNe_B_Distance[TeNe_A_Index] = TeNe_C_Distance[1]
          • Set VariableSet TeNe_B_Size_Effect[TeNe_A_Index] = TeNe_C_Size_Value[1]
          • Special Effect - Set Scale of TeNe_B_Effect[TeNe_A_Index] to TeNe_B_Size_Effect[TeNe_A_Index]
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Random real number between 0.00 and 1.00) Less than or equal to TeNe_B_Crit_Chance[(Level of TeNe_C_Ability for TeNe_B_Caster[TeNe_A_Index])]
            • Then - Actions
              • Set VariableSet TeNe_B_Damage[TeNe_A_Index] = ((TeNe_C_DMG_Base[1] + TeNe_C_DMG_PerLVL[(Level of TeNe_C_Ability for TeNe_B_Caster[TeNe_A_Index])]) x TeNe_C_Crit_Percentage[(Level of TeNe_C_Ability for TeNe_B_Caster[TeNe_A_Index])])
              • Set VariableSet TeNe_B_Crit[TeNe_A_Index] = True
            • Else - Actions
              • Set VariableSet TeNe_B_Damage[TeNe_A_Index] = (TeNe_C_DMG_Base[1] + TeNe_C_DMG_PerLVL[(Level of TeNe_C_Ability for TeNe_B_Caster[TeNe_A_Index])])
              • Set VariableSet TeNe_B_Crit[TeNe_A_Index] = False
          • -------- ============================= --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • TeNe_A_Index Equal to 1
            • Then - Actions
              • Trigger - Turn on Tene Periodic <gen>
            • Else - Actions
          • -------- ============================= --------
          • Custom script: call RemoveLocation(udg_TeNe_A_Point[3])
          • -------- ============================= --------
      • Custom script: call RemoveLocation(udg_TeNe_A_Point[1])
      • Custom script: call RemoveLocation(udg_TeNe_A_Point[2])


It's important not to use :
View attachment 399214
As it can lead to memory leaks so the safer bet is using the loop that uses an integer variable like so:
  • Actions
    • Set VariableSet Reference_Owner = (Triggering player)
    • For each (Integer Summon_Loop_Variable) from 1 to 3, do (Actions)
      • Loop - Actions
        • -------- Your actions --------
        • -------- INCLUDING Location removals "call RemoveLocation(udg_XYZ_Variable[2557])" --------
EDIT:
Example
  • Example
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Summon 'da bones bruddahs'
    • Actions
      • Set VariableSet Reference_Owner = (Triggering player)
      • Set VariableSet Point[0] = (Position of (Triggering unit))
      • Set VariableSet Point[1] = (Point[0] offset by 200.00 towards (Facing of (Triggering unit)) degrees.)
      • For each (Integer Summon_Loop_Variable) from 1 to 3, do (Actions)
        • Loop - Actions
          • Unit - Create 1 Dark Minion for Reference_Owner at Point[1] facing Default building facing degrees
          • Animation - Play (Last created unit)'s birth animation
          • Animation - Queue (Last created unit)'s stand animation
          • Set VariableSet Point[2] = (Position of (Last created unit))
          • Special Effect - Create a special effect at Point[2] using Abilities\Spells\Undead\RaiseSkeletonWarrior\RaiseSkeleton.mdl
          • Special Effect - Destroy (Last created special effect)
          • Unit - Set Max HP of (Last created unit) to (160 + (20 x (Integer(XYz))))
          • Unit - Set Max Mana of (Last created unit) to (30 + (20 x (Integer(XYZ))))
          • Unit - Set Base Damage of (Last created unit) to (10 + (5 x (Integer(XYZ)))) for weapon index: 0
          • Unit - Set Attack Interval of (Triggering unit) to (2.00 x (2.00 / (0.01 x (Real(XYZ))))) for weapon index: (1 - 1)
          • Unit - Set Armor of (Last created unit) to (3.00 + (0.15 x (Real(XYZ))))
          • Unit - Add classification of Summoned to (Last created unit)
          • Unit - Set life of (Last created unit) to 100.00%
          • Unit - Set mana of (Last created unit) to 100.00%
          • Custom script: call RemoveLocation(udg_Point[2]
      • Custom script: call RemoveLocation(udg_Point[0]
      • Custom script: call RemoveLocation(udg_Point[1]
Ahh!! Now it makes way more sense, and the 1 - 3 numbers for the loop can they be variables aswell?
 
Status
Not open for further replies.
Top