1. Find your way through the deepest dungeon in the 18th Mini Mapping Contest Poll.
    Dismiss Notice
  2. A brave new world lies beyond the seven seas. Join the 34th Modeling Contest today!
    Dismiss Notice
  3. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
Hive 3 Remoosed BETA - NOW LIVE. Go check it out at BETA Hive Workshop! Post your feedback in this new forum BETA Feedback.
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

A unit gets a buff when attacked

Discussion in 'World Editor Help Zone' started by DaneTheBeast, Feb 17, 2015.

  1. DaneTheBeast

    DaneTheBeast

    Joined:
    Dec 11, 2014
    Messages:
    608
    Resources:
    1
    Maps:
    1
    Resources:
    1
    I want to make it so when the unit is attacked it gets the "bloodlust" effect on it, making it move faster. The problem is I have no idea how to do it, any help would be appreciated
     
  2. Yugata

    Yugata

    Joined:
    May 12, 2014
    Messages:
    131
    Resources:
    0
    Resources:
    0
    Well, that depends if the unit has an orb effect already.
    1) If it doesn't, then the easiest method you can use would probably be Orb of Lightning (New).
    The easiest way
    1) The first step would be to find the ability. Orb of Light (New) is an item ability. Make a custom ability of it and change it to a unit/hero spell.
    2) Make a custom ability of Bloodlust.
    3) On the Orb of Lightning ability that you made, add the Bloodlust spell to the field "Data - Effect Ability"
    4) Add the Orb of Lightning (New) spell to your unit, and adjust any other fields on the spell. (If you want the bloodlust affect to happen every time, then set the fields "Data - Chance to hit whatever" to 100. and set the damage bonus to 0 if you don't want bonus damage.

    Also, you would have to make 1 or 2 triggers, depending on how many units have this ability.
    If only one unit has it, then you can do this
    • Attack Acquire
      • Events
        • Unit - YourUnit Acquires a target
      • Conditions
      • Actions
        • Unit - Order (Triggering unit) to Attack (Targeted unit)

    Otherwise you have to add another small trigger
    • Add Unit
      • Events
        • Unit - A unit enters (Playable map area)
      • Conditions
        • (Unit-type of (Triggering unit)) Equal to YourUnit
      • Actions
        • Trigger - Add to Attack Acquire <gen> the event (Unit - (Triggering unit) Acquires a target)

    The only problem with this is when there's TOO many units that you want to have the spell. I don't know the details, but having too many events on a trigger crashes the game or something.


    2) If your unit is using an orb effect already, then you would have to trigger it.
    Buggy Way
    1) Create a dummy unit with a bloodlust ability
    • Bloodlust
      • Events
        • Unit - A unit Is attacked
      • Conditions
        • (Unit-type of (Attacking unit)) Equal to YourUnit
      • Actions
        • Set Temp_P = (Position of (Triggering unit))
        • Unit - Create 1 Bloodlust Caster for (Owner of (Attacking unit)) at Temp_P facing Default building facing degrees
        • Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
        • Unit - Order (Last created unit) to Orc Shaman - Bloodlust (Triggering unit)
        • Custom script: call RemoveLocation (udg_Temp_P)

    The main problem with doing it this way is that the unit can cancel its attack, but the trigger will still run, so a unit can be forever bloodlusted over and over again quickly.


    3) The possibly last way would be to use a damage detection system. I don't have a way to show you the damage detection way at the moment, but if you want it, I can give it to you later.

    Edit: I think I misread your problem, so #1 probably won't work for you. Just ignore that one. Sorry
     
    Last edited: Feb 17, 2015
  3. DaneTheBeast

    DaneTheBeast

    Joined:
    Dec 11, 2014
    Messages:
    608
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Thanks. I need it to apply bloodlust to the attacked unit that lasts, lets say, 10 seconds, but can't be re-applied for the next 60 seconds. Also, when the unit gets the buff it doesn't stop doing what it's currently doing, if it's moving it continues to move.
     
  4. humanitysector

    humanitysector

    Joined:
    Jul 25, 2014
    Messages:
    31
    Resources:
    0
    Resources:
    0
    I am also interested in how this trigger is made.

    It probably requires indexing and a counter, but idk.
     
  5. Yugata

    Yugata

    Joined:
    May 12, 2014
    Messages:
    131
    Resources:
    0
    Resources:
    0
    Ok, I think I got you on this one.
    Triggers
    • Bloodlust
      • Events
        • Unit - A unit Is attacked
      • Conditions
        • (Unit-type of (Attacked unit)) Equal to Almighty Runner
      • Actions
        • Set Temp_Unit = (Attacked unit)
        • Set Bloodlust_Boolean = False
        • For each (Integer Bloodlust_Loop) from 1 to Bloodlust_Loop_Max, do (Actions)
          • Loop - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • Bloodlust_Boolean Equal to False
                • Temp_Unit Equal to Bloodlust_C[Bloodlust_Loop]
              • Then - Actions
                • Set Bloodlust_Boolean = True
              • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Bloodlust_Boolean Equal to True
          • Then - Actions
            • Set Temp_P = (Position of Temp_Unit)
            • Unit - Create 1 Bloodlust Caster for (Owner of Temp_Unit) at Temp_P facing Default building facing degrees
            • Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
            • Unit - Order (Last created unit) to Orc Shaman - Bloodlust Temp_Unit
            • Set Bloodlust_Loop_Max = (Bloodlust_Loop_Max + 1)
            • Set Bloodlust_Timer[Bloodlust_Loop_Max] = 60.00
            • Set Bloodlust_C[Bloodlust_Loop_Max] = Temp_Unit
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • Bloodlust_Loop_Max Equal to 1
              • Then - Actions
                • Trigger - Turn on Bloodlust Timer <gen>
              • Else - Actions
          • Else - Actions

    • Bloodlust Timer
      • Events
        • Time - Every 0.05 seconds of game time
      • Conditions
      • Actions
        • For each (Integer Bloodlust_Loop) from 1 to Bloodlust_Loop_Max, do (Actions)
          • Loop - Actions
            • Set Bloodlust_Timer[Bloodlust_Loop] = (Bloodlust_Timer[Bloodlust_Loop] - 0.05)
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • Bloodlust_Timer[Bloodlust_Loop] Less than or equal to 0.00
              • Then - Actions
                • Set Bloodlust_C[Bloodlust_Loop] = Bloodlust_C[Bloodlust_Loop_Max]
                • Set Bloodlust_Timer[Bloodlust_Loop] = Bloodlust_Timer[Bloodlust_Loop_Max]
                • Set Bloodlust_Loop = (Bloodlust_Loop - 1)
                • Set Bloodlust_Loop_Max = (Bloodlust_Loop_Max - 1)
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • Bloodlust_Loop_Max Less than or equal to 0
                  • Then - Actions
                    • Trigger - Turn off Bloodlust Timer <gen>
                  • Else - Actions
              • Else - Actions


    This test map was sorta made in a rush, so it may or may not work right, and there could be useless junk like an extra folder.
     

    Attached Files:

  6. DaneTheBeast

    DaneTheBeast

    Joined:
    Dec 11, 2014
    Messages:
    608
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Hmm. What I noticed is that from the start of the map the unit has "Endurance Aura" buff. And attacked there doesnt seem to be any difference. There is no sound or visual that tells you that the unit got the buff, not even the buff on it changes, it didn't get the bloodlust.
     
  7. Yugata

    Yugata

    Joined:
    May 12, 2014
    Messages:
    131
    Resources:
    0
    Resources:
    0
    Hahaha, I knew I went wrong somewhere. When I first made this, I had less than 10 minutes (school lunch). Now I'm back at home and I already found all the problems you noticed.


    Triggers
    • Bloodlust
      • Events
        • Unit - A unit Is attacked
      • Conditions
        • (Unit-type of (Attacked unit)) Equal to Almighty Runner
      • Actions
        • Set Temp_Unit = (Attacked unit)
        • Set Bloodlust_Boolean = False
        • For each (Integer Bloodlust_Loop) from 1 to Bloodlust_Loop_Max, do (Actions)
          • Loop - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • Bloodlust_Boolean Equal to False
                • Temp_Unit Equal to Bloodlust_C[Bloodlust_Loop]
              • Then - Actions
                • Set Bloodlust_Boolean = True
              • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Bloodlust_Boolean Equal to False
          • Then - Actions
            • Set Temp_P = (Position of Temp_Unit)
            • Unit - Create 1 Bloodlust Caster for (Owner of Temp_Unit) at Temp_P facing Default building facing degrees
            • Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
            • Unit - Order (Last created unit) to Orc Shaman - Bloodlust Temp_Unit
            • Set Bloodlust_Loop_Max = (Bloodlust_Loop_Max + 1)
            • Set Bloodlust_Timer[Bloodlust_Loop_Max] = 60.00
            • Set Bloodlust_C[Bloodlust_Loop_Max] = Temp_Unit
            • Custom script: call RemoveLocation (udg_Temp_P)
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • Bloodlust_Loop_Max Equal to 1
              • Then - Actions
                • Trigger - Turn on Bloodlust Timer <gen>
              • Else - Actions
          • Else - Actions


    • Bloodlust Timer
      • Events
        • Time - Every 0.05 seconds of game time
      • Conditions
      • Actions
        • For each (Integer Bloodlust_Loop) from 1 to Bloodlust_Loop_Max, do (Actions)
          • Loop - Actions
            • Set Bloodlust_Timer[Bloodlust_Loop] = (Bloodlust_Timer[Bloodlust_Loop] - 0.05)
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • Bloodlust_Timer[Bloodlust_Loop] Less than or equal to 0.00
              • Then - Actions
                • Set Bloodlust_C[Bloodlust_Loop] = Bloodlust_C[Bloodlust_Loop_Max]
                • Set Bloodlust_Timer[Bloodlust_Loop] = Bloodlust_Timer[Bloodlust_Loop_Max]
                • Set Bloodlust_Loop = (Bloodlust_Loop - 1)
                • Set Bloodlust_Loop_Max = (Bloodlust_Loop_Max - 1)
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • Bloodlust_Loop_Max Less than or equal to 0
                  • Then - Actions
                    • Trigger - Turn off Bloodlust Timer <gen>
                  • Else - Actions
              • Else - Actions


    In the first trigger, I set the wrong condition. It basically said "If the boolean is true, THEN DO actions. But it was suppose to be false to do the actions. There was a leak I forgot to clean, and the endurance aura buff is gone. I forgot to set it to no targets allowed.

    The test map should be cleaner, and it should work now. If you want a cooldown to show for the 60 seconds, I think I could work that in if you want it.

    Edit: Wow I'm off today. Wrong attachment added. The real test map should be call Bloodlust2.w3x
     

    Attached Files:

  8. DaneTheBeast

    DaneTheBeast

    Joined:
    Dec 11, 2014
    Messages:
    608
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Thanks. That seems to work perfectly(on your map). I will credit you (and others that helped me on the hive) in the new version of my map if all works well :D
     
    Last edited: Feb 18, 2015
  9. DaneTheBeast

    DaneTheBeast

    Joined:
    Dec 11, 2014
    Messages:
    608
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Alright. I tested it and I can't get it to work. I will upload my map and you can open it and look into the triggers and such. I hope you can find the problem because i can't. I changed that the Bloodlust Caster doesnt have an attack and doesnt have a shadow, so he doesnt attack my buildings. I also made a trigger that you can send creeps to yourself and the Ogre (The unit that is the one that i want the ability on) is sendable from the start of the game. (2nd tier shrine). Use greeisgood for gold and send 1 ogre and when your towers attack him he doesn't get the buff. I looked around if I made any mistakes but I am not sure where it is. Thanks for all your help, really close to completing the trigger :ogre_haosis:
     

    Attached Files:

  10. Yugata

    Yugata

    Joined:
    May 12, 2014
    Messages:
    131
    Resources:
    0
    Resources:
    0
    Ok, I found your problem. You gave the dummy unit the wrong bloodlust ability. :goblin_boom:


    There are 5 different bloodlusts in your map. Any of those that you are using you should name more specifically so you can find them easier. The copy I have I renamed the right Bloodlust to "Bloodlust XL Infinity DLX".

    What I think went wrong was that you gave the dummy unit the orc bloodlust ability, which has a requirement to it, and of course can't be casted.

    I tried it out now, and it works just fine. :)

    For the record, This looks really interesting, and I hope you continue to finish this!
     

    Attached Files:

  11. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    26,189
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    You should rather trigger it when the unit is damaged. Otherwise just the act of a catapult >1,000 units away beginning to attack (not even firing) will cause the unit to get bloodlust. It also allows you to trigger it off ability damage (unlike currently where abilities will not trigger it which could be exploited).
     
  12. jot0017

    jot0017

    Joined:
    Jan 3, 2013
    Messages:
    68
    Resources:
    0
    Resources:
    0
    If the Ogre already is in the map or it will exist only once you can use this ;)

    Ogre Cast
    • Ogre Cast
      • Events
        • Unit - The Ogre 0001 <gen> Takes damage
      • Conditions
      • Actions
        • Trigger - Turn off (This trigger)
        • Set Ogre_Point = (Position of The Ogre 0001 <gen>)
        • Unit - Create 1 Dummy Unit for (Triggering player) at Ogre_Point facing Default building facing degrees
        • Unit - Add BloodLust to (Last created unit)
        • Unit - Order (Last created unit) to Orc Shaman - Bloodlust The Ogre 0001 <gen>
        • Countdown Timer - Start Ogre_Timer to expire in 60.00 seconds, as a One-shot timer, performing (Trigger - Turn on (This trigger)) upon expiration.

    And you use this Ogre Cast in case the unit is not existing in the map already, BUT ONLY if you will produce ONE AND NO MORE OGRES

    Ogre Cast
    • Ogre Appears
      • Events
        • Unit - A unit enters (Playable map area)
      • Conditions
        • (Unit-type of (Triggering unit)) Equal to The Ogre
      • Actions
        • Trigger - Turn off (This trigger)
        • Set The_Ogre = (Entering unit)
        • Trigger - Add to Ogre Cast <gen> the event (Unit - The_Ogre Takes damage)
     
  13. DaneTheBeast

    DaneTheBeast

    Joined:
    Dec 11, 2014
    Messages:
    608
    Resources:
    1
    Maps:
    1
    Resources:
    1
    That is really interesting, and you are right. I saw that it gets the buff before it takes damage. The problem is the only "Unit takes damage" I found was in "Unit Specific Event", which, i guess, can't be used. Not sure how to do it.
     
  14. DaneTheBeast

    DaneTheBeast

    Joined:
    Dec 11, 2014
    Messages:
    608
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Thanks, but the ogre isn't in it from the start, and he can be spawned infinitely
     
  15. jot0017

    jot0017

    Joined:
    Jan 3, 2013
    Messages:
    68
    Resources:
    0
    Resources:
    0
  16. DaneTheBeast

    DaneTheBeast

    Joined:
    Dec 11, 2014
    Messages:
    608
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Oh nice, well, that is a little too advanced for now :D
    shhh
    (or maybe I am just lazy)
    Thanks for all your help but as long as the current trigger is working and there are no problems I am going to stick with it.
    If I remember, everyone is getting credited :p