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

[Solved] Petrify Skill Help <GUI>

Level 7
Joined
Oct 6, 2022
Messages
132
Hello, I'm currently making a skill called petrify like Medusa but can also disable Bladestorm then petrifies the Bladestorm caster but i don't know how. The skill was not targetable btw. Thanks in advance :thumbs_up:

  • Petrify
    • Events
      • Unit - A unit Begins channeling an ability
    • Conditions
      • (Ability being cast) Equal to Petrify (more powerful)
    • Actions
      • Set ULT_Caster = (Triggering unit)
      • Unit - Create 1 Casting Dummy for (Owner of ULT_Caster) at ((Position of ULT_Caster) offset by 100.00 towards (Facing of ULT_Caster) degrees) facing Default building facing degrees
      • Unit Group - Add (Last created unit) to ULT_DummyArea
      • Unit - Create 1 Casting Dummy for (Owner of ULT_Caster) at ((Position of ULT_Caster) offset by 200.00 towards (Facing of ULT_Caster) degrees) facing Default building facing degrees
      • Unit Group - Add (Last created unit) to ULT_DummyArea
      • Unit - Create 1 Casting Dummy for (Owner of ULT_Caster) at ((Position of ULT_Caster) offset by 400.00 towards (Facing of ULT_Caster) degrees) facing Default building facing degrees
      • Unit Group - Add (Last created unit) to ULT_DummyArea
      • Unit - Create 1 Casting Dummy for (Owner of ULT_Caster) at ((Position of ULT_Caster) offset by 600.00 towards (Facing of ULT_Caster) degrees) facing Default building facing degrees
      • Unit Group - Add (Last created unit) to ULT_DummyArea
      • Unit - Create 1 Casting Dummy for (Owner of ULT_Caster) at ((Position of ULT_Caster) offset by 800.00 towards (Facing of ULT_Caster) degrees) facing Default building facing degrees
      • Unit Group - Add (Last created unit) to ULT_DummyArea
      • Unit Group - Pick every unit in ULT_DummyArea and do (Actions)
        • Loop - Actions
          • Unit Group - Pick every unit in (Units within 300.00 of (Position of (Picked unit)) matching ((((Matching unit) belongs to an enemy of (Owner of ULT_Caster)) Equal to True) and (((((Matching unit) is A structure) Equal to False) and (((Matching unit) is alive) Equal to True)) and ((((Matchi and do (Actions)
            • Loop - Actions
              • Unit - Create 1 Casting Dummy for (Owner of ULT_Caster) at (Position of (Picked unit)) facing Default building facing degrees
              • Unit - Add Petrify Dummy to (Last created unit)
              • Unit - Set level of Petrify Dummy for (Last created unit) to (Level of Petrify (more powerful) for ULT_Caster)
              • Set ULT_DummyCaster = (Last created unit)
              • Unit - Order ULT_DummyCaster to Night Elf Keeper Of The Grove - Entangling Roots (Picked unit)
      • Wait 1.00 seconds
      • Unit Group - Pick every unit in ULT_DummyArea and do (Actions)
        • Loop - Actions
          • Unit - Remove (Picked unit) from the game
      • Unit Group - Remove all units from ULT_DummyArea
 
Level 25
Joined
Sep 26, 2009
Messages
2,378
Bladestorm makes the caster magic-immune. You should decide how this spell should generally affect magic-immune units or if Bladestorm spell is an exception.
I don't think there is any fool-proof way, but since Bladestorm makes the caster magic-immune for the duration of the spell, you could just assume that the unit is currently casting Bladestorm if level of bladestorm ability > 0 and the unit is magic-immune.
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Level of Bladestorm for your_unit) Greater than 0
      • (your_unit is Magic Immune) Equal to True
    • Then - Actions
      • -------- is casting bladestorm --------
    • Else - Actions
To interrupt bladestorm, you must pause and immediately unpause the unit
  • Unit - Pause your_unit
  • Unit - Unpause your_unit
---
As for the trigger itself, there are few things that could be reworked:
  • You should use event 'Unit starts the effect of an ability' as that trigger fires when mana is drained and spell cooldown starts. The Begin casting/channeling are not often used as they fire before the 'starts the effect' event
  • You leak locations. Basically every (Position of some_unit) creates a location that must be destroyed via custom script, see the first post in this thread: Things That Leak
  • You also leak unit groups: Any time you use a 'Pick every unit' actions and you don't refer to a unit group variable, then you create a fresh new unit group which will leak if not destroyed.
    • So this is safe
      • Unit Group - Pick every unit in ULT_DummyArea and do (Actions)
    • But this leaks unit group:
      • Unit Group - Pick every unit in (Units within 300.00 ...
  • Inside the inner-most 'Pick every unit' action: you create a fresh dummy unit, give it Petrify Dummy ability and order it to cast. But you do not remove the unit anywhere, basically causing a unit leak
  • The first 5 dummy units created at the start of the trigger (and added to ULT_DummyArea) seem to be only used for detecting units within 300.0 range of their position. What you can do instead is just use 2 point variables and offset them inside a 'for each' loop action like so:
      • Actions
        • Set VariableSet casterLoc = (Position of (Triggering unit))
        • For each (Integer A) from 0 to 4, do (Actions)
          • Loop - Actions
            • Set VariableSet offsetLoc = (casterLoc offset by ((Real((Integer A))) x 200.00) towards (Facing of (Triggering unit)) degrees.)
            • Custom script: set bj_wantDestroyGroup = true
            • Unit Group - Pick every unit in (Units within 300.00 of offsetLoc matching ...) and do (Actions)
              • Loop - Actions
                • -------- creates dummy here and orders it to cast the Petrify dummy spell --------
            • Custom script: call RemoveLocation(udg_offsetLoc)
        • Custom script: call RemoveLocation(udg_casterLoc)
 
Level 7
Joined
Oct 6, 2022
Messages
132
Ayo, i didn't expect that i don't need to create 5 dummies to do it especially my trigger leaks. Thanks for helping me out right there.
Ummm can i ask for another help from you?
 
Last edited:
Level 7
Joined
Oct 6, 2022
Messages
132
In this one i'm making a huge bullet rain using Artillery effect, but whenever this one executes if causes the game to lag i don't know how to figure this one out so maybe you could help me with it?

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
    • Then - Actions
      • -------- Special effects --------
      • For each (Integer A) from 1 to 36, do (Actions)
        • Loop - Actions
          • Unit - Create 1 Casting Dummy for (Owner of Oda_SS_Caster) at ((Position of Oda_SS_Caster) offset by 1500.00 towards ((Real((Integer A))) x 10.00) degrees) facing ((Real((Integer A))) x 10.00) degrees
          • Unit Group - Add (Last created unit) to Oda_SS_DG
          • Set Oda_SS_Dummy[(Integer A)] = (Last created unit)
          • Special Effect - Create a special effect at (Position of (Last created unit)) using war3mapImported\ArtilleryStraight.mdx
          • Special Effect - Destroy (Last created special effect)
          • Special Effect - Create a special effect at (Position of (Last created unit)) using war3mapImported\t_newdirtexnofire.mdx
          • Special Effect - Destroy (Last created special effect)
          • Unit - Turn collision for Oda_SS_Dummy[(Integer A)] Off
      • For each (Integer A) from 1 to 36, do (Actions)
        • Loop - Actions
          • Unit - Create 1 Casting Dummy for (Owner of Oda_SS_Caster) at ((Position of Oda_SS_Caster) offset by 1300.00 towards ((Real((Integer A))) x 10.00) degrees) facing ((Real((Integer A))) x 10.00) degrees
          • Unit Group - Add (Last created unit) to Oda_SS_DG
          • Set Oda_SS_Dummy[(Integer A)] = (Last created unit)
          • Special Effect - Create a special effect at (Position of (Last created unit)) using war3mapImported\ArtilleryStraight.mdx
          • Special Effect - Destroy (Last created special effect)
          • Special Effect - Create a special effect at (Position of (Last created unit)) using war3mapImported\t_newdirtexnofire.mdx
          • Special Effect - Destroy (Last created special effect)
          • Unit - Turn collision for Oda_SS_Dummy[(Integer A)] Off
      • For each (Integer A) from 1 to 36, do (Actions)
        • Loop - Actions
          • Unit - Create 1 Casting Dummy for (Owner of Oda_SS_Caster) at ((Position of Oda_SS_Caster) offset by 1100.00 towards ((Real((Integer A))) x 10.00) degrees) facing ((Real((Integer A))) x 10.00) degrees
          • Unit Group - Add (Last created unit) to Oda_SS_DG
          • Set Oda_SS_Dummy[(Integer A)] = (Last created unit)
          • Special Effect - Create a special effect at (Position of (Last created unit)) using war3mapImported\ArtilleryStraight.mdx
          • Special Effect - Destroy (Last created special effect)
          • Special Effect - Create a special effect at (Position of (Last created unit)) using war3mapImported\t_newdirtexnofire.mdx
          • Special Effect - Destroy (Last created special effect)
          • Unit - Turn collision for Oda_SS_Dummy[(Integer A)] Off
      • For each (Integer A) from 1 to 27, do (Actions)
        • Loop - Actions
          • Unit - Create 1 Casting Dummy for (Owner of Oda_SS_Caster) at ((Position of Oda_SS_Caster) offset by 900.00 towards ((Real((Integer A))) x 13.30) degrees) facing ((Real((Integer A))) x 13.50) degrees
          • Unit Group - Add (Last created unit) to Oda_SS_DG
          • Set Oda_SS_Dummy[(Integer A)] = (Last created unit)
          • Special Effect - Create a special effect at (Position of (Last created unit)) using war3mapImported\ArtilleryStraight.mdx
          • Special Effect - Destroy (Last created special effect)
          • Special Effect - Create a special effect at (Position of (Last created unit)) using war3mapImported\t_newdirtexnofire.mdx
          • Special Effect - Destroy (Last created special effect)
          • Unit - Turn collision for Oda_SS_Dummy[(Integer A)] Off
      • For each (Integer A) from 1 to 18, do (Actions)
        • Loop - Actions
          • Unit - Create 1 Casting Dummy for (Owner of Oda_SS_Caster) at ((Position of Oda_SS_Caster) offset by 700.00 towards ((Real((Integer A))) x 20.00) degrees) facing ((Real((Integer A))) x 20.00) degrees
          • Unit Group - Add (Last created unit) to Oda_SS_DG
          • Set Oda_SS_Dummy[(Integer A)] = (Last created unit)
          • Special Effect - Create a special effect at (Position of (Last created unit)) using war3mapImported\ArtilleryStraight.mdx
          • Special Effect - Destroy (Last created special effect)
          • Special Effect - Create a special effect at (Position of (Last created unit)) using war3mapImported\t_newdirtexnofire.mdx
          • Special Effect - Destroy (Last created special effect)
          • Unit - Turn collision for Oda_SS_Dummy[(Integer A)] Off
      • For each (Integer A) from 1 to 16, do (Actions)
        • Loop - Actions
          • Unit - Create 1 Casting Dummy for (Owner of Oda_SS_Caster) at ((Position of Oda_SS_Caster) offset by 500.00 towards ((Real((Integer A))) x 22.50) degrees) facing ((Real((Integer A))) x 22.50) degrees
          • Unit Group - Add (Last created unit) to Oda_SS_DG
          • Set Oda_SS_Dummy[(Integer A)] = (Last created unit)
          • Special Effect - Create a special effect at (Position of (Last created unit)) using war3mapImported\ArtilleryStraight.mdx
          • Special Effect - Destroy (Last created special effect)
          • Special Effect - Create a special effect at (Position of (Last created unit)) using war3mapImported\t_newdirtexnofire.mdx
          • Special Effect - Destroy (Last created special effect)
          • Unit - Turn collision for Oda_SS_Dummy[(Integer A)] Off
      • For each (Integer A) from 1 to 9, do (Actions)
        • Loop - Actions
          • Unit - Create 1 Casting Dummy for (Owner of Oda_SS_Caster) at ((Position of Oda_SS_Caster) offset by 300.00 towards ((Real((Integer A))) x 40.00) degrees) facing ((Real((Integer A))) x 40.00) degrees
          • Unit Group - Add (Last created unit) to Oda_SS_DG
          • Set Oda_SS_Dummy[(Integer A)] = (Last created unit)
          • Special Effect - Create a special effect at (Position of (Last created unit)) using war3mapImported\ArtilleryStraight.mdx
          • Special Effect - Destroy (Last created special effect)
          • Special Effect - Create a special effect at (Position of (Last created unit)) using war3mapImported\t_newdirtexnofire.mdx
          • Special Effect - Destroy (Last created special effect)
          • Unit - Turn collision for Oda_SS_Dummy[(Integer A)] Off
      • -------- END Special effects --------
      • Unit Group - Pick every unit in Oda_SS_DG and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
            • Then - Actions
              • Unit - Add a 0.50 second Generic expiration timer to (Picked unit)
            • Else - Actions
          • Unit Group - Remove all units from Oda_SS_DG
      • Unit Group - Pick every unit in (Units within 1500.00 of (Position of Oda_SS_Caster) matching ((((Matching unit) belongs to an enemy of (Owner of Oda_SS_Caster)) Equal to True) and (((((Matching unit) is A structure) Equal to False) and (((Matching unit) is alive) Equal to True)) and (((Mat and do (Actions)
        • Loop - Actions
          • Unit - Cause Oda_SS_Caster to damage (Picked unit), dealing (300.00 x (Real((Level of (Oda Nobunaga) for Oda_SS_Caster)))) damage of attack type Spells and damage type Normal
    • Else - Actions
 
In the section marked as "--- Special Effects ---" you create 178 units (Dummies).
Creating that many units is likely to cause lagg and from what I see, you only use the dummies in order to get their location? Do they do something else?
Also, you're leaking a ton of locations. You can fix the point leaks by storing the points in variables so you can clean them up.
  • Actions
    • Set Oda_SS_Caster_Point = (Position of Oda_SS_Caster)
    • For each (Integer A) from 1 to 36, do (Actions)
      • Loop - Actions
        • Set Oda_SS_Vfx_Point = (Oda_SS_Caster_Point offset by 1500.00 towards ((Real((Integer A))) x 10.00) degrees)
        • ...
        • Custom script: call RemoveLocation(udg_Oda_SS_Vfx_Point)
    • Custom script: call RemoveLocation(udg_Oda_SS_Caster_Point)
My trigger here also gets the location without creating a dummy. If you can get what you want without dummies, it will likely solve the lagg-issue.
 
Level 25
Joined
Sep 26, 2009
Messages
2,378
Yea, the main issue will be what ThompZon wrote. Units take a lot of WC3's resources, so creating ~180 units in one go is bound to cause some serious fps drops.
Leaks aside, the other thing is that you are also creating 2 special effects per created dummy, so a total of ~360 effects in a rather small area. Effects may also cause some fps drops, even more so for effects that have lot of particles/smoke, etc.

So the basic idea should be that you store caster's position in point variable and inside loop you create a new location which is offset from the caster's location and assign that to a variable (the action that does that is called 'Point with polar offset'). Then you create special effects using that offset location.

Getting rid of the dummy units and resolving those location leaks should help you somewhat. You also leak unit group again at the end of the trigger (where you deal damage).
I don't think you can optimize this more, apart from lowering the amount of special effects that you create (but you should probably take a look at it after resolving the above mentioned issues).

As for the trigger's readability, I would split this trigger in two: One trigger has the loops in it and second trigger creates the special effects.
  • Effects Trigger
    • Events
    • Conditions
    • Actions
      • Special Effect - Create a special effect at offsetLoc using ...
      • Special Effect - Destroy (Last created special effect)
      • Special Effect - Create a special effect at offsetLoc using ...
      • Special Effect - Destroy (Last created special effect)
  • Actions
    • Set VariableSet casterLoc = (Position of (Triggering unit))
    • For each (Integer A) from 1 to 36, do (Actions)
      • Loop - Actions
        • Set VariableSet offsetLoc = (casterLoc offset by 1500.00 towards ((Real((Integer A))) x 10.00) degrees.)
        • Trigger - Run Effects Trigger <gen> (checking conditions)
        • Custom script: call RemoveLocation(udg_offsetLoc)
Also, you may want to limit the number of loop iterations you do. The first 3 loops all run 36 times, they just create the special effect at different offset from the caster, so you may as well merge those together:
  • Actions
    • Set VariableSet casterLoc = (Position of (Triggering unit))
    • For each (Integer A) from 1 to 36, do (Actions)
      • Loop - Actions
        • Set VariableSet offsetLoc = (casterLoc offset by 1500.00 towards ((Real((Integer A))) x 10.00) degrees.)
        • Trigger - Run Effects Trigger <gen> (checking conditions)
        • Custom script: call RemoveLocation(udg_offsetLoc)
        • -------- ---- --------
        • Set VariableSet offsetLoc = (casterLoc offset by 1300.00 towards ((Real((Integer A))) x 10.00) degrees.)
        • Trigger - Run Effects Trigger <gen> (checking conditions)
        • Custom script: call RemoveLocation(udg_offsetLoc)
        • -------- ---- --------
        • Set VariableSet offsetLoc = (casterLoc offset by 1100.00 towards ((Real((Integer A))) x 10.00) degrees.)
        • Trigger - Run Effects Trigger <gen> (checking conditions)
        • Custom script: call RemoveLocation(udg_offsetLoc)
 
Level 7
Joined
Oct 6, 2022
Messages
132
Bladestorm makes the caster magic-immune. You should decide how this spell should generally affect magic-immune units or if Bladestorm spell is an exception.
I don't think there is any fool-proof way, but since Bladestorm makes the caster magic-immune for the duration of the spell, you could just assume that the unit is currently casting Bladestorm if level of bladestorm ability > 0 and the unit is magic-immune.
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Level of Bladestorm for your_unit) Greater than 0
      • (your_unit is Magic Immune) Equal to True
    • Then - Actions
      • -------- is casting bladestorm --------
    • Else - Actions
To interrupt bladestorm, you must pause and immediately unpause the unit
  • Unit - Pause your_unit
  • Unit - Unpause your_unit
---
As for the trigger itself, there are few things that could be reworked:
  • You should use event 'Unit starts the effect of an ability' as that trigger fires when mana is drained and spell cooldown starts. The Begin casting/channeling are not often used as they fire before the 'starts the effect' event
  • You leak locations. Basically every (Position of some_unit) creates a location that must be destroyed via custom script, see the first post in this thread: Things That Leak
  • You also leak unit groups: Any time you use a 'Pick every unit' actions and you don't refer to a unit group variable, then you create a fresh new unit group which will leak if not destroyed.
    • So this is safe
      • Unit Group - Pick every unit in ULT_DummyArea and do (Actions)
    • But this leaks unit group:
      • Unit Group - Pick every unit in (Units within 300.00 ...
  • Inside the inner-most 'Pick every unit' action: you create a fresh dummy unit, give it Petrify Dummy ability and order it to cast. But you do not remove the unit anywhere, basically causing a unit leak
  • The first 5 dummy units created at the start of the trigger (and added to ULT_DummyArea) seem to be only used for detecting units within 300.0 range of their position. What you can do instead is just use 2 point variables and offset them inside a 'for each' loop action like so:
      • Actions
        • Set VariableSet casterLoc = (Position of (Triggering unit))
        • For each (Integer A) from 0 to 4, do (Actions)
          • Loop - Actions
            • Set VariableSet offsetLoc = (casterLoc offset by ((Real((Integer A))) x 200.00) towards (Facing of (Triggering unit)) degrees.)
            • Custom script: set bj_wantDestroyGroup = true
            • Unit Group - Pick every unit in (Units within 300.00 of offsetLoc matching ...) and do (Actions)
              • Loop - Actions
                • -------- creates dummy here and orders it to cast the Petrify dummy spell --------
            • Custom script: call RemoveLocation(udg_offsetLoc)
        • Custom script: call RemoveLocation(udg_casterLoc)
By the way, about this one. The unit that casted Bladestorm seems to not been able get petrified after being PauseUnpause, was there any solution for it?
 
Level 25
Joined
Sep 26, 2009
Messages
2,378
Just tested it and you are right.
The bladestorm gets interrupted, but the unit retains magic immunity for about 0.01 seconds.

A possible solution could be that anytime you detect a unit actively casting bladestorm, you pause/unpause the unit and add those units into a unit group. After the 'Pick every unit' action where you petrify units start a one-time countdown timer with expiration time of 0.02 seconds.
Create another trigger that fires when the timer expires and inside this trigger pick every unit in the unit group where you placed units with bladestorm. At this point they should no longer have magic-immunity, so you can create a dummy unit, give it petrify spell and cast it on those units.

The problem here is that the second trigger will not have a triggering unit, so you would need to store reference to the caster somewhere. I would suggest using hashtables.

The trigger flow could be as follows:
In the 'Petrify' trigger:
  1. Trigger starts when a unit casts Petrify
  2. Pick all units within 300.0 of the petrify points
    1. if picked unit is actively casting bladestorm, interrupt it and add the unit to 'DelayedPetrifyGroup' unit group, store reference to Triggering unit in hashtable, using child key 'PetrifyCaster' and parent key = handleId of the picked unit
    2. if not casting bladestorm, create dummy now and petrify the picked unit
  3. Start a 0.02 timer
In 'Petrify Delayed' trigger:
  1. Trigger starts when timer expires
  2. Pick all units in 'DelayedPetrifyGroup' unit group
  3. For each unit load the reference to the petrify caster from hashtable, using the same parent/child keys as used in previous trigger
  4. Create dummy give it petrify spell, cast it on picked unit
  5. Remove picked unit from the unit group
 
Last edited:
Level 7
Joined
Oct 6, 2022
Messages
132
Just tested it and you are right.
The bladestorm gets interrupted, but the unit retains magic immunity for about 0.01 seconds.

A possible solution could be that anytime you detect a unit actively casting bladestorm, you pause/unpause the unit and add those units into a unit group. After the 'Pick every unit' action where you petrify units start a one-time countdown timer with expiration time of 0.02 seconds.
Create another trigger that fires when the timer expires and inside this trigger pick every unit in the unit group where you placed units with bladestorm. At this point they should no longer have magic-immunity, so you can create a dummy unit, give it petrify spell and cast it on those units.

The problem here is that the second trigger will not have a triggering unit, so you would need to store reference to the caster somewhere. I would suggest using hashtables.

The trigger flow could be as follows:
In the 'Petrify' trigger:
  1. Trigger starts when a unit casts Petrify
  2. Pick all units within 300.0 of the petrify points
    1. if picked unit is actively casting bladestorm, interrupt it and add the unit to 'DelayedPetrifyGroup' unit group, store reference to Triggering unit in hashtable, using child key 'PetrifyCaster' and parent key = handleId of the picked unit
    2. if not casting bladestorm, create dummy now and petrify the picked unit
  3. Start a 0.02 timer
In 'Petrify Delayed' trigger:
  1. Trigger starts when timer expires
  2. Pick all units in 'DelayedPetrifyGroup' unit group
  3. For each unit load the reference to the petrify caster from hashtable, using the same parent/child keys as used in previous trigger
  4. Create dummy give it petrify spell, cast it on picked unit
  5. Remove picked unit from the unit group
I can't follow, can you show it to me via trigger? (Sorry for the late reply)
 
Level 25
Joined
Sep 26, 2009
Messages
2,378
Here

  • Map Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set VariableSet SpellsHashtable = (Last created hashtable)
  • Petrify Start
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Petrify
    • Actions
      • Set VariableSet caster = (Triggering unit)
      • Set VariableSet angle = (Facing of caster)
      • Set VariableSet casterLoc = (Position of caster)
      • -------- ------ --------
      • Unit - Create 1 Dummy for (Triggering player) at casterLoc facing Default building facing degrees
      • Set VariableSet dummy = (Last created unit)
      • Unit - Add Root (Dummy) to dummy
      • Unit - Set level of Root (Dummy) for dummy to (Level of Petrify for caster)
      • -------- ------ --------
      • For each (Integer A) from 0 to 4, do (Actions)
        • Loop - Actions
          • Set VariableSet offsetLoc = (casterLoc offset by ((Real((Integer A))) x 200.00) towards angle degrees.)
          • Unit - Move dummy instantly to offsetLoc
          • -------- ------ --------
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units within 300.00 of offsetLoc matching ((((Matching unit) belongs to an enemy of (Triggering player).) Equal to True) and ((((Matching unit) is A structure) Equal to False) and (((Matching unit) is alive) Equal to True))).) and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of Bladestorm for (Picked unit)) Greater than 0
                  • ((Picked unit) is Magic Immune) Equal to True
                • Then - Actions
                  • Unit - Pause (Picked unit)
                  • Unit - Unpause (Picked unit)
                  • Unit Group - Add (Picked unit) to DelayedPetrifyGroup
                  • Hashtable - Save Handle Ofcaster as (Key PetrifyCaster.) of (Key (Picked unit).) in SpellsHashtable.
                • Else - Actions
                  • Unit - Order dummy to Night Elf Keeper Of The Grove - Entangling Roots (Picked unit)
          • -------- ------ --------
          • Custom script: call RemoveLocation(udg_offsetLoc)
      • -------- ------ --------
      • Unit - Remove dummy from the game
      • Custom script: call RemoveLocation(udg_casterLoc)
      • -------- ------ --------
      • Countdown Timer - Start DelayedPetrifyTimer as a One-shot timer that will expire in 0.02 seconds
  • Petrify Delayed
    • Events
      • Time - DelayedPetrifyTimer expires
    • Conditions
    • Actions
      • Unit Group - Pick every unit in DelayedPetrifyGroup and do (Actions)
        • Loop - Actions
          • Set VariableSet offsetLoc = (Position of (Picked unit))
          • Set VariableSet caster = (Load (Key PetrifyCaster.) of (Key (Picked unit).) in SpellsHashtable.)
          • -------- ------ --------
          • Unit - Create 1 Dummy for (Owner of caster) at offsetLoc facing Default building facing degrees
          • Set VariableSet dummy = (Last created unit)
          • Unit - Add Root (Dummy) to dummy
          • Unit - Set level of Root (Dummy) for dummy to (Level of Petrify for caster)
          • -------- ------ --------
          • Unit - Order dummy to Night Elf Keeper Of The Grove - Entangling Roots (Picked unit)
          • -------- ------ --------
          • Hashtable - Save Handle OfNo unit as (Key PetrifyCaster.) of (Key (Picked unit).) in SpellsHashtable.
          • -------- ------ --------
          • Unit - Remove dummy from the game
          • Custom script: call RemoveLocation(udg_offsetLoc)
      • Unit Group - Remove all units from DelayedPetrifyGroup.
Attached is an example map (created on version 1.36 so it may not work for you if you are on older wc3 version)
  • Run the map, try casting the petrify spell by using the 'Petrifier' unit
  • Pressing Esc key will force the Blademaster to cast Bladestorm (unless it's on CD)
 

Attachments

  • petrify_example.w3m
    20.6 KB · Views: 1
Level 7
Joined
Oct 6, 2022
Messages
132
Here

  • Map Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set VariableSet SpellsHashtable = (Last created hashtable)
  • Petrify Start
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Petrify
    • Actions
      • Set VariableSet caster = (Triggering unit)
      • Set VariableSet angle = (Facing of caster)
      • Set VariableSet casterLoc = (Position of caster)
      • -------- ------ --------
      • Unit - Create 1 Dummy for (Triggering player) at casterLoc facing Default building facing degrees
      • Set VariableSet dummy = (Last created unit)
      • Unit - Add Root (Dummy) to dummy
      • Unit - Set level of Root (Dummy) for dummy to (Level of Petrify for caster)
      • -------- ------ --------
      • For each (Integer A) from 0 to 4, do (Actions)
        • Loop - Actions
          • Set VariableSet offsetLoc = (casterLoc offset by ((Real((Integer A))) x 200.00) towards angle degrees.)
          • Unit - Move dummy instantly to offsetLoc
          • -------- ------ --------
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units within 300.00 of offsetLoc matching ((((Matching unit) belongs to an enemy of (Triggering player).) Equal to True) and ((((Matching unit) is A structure) Equal to False) and (((Matching unit) is alive) Equal to True))).) and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of Bladestorm for (Picked unit)) Greater than 0
                  • ((Picked unit) is Magic Immune) Equal to True
                • Then - Actions
                  • Unit - Pause (Picked unit)
                  • Unit - Unpause (Picked unit)
                  • Unit Group - Add (Picked unit) to DelayedPetrifyGroup
                  • Hashtable - Save Handle Ofcaster as (Key PetrifyCaster.) of (Key (Picked unit).) in SpellsHashtable.
                • Else - Actions
                  • Unit - Order dummy to Night Elf Keeper Of The Grove - Entangling Roots (Picked unit)
          • -------- ------ --------
          • Custom script: call RemoveLocation(udg_offsetLoc)
      • -------- ------ --------
      • Unit - Remove dummy from the game
      • Custom script: call RemoveLocation(udg_casterLoc)
      • -------- ------ --------
      • Countdown Timer - Start DelayedPetrifyTimer as a One-shot timer that will expire in 0.02 seconds
  • Petrify Delayed
    • Events
      • Time - DelayedPetrifyTimer expires
    • Conditions
    • Actions
      • Unit Group - Pick every unit in DelayedPetrifyGroup and do (Actions)
        • Loop - Actions
          • Set VariableSet offsetLoc = (Position of (Picked unit))
          • Set VariableSet caster = (Load (Key PetrifyCaster.) of (Key (Picked unit).) in SpellsHashtable.)
          • -------- ------ --------
          • Unit - Create 1 Dummy for (Owner of caster) at offsetLoc facing Default building facing degrees
          • Set VariableSet dummy = (Last created unit)
          • Unit - Add Root (Dummy) to dummy
          • Unit - Set level of Root (Dummy) for dummy to (Level of Petrify for caster)
          • -------- ------ --------
          • Unit - Order dummy to Night Elf Keeper Of The Grove - Entangling Roots (Picked unit)
          • -------- ------ --------
          • Hashtable - Save Handle OfNo unit as (Key PetrifyCaster.) of (Key (Picked unit).) in SpellsHashtable.
          • -------- ------ --------
          • Unit - Remove dummy from the game
          • Custom script: call RemoveLocation(udg_offsetLoc)
      • Unit Group - Remove all units from DelayedPetrifyGroup.
Attached is an example map (created on version 1.36 so it may not work for you if you are on older wc3 version)
  • Run the map, try casting the petrify spell by using the 'Petrifier' unit
  • Pressing Esc key will force the Blademaster to cast Bladestorm (unless it's on CD)
I didn't expect you are also going to send some map, thank you for your kindness.:peasant-thumbs-up-cheers:
 
Top