Any way to test for Attack Type?

gref

New Member
Reaction score
33
The Premise->
All damage a unit does has a chance to crit.
The chance to crit depends on what type of attack it was:
A Spell: dependent on intelligence
A Melee/Range attack: dependent on agility

So I need something that will detect whether the damage taken by a unit was done by a spell (Magic or Spells attack) or done by a unit's default attack (Normal, Piercing, Hero etc.) so I can determine whether I use Agility or Intelligence to determine the chance for a crit.

Code:
//Obviously pseudo code.
Events
    Unit - ArbitraryUnit Takes damage
Conditions...
Actions...

    If (Attack type = BLAH)
        Then 
            If Agility/ Random(0 -> 500) > 1
                Do crit damage 
        Else
            If Intelligence/ Random(0 -> 500) > 1
                Do crit damage 
//Numbers are arbitrary




Old:
"I'm wanting to implement a system that gives spell crits depending on intelligence, melee crits depending on agility and crit-resistance depending on strength.
To do this I need to know what type of Attack the Damage Source implies on the Triggering unit in the Event:
Code:
Events
    Unit - ArbitraryUnit Takes damage
Conditions...
Actions...

Does anyone know how to do this?
(+Rep of course will be awarded. (But helping people is good anyway))"
 
I

IKilledKEnny

Guest
Not without advance JASS as far as I know. But for one target spells it's easy.

Code:
Unit starts the effect of an ability
if target of ability being cast !=null and
random number between 1 and 100 >= 20 then
cause triggering unit to damage target of ability being cast
 

gref

New Member
Reaction score
33
Aye, that will work for spells.
But the reason I'm using the Damage events is its for all abilities, and so the critical can be proportional to the damage done. I can make the critical etc, I just don't know how to detect if its a spell or a melee/ranged attack. --

Thanks anyway IKilledKEnny
 
I

IKilledKEnny

Guest
Well if the spell has buff on his enemy targets you can check if the unit have the buff.
 

Sooda

Diversity enchants
Reaction score
318
I maybe know the answer to this...

EDIT: You can and should shange event to takes damage:
Code:
Attack Type
    Events
        Unit - A unit Is attacked
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Attacking unit) is A melee attacker) Equal to True
            Then - Actions
                -------- Attack was melee --------
                -------- Add here your melee actions. --------
                -------- On last line we don' t have to check other possibilities because it was melee attack so skip all future actions. --------
                Skip remaining actions
            Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Attacking unit) is A ranged attacker) Equal to True
                    Then - Actions
                        -------- Attacker was ranged. --------
                        -------- On last line we don' t have to check other possibilities because it was ranged attack so skip all future actions. --------
                        Skip remaining actions
                    Else - Actions
                        -------- If it wasn' t melee nor ranged it has to be spell attack. --------
 

gref

New Member
Reaction score
33
I maybe know the answer to this...

Oh? *Waiting expectantly*


-> IKilledKEnny
That works... but what if its a spell with a duration? etc.
I was think that perhaps as a unit casts a spell, I add it to a Unit Group called SpellDamageGroup or something, then check in the damage event if the damage source is in SpellDamageGroup, and if it is, do spell damage, remove from group. If not, do normal damage.
But that means I'd have to add that to every spell that does damage as an event, and not to the ones that don't do damage. And I don't have any idea how that will work with aoe. :(
 

denmax

You can change this now in User CP.
Reaction score
155
I don't really quite understand..
So you want to make a criticalization of your attack with the attack type of the attacker?

Type of attack is Element, Type of damage is Pierce, Hero, Chaos. So is it the element thing?
 
I

IKilledKEnny

Guest
Sooda your way won't work (even if you change the event) becuase the trigger would run and return yes on the last condition even if the spell-caster attacked normally and not only casted a spell.

Gref, I will ook into it in more depth I'll try to find a boolean that retunrs wether the damage source was a spell or not.

A month ago I could say with confidence if it's possible or not, but since I started learning JASS my GUI knowledge is fading away. :p

Edit:

I looked into some JASS functions (I wasn't able to find any GUI functions that will ehlp: I found this:

GetEventDamage

takes nothing returns real, I'm not sure what it does but I would suggest checking out.
 

gref

New Member
Reaction score
33
I don't really quite understand..
So you want to make a criticalization of your attack with the attack type of the attacker?

Type of attack is Element, Type of damage is Pierce, Hero, Chaos. So is it the element thing?

->
All damage a unit does has a chance to crit.
The chance to crit depends on what type of attack it was:
A Spell: dependent on intelligence
A Melee/Range attack: dependent on agility

So I need something that will detect whether the damage taken by a unit was done by a spell (Magic or Spells attack) or done by a unit's default attack (Normal, Piercing, Hero etc.) so I can determine whether I use Agility or Intelligence to determine the chance for a crit.
 

denmax

You can change this now in User CP.
Reaction score
155
Then create 2 different triggers.. One for melee, range and magic, another one for spells..
Now the other problem..
How do you create a criticalization of the spells if it is not one target only? (Breath of Fire, War Stomp, Fan of knives etc.)

EDIT: For the crit resistance. I don't get it, resistance xSTR? so it means it can be any attacks right?
 

gref

New Member
Reaction score
33
Well thats simple and not something I'm having a trouble with conceptionally.

Example: Agi based crit.
Code:
If ((Agility/Random(0 -> 500))>1)
    Then
        If ((Strength/Random(0 -> 500))>1)
            Then
                Crit cancelled.
            Else
                Crit Happens
    Else
        Crit doesnt happen.

Edit: You mean the group triggers? Yeah...it's a great idea till only one person in an Area of Effect gets the spell chance, and the others all get the agi chance.
 

denmax

You can change this now in User CP.
Reaction score
155
What about cleave? What will happen? The critical damage cannot be divided because its a trigger, not from the attacking Hero.
I think there is no such condition as attack type = Normal/Piercing/Hero/etc. The only condition that is possible is the Boolean Condition which has melee attacker and ranged attacker.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • 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 Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top