• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Trigger event: critical strike?

Status
Not open for further replies.
Level 3
Joined
Aug 22, 2011
Messages
29
Hello guys

I've been working on a map for a pretty long time now and I've encountered another problem. I would like to make a trigger that heals you for a percentage if you crit. I think i have the actions right, but i can't seem to make the event/condition work. Any suggestions?

Thanks, buudeluu

Triggering below:
  • Mortal Blow
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Mortal Blow
    • Actions
      • Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + ((Max life of (Triggering unit)) x 0.20))
      • Special Effect - Create a special effect attached to the overhead of (Triggering unit) using Abilities\Spells\Human\Heal\HealTarget.mdl
 
Level 3
Joined
Aug 22, 2011
Messages
29
I am now using a custom crit strike system using triggers, but the problem i'm encountering is that some of the crit strikes seem to stack and sometimes it even gives a crit of 0!, but that damage is there nontheless.

Here are the triggers:

  • Critical Throw 1
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Assasin
      • ((Attacked unit) belongs to an enemy of (Owner of (Attacking unit))) Equal to True
    • Actions
      • Trigger - Add to Critical Throw 2 <gen> the event (Unit - (Attacked unit) Takes damage)
  • Critical Throw 2
    • Events
    • Conditions
      • (Unit-type of (Damage source)) Equal to Assasin
    • Actions
      • Set CritChanceCritThrow = (Random integer number between 1 and 100)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Real(CritChanceCritThrow)) Less than or equal to (3.00 x (Real((Level of Critical Throw for (Damage source)))))
        • Then - Actions
          • Set CritDamage_CritThrow = (2.00 x (Damage taken))
          • Unit - Cause (Damage source) to damage (Triggering unit), dealing CritDamage_CritThrow damage of attack type Hero and damage type Normal
          • Floating Text - Create floating text that reads ((String((Integer((1.50 x CritDamage_CritThrow))))) + !) above (Damage source) with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
          • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
          • Floating Text - Change (Last created floating text): Disable permanence
          • Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
          • Set CritDamage_CritThrow = 0.00
        • Else - Actions
 
Level 14
Joined
Dec 12, 2012
Messages
1,007
Hm, this is quite bad:

  • The detection can easy bug and is abusable.
  • You leak Events and possible stack multiple events on one unit.
  • The dealt damage may not be accurate, as it gets reduced two times by the units specific armor reduction.
  • The spell is not MUI.
  • These triggers can even let the whole game crash.

What you do here is very unsafe and bugged, I recommend you the DDS posted above. There you can just do something like this:

  • Critical Throw 2
    • Events
      • Game - damageEventTrigger becomes Equal to 1.00
    • Conditions
      • (Unit-type of (Damage source)) Equal to Assasin
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • damageType Equal to PHYSICAL
        • Then - Actions
          • Set CritChanceCritThrow = (Random integer number between 1 and 100)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Real(CritChanceCritThrow)) Less than or equal to (3.00 x (Real((Level of Critical Throw for (Damage source)))))
            • Then - Actions
              • Set CritDamage_CritThrow = (2.00 x (Damage taken))
              • -------- Here you set the damage to the desired value --------
              • Set amount = amount + CritDamage_CritThrow
              • Floating Text - Create floating text that reads ((String((Integer(amount)))) + !) above (Damage source) with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
              • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
              • Floating Text - Change (Last created floating text): Disable permanence
              • Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
              • Set CritDamage_CritThrow = 0.00
            • Else - Actions
          • Else - Actions
 
Status
Not open for further replies.
Top