Tutorial Clumsy but Effective GUI damage detection

TomTTT

New Member
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

tommerbob

Minecraft. :D
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!
Staff member
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
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
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!)
What happen if several units are damaged?
This working style should be graveyarded.
We already have this.
 

Medeam

New Member
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
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
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
Staff member
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
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.
  • The Helper The Helper:
    they did not winterize any of the plants and they froze
  • The Helper The Helper:
    it is not that power consumption went up it was available capacity went down with power plants freezing
  • Varine Varine:
    What a fucking disaster. Are all of the Texas people okay? I see TH is, are we the only two?
  • Varine Varine:
    How have the other states held up? I just got power back so I have no idea what's going on, we didn't get warning
  • Varine Varine:
    Why the fuck didn't they fix this ten years ago when it happened?
  • Blackveiled Blackveiled:
    I'm in it with you and TH as well. My power has been in and out, and I have a ruptured pipe that I need to fix, shouldn't be too bad to fix myself.
  • Varine Varine:
    I hope you're staying warm! Apparently the supply is coming up so hopefully we can get back to normal power soon, mine has been on for six hours now.
  • M Mulciberxp:
    My power has been off most of the last 2 days. We had a generator installed 3 years ago though, so we're staying warm. Water is another issue...
  • The Helper The Helper:
    Where I live has a pool so we are using that to get water to flush the toilets. We have enough bottled water to drink and brush teeth and stuff but it has been a few days and no shower though....
  • Varine Varine:
    I had some water in gallon jugs, and got our water back on yesterday. We don't seem to have any leaks, but I haven't crawled down there to look yet.
  • The Helper The Helper:
    still no water I cannot remember when I last showered now I know how they felt in the old west lol
  • Varine Varine:
    My poor plants are happy, they aren
  • Varine Varine:
    aren't used to going this long without water or lights or normal heat. I think a couple of them froze, but they look like they'll make it
  • Varine Varine:
    Well one of them is pretty rough but I think it was sick to begin with, that one always had some problems.
  • jonas jonas:
  • jonas jonas:
    ???
  • Ghan Ghan:
    That is such a Texas thing to say lol
  • midnight8 midnight8:
    a positive could come out of this. So many people trapped at home could put a dent in the covid numbers in Texas
  • Varine Varine:
    That dude, Tom Boyd, is really upset about the backlash from his "it's your fault you're freezing" thing because he claims he resigned before saying it, so it wasn't like he said it in his official capacity or anything.
  • jonas jonas:
    Almost as if he was saying "screw you guys, I'm going home"
  • Varine Varine:
    I'm fairly new here still but that seems to be the analogous message by several of our politicians.
  • vypur85 vypur85:
    Nobody?
  • jonas jonas:
    Hi vypur85, long time no see
  • tom_mai78101 tom_mai78101:
    Hi vypur85, long time no see.
  • The Helper The Helper:
    We are all somebody

    Members online

    No members online now.

    Affiliates

    Hive Workshop NUON Dome
    Top