• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Ways to optimize or replace this trigger

Status
Not open for further replies.
Level 5
Joined
Dec 22, 2007
Messages
103
Currently I have a hero using the Royal Captain model from Tranquil. He has a shield bash that has a good animation, however, when this procs it make the
same slicing noise as his ordinary attacks. I tried remedying this with these triggers.
  • Trigger 1
  • Events
    • Time - Every 0.10 seconds of game time
  • Conditions
  • Actions
    • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Picked unit) has buff Stunned (Shield Bash)) Equal to True
        • Then - Actions
          • Sound - Play MetalHeavyBashMetal3 <gen> at 100.00% volume, attached to Darium
          • Trigger - Turn off (This trigger)
        • Else - Actions
  • Trigger 2
  • Events
    • Unit - A unit Is attacked
  • Conditions
    • (Attacking unit) Equal to Darium
    • (Level of Shield Bash for Darium) Greater than or equal to 2
  • Actions
    • Trigger - Turn on Shield Bash Sound <gen>
Trigger 1 is initially disabled, though it doesn't matter very much. The issue I'm having with this is on consecutive bashes, the trigger is re-enabled via
attacks made by the hero, thus the sound goes off far after the second bash goes off. On a side note, I don't know how I can make the sound proc when
its the killing blow to a unit. Any help is appreciated.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
You have to trigger the Bash, so you can effectively detect it, and play the sound, and do what you want when it kills the unit. I could help you with this but I don't have Wc3 on this computer.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
You basically create a dummy Passive ability (wich does nothing, like a Critical with 0% chance)

Then, with trigger, you detect damage, and get a Random Integer between 1 and 100, if the number is less than or equal to your bash chance (Can be Ability Level x 5, wich would be 5%, 10%, 15%, and 20%) and if it's true, you create a dummy and order the dummy to cast a Stormbolt with 0 duration to the target. 0 duration means infinite.

Then, you create a timer with a certain duration (can be Ability level x 0.5, wich would result in 0.5 s, 1s, 1.5s, and 2s) and add the target unit Id. When the timer expires, you remove the Stun buff from the target unit and stop/destroy the timer, and Flush Child timer id to clean the Hash and remove leaks. Removing the buff also removes the stun.

This may collide with other stuns, like, if you do a 0.5s stun, and during that time another unit deals a 5s stun, when the 0.5s timer reaches 0, the buff will be removed, meaning that the 5s stun will take no effect.

This can be solved by either adding an specific stun buff to each stun ability, or creating some system with cummulative stun durations.

You can, alternatively, create the Stormbolt with the 4 levels, and make the Stormbolt level for the Dummy equal to Bash level for the damage source, so you get rid of the timer and everything else. The bad thing is having to create a Stun ability for each passive stun you have, but it's way way way way way easier.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
  • Melee Initialization
    • Events
      • Unit - A unit Is attacked
    • Conditions
    • Actions
      • Set Unit = (Triggering unit)
      • Set Integer = (Level of PassiveStun for (Attacking unit))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Integer Greater than 0
          • (Random integer number between 1 and 100) Less than or equal to (Integer x 5)
        • Then - Actions
          • Set Point = (Position of Unit)
          • Unit - Create 1 DummyCaster for (Owner of (Attacking unit)) at Point facing Default building facing degrees
          • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
          • Unit - Add DummyStun to (Last created unit)
          • Unit - Set level of DummyStun for (Last created unit) to Integer
          • Unit - Order (Last created unit) to Human Mountain King - Storm Bolt Unit
          • ----- I'm just guessing that you're basing the ability of StormBolt -----
          • Custom script: call RemoveLocation(udg_Point)
        • Else - Actions
It's better if you use "A unit is damaged" (You need a Damage Detection System) because the unit attack begins about 0.7 seconds before the actual damage is dealt, and can be abuseable if you order the attacking unit to stop after the attack began.
 
Level 5
Joined
Dec 22, 2007
Messages
103
Using above trigger with an added animation and sound action; however, I need a small wait to match the sound up with the attack, and I've been told to never use waits. I
believe triggering it upon damage taken would fix that issue. How do I get a damage detector?
 
Status
Not open for further replies.
Top