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

Question about custom abilitys

Status
Not open for further replies.
Level 12
Joined
Dec 11, 2014
Messages
662
1) You have the same auto-cast Bloodlust that's single target, but whenever it's cast you take units in range around the target and for each unit summon a dummy unit with Bloodlust of appropriate level which casts Bloodlust on that unit.

2) You have a custom spell, preferably 'Channel', that's set up correctly (mana, cooldown, range etc.). Whenever you cast it, take the units within that area and do the same Dummy unit thing in step (1)
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,540
^ You only need 1 Dummy unit to cast Bloodlust on multiple targets.

Use the Pick every unit action, something like this:
Create 1 Dummy unit -> Add bloodlust to last created unit -> Pick every unit within 600 range of position of casting unit -> Order last created unit to Orc - Bloodlust picked unit

Anyway, you should search for answers before posting, this is a very common question.
This thread has an example: Cast Mass/Multiple/AoE Bloodlust spells
Note that the examples in that thread create multiple Dummy units when all you need is 1.

And I attached a map with a Dummy unit you can copy and paste. Make sure the bloodlust ability that the dummy uses has no mana cost, no cooldown, unlimited cast range, and no requirements, this way the Dummy can actually cast it.
 

Attachments

  • Dummy Uncle.w3x
    16.1 KB · Views: 25
Last edited:
Level 4
Joined
Aug 2, 2015
Messages
50
  • Flame Sear
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Flame Sear
    • Actions
      • Unit Group - Pick every unit in (Random 7 units from (Units within 700.00 of (Position of (Casting unit)) matching ((Owner of (Matching unit)) Not equal to Player 20 (Lavender)).)) and do (Actions)
        • Loop - Actions
          • Unit - Create 1 Flame Sear for Neutral Hostile at (Position of (Picked unit)) facing Default building facing degrees
          • Unit - Hide (Last created unit)
          • Unit - Set mana of (Last created unit) to 99.00%
          • Unit - Order (Last created unit) to Neutral Fire Lord - Soul Burn (Picked unit)
          • Wait 2.00 seconds
          • Unit - Remove (Last created unit) from the game

Is there a way to make this trigger more CPU friendly?
Cus the way it is now, crashes the game.

(To clearify, I want to make a soulburn AoE targeting up to 15 units.)
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,540
There's a lot you're doing wrong there.

You don't need to mess with hiding the Dummy, adjusting it's mana, or removing the dummy after a Wait.

You should avoid using Waits inside the Pick Every Unit function as it will cause problems.

You're also leaking points/unit group. See Things That Leak in my signature for more info.

Here's how you should trigger it:
Here's the basic setup for turning single target spells into AoE spells:
  • Cast Soul Burn AoE
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to AoE Soul Burn
    • Actions
      • Set VariableSet Point = (Position of (Triggering unit))
      • -------- --------
      • -------- Set this to the Area of Effect of your spell --------
      • Set VariableSet AoE = 800.00
      • -------- --------
      • -------- Create and setup the Dummy --------
      • Unit - Create 1 Dummy (Uncle) for (Triggering player) at Point facing Default building facing degrees
      • Unit - Add Soul Burn (Dummy) to (Last created unit)
      • Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
      • -------- --------
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within AoE of Point.) 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 (Triggering player).) Equal to True
              • ((Picked unit) is alive) Equal to True
              • ((Picked unit) is A structure) Equal to False
              • ((Picked unit) is hidden) Equal to False
              • ((Picked unit) is invulnerable) Equal to False
              • ((Picked unit) is Magic Immune) Equal to False
            • Then - Actions
              • Unit - Order (Last created unit) to Neutral Fire Lord - Soul Burn (Picked unit)
            • Else - Actions
      • -------- --------
      • -------- Clean up memory leaks --------
      • Custom script: call RemoveLocation (udg_Point)
Here's the same trigger but designed to work with a Maximum number of targets. It picks RANDOM targets each time you cast the spell. This is needed for cases with Maximum Targets:
  • Cast Soul Burn AoE max targets
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to AoE Soul Burn
    • Actions
      • Set VariableSet Point = (Position of (Triggering unit))
      • -------- --------
      • -------- Set this to the Area of Effect of your spell --------
      • Set VariableSet AoE = 800.00
      • -------- --------
      • -------- Set this to the maximum number of targets affected --------
      • Set VariableSet SB_Max_Targets = 15
      • -------- --------
      • -------- Create and setup the Dummy --------
      • Unit - Create 1 Dummy (Uncle) for (Triggering player) at Point facing Default building facing degrees
      • Unit - Add Soul Burn (Dummy) to (Last created unit)
      • Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
      • -------- --------
      • Set VariableSet SB_Group = (Units within AoE of Point.)
      • Unit Group - Pick every unit in SB_Group 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 (Triggering player).) Equal to True
              • ((Picked unit) is alive) Equal to True
              • ((Picked unit) is A structure) Equal to False
              • ((Picked unit) is hidden) Equal to False
              • ((Picked unit) is invulnerable) Equal to False
              • ((Picked unit) is Magic Immune) Equal to False
            • Then - Actions
            • Else - Actions
              • -------- This gets rid of units from SB_Group that shouldn't be in it (like allies) --------
              • Unit Group - Remove (Picked unit) from SB_Group.
      • For each (Integer A) from 1 to SB_Max_Targets, do (Actions)
        • Loop - Actions
          • -------- This picks (SB_Max_Targets) units at random from SB_Group and casts Soul Burn on them --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of units in SB_Group) Greater than 0
            • Then - Actions
              • Set VariableSet SB_Target = (Random unit from SB_Group)
              • Unit - Order (Last created unit) to Neutral Fire Lord - Soul Burn SB_Target
              • Unit Group - Remove SB_Target from SB_Group.
            • Else - Actions
      • -------- --------
      • -------- Clean up memory leaks --------
      • Custom script: call DestroyGroup (udg_SB_Group)
      • Custom script: call RemoveLocation (udg_Point)

Important Note:
You can usually use the same Dummy unit for all of your spells.
I recommend copying and pasting the Dummy from my map into your map and using it in all of your Dummy triggers.

Edit: Fixed a small issue, uploaded a new version.
 

Attachments

  • AoE Bloodlust + Soul Burn 2.w3m
    21.3 KB · Views: 20
Last edited:
Level 4
Joined
Aug 2, 2015
Messages
50
Im struggling to get ai to use this skill, so I figured , make a trigger order!
  • SB
    • Events
      • Unit - Grand Warlock 0459 <gen> Is attacked
      • Unit - Lady 0460 <gen> Is attacked
    • Conditions
    • Actions
      • Trigger - Turn off (This trigger)
      • Unit - Order (Attacked unit) to Special - Channel.
      • Wait 3.50 seconds
      • Trigger - Turn on (This trigger)
Are there errors in this?
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,540
Oh, the base order Id for the ability isn't Channel. Look it up on the ability.

Set it's base order id to something like thunderclap or taunt since you'll need to order the units to cast it without a target.
 
Last edited:

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
You should avoid using Waits inside the Pick Every Unit function as it will cause problems.
To clarify this. Wait does not work inside those functions. It will literally cause the thread to crash when TriggerSleepAction, the function that Wait is implemented with, is called.
is there a way to order computer press a certain button instead?
That makes no sense as players do not have buttons. Only clients do.
 
Status
Not open for further replies.
Top