[Trigger] Custom Taunt Optimization

Level 13
Joined
Sep 11, 2013
Messages
467
Greetings!

I wish to optimize this trigger that I found on a map because I wish to put this taunt spell in my map on Tiny.

So..
1. This Taunt will give me +1 armor when I cast the spell near an enemy and I don't wish that..
I just want basic Taunt that seems to work fine with this trigger. (Ex:Force all enemy near me to attack me for 3 seconds //Just 1 level)

What should I delete in order to not break the entire trigger and in order to remove that part with +1 armor?
I suspect those 2 custom scripts.. but I am not sure if that is enough..
  • Custom script: call UnitAddAbility(udg_BC_Unit[1], 'A001')
  • Custom script: call UnitRemoveAbility(udg_BC_Unit[1], 'A001')

2. Also, I wish this trigger to not have bugs, but I don't know if is created/optimized properly. (I don't wish my game to crash in the middle of the game because of this trigger)
Please take a look and tell me if is good.:peasant-bowing:
I attached the map in this post

The help will be appreciated!

  • BC Setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set VariableSet BC_Hashtable = (Last created hashtable)
  • BC Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Berserker's Call
    • Actions
      • Set VariableSet BC_Unit[1] = (Triggering unit)
      • Set VariableSet BC_CasterLoc = (Position of BC_Unit[1])
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 375.00 of BC_CasterLoc matching ((((Matching unit) is A structure) Equal to False) and (((Matching unit) belongs to an enemy of (Triggering player).) Equal to True)).) and do (Actions)
        • Loop - Actions
          • Set VariableSet BC_Unit[2] = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • BC_Unit[2] Not equal to No unit
            • Then - Actions
              • Set VariableSet BC_HandleID = (Key (Picked unit).)
              • Hashtable - Save Handle OfBC_Unit[1] as (Key Caster.) of BC_HandleID in BC_Hashtable.
              • Custom script: call UnitAddAbility(udg_BC_Unit[1], 'A001')
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (BC_Unit[2] is in BC_GroupBC.) Equal to False
                • Then - Actions
                  • Unit Group - Add BC_Unit[2] to BC_GroupBC
                  • Special Effect - Create a special effect attached to the chest of BC_Unit[2] using Abilities\Spells\Other\Incinerate\IncinerateBuff.mdl
                  • Set VariableSet BC_SFX = (Last created special effect)
                  • Hashtable - Save Handle OfBC_SFX as (Key SFX.) of BC_HandleID in BC_Hashtable.
                • Else - Actions
            • Else - Actions
      • Trigger - Turn on BC Loop <gen>
      • Trigger - Turn on BC Remove <gen>
      • Custom script: call RemoveLocation(udg_BC_CasterLoc)
  • BC Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in BC_GroupBC and do (Actions)
        • Loop - Actions
          • Set VariableSet BC_HandleID = (Key (Picked unit).)
          • Set VariableSet BC_Unit[1] = (Load (Key Caster.) of BC_HandleID in BC_Hashtable.)
          • Set VariableSet BC_SFX = (Load (Key SFX.) of BC_HandleID in BC_Hashtable.)
          • Set VariableSet BC_Unit[2] = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (BC_Unit[2] has buff Berserker's Call ) Equal to True
            • Then - Actions
              • Unit - Order BC_Unit[2] to Attack BC_Unit[1]
            • Else - Actions
              • Custom script: call UnitRemoveAbility(udg_BC_Unit[1], 'A001')
              • Unit - Order BC_Unit[2] to Stop.
              • Unit Group - Remove BC_Unit[2] from BC_GroupBC.
              • Special Effect - Destroy BC_SFX
              • Hashtable - Clear all child hashtables of child BC_HandleID in BC_Hashtable.
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in (Units in (Playable map area))) Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                  • Trigger - Turn off BC Loop <gen>
                • Else - Actions
  • BC Remove
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Set VariableSet BC_HandleID = (Key (Triggering unit).)
      • Set VariableSet BC_SFX = (Load (Key SFX.) of BC_HandleID in BC_Hashtable.)
      • Unit Group - Remove (Triggering unit) from BC_GroupBC.
      • Special Effect - Destroy BC_SFX
      • Hashtable - Clear all child hashtables of child BC_HandleID in (Last created hashtable).
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in (Units in (Playable map area))) Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
          • Trigger - Turn off BC Loop <gen>
        • Else - Actions
 

Attachments

  • Tiny Taunt Berserker's Call 2025.w3x
    18.2 KB · Views: 2
Your intuition was right. :) The 'A001' ability is listed in the object editor a custom ability "Item Armor Bonus - ARMOR FOR TAUNT". You can view the raw-codes of each object in the object editor by opening the object editor and pressing CTRL+D (or going to View > Display Values As Raw Data). So you just need to remove those two lines (the custom scripts that add/remove the ability) and you're good to go!
 

