Tutorial Clumsy but Effective GUI damage detection

TomTTT

New Member
Reaction score
44
Editor thoughts (in other words - why the heck the tutorial is made)
Ok. So i few days ago i helped someone to create a floating text about taking amount of gold from a unit if you have an item... And i noticed the only way was to do this was by using a damage detection system that I found at last, But telling the truth, it has been mostly JASS, but you could refer to whoever needed. And i thought, why not trying to make my own GUI friendly damage detection system? So today, when I sang in the shower as usual :)D) i came to realisation!

The point (in other words - skip your stories and lemme see!)
Since the event,
Trigger:
  • Unit - A unit Is attacked

Is triggered like half a second before the actual attack happens, you can set the life of the attacked unit in a real variable,
Trigger:
  • Set realArray[1] = (Life of (Triggering unit))

then wait a little while,
Trigger:
  • Wait 0.50 seconds

And then set the life of the attacked unit again, in another variable,
Trigger:
  • Set realArray[2] = (Life of (Triggering unit))

And with the Arithmetic option, calculate the damage dealt!
Trigger:
  • Set realArray[3] = (realArray[1] - realArray[2])

So for all those who in need of a damage detection, an easy-but-taking some-time trigger without all the JASS that the only think you know about it is it's name (and for those who don't, it's JASS, clever, right?)
So basically, the trigger is simple:
Trigger:
  • Detect
    • Events
      • Unit - A unit Is attacked
    • Conditions
    • Actions
      • Set realArray[1] = (Life of (Triggering unit))
      • Wait 0.50 seconds
      • Set realArray[2] = (Life of (Triggering unit))
      • Set realArray[3] = (realArray[1] - realArray[2])


I'm pretty sure i'll get flamed for this but i just couldn't hold posting this here. I did a research and the only damage detection i found WAS made with JASS.

NOTE
Whenever i say those things about JASS i don't mean to under estimate it's power. I do realise it IS a lot more powerful than GUI, but this tutorial is meant for those (like me) who don't understand JASS.

I don't see this neccesery, since this is a one trigger system (is it called a system?) but added a demo map.
 

Attachments

  • Damage Detection GUI.w3x
    16.9 KB · Views: 329

tommerbob

Minecraft. :D
Reaction score
110
Weep's Damage Detection system is made in Jass, but it is made for GUI users, and it is very very simple to use. No need for this.
 

Flare

Stops copies me!
Reaction score
662
Sadly, this is not really effective at all - two perfectly plausible (and very common) situations in a WC3 game will cause this to screw up (or just not do what the name says)
  • Healing/natural regeneration - if healing occurs or natural regeneration is relatively high, your damage value is going to be thrown off
  • Spell damage - A Unit Is Attacked doesn't handle offensive spells targeted at the unit, so they won't be capable of registering as damage sources (but they are able to throw off normal attacks if the spell lands during your 0.5sec window)

There may be more pitfalls with this system, but I want to play some more Call of Duty now... :3

I'm pretty sure i'll get flamed for this but i just couldn't hold posting this here. I did a research and the only damage detection i found WAS made with JASS.
I get the feeling I might have posted one long ago... although, it may have been part of another demo map. I'll have to try and fish it up from my attachments
 

Accname

2D-Graphics enthusiast
Reaction score
1,463
sorry but not only what flare said is right but it wouldnt even detect all physical attacks damage.
1). ranged units attack will most probably not hit within these 0.5 seconds.
2). not all melee units have an attack animation point value of 0.5 or below, attacks of units with values above 0.5 will not be detected as well.

besides, very very inaccurate.

to the damage detection part:
you can make damage detection systems solely with GUI. its not even hard. i made my own damage detection systems myself when i wasnt this experienced in map making.
the problem with GUI damage detection systems is that they always leak. you cannot make them leak-free. but Weep made a pretty decent damage detection system which is GUI friendly and can be used like a generic "any unit is damaged" event in GUI.
 

Medeam

New Member
Reaction score
3
Everything leaks no matter what....
The difference between jass and gui aren't so high unless you are doing huge over 200 unit projectile or physics systems which almost or anybody has never done.

Tho they are right, this is not so great of a damage detection method but it is very good still no matter since there is no gui damage detect.... That reminds me, I should submit one and get all the jass'ers to flame me.

I would advise trying to explore a bit past unit is attacked and look for unit groups combined with specific unit events as well Accname any gui damage detect can be generic/any unit is damaged too.... it is just not done and ready for you like Weep's is and even if it is easy and simple... I barely see anyone ever use it in their maps unless it is one that is advanced.
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
What happen if several units are damaged?
This working style should be graveyarded.
We already have this.
 

Medeam

New Member
Reaction score
3
But it is not gui.... This also helps lead the way for more beginners or people who have trouble remembering how to do stuff like this but better instead of starting on something complex they can start small and move onto that half jass dmg detect then pure jass.

I think if the tutorial was made for all units on a map then it would be fine, but now it would not work on several units.

So why not help him to try to index or hashtable this and use a better event with actions and conditions.

I would help but I am currently busy and will try to help if nobody does later...
 

tommerbob

Minecraft. :D
Reaction score
110
But it is not gui.... This also helps lead the way for more beginners or people who have trouble remembering how to do stuff like this but better instead of starting on something complex they can start small and move onto that half jass dmg detect then pure jass.

I think if the tutorial was made for all units on a map then it would be fine, but now it would not work on several units.

So why not help him to try to index or hashtable this and use a better event with actions and conditions.

I would help but I am currently busy and will try to help if nobody does later...

It doesn't matter if GDD is GUI or not. It's a system designed to make map making easier, which it does. You don't use a system so you know the ins and outs of how it works. Yo use a system because it makes your job as a mapmaker easier.

Sure, there are the tech junkies out there who want to understand how every little thing works, and I'll admit it is nice to understand things. But for most mapmakers, they use "systems" so they don't have to do all the dirty work--that's what the system is for.

GDD is the best damage detection system out there for GUI users. It is simple, easy to implement, and requires no Jass knowledge.
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
But it is not gui.... This also helps lead the way for more beginners or people who have trouble remembering how to do stuff like this but better instead of starting on something complex they can start small and move onto that half jass dmg detect then pure jass.
...except that for people who'd rather do it all themselves, there is an easier, accurate, and already well-known method of setting up true damage detection in pure GUI (it's mentioned in almost every thread asking about GUI and damage detection, and uses adding an event to a trigger with another trigger).

Ironically, making the OP's system MUI would be most easily done using JASS :eek: in the form of custom script for locals. :p
 

Romek

Super Moderator
Reaction score
964
Working damage detection is easily made in GUI. It's just easier to do so in JASS. As for leaks... I doubt it'll make any difference to any modern computer. As long as you don't create too many units. Make a GUI damage detection for your own use though. Don't submit 'leaky' code in hope of having it approved. :p

Also, do note that people who use JASS don't necessarily hate people who use GUI. Most people who code in JASS actually started from GUI, including me. JASS is obviously more powerful, but is also considerably harder to learn (though it's actually easier to use once you know how to, however odd that sounds). GUI is made for beginners, and is obviously much easier to learn, though it's also much more limited.

You seem to be under some impression that there's a war between people who use each of the two methods of coding. This is not the case. :rolleyes:
 

Bogrim

y hello thar
Reaction score
154
This system doesn't detect damage though. It detects life changes over the span of 0.50 seconds - usually more because of the large inaccuracity in the wait action compared to a timer. One of the many reasons for this doesn't make a damage system is because if the unit is healed you can't detect the damage taken.

The war is totally there, Romek. It's just fought between the lines.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • 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 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