Detecting a units attack damage?

Komaqtion

You can change this now in User CP.
Reaction score
469
What exactly is it you need ? :S
To detect when a unit is damaged, or sinply get a unit's damage ? :S
 

Laiev

Hey Listen!!
Reaction score
188
simply get a units damage

Link

I do a little change in this system because this use damage system from rising_dusk and i like more the damage from Jesus4Lyf.. you can easy do that and got the function which you want
:p
 

shiFt

Member
Reaction score
8
is it not like getting the value for an attribute, I under stand that the damage has number of sides of a dice etc. but if it were a set value how would you detect a units attack damage in the same way you would get a units attribute points?
 

Viikuna

No Marlo no game.
Reaction score
265
You need a triggered controlled envinronment, where all damage bonus thingies are done with one system. ( Example: UnitProperties in hiveworkshop.com )

You also need somekind of gsl script for getting each unit types base damage vales, and writing them to your unit structs. ( You can find this GMSI tool from wc3c.net )



This way you can perfectly control and know each units damage. ( Works also for stuff like, attackspeed, armor, damage type, and others )
 

Jesus4Lyf

Good Idea™
Reaction score
397
JASS:
library GetLastDamage uses AIDS, Damage
    private struct UnitDamage extends array
        real last
        private method AIDS_onCreate takes nothing returns nothing
            set this.last=0
        endmethod
        //! runtextmacro AIDS()
        private static method onDamage takes nothing returns boolean
            if Damage_IsAttack() then
                set thistype[GetEventDamageSource()].last=GetEventDamage()
            endif
            return false
        endmethod
        private static method AIDS_onInit takes nothing returns nothing
            local trigger t=CreateTrigger()
            call TriggerAddCondition(t,Filter(function thistype.onDamage))
            call Damage_RegisterEvent(t)
        endmethod
    endstruct
    // use this to get a unit's last attack damage.
    function GetUnitLastDamage takes unit u returns real
        return UnitDamage<u>.last
    endfunction
endlibrary</u>

Freehand, but hey. Try that. :)
Requires: AIDS, Damage.
 

Viikuna

No Marlo no game.
Reaction score
265
The thing is that it will return different values depending on what kind of armor type the unit you last attacked has.

Thats wrong way to do it, seriously. It doesnt even work properly.


Also. System implementation is the only way to do most of cool stuff in wc3. Because editor is so limited, and doesnt allow you to properly control all the stuff that you want, you are forced to do that stuff with big vJass systems. Thats just how it is.
 

Jesus4Lyf

Good Idea™
Reaction score
397
I totally agree. But that's even the point of it - a quick, cheap fix.
I just don't feel like telling someone to go use additional third party programs when something that is "close enough" in most circumstances will do. And it is fairly evident what downsides there will be...

But even in your method, you won't get things like critical strike, or stuff like that.
 

Viikuna

No Marlo no game.
Reaction score
265
It detects units current attack damage. If critical is scripted, you can easily calculate ciritical damage too.

Actually, Id like to hear what exactly are you gonna use this stuff anyways. It makes it damn much easier to find the best solution for you.


So, we need more data. Give it to us.
 

shiFt

Member
Reaction score
8
Its just to be able to control damage through spells so that they dont become obsolete to attack damage later in the game, so basing the damage off the units attack damage can be a usefull way of equalizing this, imo

Basically getting the value of the attack damage as displayed in the UI, regardless of real damage dealt to units with varying armor types.

If number of sides of dice and sides per die were set to 1, then the damage would solely be dictated by items and attributes right?
 

Viikuna

No Marlo no game.
Reaction score
265
So something like:

Big Bad Swing.

Barbarian swings his axe with imba force and damages all units in front of him. Deals X times of your attack damage as damage.



That would work with the method I posted earlier.
 

shiFt

Member
Reaction score
8
lol yes, where do i find the UnitProperties system, oh i see now, its been graveyarded :(
 

Viikuna

No Marlo no game.
Reaction score
265
Not really. It makes the amount of data you need smaller, but its pretty muchly the same job even if you have more dices and slices.

edit.

Instructions:


1. Get or make some system that works like UntiProperties. This unit struct should hold all neccesary unit related data.

2. Use that system to do ALL unit stats manipulation in your map.

3. Learn to use GMSI and make some gsl script, that:

- Reads data from object editor fields. ( min attack damage, max attack damage, number dices per slice, etc. )

- Writes that data to your unit structs at map init, so each unit automaticly has its armor value in struct set to the armor value in object editor, for example.

4. Abuse this stuff, and make cool spells and thingies with it.
 

shiFt

Member
Reaction score
8
But if I set the dice thingy to 1 then it the attack damage stays constant, along with a o value for damage base, then I wouldnt need to use the GMSI? Then I could just use UnitProperties to add stats and modify damage etc.

^Jesus4lyf, how would i make a function that determines the highest attribute of a Hero? I suppose the additional damage base and dice options are negligible when looking at what damage is mainly composed of, the main stat. Then again not many people who pick up maps want to build stats, they are mainly focused on large damage items, its sigh rly.

is that akon in your avatar viikuna? always wondered :)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      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