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

How to command a unit to use an ability

Status
Not open for further replies.
You issue the order based on the ability's order string.

If it is a targeted ability, do a target order. If the ability has no target, then issue an immediate order (order with no target). If it is area of effect, then issue a point order. For the order string part, select the value that corresponds with the ability's order string in the object editor.

For example, if the order string is "Firebolt", the option you would select would be "Neutral - Firebolt".
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
In the "Units" trigger actions, you find "Unit - Issue unit an order targeting an order / Point / no-target" then you select the order you want your unit to do.

Some orders aren't on the list, and have to be ordered with some custom script.
 
Level 4
Joined
Aug 26, 2012
Messages
123
Spartipilo said:
Some orders aren't on the list, and have to be ordered with some custom script.

Or, on the "order" dialog you can use "Convert string to order", and on the string you can write the ability's order ID
(Well, it will be written like "Unit - Issued (unit) to (String order (immolation)) )
 
Level 8
Joined
Oct 26, 2008
Messages
387
Can you guys post a trigger example? The ability I want to activate is enrage...

Unit - Issue unit order with no target

I am not sure if enrage exists in the objects editor by itself, but i will give you an example to help you.

Let say i make my own custom ability, based on storm bolt. and i name it, Boom Bolt! If i want to trigger my unit to cast that ability the action would be this,

  • Unit - Issue MyUnit to Human - Storm Bolt MyTarget
I am guessing enrage is an instant ability no targeted, but i am not sure in which ability you base it so i can give you the exact line
 
Level 2
Joined
Aug 3, 2012
Messages
19
Thanks for the help guys +Rep to all and I found an ability that does exactly what I want... bloodlust so is all good now :) and this is how I ended up setting it up...

  • Zombies use enrage ability
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units of type Zombie) and do (Unit - Order (Picked unit) to Orc Shaman - Activate Bloodlust)
      • Unit Group - Pick every unit in (Units of type Zombie P1) and do (Unit - Order (Picked unit) to Orc Shaman - Activate Bloodlust)
      • Unit Group - Pick every unit in (Units of type Zombie P2) and do (Unit - Order (Picked unit) to Orc Shaman - Activate Bloodlust)
      • Unit Group - Pick every unit in (Units of type Zombie P3) and do (Unit - Order (Picked unit) to Orc Shaman - Activate Bloodlust)
      • Unit Group - Pick every unit in (Units of type Zombie P4) and do (Unit - Order (Picked unit) to Orc Shaman - Activate Bloodlust)
      • Unit Group - Pick every unit in (Units of type Zombie P5) and do (Unit - Order (Picked unit) to Orc Shaman - Activate Bloodlust)
      • Unit Group - Pick every unit in (Units of type Zombie P6) and do (Unit - Order (Picked unit) to Orc Shaman - Activate Bloodlust)
      • Unit Group - Pick every unit in (Units of type Zombie P7) and do (Unit - Order (Picked unit) to Orc Shaman - Activate Bloodlust)
      • Unit Group - Pick every unit in (Units of type Zombie P8) and do (Unit - Order (Picked unit) to Orc Shaman - Activate Bloodlust)
EDIT: failed attempt :( im just going to make another unit that attacks and runs faster I guess...
 
Last edited:
Level 20
Joined
Jul 14, 2011
Messages
3,213
Well, that trigger has 9 UnitGroup leaks every 10 seconds, wich is wicked and sick.

Why's there 8 Unit-Types Zombies, one for each player? Why?
What do you want them to do?
 
Level 5
Joined
Jun 24, 2012
Messages
112
Thanks for the help guys +Rep to all and I found an ability that does exactly what I want... bloodlust so is all good now :) and this is how I ended up setting it up...

  • Zombies use enrage ability
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units of type Zombie) and do (Unit - Order (Picked unit) to Orc Shaman - Activate Bloodlust)
      • Unit Group - Pick every unit in (Units of type Zombie P1) and do (Unit - Order (Picked unit) to Orc Shaman - Activate Bloodlust)
      • Unit Group - Pick every unit in (Units of type Zombie P2) and do (Unit - Order (Picked unit) to Orc Shaman - Activate Bloodlust)
      • Unit Group - Pick every unit in (Units of type Zombie P3) and do (Unit - Order (Picked unit) to Orc Shaman - Activate Bloodlust)
      • Unit Group - Pick every unit in (Units of type Zombie P4) and do (Unit - Order (Picked unit) to Orc Shaman - Activate Bloodlust)
      • Unit Group - Pick every unit in (Units of type Zombie P5) and do (Unit - Order (Picked unit) to Orc Shaman - Activate Bloodlust)
      • Unit Group - Pick every unit in (Units of type Zombie P6) and do (Unit - Order (Picked unit) to Orc Shaman - Activate Bloodlust)
      • Unit Group - Pick every unit in (Units of type Zombie P7) and do (Unit - Order (Picked unit) to Orc Shaman - Activate Bloodlust)
      • Unit Group - Pick every unit in (Units of type Zombie P8) and do (Unit - Order (Picked unit) to Orc Shaman - Activate Bloodlust)
