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

Changing this custom Spell

Status
Not open for further replies.
Level 12
Joined
May 7, 2008
Messages
330
Aye it's me again, back with another question ^^

I have a code which I downloaded from one of the Hive users and it's working absolutely fine, however once the unit starts spinning I can't cast spells, which I would prefer if I could whilst spinning.

Basically this is a spell like in Dota from Moghul Kahn called Counter Helix.

  • Counter Helix Setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- // --------
      • Custom script: set udg_CH_Hash = InitHashtable()
      • -------- // --------
      • -------- Ability Counter Helix: --------
      • Set VariableSet CH_Ability = Backlash
      • -------- // --------
      • -------- Ability that allows Mogul Kahn to rotate: --------
      • Set VariableSet CH_Ability_Spin = Spin (Effect)
      • -------- // --------
      • -------- You want to see flotation texts what indicate how much the spell Counter Helix caused? If yes, maintain Boolean below as true: --------
      • Set VariableSet CH_Allow_Text = False
      • -------- If you doesn't want to view flotation texts, set the booelan above has FALSE. --------
      • -------- // --------
      • -------- To destroy trees, mark the variable below as true: --------
      • Set VariableSet CH_Allow_Tree = False
      • -------- For the spell not to destroy trees, configure the variable above as false. --------
      • -------- // --------
      • -------- Counter Helix's Buff: --------
      • Set VariableSet CH_Buff = Backlash
      • -------- // --------
      • -------- Area of Effect: --------
      • Set VariableSet CH_AoE[1] = 300.00
      • Set VariableSet CH_AoE[2] = 325.00
      • Set VariableSet CH_AoE[3] = 350.00
      • -------- Note: area of effect per level. --------
      • -------- // --------
      • -------- Chance of executing this spell: --------
      • Set VariableSet CH_Chance[1] = 8
      • Set VariableSet CH_Chance[2] = 10
      • Set VariableSet CH_Chance[3] = 12
      • -------- Note: chance to spin per level. --------
      • -------- // --------
      • -------- Damage caused by this spell per level: --------
      • Set VariableSet CH_Damage[1] = 50.00
      • Set VariableSet CH_Damage[2] = 75.00
      • Set VariableSet CH_Damage[3] = 100.00
      • -------- // --------
      • -------- Maximum duration that Mogul Kahn can rotate: --------
      • Set VariableSet CH_Spin_Max = 0.65
      • -------- Note: 0.65 are equal to 0.65 seconds. --------
      • -------- // --------
      • -------- Name of the Model of the Effect Special servant when an unit is punished by the Mogul kahn: --------
      • Set VariableSet CH_Model = Abilities\Spells\Other\Stampede\StampedeMissileDeath.mdl
      • -------- // --------
      • -------- Angle that the flotation text will be guided: --------
      • Set VariableSet CH_Text_Angle = 90.00
      • -------- Time (in Real) that the text takes to disappear of their views: --------
      • Set VariableSet CH_Text_FadingAge = 1.50
      • -------- Time (in Real) that the flotation text takes to disappear definitively: --------
      • Set VariableSet CH_Text_LifeSpan = 2.00
      • -------- Text size for the message that will be created: --------
      • Set VariableSet CH_Text_Size = 11.50
      • -------- // --------
      • -------- Attack type caused by this spell: --------
      • Set VariableSet CH_Type_Attack = Hero
      • -------- Damage type caused by this spell: --------
      • Set VariableSet CH_Type_Damage = Universal
      • -------- // --------
      • -------- Type of responsible unit for destroying trees: --------
      • Set VariableSet CH_Type_Dummy = Dummy
      • -------- // --------
      • -------- To destroy trees: --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • CH_Allow_Tree Equal to True
        • Then - Actions
          • -------- // --------
          • Set VariableSet CH_Point = (Center of (Playable map area))
          • Unit - Create 1 CH_Type_Dummy for Neutral Passive at CH_Point facing Default building facing degrees
          • Set VariableSet CH_Dummy = (Last created unit)
          • -------- // --------
          • -------- Destroy Leak: --------
          • Custom script: call RemoveLocation(udg_CH_Point)
          • -------- // --------
        • Else - Actions
      • -------- // --------
      • -------- To reduce the leg that can cause Trigger, use the following custom script: --------
      • Custom script: call DestroyTrigger (GetTriggeringTrigger())
      • -------- // --------

  • Counter Helix Loop
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in CH_Group[1] and do (Actions)
        • Loop - Actions
          • -------- // --------
          • -------- Caster: --------
          • Set VariableSet CH_Caster = (Picked unit)
          • -------- // --------
          • -------- Caster's Handle: --------
          • Set VariableSet CH_Handle = (Picked unit)
          • -------- // --------
          • -------- Time that remains for Mogul Kahn to stop rotating: --------
          • Set VariableSet CH_Spin_Current = (Load 1 of (Key CH_Handle.) from CH_Hash.)
          • -------- // --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • CH_Spin_Current Greater than or equal to CH_Spin_Max
                  • (CH_Caster has buff Stunned (Pause)) Equal to True
                  • (CH_Caster has buff Stunned) Equal to True
                  • (CH_Caster is Stunned) Equal to True
                  • (CH_Caster is paused) Equal to True
                  • (CH_Caster is dead) Equal to True
            • Then - Actions
              • -------- Remove the ability that allows Caster to spin: --------
              • Unit - Remove CH_Ability_Spin from CH_Caster
              • -------- // --------
              • -------- Clean Mogul Kahn's saved data: --------
              • Hashtable - Clear all child hashtables of child (Key CH_Handle.) in CH_Hash.
              • -------- // --------
              • -------- When he stops rotating, remove of the group: --------
              • Unit Group - Remove CH_Caster from CH_Group[1].
              • -------- // --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (CH_Group[1] is empty) Equal to True
                • Then - Actions
                  • -------- If the group (CH_Group[1]) is empty, turn OFF this trigger: --------
                  • Trigger - Turn off (This trigger)
                • Else - Actions
              • -------- // --------
            • Else - Actions
              • -------- Increase the variable so that Mogul Kahn stops spinning: --------
              • Hashtable - Save (CH_Spin_Current + 0.05) as 1 of (Key CH_Handle.) in CH_Hash.
              • -------- // --------
              • -------- Level of Spell Counter Helix for Caster: --------
              • Set VariableSet CH_Level = (Level of CH_Ability for CH_Caster)
              • -------- // --------
              • -------- To Destroy/Kill Trees: --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • CH_Allow_Tree Equal to True
                • Then - Actions
                  • -------- Position of Caster: --------
                  • Set VariableSet CH_Point = (Position of CH_Caster)
                  • -------- // --------
                  • Destructible - Pick every destructible within CH_AoE[CH_Level] of CH_Point and do (Actions)
                    • Loop - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • ((Picked destructible) is alive) Equal to True
                        • Then - Actions
                          • -------- // --------
                          • -------- Order the dummy to harvest the picked destructible: --------
                          • Unit - Order CH_Dummy to Harvest (Picked destructible)
                          • -------- // --------
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Current order of CH_Dummy) Equal to (Order(harvest))
                            • Then - Actions
                              • -------- If the destructible is a tree, destroy: --------
                              • Destructible - Kill (Picked destructible)
                            • Else - Actions
                          • -------- // --------
                          • -------- Order that Dummy stops: --------
                          • Unit - Order CH_Dummy to Stop.
                          • -------- // --------
                        • Else - Actions
                  • -------- // --------
                  • -------- Destroy/Remove any leak(s): --------
                  • Custom script: call RemoveLocation(udg_CH_Point)
                  • -------- // --------
                • Else - Actions
              • -------- // --------
          • -------- --------------------------- --------


  • Counter Helix
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Triggering unit) has buff Stunned (Pause)) Equal to False
      • (Level of CH_Ability for (Triggering unit)) Greater than 0
      • ((Triggering unit) has buff Stunned) Equal to False
      • ((Triggering unit) has buff CH_Buff) Equal to True
      • ((Triggering unit) is Stunned) Equal to False
      • ((Triggering unit) is paused) Equal to False
      • ((Triggering player) is an enemy of (Owner of (Attacking unit)).) Equal to True
    • Actions
      • -------- // --------
      • -------- Level of Spell Counter Helix for Caster: --------
      • Set VariableSet CH_Level = (Level of CH_Ability for CH_Caster)
      • -------- // --------
      • -------- CH_Chance[0] it is to verify the probability of CH_Caster to rotate: --------
      • Set VariableSet CH_Chance[0] = (Random integer number between 1 and 100)
      • -------- // --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • CH_Chance[0] Less than or equal to CH_Chance[CH_Level]
        • Then - Actions
          • -------- // --------
          • -------- Set the unit will go rotate: --------
          • Set VariableSet CH_Caster = (Triggering unit)
          • -------- // --------
          • -------- Caster's Handle: --------
          • Set VariableSet CH_Handle = (Triggering unit)
          • -------- // --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (CH_Caster is in CH_Group[1].) Equal to True
            • Then - Actions
              • -------- // --------
              • -------- Time that remains for Mogul Kahn to stop rotating: --------
              • Set VariableSet CH_Spin_Current = (Load 1 of (Key CH_Handle.) from CH_Hash.)
              • -------- Save - 0.05 for Mogul Kahn whenever he rotates: --------
              • Hashtable - Save (CH_Spin_Current - 0.05) as 1 of (Key CH_Handle.) in CH_Hash.
              • -------- // --------
            • Else - Actions
              • -------- // --------
              • -------- Save 0.05 for Mogul Kahn whenever he rotates: --------
              • Hashtable - Save 0.00 as 1 of (Key CH_Handle.) in CH_Hash.
              • -------- // --------
              • -------- Add the ability that will allow Caster to rotate: --------
              • Unit - Add CH_Ability_Spin to CH_Caster
              • -------- // --------
              • -------- Order that Caster works the ability wins: --------
              • Unit - Order CH_Caster to Orc Blademaster - Bladestorm.
              • -------- // --------
              • -------- Add Caster for the group: --------
              • Unit Group - Add CH_Caster to CH_Group[1]
              • -------- // --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Counter Helix Loop <gen> is on) Equal to True
                • Then - Actions
                • Else - Actions
                  • -------- Turn ON the fallowing Trigger: --------
                  • Trigger - Turn on Counter Helix Loop <gen>
              • -------- // --------
          • -------- // --------
          • -------- Point of CH_Caster: --------
          • Set VariableSet CH_Point = (Position of CH_Caster)
          • -------- // --------
          • -------- Group of Units to be punished by CH_Caster: --------
          • Set VariableSet CH_Group[2] = (Units within CH_AoE[CH_Level] of CH_Point.)
          • -------- // --------
          • -------- Use the two lines below to remove mistakes: --------
          • Custom script: call RemoveLocation(udg_CH_Point)
          • Custom script: set bj_wantDestroyGroup = true
          • -------- // --------
          • -------- Catch the units of the group: --------
          • Unit Group - Pick every unit in CH_Group[2] and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) belongs to an enemy of (Owner of CH_Caster).) Equal to True
                  • ((Picked unit) is A town-hall-type unit) Equal to False
                  • ((Picked unit) is Mechanical) Equal to False
                  • ((Picked unit) is A structure) Equal to False
                  • ((Picked unit) is Ethereal) Equal to False
                  • ((Picked unit) is hidden) Equal to False
                  • ((Picked unit) is dead) Equal to False
                • Then - Actions
                  • -------- // --------
                  • -------- Target that will be punished: --------
                  • Set VariableSet CH_Target = (Picked unit)
                  • -------- // --------
                  • -------- Special effect created in the target: --------
                  • Special Effect - Create a special effect attached to the origin of CH_Target using CH_Model
                  • Special Effect - Destroy (Last created special effect)
                  • -------- The last created special effect was destroyed to remove any leaks. --------
                  • -------- // --------
                  • -------- Damage the affected target for this spell: --------
                  • Unit - Cause CH_Caster to damage CH_Target, dealing CH_Damage[CH_Level] damage of attack type CH_Type_Attack and damage type CH_Type_Damage
                  • -------- // --------
                  • -------- In the next part it consists of the visualization of flotation texts. --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • CH_Allow_Text Equal to True
                    • Then - Actions
                      • -------- // --------
                      • Set VariableSet CH_Text_Player = (Player group((Owner of CH_Caster)))
                      • -------- // --------
                      • Floating Text - Create floating text that reads (|cffFF2B2B- + (String((Integer(CH_Damage[CH_Level]))))) above (Picked unit) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
                      • Floating Text - Hide (Last created floating text) for (All players)
                      • Floating Text - Show (Last created floating text) for CH_Text_Player
                      • Floating Text - Change (Last created floating text): Disable permanence
                      • Floating Text - Change the lifespan of (Last created floating text) to CH_Text_LifeSpan seconds
                      • Floating Text - Change the fading age of (Last created floating text) to CH_Text_FadingAge seconds
                      • Floating Text - Set the velocity of (Last created floating text) to 100.00 towards CH_Text_Angle degrees
                      • -------- // --------
                      • -------- Destroy/Remove any leak(s): --------
                      • Custom script: call DestroyForce(udg_CH_Text_Player)
                      • Custom script: set udg_CH_Text_Player = null
                      • -------- // --------
                    • Else - Actions
                  • -------- // --------
                • Else - Actions
          • -------- // --------
        • Else - Actions
      • -------- // --------


Any help is greatly appreciated!
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,537
It's because the hero is casting Bladestorm. You can't cast spells during Bladestorm.

You need to redesign the spell to no longer use Bladestorm and instead trigger the spin animation yourself. You can do this using SetUnitAnimationByIndex.
 
Status
Not open for further replies.
Top