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

Auto Casting Custom Spell

Status
Not open for further replies.
Level 7
Joined
May 30, 2018
Messages
290
Hello guys. I tried to make an unit automatically cast "Ray of Disruption".

  • Void Seer
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Void Seer
    • Actions
      • Unit - Order (Attacking unit) to Orc Shadow Hunter - Healing Wave (Triggering unit)
I made this simple trigger and changed the order string of the ability to "healingwave". Unfortunatelly it doesn't seem to work.
Maybe someone could help out :)
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,546
You can't change the order string of abilities in the Object Editor (With the exception of two abilities: Channel + Charge Gold and Lumber). I know it doesn't make any sense, why would it be an option but not work? It just doesn't work and never has.

Instead, use the order associated with Ray of Disruption. And if that isn't available, you'll have to use some Jass/Lua to do it.

Here's the Order ID for Ray of Disruption: 852615

  • Cast Ray
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Your Unit
    • Actions
      • Set VariableSet Caster = (Attacking unit)
      • Set VariableSet Target = (Attacked unit)
      • Custom script: call IssueTargetOrderById(udg_Caster, 852615, udg_Target)
With this setup the Attacking unit will cast Ray of Disruption on the attacked unit.

Note that Ray of Disruption doesn't work unless the target has buffs to dispel.
 
Last edited:
Level 7
Joined
May 30, 2018
Messages
290
You can't change the order string of abilities in the Object Editor (With the exception of two abilities: Channel + Charge Gold and Lumber). I know it doesn't make any sense, why would it be an option but not work? It just doesn't work and never has.

Instead, use the order associated with Ray of Disruption. And if that isn't available, you'll have to use some Jass/Lua to do it.
aww rip me, there is no order unfortunatelly :/ and I have no clue about Jass/Lua.

Something else thats weird is that I tried to change the whole trigger to an existing spell (healing wave)...but the unit doesn't even cast that

  • Void Seer
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Void Seer
    • Actions
      • Unit - Order (Attacking unit) to Orc Shadow Hunter - Healing Wave (Triggering unit)
Now the unit has healing wave instead of ray of disruption, but still doesnt cast it...any ideas what I did wrong :/?
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,546
Follow the trigger I posted above for Ray of Disruption. Also, I think you're trying to cast Healing Wave on an enemy, which won't work unless you adjust the Targets Allowed. And Ray of Disruption requires the target to have a buff (positive for enemies, negative for allies) in order to cast.
 
Level 7
Joined
May 30, 2018
Messages
290
Follow the trigger I posted above for Ray of Disruption. Also, I think you're trying to cast Healing Wave on an enemy, which won't work unless you adjust the Targets Allowed. And Ray of Disruption requires the target to have a buff (positive for enemies, negative for allies) in order to cast.

Thanks man. Helpful as always Uncle ^^ +rep
 
Level 7
Joined
May 30, 2018
Messages
290
You can't change the order string of abilities in the Object Editor (With the exception of two abilities: Channel + Charge Gold and Lumber). I know it doesn't make any sense, why would it be an option but not work? It just doesn't work and never has.

Instead, use the order associated with Ray of Disruption. And if that isn't available, you'll have to use some Jass/Lua to do it.

Here's the Order ID for Ray of Disruption: 852615

  • Cast Ray
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Your Unit
    • Actions
      • Set VariableSet Caster = (Attacking unit)
      • Set VariableSet Target = (Attacked unit)
      • Custom script: IssueTargetOrderById(udg_Caster, 852615, udg_Target)
With this setup the Attacking unit will cast Ray of Disruption on the attacked unit.

Note that Ray of Disruption doesn't work unless the target has buffs to dispel.

oof I just tried your trigger but got following error message.
upload_2020-4-11_0-33-32.png


+ where do I find ability order id's and custom ability order id's ? :)
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,546
Here's how to get the Order Id:
  • Order Id
    • Events
      • Unit - A unit Is issued an order targeting an object
      • Unit - A unit Is issued an order targeting a point
      • Unit - A unit Is issued an order with no target
    • Conditions
    • Actions
      • Game - Display to (All players) for 30.00 seconds the text: ((Name of (Ordered unit)) + ( Issued Order: + (String((Issued order)))))
      • Custom script: call DisplayTextToPlayer(Player(0), 0, 0, I2S(GetIssuedOrderId()))
That'll display the Order string + Order Id.

Edit: Forgot "call" in the custom script. Edit #2: It should be I2S(GetIssuedOrderId())). Fixed it and updated all of my posts to have the correct information.
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,546
oof I just tried your trigger but got following error message. View attachment 352070

+ where do I find ability order id's and custom ability order id's ? :)
Sorry, I forgot you need to put "call" in your custom script.

So it should look like:
  • Custom script: call DisplayTextToPlayer(Player(0), 0, 0, I2S(GetIssuedOrderId()))
  • Custom script: call IssueTargetOrderById(udg_Caster, 852615, udg_Target)
 
Last edited:
Level 7
Joined
May 30, 2018
Messages
290
Sorry, I forgot you need to put "call" in your custom script.