EDIT: failed attempt :( im just going to make another unit that attacks and runs faster I guess...

Yea why not just use arrays as well? Much simpler that way you could loop it.

To do this, go the variable editor and select "Array" and select a size (if you have 8 players, select 8). Then you can just go from there.
 
Level 4
Joined
Aug 26, 2012
Messages
123
Just example:
  • Events
    • Map Initialization
  • Conditions
  • Actions
    • Set Zombie[1] = Zombie P1
    • Set Zombie[2] = Zombie P2
    • Set Zombie[3] = Zombie P3
    • ---- until ----
    • Set Zombie[8] = Zombie P8
    • Set Zombie[9] = Zombie
Then:
  • Events
    • Time - Every 10.00 seconds of game time
  • Conditions
  • Actions
    • Loop - For each Integer A from 1 to 9 do actions
      • Actions
        • Unit Group - Pick every unit in (Units of type Zombie[Integer A]) and do actions
          • Unit - Order (Picked unit) to Orc Shaman - Activate Bloodlust
(There, simpler clicking, doesn't it?)
 
Level 5
Joined
Jun 24, 2012
Messages
112
Just example:
  • Events
    • Map Initialization
  • Conditions
  • Actions
    • Set Zombie[1] = Zombie P1
    • Set Zombie[2] = Zombie P2
    • Set Zombie[3] = Zombie P3
    • ---- until ----
    • Set Zombie[8] = Zombie P8
    • Set Zombie[9] = Zombie
Then:
  • Events
    • Time - Every 10.00 seconds of game time
  • Conditions
  • Actions
    • Loop - For each Integer A from 1 to 9 do actions
      • Actions
        • Unit Group - Pick every unit in (Units of type Zombie[Integer A]) and do actions
          • Unit - Order (Picked unit) to Orc Shaman - Activate Bloodlust
(There, simpler clicking, doesn't it?)

The first part isn't necessary. Just get rid of the P8 stuff and make it an array.
 
Level 4
Joined
Aug 26, 2012
Messages
123
Yeah, I know, I just want to connect the DeathsAbyss's trigger with that one...
(Yes, actually, I'm too lazy to write that....)
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
Yea why not just use arrays as well? Much simpler that way you could loop it.

To do this, go the variable editor and select "Array" and select a size (if you have 8 players, select 8). Then you can just go from there.

lol, you maybe dont know but Jass arrays have ever 8192 indexes, the value in box is just to let you hope
to prove this, go and make unit array of size one and the aet unit[0] go somrthing and unit[1] to something else and then for instance kill both of them, both will be killed
using arrays while having 8 groups leave you with 8184 empty groups and technically looping trough 8 array values is the same as having 8 values in row

you can actually use only one unit group for this whole or just add before every unit group custom script set bj_wantDestroyGroup = true
 
Level 5
Joined
Jun 24, 2012
Messages
112
lol, you maybe dont know but Jass arrays have ever 8192 indexes, the value in box is just to let you hope
to prove this, go and make unit array of size one and the aet unit[0] go somrthing and unit[1] to something else and then for instance kill both of them, both will be killed
using arrays while having 8 groups leave you with 8184 empty groups and technically looping trough 8 array values is the same as having 8 values in row

you can actually use only one unit group for this whole or just add before every unit group custom script set bj_wantDestroyGroup = true

Not sure what you're tying to say in the first part...
On the bolded stuff.. Duh lol. It's just 10x simpler and easier. Also better in case you need to reference them in the future.
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
if you open variable editor or how is it called and you press array and ok it doesnt matter what number you typed in, the size of the array will ever be 8192(like if you created 8192 unit groups)
when im on computer Ill post a way to do it without array
also it doesnt matter if you use or dont array, you can just pick those units again when you want to make them do something later
 
Status
Not open for further replies.
Top