How to store damage done?

D

DsD)Core(

Guest
Hey, I'm trying to make a ''damage meter'' for my map. What I got right now is:
JASS:
Globalsys damage meter
    Events
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Attacking unit) belongs to an ally of Player 1 (Red)) Equal to True
                ((Attacked unit) belongs to an ally of Player 1 (Red)) Equal to True
            Then - Actions
                Unit - Order (Attacking unit) to Stop
            Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Attacking unit) belongs to an ally of Player 6 (Orange)) Equal to True
                        ((Attacked unit) belongs to an ally of Player 6 (Orange)) Equal to True
                    Then - Actions
                        Unit - Order (Attacking unit) to Stop
                    Else - Actions
                        Set DmgDealt_Total[(Player number of (Owner of (Damage source)))] = (DmgDealt_Total[(Player number of (Owner of (Damage source)))] + (Damage taken))
                        Set DmgDealt_Round[(Player number of (Owner of (Damage source)))] = (DmgDealt_Round[(Player number of (Owner of (Damage source)))] + (Damage taken))

And some commands that will call it. But they always say 0, so it seems like the damage is somehow not stored. Am I doing anything wrong?

Thanks!
 

denmax

You can change this now in User CP.
Reaction score
155
Attacking unit only refers to the event "Is attacked"..

Triggering Unit refers to the unit taking the damage and Damage Source refers to the unit dealing the damage..
 
D

DsD)Core(

Guest
So what would you suggest? I'm making the order unit to stop attacking seperate trigger on unit is attacked, that's for sure. How about the plain damage gain?
 

Draphoelix

It's not the wintercold that's killing me
Reaction score
132
Pick every unit in your map, later make an action like : Add the event (Picked Unit) takes damage to trigger Trigger
 

denmax

You can change this now in User CP.
Reaction score
155
So what would you suggest? I'm making the order unit to stop attacking seperate trigger on unit is attacked, that's for sure. How about the plain damage gain?

Separate the Anti-Ally attack trigger and that trigger from the plain damage gain..
 
D

DsD)Core(

Guest
denmax, I did that.
Now I have this:
JASS:
Globalsys dmg catch
    Events
    Conditions
    Actions
        Set DmgDealt_Total[(Player number of (Owner of (Damage source)))] = (DmgDealt_Total[(Player number of (Owner of (Damage source)))] + (Damage taken))
        Set DmgDealt_Round[(Player number of (Owner of (Damage source)))] = (DmgDealt_Round[(Player number of (Owner of (Damage source)))] + (Damage taken))

And it's still not working for some reason.. This is my trigger to call the damage done:
JASS:
Arenasys endsys
    Events
    Conditions
    Actions
        Game - Display to (All players) the text: |c00FCD116Damage do...
        Unit Group - Pick every unit in (Units in (Playable map area) matching (((Triggering unit) is A Hero) Equal to True)) and do (Actions)
            Loop - Actions
                Game - Display to (All players) the text: (Player_Colors[(Player number of (Picked player))] + ((Name of (Picked player)) + (|r:  + (String(DmgDealt_Round[(Player number of (Picked player))])))))
(this event is called by a different trigger upon the ending of the round, and it shows a whole list of 0.0 0.0 0.0 0.0 0.0)
What am I doing wrong? ;(
 

Artificial

Without Intelligence
Reaction score
326
Could you show the trigger that adds the events to the 'Globalsys dmg catch'? Or do you even have one?
 
D

DsD)Core(

Guest
Alright, actually I just found it somewhere. It's working now and for the other curious people, the combination of these 2 triggers make a succesfull damage done storage:

Detect unit
JASS:
Globalsys unit catch
    Events
        Unit - A unit enters (Playable map area)
    Conditions
    Actions
        Trigger - Add to Globalsys dmg catch <gen> the event (Unit - (Triggering unit) Takes damage)

Catch damage
JASS:
Globalsys dmg catch
    Events
    Conditions
    Actions
        Set DmgDealt_Total[(Player number of (Owner of (Damage source)))] = (DmgDealt_Total[(Player number of (Owner of (Damage source)))] + (Damage taken))
        Set DmgDealt_Round[(Player number of (Owner of (Damage source)))] = (DmgDealt_Round[(Player number of (Owner of (Damage source)))] + (Damage taken))

Thanks for the help, and gl to the others using it ;p

PS. I use a round and total variable for a total damage done and one that resets after every round. Just a total for example would be enough.
 

Flare

Stops copies me!
Reaction score
662
You can look for Chocobo's tutorial on making your own damage detection, or just copy-paste the triggers from this. If you don't particularly need physical damage detection, just copy the two init triggers, and the all damage trigger (and delete any actions relating to the Damage Detection spellbook, and the Physical/Spell damage triggers)

@Tiber: It can be done without JASS, but it's not the most efficient way of doing it
 
D

DsD)Core(

Guest
Sorry, I actually didn't realize that. But I didn't understand what you said there until I saw the actual trigger posted somewhere. But you're right.
 
D

DsD)Core(

Guest
Yeah thanks, I actually got it from that guide :)
<3

EDIT: I just want to catch the damage into a variable to show it to players with a command, the overhead text would be a bit confusing for my arena map ;p
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top