1. Join other hivers in a friendly concept-art contest. The contestants have to create a genie coming out of its container. We wish you the best of luck!
    Dismiss Notice
  2. The Melee Mapping Contest #4: 2v2 - Results are out! Step by to congratulate the winners!
    Dismiss Notice
  3. We're hosting the 15th Mini-Mapping Contest with YouTuber Abelhawk! The contestants are to create a custom map that uses the hidden content within Warcraft 3 or is inspired by any of the many secrets within the game.
    Dismiss Notice
  4. The 20th iteration of the Terraining Contest is upon us! Join and create exquisite Water Structures for it.
    Dismiss Notice
  5. Check out the Staff job openings thread.
    Dismiss Notice

Auto Casting Transformation

Discussion in 'Triggers & Scripts' started by Illidanthepredator, Jun 14, 2019 at 7:00 PM.

  1. Illidanthepredator

    Illidanthepredator

    Joined:
    Jun 9, 2019
    Messages:
    11
    Resources:
    0
    Resources:
    0
    So I am making an anime themed map and am looking to how to make an ability that activates only when heroes life is low and significantly raises their attributes makes them levitate slightly and changes his color...
     
  2. Pyrogasm

    Pyrogasm

    Joined:
    Feb 27, 2007
    Messages:
    2,412
    Resources:
    0
    Resources:
    0
    • Events
      • Time - Every 0.50 seconds of game-time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in GROUP_THAT_HAS_ALL_UNITS_WITH_THIS_ABILITY_IN_IT and do (Actions)
        • Loop - Actions
          • Set TempUnit = (Picked Unit)
          • Set LifePct = (Percentage life of TempUnit)
          • Set BonusActive = ((Level of THIS_ABILITY_GETS_ADDED_WHEN_THIS_IS_ACTIVE) for TempUnit) greater than 0) //BonusActive is a boolean variable
          • If (All conditions are true) then do (Then actions) else do (Else actions)
            • If - Conditions
              • LifePct less than or equal to THRESHOLD_VALUE
              • BonusActive equal to false
            • Then - Actions
              • Unit - Add THIS_ABILITY_GETS_ADDED_WHEN_THIS_IS_ACTIVE to TempUnit
              • -------- set bonuses here --------
              • -------- you may need to store the amount of added stats in a variable so you can properly remove them later --------
            • Else - Actions
          • If (All conditions are true) then do (Then actions) else do (Else actions)
            • If - Conditions
              • LifePct greater than or equal to THRESHOLD_VALUE
              • BonusActive equal to true
            • Then - Actions
              • Unit - Remove THIS_ABILITY_GETS_ADDED_WHEN_THIS_IS_ACTIVE from TempUnit
              • -------- remove bonuses here --------
            • Else - Actions

    Add units to the group as necessary (when they learn the skill, enter the map, reach a certain level, whatever). If you DO need to store the added stats a MUI solution will require a unit indexer and some arrays or a hashtable for this information. Otherwise this method should work fine. Instead of adding the stats with a trigger you could even make an attribute bonus ability and add that with triggers as I did for the visual effect/flag ability above.
     
  3. Illidanthepredator

    Illidanthepredator

    Joined:
    Jun 9, 2019
    Messages:
    11
    Resources:
    0
    Resources:
    0
    What kind of variable is BonusActive?
     
  4. Pyrogasm

    Pyrogasm

    Joined:
    Feb 27, 2007
    Messages:
    2,412
    Resources:
    0
    Resources:
    0
    It literally says next to the line because I knew it was not going to be clear: //BonusActive is a boolean variable
     
  5. Illidanthepredator

    Illidanthepredator

    Joined:
    Jun 9, 2019
    Messages:
    11
    Resources:
    0
    Resources:
    0
    i have it as that...and i dont see anything about level of hero ability?
     
  6. Pyrogasm

    Pyrogasm

    Joined:
    Feb 27, 2007
    Messages:
    2,412
    Resources:
    0
    Resources:
    0
    It's an integer comparison.
     
  7. Illidanthepredator

    Illidanthepredator

    Joined:
    Jun 9, 2019
    Messages:
    11
    Resources:
    0
    Resources:
    0
    Oh well i dont have that option...do i really need it
     
  8. Illidanthepredator

    Illidanthepredator

    Joined:
    Jun 9, 2019
    Messages:
    11
    Resources:
    0
    Resources:
    0
    Nevermind I give up...i dont even know what ability to use to make the ability...im so bad at this...gonna take me forever to finish my project
     
  9. Pyrogasm

    Pyrogasm

    Joined:
    Feb 27, 2007
    Messages:
    2,412
    Resources:
    0
    Resources:
    0
    For fuck's sake dude you will never learn if you don't try. Think about what you are trying to do. Use your brain. Try something instead of giving up.

    The ability I said to add is just functioning as a flag. It doesn't DO anything, the unit just HAS it when the extra stats are active so that your trigger knows if its already added the stats to a unit or not. Without this ability you will have to use a hashtable or unit indexer + arrays as I said below. Base it on an item ability like claws of attack bonus and make not give any bonuses. Item abilities usually don't show up on the command card so you won't have to hide it. If you are going to use an attribute bonus ability to increase stats then you can just use (and check for) that ability instead and you don't have to have another invisible ability that does nothing.

    I looked and it turns out Blizzard is absolutely retarded and doesn't allow GUI to assign boolean variables to any of the comparison options that do exist in conditions. For some fucking reason nooooo it can't do that. You will have to do this instead:

    • Events
      • Time - Every 0.50 seconds of game-time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in GROUP_THAT_HAS_ALL_UNITS_WITH_THIS_ABILITY_IN_IT and do (Actions)
        • Loop - Actions
          • Set TempUnit = (Picked Unit)
          • Set LifePct = (Percentage life of TempUnit)
          • Set BonusLvl = ((Level of FLAG_ABILITY) for TempUnit)
          • If (All conditions are true) then do (Then actions) else do (Else actions)
            • If - Conditions
              • LifePct less than or equal to THRESHOLD_VALUE
              • BonusLvl equal to 0
            • Then - Actions
              • Unit - Add FLAG_ABILITY to TempUnit
              • -------- Change stats here if you are going to use a trigger, or instead of FLAG_ABILITY add the proper attribute bonus ability --------
              • -------- --------
              • -------- this is a trick to make it so you can set the fly height of ground units with a trigger --------
              • -------- it only has to be done once per unit and then you can set its height at will, which is why this part of the trigger ISN'T in the other if statement below this one --------
              • Unit - Add Crow Form (Medivh) to TempUnit
              • Unit - Remove Crow Form (Medivh) from TempUnit
              • Unit - Set TempUnit fly height to HEIGHT_YOU_WANT at RATE_YOU_WANT_IT_TO_CHANGE
              • -------- choose your new color here --------
              • Unit - Set TempUnit vertex color to RED %, GREEN %, BLUE % and 0% transparency
            • Else - Actions
          • If (All conditions are true) then do (Then actions) else do (Else actions)
            • If - Conditions
              • LifePct greater than or equal to THRESHOLD_VALUE
              • BonusLvl greater than 0
            • Then - Actions
              • Unit - Remove FLAG_ABILITY from TempUnit
              • -------- remove bonuses here if you used a trigger or instead of FLAG_ABILITY remove the proper attribute bonus ability --------
              • Unit - Set TempUnit fly height to ORIGNIAL_FLY_HEIGHT at RATE_YOU_WANT_IT_TO_CHANGE
              • Unit - Set TempUnit vertex color to 100%, 100%, 100% and 0% transparency
            • Else - Actions



    Another possible way to achieve the transformation is to make a second version of the unit in the object editor that has the fly height, color, and increased stats that you want. Then you can morph the hero into that alternate version by using the method in this tutorial: Hero passive transformation. You may actually find this to be easier than what I suggested, but it is possible (unlikely but possible) that it will muck with other spells you're using that add abilities to heroes.
     
  10. Illidanthepredator

    Illidanthepredator

    Joined:
    Jun 9, 2019
    Messages:
    11
    Resources:
    0
    Resources:
    0
    I dont know man...nothing ever seems to work right with me...i thinks it my editor
     
  11. Pyrogasm

    Pyrogasm

    Joined:
    Feb 27, 2007
    Messages:
    2,412
    Resources:
    0
    Resources:
    0
    Alright then I hereby refuse to continue helping you if you're not going to acknowledge the detailed instructions and full and complete trigger with comments I posted for you above. Your editor is not bugged. It works logically, consistently and (for the most part) exactly as it describes it does. Blizzard has made many major improvements with the pending release of Reforged, so I suggest you make sure your editor is updated by connecting to Battle.net.
     
  12. Illidanthepredator

    Illidanthepredator

    Joined:
    Jun 9, 2019
    Messages:
    11
    Resources:
    0
    Resources:
    0
    I've done boths triggers still dont work..... its my editor..its outdated and I dont have battle.net