Attachments

  • Tiny Taunt Berserker's Call 2025.w3x
    18.1 KB · Views: 3
Level 13
Joined
Sep 11, 2013
Messages
467
Your intuition was right. :) The 'A001' ability is listed in the object editor a custom ability "Item Armor Bonus - ARMOR FOR TAUNT". You can view the raw-codes of each object in the object editor by opening the object editor and pressing CTRL+D (or going to View > Display Values As Raw Data). So you just need to remove those two lines (the custom scripts that add/remove the ability) and you're good to go!
Thank you @PurgeandFire! Seems to work good! I just hope that this trigger will not create crash or bugs random when I will play with players.:peasant-smile:
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
Thank you @PurgeandFire! Seems to work good! I just hope that this trigger will not create crash or bugs random when I will play with players.:peasant-smile:
I looked over the triggers in Purge's map and there were some serious issues, assuming from the original creator or something went wrong during the process.

I fixed them in the attached map.

Also, the Hashtable design is overkill, this would be a good case for Unit Indexing. Not that big of a deal though, if it works it works.

Edit: Attached the Unit Indexer design (Fix 2), much cleaner and if you already have a Unit Indexer it's more efficient.
 

Attachments

  • Tiny Taunt Berserker's Call 2025 Fix 1.w3x
    18.5 KB · Views: 2
  • Taunt Berserkers Call Fix 2.w3x
    21.8 KB · Views: 2
Last edited:
Level 13
Joined
Sep 11, 2013
Messages
467
Hi Uncle!
Thank you for your help/effort to solve the problems and thank you because you had optimized the trigger.
Edit: Attached the Unit Indexer design (Fix 2), much cleaner and if you already have a Unit Indexer it's more efficient.
Sure, I already use Unit Indexer with other triggers created by you:peasant-thumbs-up:

Right now, I work on Taunt Berserkers Call (Fix 2) - with Unit Indexer and all seems to work great, but I found a weird bug after few tests and I have no idea how to fix that..

I didn't change the map. All you have to do to reproduce the bug is to put 2 Tiny left and right close to the many peasants like in the video (I put both Tiny on hold position) and then use taunt on both (almost at the same time) and then just spam taunt on 1 and the bug will appear. After that you can spam taunt on the other Tiny and the bug will appear on the other side. (some random peasants will attack the other Tiny and they have visual buff on them)



EDIT: I just tested my original map and all maps posted in this thread. The bug appear in all maps.
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
I see, the issue is one that I often forget about. A Unit Group's "Area of Effect" is not the same as an Abilities "Area of Effect".

The Unit Group ignores Collision Size when doing it's "within range" calculation:
  • Unit Group - Pick every unit in (Units within 375.00 of BC_Point.) and do (Actions)
While an Ability will include the unit's Collision Size in it's "within range" calculation, meaning it has further reach.

One way to fix this is to apply the Buff manually inside of the trigger since that'll avoid relying on the Ability buff/AoE. I did that in this new map version. The only downside here is that a Dummy unit is now targeting the enemy units with another ability, which could have unforeseen consequences (Spell Shield comes to mind). It has the upside that you can make the Dummy ability apply extra effects. In this case I'm using Cripple, although I've disabled it's normal effects, but you could change it to reduce speed, reduce damage, apply an entirely different buff, etc.

And this thread contains an example of another fix which might work, allowing you to continue using the Roar buff:
 

Attachments

  • Taunt Berserkers Call Fix 3.w3x
    22.5 KB · Views: 2
Last edited:
Level 13
Joined
Sep 11, 2013
Messages
467
I see, the issue is one that I often forget about. A Unit Group's "Area of Effect" is not the same as an Abilities "Area of Effect".

The Unit Group ignores Collision Size when doing it's "within range" calculation:
  • Unit Group - Pick every unit in (Units within 375.00 of BC_Point.) and do (Actions)
While an Ability will include the unit's Collision Size in it's "within range" calculation, meaning it has further reach.

One way to fix this is to apply the Buff manually in the trigger since that'll avoid relying on the Ability buff/AoE. I did that in this new map version. The only downside here is that a Dummy unit is now targeting the unit's with another ability, which could have unforeseen consequences (Spell Shield comes to mind). It has the upside that you can make the Dummy ability apply extra effects. In this case I'm using Cripple although I've disabled it's normal effects but you could change it to reduce speed, reduce damage, apply an entirely different buff, etc.

And this thread contains an example of another fix which might work, allowing you to continue using the Roar buff:
Wow! Thank you very much @Uncle! Work perfect and that part with spell shield is an upside for me, not a downside:peasant-tongue-out:

I don't need the Roar buff, but thank your for letting me know the alternative solution. :peasant-thumbs-up-cheers:
 
Top