• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

triggered critchance

Status
Not open for further replies.
Level 4
Joined
Apr 16, 2009
Messages
22
Hi.

After searching the internet and all the spells on this site, I can't seem to find a way to increase the critchance of units through triggers.

I want to give items critchance. So if a unit picks up an item with like 7% critchance, then it should increase critchance with 7% for that unit. Is this even possible to do? I don't want to use the crit spell because that rounds instead of giving exact numbers.

Sorry for any bad grammar or spelling, I'm not a native speaker of english.

And thank you for any help.
 
Level 9
Joined
Jul 30, 2018
Messages
445
Use a damage detection system (good one: GUI-Friendly Damage Detection v1.2.1) and use trigger action Damage target to deal damage to the attacked unit via a trigger which detects when unit is damaged (one such comes with the above DDS). With that system you do not only get the trigger event to detect damage, but you also get the exact damage dealt which you can easily multiply by anything (like 2x or whatever).

Here's an example trigger with said DDS:
  • Events
    • Game - GDD_Event becomes Equal to 0.00
  • Conditions
    • (GDD_DamageSource has an item of type [Your item]) Equal to True
  • Actions
    • Set TempInteger = (Random integer number between 1 and 100)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • TempInteger Less than or equal to 7
      • Then - Actions
        • Unit - Cause GDD_DamageSource to damage GDD_DamagedUnit, dealing (GDD_Damage) damage of attack type Normal and damage type Normal //For double damage no multiplying here, because the dmg is already dealt once
      • Else - Actions
 
Last edited:
Level 4
Joined
Apr 16, 2009
Messages
22
Use a damage detection system (good one: GUI-Friendly Damage Detection v1.2.1) and use trigger action Damage target to deal damage to the attacked unit via a trigger which detects when unit is damaged (one such comes with the above DDS). With that system you do not only get the trigger event to detect damage, but you also get the exact damage dealt which you can easily multiply by anything (like 2x or whatever).

Here's an example trigger with said DDS:
  • Events
    • Game - GDD_Event becomes Equal to 0.00
  • Conditions
    • (GDD_DamageSource has an item of type [Your item]) Equal to True
  • Actions
    • Set TempInteger = (Random integer number between 1 and 100)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • TempInteger Less than or equal to 7
      • Then - Actions
        • Unit - Cause GDD_DamageSource to damage GDD_DamagedUnit, dealing (GDD_Damage) damage of attack type Normal and damage type Normal //For double damage no multiplying here, because the dmg is already dealt once
      • Else - Actions

But would this work with multiple items? For like an RPG? with different gear.
 
Level 38
Joined
Feb 27, 2007
Messages
4,951
Yes, you just need to store the unit's total crit chance in a variable and use that variable where Sabe wrote 7 in the trigger. You will need to update this crit chance variable as units pick up and drop items, and if any spells affect crit chance that will have to be accounted for too.
 
Level 4
Joined
Apr 16, 2009
Messages
22
Just want to make sure I got this right.

Like this right?
crit.png
+10crit.png
-10 crit.png
 
Status
Not open for further replies.
Top