Wc3C.net

Wc3C.net (http://www.wc3c.net/forums.php)
-   Scripts (http://www.wc3c.net/forumdisplay.php?f=737)
-   -   DamageEvent & DamageModifiers (http://www.wc3c.net/showthread.php?t=108009)

Anitarf 10-21-2009 02:54 PM

DamageEvent & DamageModifiers
 
This is a compilation of libraries intended to replace the damage detection and prevention engine ADamage. Originally, this was intended to be merely the next version of ADamage, but some conceptual changes such as moving from damage prevention to more general damage modification made it difficult to maintain backwards compatibility, so I decided to make it a new resource instead which could provide a more general, robust and modular damage detection and modification framework than ADamage. Also, I know some people will like that fact that I gave it a new name.

The resource is split into two libraries:
  • DamageEvent, a damage detection engine.

    If you are already using another damage detection system in your map, DamageEvent will interface with it instead of creating its own damage detection triggers to avoid wasting performance. Currently supported damage detection systems are IDDS and LLDD.
    Expand DamageEvent:

  • DamageModifiers, an optional addon that allows you to modify damage.

    Two versions of DamageModifiers are provided, one that uses Table and one that uses AutoIndex.
    DamageModifiers can use either xepreload or AbilityPreload to preload the ability it uses.
    Expand DamageModifiers (Table version):
    Expand DamageModifiers (AutoIndex version):

Tot 10-21-2009 03:05 PM

This is a really cool system, but a bit complecated!!

can you please include a demo-map?

would be nice

nichts 10-21-2009 04:04 PM

now that there are static ifs and optional library requirements:
why don't you merge the Table and the AutoIndex version into one library - that would make later switching much easier (and they don't seem to be that different from each other anyway)

Anitarf 10-21-2009 05:01 PM

Well, optional requirements are just that, optional. In this case, however, the requirement isn't optional: either Table or AutoIndex, one of those requirements must be there. Furthermore, I need to declare globals depending on which library is used and I'm not sure I can do that in static ifs.

I suppose I could use static ifs for alternate versions of DamageEvent, though.

Anachron 10-22-2009 07:42 AM

Collapse JASS:
//*  Damage modifiers are implemented as structs that extend the
//*  system's DamageModifier struct. A damage modifier is created
//*  for a specific unit and can modify both the damage that the
//*  unit deals and receives (using the damage and damaged methods
//*  respectively, see the interface defined at the end of the
//*  calibration section).
Shouldn't it be UNIT_TYPE specific?

Further on, there is no example code.
No matter how good your documentation is, an example code is always on top when it comes to user friendly.

Some good stuff you did:
- Automatic Trigger Refresh
- Versions for Table, AutoIndex
- Versions for IDDS, LLDD

Edit:
Collapse JASS:
// In wc3, damage events sometimes occur when no real damage is dealt,
        // for example when some spells are cast that don't really deal damage,
        // also some systems use very small damages to test for valid targets,
        // so this system will only consider damage events where damage is
        // higher than this threashold value.
        private constant real DAMAGE_THRESHOLD = 0.05
Damage event bigger then DAMAGE_THRESHOLD AND smaller then 0 should be considered.

Edit2:
Collapse JASS:
public struct shield extends shield_template
        private ShieldRelay relay
        
        static method create takes unit u, integer priority returns shield
Is there any reason why you wrote that public to the struct, but not the public to the static?


Edit3:
Collapse JASS:
        method damaged takes unit damageSource, real damage returns real //returned real says how much damage to prevent

What do you mean with prevent? Elaborate please.

Anitarf 10-22-2009 10:01 AM

Quote:

Originally Posted by Anachron
Shouldn't it be UNIT_TYPE specific?

No.

Quote:

Further on, there is no example code.
No matter how good your documentation is, an example code is always on top when it comes to user friendly.
There is an example in the DamageModifiers documentation.

Quote:

Damage event bigger then DAMAGE_THRESHOLD AND smaller then 0 should be considered.
Why?

Quote:

Is there any reason why you wrote that public to the struct, but not the public to the static?
Methods without a prefix are already considered public.

Quote:

What do you mean with prevent? Elaborate please.
No. Read the documentation.

Anachron 10-22-2009 04:35 PM

Quote:

No.

Why not? I would rather set the data for a unittype instead for every single unit.

Quote:

There is an example in the DamageModifiers documentation.
Ehrm,... You can't call that example.

Quote:

Why?
Because else it doesn't register negative damage events?

Quote:

Methods without a prefix are already considered public.
Sure, but structs without a prefix are already considered as public too.

Quote:

No. Read the documentation.
I did but still its unclear for me.

Rising_Dusk 10-22-2009 05:30 PM

Quote:

Originally Posted by Anachron
Why not? I would rather set the data for a unittype instead for every single unit.

I would rather, as a user, have control at the unit level than at the unittype level.
Quote:

Originally Posted by Anachron
Because else it doesn't register negative damage events?

No DDS supports negative damage, nor should they. If you want to heal a unit, negative damage is not the way to do it.

Anitarf 10-22-2009 05:30 PM

Quote:

Originally Posted by Anachron
Why not? I would rather set the data for a unittype instead for every single unit.

I wouldn't. How am I supposed to make a buff that modifies incoming damage if I can't apply it to a specific unit?

Quote:

Ehrm,... You can't call that example.
I just did.

Quote:

Because else it doesn't register negative damage events?
Okay, I'll fix it when you manage to produce a negative damage event.

Quote:

Sure, but structs without a prefix are already considered as public too.
There is a difference between a struct with a public prefix and a struct without one. There is no such diference when it comes to struct methods.

Quote:

I did but still its unclear for me.
My point was that I don't care, the documentation clearly states that I do not intend to provide any further support for that library, this includes answering your vague questions about it.

Anachron 10-23-2009 07:45 AM

To Dusk:


Quote:

I would rather, as a user, have control at the unit level than at the unittype level.

You got me wrong. You should be able to handle it on unit level too, but maybe the user doesn't want to just set all the data for every single unit, so you can add a small (optional) addon (module) to store stuff in tables and just set the unit data on entering the playable map area to the data you saved to be basic for any unit of that type?

Quote:

No DDS supports negative damage, nor should they. If you want to heal a unit, negative damage is not the way to do it.
Is there any other way as doing an triggered heal that has a damagetype/weapontype? I for example use it (native UnitDamageTarget) to heal units too. That allows me to even block heals from units.




to Anitarf:


Quote:

I wouldn't. How am I supposed to make a buff that modifies incoming damage if I can't apply it to a specific unit?
Please read the first answer to Rising_Dusk.

Quote:

I just did.
Its not looking as helping anyone who got questions, really.

Quote:

Okay, I'll fix it when you manage to produce a negative damage event.
Collapse JASS:
native UnitDamageTarget             takes unit whichUnit, widget target, real amount, boolean attack, boolean ranged, attacktype attackType, damagetype damageType, weapontype weaponType returns boolean

Quote:

There is a difference between a struct with a public prefix and a struct without one. There is no such diference when it comes to struct methods.
Which different? I didn't heard of any. (Wanna learn! :))

Quote:

My point was that I don't care, the documentation clearly states that I do not intend to provide any further support for that library, this includes answering your vague questions about it.
If you don't care about users to get to know to your system who need help in your stuff, how can you submit it then? Its a insolence to provide such advanced stuff without further help.


Earth-Fury 10-23-2009 08:31 AM

Quote:

Originally Posted by Anachron
Which different? I didn't heard of any. (Wanna learn! :))

Quote:

Originally Posted by Anitarf
Read the documentation.


Though he was referring to his system's documentation, I am using that quote to refer to vJass' documentation.

If you want to learn, start with English.

Anachron 10-23-2009 08:43 AM

Quote:

Though he was referring to his system's documentation, I am using that quote to refer to vJass' documentation.
I am quite sure you learned vJass by getting help from other people, not from reading the documentation.

Quote:

If you want to learn, start with English.
Its not my fault that in school English isn't teached well, I already in a good english course but still my english isn't that good as yours.

So what about it?

Anitarf 10-23-2009 08:47 AM

Quote:

Its not looking as helping anyone who got questions, really.
If you have specific questions, then ask away.

Quote:

Collapse JASS:
native UnitDamageTarget             takes unit whichUnit, widget target, real amount, boolean attack, boolean ranged, attacktype attackType, damagetype damageType, weapontype weaponType returns boolean

Have you tested that? When I tried that with a negative value, I got a damage event with a total of 0 damage. Unless you can actually produce a negative damage event in a test map, shut up.

Quote:

If you don't care about users to get to know to your system who need help in your stuff, how can you submit it then? Its a insolence to provide such advanced stuff without further help.
Again, read the documentation. It clearly states that that is a compatibility library. I don't need to provide support for that, because noone is supposed to keep using it, it is just meant to provide backwards compatibility to old resources. If you really care so much about it, go read the ADamage documentation.

Anachron 10-23-2009 08:52 AM

Quote:

Have you tested that? When I tried that with a negative value, I got a damage event with a total of 0 damage. Unless you can actually produce a negative damage event in a test map, shut up.
You could also use any negative attack (UnitDamage - 1000), I am quite sure it will heal in every testmap.

Earth-Fury 10-23-2009 08:55 AM

Quote:

Originally Posted by Anachron
You could also use any negative attack (UnitDamage - 1000), I am quite sure it will heal in every testmap.

Quote:

Originally Posted by Anitarf
Unless you can actually produce a negative damage event in a test map, shut up.



All times are GMT. The time now is 06:14 PM.

Powered by vBulletin (Copyright ©2000 - 2019, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services