• 🏆 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!

How to make Adding Critical Strike? [Solved]

Status
Not open for further replies.

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,583
Here's a crit system I threw together.
  • Acquire Sword of Critting
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Sword of Critting
    • Actions
      • Set VariableSet UDex = (Custom value of (Hero manipulating item))
      • -------- --------
      • -------- Increase Crit Chance --------
      • Set VariableSet Stats_CritChance[UDex] = (Stats_CritChance[UDex] + 10.00)
      • -------- --------
      • -------- Add crit ability (could also give all units this ability by default) --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Critical Strike (Stat) for (Hero manipulating item)) Equal to 0
        • Then - Actions
          • Unit - Add Critical Strike (Stat) to (Hero manipulating item)
        • Else - Actions
      • -------- --------
      • -------- Adjust the crit ability based on your Crit Chance / Crit Multiplier --------
      • Ability - Set Ability: (Unit: (Hero manipulating item)'s Ability with Ability Code: Critical Strike (Stat))'s Real Level Field: Chance to Critical Strike ('Ocr1') of Level: 0 to Stats_CritChance[UDex]
      • Ability - Set Ability: (Unit: (Hero manipulating item)'s Ability with Ability Code: Critical Strike (Stat))'s Real Level Field: Damage Multiplier ('Ocr2') of Level: 0 to Stats_CritMultiplier[UDex]
      • Unit - Set level of Critical Strike (Stat) for (Hero manipulating item) to 2
      • Unit - Set level of Critical Strike (Stat) for (Hero manipulating item) to 1
  • Lose Sword of Critting
    • Events
      • Unit - A unit Loses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Sword of Critting
    • Actions
      • Set VariableSet UDex = (Custom value of (Hero manipulating item))
      • -------- --------
      • -------- Decrease Crit Chance --------
      • Set VariableSet Stats_CritChance[UDex] = (Stats_CritChance[UDex] - 10.00)
      • -------- --------
      • -------- Adjust the crit ability based on your Crit Chance / Crit Multiplier --------
      • Ability - Set Ability: (Unit: (Hero manipulating item)'s Ability with Ability Code: Critical Strike (Stat))'s Real Level Field: Chance to Critical Strike ('Ocr1') of Level: 0 to Stats_CritChance[UDex]
      • Ability - Set Ability: (Unit: (Hero manipulating item)'s Ability with Ability Code: Critical Strike (Stat))'s Real Level Field: Damage Multiplier ('Ocr2') of Level: 0 to Stats_CritMultiplier[UDex]
      • Unit - Set level of Critical Strike (Stat) for (Hero manipulating item) to 2
      • Unit - Set level of Critical Strike (Stat) for (Hero manipulating item) to 1
  • Acquire Sword of Multiplying
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Sword of Multiplying
    • Actions
      • Set VariableSet UDex = (Custom value of (Hero manipulating item))
      • -------- --------
      • -------- Increase Crit Multiplier (0.01 = 1% and 1.00 = 100%) --------
      • Set VariableSet Stats_CritMultiplier[UDex] = (Stats_CritMultiplier[UDex] + 1.00)
      • -------- --------
      • -------- Adjust the crit ability based on your Crit Chance / Crit Multiplier --------
      • Ability - Set Ability: (Unit: (Hero manipulating item)'s Ability with Ability Code: Critical Strike (Stat))'s Real Level Field: Chance to Critical Strike ('Ocr1') of Level: 0 to Stats_CritChance[UDex]
      • Ability - Set Ability: (Unit: (Hero manipulating item)'s Ability with Ability Code: Critical Strike (Stat))'s Real Level Field: Damage Multiplier ('Ocr2') of Level: 0 to Stats_CritMultiplier[UDex]
      • Unit - Set level of Critical Strike (Stat) for (Hero manipulating item) to 2
      • Unit - Set level of Critical Strike (Stat) for (Hero manipulating item) to 1
  • Lose Sword of Multiplying
    • Events
      • Unit - A unit Loses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Sword of Multiplying
    • Actions
      • Set VariableSet UDex = (Custom value of (Hero manipulating item))
      • -------- --------
      • -------- Decrease Crit Multiplier (0.01 = 1% and 1.00 = 100%) --------
      • Set VariableSet Stats_CritMultiplier[UDex] = (Stats_CritMultiplier[UDex] - 1.00)
      • -------- --------
      • -------- Adjust the crit ability based on your Crit Chance / Crit Multiplier --------
      • Ability - Set Ability: (Unit: (Hero manipulating item)'s Ability with Ability Code: Critical Strike (Stat))'s Real Level Field: Chance to Critical Strike ('Ocr1') of Level: 0 to Stats_CritChance[UDex]
      • Ability - Set Ability: (Unit: (Hero manipulating item)'s Ability with Ability Code: Critical Strike (Stat))'s Real Level Field: Damage Multiplier ('Ocr2') of Level: 0 to Stats_CritMultiplier[UDex]
      • Unit - Set level of Critical Strike (Stat) for (Hero manipulating item) to 2
      • Unit - Set level of Critical Strike (Stat) for (Hero manipulating item) to 1
It uses a Unit Indexer to keep track of each unit's Critical Strike Chance and Critical Strike Multiplier. When you acquire/lose one of the Crit Items it updates the Crit variables and adjusts the Critical Strike ability to match the new values. Note that the Index for these Ability fields starts at 0, so despite it saying Level: 0, it's really referencing ability Level 1.

Also, these Ability fields are a bit buggy so you need to "refresh" the ability in order for the stats to update properly. That's why I set the ability to level 2 and then back to level 1, this "refreshes" it.

The default crit chance is set to 0% and the default crit multiplier is set to 1.5x normal damage. If you want to adjust these values you can change their Initial value in the Variable Editor (Control + B). Keep in mind that units need to have the Critical Strike ability for any of this to work.
 

Attachments

  • Crit Stat.w3m
    25.1 KB · Views: 29
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,583
How do the mechanics work for having multiple critical strike abilities? Because I'm under the impression that having two separate critical strike abilities won't stack the way you'd want them to.

For instance:
You have 5 items that add 20% critical strike chance each. OP wants this to amount to a 100% chance to crit, but I'm under the impression that the stacking item abilities will either 1) Not stack at all leaving you with a 20% chance to crit. 2) Roll the dice for EACH ability, meaning you have a 20%/20%/20%/20%/20% chance to crit. I can't imagine it would add the chances together to make a single 100% chance.
 
Last edited:
Exactly as Uncle says, its not hard to find here on Hive or figure out how abilities such as Critical Strike, Bash etc work
each one rolls separately, so if you have 10 bashes each with 10%chance, you don't get 100% bash, you get 10 x roll for 10% success of Bashing on each autoattack, and if you have 3 items each with 30%crit ability, you don't have 90% crit chance on 1 autoattack, you have 3x roll 30%chance to crit

I need a crit stacking system or some way which likely will include a damage engine, I just don't know which one to use or how to set it up (or a custom triggered crit chance if that is possible I have no clue) so that's the kind of help I'm asking for
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,583
Exactly as Uncle says, its not hard to find here on Hive or figure out how abilities such as Critical Strike, Bash etc work
each one rolls separately, so if you have 10 bashes each with 10%chance, you don't get 100% bash, you get 10 x roll for 10% success of Bashing on each autoattack, and if you have 3 items each with 30%crit ability, you don't have 90% crit chance on 1 autoattack, you have 3x roll 30%chance to crit

I need a crit stacking system or some way which likely will include a damage engine, I just don't know which one to use or how to set it up (or a custom triggered crit chance if that is possible I have no clue) so that's the kind of help I'm asking for
Scroll up :p
 
Status
Not open for further replies.
Top