1. The Aftermath has been revealed for the 19th Terraining Contest! Be sure to check out the Results and see what came out of it.
    Dismiss Notice
  2. Melee Mapping Contest #3 - Results are out! Congratulate the winners and check plenty of new 4v4 melee maps designed for this competition!
    Dismiss Notice
  3. The winners of our cinematic soundtrack competition have been decided! Step by the Music Contest #11 - Results to check the entries and congratulate the winners!
    Dismiss Notice

how to give a unit a buff?

Discussion in 'World Editor Help Zone' started by sluk, Sep 3, 2016.

  1. sluk

    sluk

    Joined:
    Feb 27, 2016
    Messages:
    614
    Resources:
    0
    Resources:
    0
    so if your food is equal to 50 or greater than your hero will get a hunger buff
    but i dont know how to add the buff
     
  2. jakeZinc

    jakeZinc

    Joined:
    Aug 13, 2013
    Messages:
    1,366
    Resources:
    20
    Spells:
    20
    Resources:
    20
    Code (vJASS):
    call UnitAddAbility(udg_YourUnit, udg_YourBuffID)

    Can be written on custom script;
    YourBuffID is an integer variable which stores the rawcode of your desired buff.
    Get Rawcode: Press Ctrl+D and go to your buff; it should look like 'B000'... or etc.
     
  3. KILLCIDE

    KILLCIDE

    Administrator

    Joined:
    Jul 22, 2015
    Messages:
    3,472
    Resources:
    20
    Models:
    2
    Icons:
    10
    Spells:
    7
    Tutorials:
    1
    Resources:
    20
    Using
    UnitAddAbility()
    doesn't work if you want to directly add the buffs.

    What most people do is add the Slow Aura (Tornado) ability to the unit since it doesn't show up in the unit's command card. All you will have to do is make sure that the movement speed, attack speed, etc values are all set to 0, the affected targets are set to "Self," and that you edit the Buff field to whatever buff you want.
     
  4. sluk

    sluk

    Joined:
    Feb 27, 2016
    Messages:
    614
    Resources:
    0
    Resources:
    0
    so there is no way to do it with triggers?
     
  5. jakeZinc

    jakeZinc

    Joined:
    Aug 13, 2013
    Messages:
    1,366
    Resources:
    20
    Spells:
    20
    Resources:
    20
    As KILLCIDE said, make an ability customized Slow Aura ( Tornado ) and of course put your specific buff inside it's buff field. Make sure it's data speed are zeroed. Then add that ability to your desired unit through trigger; GUI func of:
    Unit - Add (YourSlowAuraTornadoCustom) Ability.

    SlowAuraTornado is chosen because the ability is not showed in the command card/slots unlike other auras.
     
  6. sluk

    sluk

    Joined:
    Feb 27, 2016
    Messages:
    614
    Resources:
    0
    Resources:
    0
    now how do i start a JASS code?
     
  7. jakeZinc

    jakeZinc

    Joined:
    Aug 13, 2013
    Messages:
    1,366
    Resources:
    20
    Spells:
    20
    Resources:
    20
    You don't need it if your not experienced in JASS cause it has GUI func of adding the ability already.
     
  8. sluk

    sluk

    Joined:
    Feb 27, 2016
    Messages:
    614
    Resources:
    0
    Resources:
    0
    i quess i am just gonna give the hero an ability that gives a buff
     
  9. Wietlol

    Wietlol

    Joined:
    Aug 1, 2013
    Messages:
    4,653
    Resources:
    3
    Spells:
    3
    Resources:
    3
    Go to the object editor.
    Create a new ability based of: Abilities -> Neutral Passive -> Units -> Slow Aura (Tornado)
    Set Data - Movement Speed Factor to 0.00
    Set Stats - Targets Allowed to Self, Invulnerable, Vulnerable
    Set Stats - Buffs to the buff(s) you want to show.

    Add that ability to your unit when you want to give the buff.
    Remove that ability and remove the buff when you want to remove the buff.
     
  10. sluk

    sluk

    Joined:
    Feb 27, 2016
    Messages:
    614
    Resources:
    0
    Resources:
    0
    so if i want to give a buff that you will have -3 armor and -3 dmg
    so how can i do that?
     
  11. RobertMKD

    RobertMKD

    Joined:
    Jan 23, 2015
    Messages:
    787
    Resources:
    1
    Maps:
    1
    Resources:
    1
    I don't use this AT ALL.

    Slow Aura (Tornado) is a negative buff which will display with red letters. It's easy to change the color of the Tooltip, but it will still be recognized as negative by certain abilities that remove positive/negative buffs.
    What I do is make a dummy ability based on Slow (the Sorceress ability) for a negative buff and Unholy Frenzy for a positive one and set all it's effect values to 0.00 and range to 9999. Set the duration as desired, if you want your buff to be permanent, then set it like 9999999 seconds and remove the buff with triggers if you ever want to.
    In the trigger, where you add the hunger buff, create a dummy unit and give it the dummy ability, then in the same trigger order the unit to "Human Sorceress - Slow" the unit you give the buff to and add a 0.4+ sec expiration timer to the dummy.
    To avoid Magic Immunity, simply set the ability to "Hero Ability", set the required level to 6 and then return it back to "Non-hero ability".
     
    Last edited: Sep 5, 2016
  12. KILLCIDE

    KILLCIDE

    Administrator

    Joined:
    Jul 22, 2015
    Messages:
    3,472
    Resources:
    20
    Models:
    2
    Icons:
    10
    Spells:
    7
    Tutorials:
    1
    Resources:
    20
    Lol that's why I said "most people."
     
  13. Wietlol

    Wietlol

    Joined:
    Aug 1, 2013
    Messages:
    4,653
    Resources:
    3
    Spells:
    3
    Resources:
    3
    Which abilities?
    Afaik, there is no ability that removes aura buffs.

    Non-aura abilities cannot apply different buffs when based of the same base ability group.
     
  14. RobertMKD

    RobertMKD

    Joined:
    Jan 23, 2015
    Messages:
    787
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Doesn't matter, maybe he wants the buff to be removable by abilities, or will add that later to his map.
     
  15. Wietlol

    Wietlol

    Joined:
    Aug 1, 2013
    Messages:
    4,653
    Resources:
    3
    Spells:
    3
    Resources:
    3
    Maybe he doesnt want to break any of the default spells.
     
  16. stan0033

    stan0033

    Joined:
    Jun 27, 2010
    Messages:
    1,574
    Resources:
    13
    Models:
    3
    Packs:
    1
    Skins:
    2
    Maps:
    6
    Spells:
    1
    Resources:
    13
    Just uuse a dummy to cast an ability with buff on it. Set the duration of the ability to 0 so it be infinite. If you want to remove the buff later just check the food integer and remove it with trigger. So easy.
     
  17. sluk

    sluk

    Joined:
    Feb 27, 2016
    Messages:
    614
    Resources:
    0
    Resources:
    0
    ok can anybody show a trigger pls i am sorry i dont really know how to work with dummy's