1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still haven't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The reforging of the races is complete. Come see the 14th Techtree Contest Results.
    Dismiss Notice
  4. It's time to choose your horse in the race - the 32nd Modeling Contest Poll is up!
    Dismiss Notice
  5. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

How to command a unit to use an ability

Discussion in 'World Editor Help Zone' started by DeathsAbyss, Sep 2, 2012.

  1. DeathsAbyss

    DeathsAbyss

    Joined:
    Aug 3, 2012
    Messages:
    18
    Resources:
    0
    Resources:
    0
    Title says it all can someone post a trigger on how to do this?
     
  2. PurgeandFire

    PurgeandFire

    Code Moderator

    Joined:
    Nov 11, 2006
    Messages:
    7,426
    Resources:
    18
    Icons:
    1
    Spells:
    4
    Tutorials:
    9
    JASS:
    4
    Resources:
    18
    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".
     
  3. Spartipilo

    Spartipilo

    Joined:
    Jul 14, 2011
    Messages:
    3,190
    Resources:
    0
    Resources:
    0
    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.
     
  4. Elfansoer

    Elfansoer

    Joined:
    Aug 26, 2012
    Messages:
    122
    Resources:
    0
    Resources:
    0
    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)) )
     
  5. DeathsAbyss

    DeathsAbyss

    Joined:
    Aug 3, 2012
    Messages:
    18
    Resources:
    0
    Resources:
    0
    Can you guys post a trigger example? The ability I want to activate is enrage...
     
  6. Maestros

    Maestros

    Joined:
    Oct 26, 2008
    Messages:
    373
    Resources:
    1
    Spells:
    1
    Resources:
    1
    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
     
  7. DeathsAbyss

    DeathsAbyss

    Joined:
    Aug 3, 2012
    Messages:
    18
    Resources:
    0
    Resources:
    0
    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: Sep 5, 2012
  8. Spartipilo

    Spartipilo

    Joined:
    Jul 14, 2011
    Messages:
    3,190
    Resources:
    0
    Resources:
    0
    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?
     
  9. SupremeGrandRuler

    SupremeGrandRuler

    Joined:
    Jun 24, 2012
    Messages:
    112
    Resources:
    0
    Resources:
    0
    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.
     
  10. Elfansoer

    Elfansoer

    Joined:
    Aug 26, 2012
    Messages:
    122
    Resources:
    0
    Resources:
    0
    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?)
     
  11. SupremeGrandRuler

    SupremeGrandRuler

    Joined:
    Jun 24, 2012
    Messages:
    112
    Resources:
    0
    Resources:
    0
    The first part isn't necessary. Just get rid of the P8 stuff and make it an array.
     
  12. Elfansoer

    Elfansoer

    Joined:
    Aug 26, 2012
    Messages:
    122
    Resources:
    0
    Resources:
    0
    Yeah, I know, I just want to connect the DeathsAbyss's trigger with that one...
    (Yes, actually, I'm too lazy to write that....)
     
  13. edo494

    edo494

    Joined:
    Apr 16, 2012
    Messages:
    3,846
    Resources:
    5
    Spells:
    1
    JASS:
    4
    Resources:
    5
    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
     
  14. SupremeGrandRuler

    SupremeGrandRuler

    Joined:
    Jun 24, 2012
    Messages:
    112
    Resources:
    0
    Resources:
    0
    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.
     
  15. edo494

    edo494

    Joined:
    Apr 16, 2012
    Messages:
    3,846
    Resources:
    5
    Spells:
    1
    JASS:
    4
    Resources:
    5
    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