• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Snippet] DamageEvent

Level 10
Joined
May 27, 2009
Messages
494
vampiric aura will trigger lifesteal whether you like it or not
and perhaps you may just filter those out upon index but there will be some instances that the units will have some upgrades like increase attack range and such o.o

@nes
lol this:
The only system I have out there right now that I wouldn't count as super optimal is Damage Modification Effect. You can count on everything else being extremely optimal and modular, running off of normally much better algorithms than you will find in any other system on any other site. The trade off for this is that some of these algorithms are much more complex to code, meaning that you may run into bugs in some systems if the version number is low. This one doesn't have said bugs, but I do still have one system out there right now that is known to have 1 bug =P. BigInt also had 1 bug in the division algorithm (which was handcrafted by me and somewhat complex, but super fast).
 
Level 10
Joined
May 27, 2009
Messages
494
it's more useful if i guess i'll use the natives...

there are still (i think two) buff problems.. either the removal is not immediate or another buff is added to the unit with the same base buff ID causing the first buff to extend its duration... o.o

anyways lets just see if nes nes can make an extension for it o.o
 
Level 2
Joined
May 4, 2009
Messages
11
Help me!
I want RegisterDamageEvent when unit type 'XXXX' got damaged then do some actions but I don't know how to use your DamageEvent and this extension AdvDamageEvent to do that. Make a tutorial or demo pls. Thanks :grin:

For detail: i'm using TriggerRegisterPlayerUnitEvent with event EVENT_PLAYER_UNIT_ATTACKED, normally it work well when unit attack unit then i can get attaker or attacking unit, but when using some spell system that mean unit attacked by dummy or this:
JASS:
call UnitDamageTarget(.caster, theUnit, .dmg, false, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNKNOWN, WEAPON_TYPE_WHOKNOWS)

then TriggerRegisterPlayerUnitEvent cant help anymore. That why i want use your DamageEvent
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
Read the docs man..

JASS:
*   module DamageEvent extends DamageEvent, AdvDamageEvent (if exists)
*
*       Interface
*       ------------------
*           private static constant method PRIORITY takes nothing returns integer       (optional)
*               -   without this declared, the priority will be set to 0 (no priority)
*           private static method onDamage takes nothing returns nothing                (optional)
*           private static method filter takes nothing returns boolean

JASS:
struct Demo extends array

private static constant method PRIORITY takes nothing returns integer
    return 5
endmethod

private static method onDamage takes nothing returns nothing
endmethod

implement DamageEvent
endstruct
 
Top