So it should look like:
  • Custom script: call DisplayTextToPlayer(Player(0), 0, 0, GetIssuedOrderId())
  • Custom script: call IssueTargetOrderById(udg_Caster, 852615, udg_Target)
Thanks a lot :)
 
Level 3
Joined
Apr 7, 2020
Messages
32
You can't change the order string of abilities in the Object Editor (With the exception of two abilities: Channel + Charge Gold and Lumber). I know it doesn't make any sense, why would it be an option but not work? It just doesn't work and never has.

Instead, use the order associated with Ray of Disruption. And if that isn't available, you'll have to use some Jass/Lua to do it.

Here's the Order ID for Ray of Disruption: 852615

  • Cast Ray
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Your Unit
    • Actions
      • Set VariableSet Caster = (Attacking unit)
      • Set VariableSet Target = (Attacked unit)
      • Custom script: call IssueTargetOrderById(udg_Caster, 852615, udg_Target)
With this setup the Attacking unit will cast Ray of Disruption on the attacked unit.

Note that Ray of Disruption doesn't work unless the target has buffs to dispel.
Is there a method to finding the Order ID of a spell not listed in the GUI? Or a list?
 
Level 7
Joined
May 30, 2018
Messages
290
I posted an example trigger 4 posts above your comment.

Hey Uncle :) I came across another small problem. I want the ray of disruption to be cast on allies of the casting unit.

  • Void Seer
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Void Seer
    • Actions
      • Set VariableSet Caster = (Attacking unit)
      • Set VariableSet Target = (All allies of (Owner of (Triggering unit)).)
      • Custom script: call IssueTargetOrderById(udg_Caster, 852615, udg_Target)
I tried this, but it gives me an error when I try to test the map. Any suggestions on what to do?
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,546
Your Target is a Player Group variable when it's supposed to be a Unit variable. Think about it, the Caster is the one attacking, and the Target is the one being attacked.

You cannot order a unit to cast a spell targeting "All allies of some player". That's telling the game to cast Ray of Disruption on Players, which is impossible. The target of the spell has to be a specific unit.

Here's how you could make the Attacking unit cast Ray on a nearby allied unit. Note that like I said before, Ray of Disruption CANNOT be used if the target has no buffs to dispel. That's why I check to see if the picked unit has buffs.
  • Ray of Disruption
    • Events
      • Unit - A unit Is attacked
    • Conditions
    • Actions
      • Set VariableSet Caster = (Attacking unit)
      • Set VariableSet Target = No unit
      • Set VariableSet Point = (Position of Caster)
      • -------- --------
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 800.00 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 ally of (Owner of Caster).) Equal to True
              • (Number of Negative buffs considered Magic or physical on (Picked unit) (Exclude expiration timers, Exclude auras)) Greater than 0
            • Then - Actions
              • Set VariableSet Target = (Picked unit)
            • Else - Actions
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Target Not equal to No unit
        • Then - Actions
          • Custom script: call IssueTargetOrderById(udg_Caster, 852615, udg_Target)
        • Else - Actions
      • -------- --------
      • Custom script: call RemoveLocation (udg_Point)
So this trigger will only work if there's an allied unit within 800 range of your Attacking unit, and only if it has a negative buff like "Slow" for example. Also, note that I left out the condition for your Void Seer unit, make sure to add that in.
 

Attachments

  • Ray of Disruption Example.w3m
    16.5 KB · Views: 31
Last edited:
Level 7
Joined
May 30, 2018
Messages
290
Your Target is a Player Group variable when it's supposed to be a Unit variable. Think about it, the Caster is the one attacking, and the Target is the one being attacked.

You cannot order a unit to cast a spell targeting "All allies of some player". That's telling the game to cast Ray of Disruption on Players, which is impossible. The target of the spell has to be a specific unit.

Here's how you could make the Attacking unit cast Ray on a nearby allied unit. Note that like I said before, Ray of Disruption CANNOT be used if the target has no buffs to dispel. That's why I check to see if the picked unit has buffs.
  • Ray of Disruption
    • Events
      • Unit - A unit Is attacked
    • Conditions
    • Actions
      • Set VariableSet Caster = (Attacking unit)
      • Set VariableSet Target = No unit
      • Set VariableSet Point = (Position of Caster)
      • -------- --------
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 800.00 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 ally of (Owner of Caster).) Equal to True
              • (Number of Negative buffs considered Magic or physical on (Picked unit) (Exclude expiration timers, Exclude auras)) Greater than 0
            • Then - Actions
              • Set VariableSet Target = (Picked unit)
            • Else - Actions
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Target Not equal to No unit
        • Then - Actions
          • Custom script: call IssueTargetOrderById(udg_Caster, 852615, udg_Target)
        • Else - Actions
      • -------- --------
      • Custom script: call RemoveLocation (udg_Point)
So this trigger will only work if there's an allied unit within 800 range of your Attacking unit, and only if it has a negative buff like "Slow" for example. Also, note that I left out the condition for your Void Seer unit, make sure to add that in.

Ah I see now...! I got it! Thanks, that really helped and I kinda understood what the issue was :D Really nice, thanks for your effort Uncle :*D!
 
Status
Not open for further replies.
Top