• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Automatic spell/ability

Status
Not open for further replies.
Level 1
Joined
Nov 1, 2023
Messages
2
Hello!

I've just made a dummy ability/spell that can craft swords from iron (I'm using custom resources system), it would be hard for players to click the ability/spell manually everytime they select the building that has that ability/spell, despite being autocast. So I wanted to make it more simple by making the ability/spell automatic.

The question is how can I make it automatic, I mean make it autocasting automatic instead of clicking it manually? Is it required by using the triggers, yes?
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
You could base the ability on Frenzy, an Autocast ability that doesn't target, and use triggers to force any Unit with this ability to cast it as long as it's enabled:
  • Iron Autocast Toggle
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Level of Frenzy for (Triggering unit)) Greater than 0
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Issued order) Equal to (Order(frenzyon))
        • Then - Actions
          • -------- Autocast is ON --------
          • Unit Group - Add (Triggering unit) to Iron_Autocast_Group
          • Trigger - Turn on Iron Autocast Loop <gen>
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Issued order) Equal to (Order(frenzyoff))
            • Then - Actions
              • -------- Autocast is OFF --------
              • Unit Group - Remove (Triggering unit) from Iron_Autocast_Group.
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in Iron_Autocast_Group) Equal to 0
                • Then - Actions
                  • Trigger - Turn off Iron Autocast Loop <gen>
                • Else - Actions
            • Else - Actions
  • Iron Autocast Loop
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Iron_Autocast_Group and do (Actions)
        • Loop - Actions
          • -------- Issue the Frenzy order -> https://www.hiveworkshop.com/threads/list-of-order-ids.350361/ --------
          • Custom script: call IssueImmediateOrderById( GetEnumUnit(), 852561 )
Iron Autocast Loop should be Initially OFF. It's designed so that it's only On while a unit has the ability set to Autocast mode.

Adjust the 0.50 second interval to something that works for you. A lower number like every 0.10 seconds should be fine.
 

Attachments

  • Iron Autocast 1.w3m
    17.5 KB · Views: 9
Last edited:
Level 1
Joined
Nov 1, 2023
Messages
2
Thank you, Uncle! It worked. I've copied some abilities/spells that is frenzy ability/spell, no targets and edited them but unfortunately they will activate at the same time as it seems they collide which is not supposed to be, looks like I have to find way to seperate them if it is possible.
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
Thank you, Uncle! It worked. I've copied some abilities/spells that is frenzy ability/spell, no targets and edited them but unfortunately they will activate at the same time as it seems they collide which is not supposed to be, looks like I have to find way to seperate them if it is possible.
That's just how Warcraft 3 works. If you don't want to rely on Frenzy then you can trigger everything yourself. The abilities aren't even necessary.
 
Status
Not open for further replies.
Top