Detecting a spell critical

Embrace_It

New Member
Reaction score
9
I started making a spell critical detection system a while ago and after browsing through some forums/tuts and the like trying to understand how it more or less works, I started coding. However, I soon realized it was a bit more complicated than I assumed at the beginning.

Now I'm asking for ideas, links that'll help me!

My own ideas:

1. Based on the "normal" Damage Detection System (where units who enter the map add an event, where it takes damage, to another trigger), maybe you could somehow tell if the damage source was a spell and maybe if its AOE, unit target etc. This idea is probably not possible...

2. Simply adding a function to every single spell capable of doing a crit which checks if the casting unit has the "Spell Critical"-ability, does calculations and returns the result.

As always, thanks in advance :)
 

Nexor

...
Reaction score
74
the first idea is possible using orb effect based damage detection system.
you could check the AoE thing using a boolean condition:
set true when casting the ability, run dmg detection, at the end set to false

just search for it here
 

BarzahdX

Active Member
Reaction score
18
Do you need to show the damage done? If yes, #1. If no, #2.

If I was in your position, I'd choose #2 regardless.
 

averes

New Member
Reaction score
17
In order to have a spell critical detection system your spells would need to be able to critical in the first place. I don't think WC3 spells can crit normally so you'd need to make yourself a custom spell system where the damage was dealt through triggers.

If you had that, you could make crits like the following. If a player casts a spell that should do some amount of damage then deal the damage to the unit, then random an integer to see if it crit, if it did, deal the damage again.

To detect this, whenever a unit takes damage you could store the damage on the unit, handle systems or custom value would work. Whenever a unit takes damage before you replace the value look at the previous value on the unit, if the values match you just got a crit.

Problems with this system? Theoretically you could do the same amount of damage twice in a row which would return as a crit. To fix this, you could make it so that every .1 seconds or something the value on unit would be reset.

EDIT: An easier way actually would be the store the damage that the spell would deal without a crit on the unit. Then check for the crit and deal the damage. If it crit the damage actually dealt to the unit should equal the value stored on the unit * 1+crit multiplier. This way gets rid of it doing two smaller damages twice and stops the issue with 2 consecutive attacks.
 

eXirrah

New Member
Reaction score
51
The type of Critical damage system I would have done is
Store every unit type that has the critical Strike spell in some array.
Store every unit's max dice in array(not necessary if the unit is not hero, in this case you store the max dmg of the unit)
then just make trigger a unit is damaged
Add all units the unit with critical strike attacks to the trigger.
When a unit takes damage and the damage dealer is a unit with critical strike.
Calculate the max damage of the unit unit that has critical strike, and if the damage deal to the attacked unit is bigger than the max dmg of the unit with critical strike - critical strike. If below than non-critical Strike
(note: by calculating the max dmg of the unit with critical strike I mean add the armor reduction of the other unit as well)

This system is not flawless ofc. If the unit that has critical strike can crit between it's min and max dmg ti will be possible to detect only the crits it did above it's max dmg.
For example if the unit has damage 1-5 and the crit multiplier is 3, then the critical damage this unit can do is 3-15, making it impossible to detect whenever the attacked unit got 3 dmg from normal attack or from critical strike.
 

eXirrah

New Member
Reaction score
51
Well I presume you can add another trigger that checks if the unit with crit start the effect of an ability or something like that and set it's custom value to some number
then in the trigger that checks the damage add condition the unit dealing damage's custom value is not equal to the value that you set when the unit casts an ability. and after the damage is done set the custom value of that unit to some other number.

EDIT: this is just an idea of how to check if the unit with critical strike does some spell dmg and not crits or something.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top