• 🏆 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!

Alternative Damagesystem v1.0

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
This system provides a alternative possibility to determine damage in wc3. You can set up your own damagetypes or what happenes when a unit get damaged, get healed or dies. It's quite flexible.

Here is the main library:

JASS:
library Damagesystem
    
    /*
    Damagesystem v1.0 by Crixx
    
    This system provides possibilities to add your own damagetypes. For example your spell can ignore
    armor or can be reduced through resistence.
    
    Beforehand:
    
    Remember to disable the exp-gain for every hero on the map as well as the "gives gold" - flag from
    neutral monsters. If you don't do this, heros will gain extra exp and you will get more gold for
    a kill with basic attacks.
    Also this system is only working with triggered spells. You just need to add the "DamageTarget" 
    line in your code.
    
    Changeable Features:
    -every Constant - variable can be edited(gold- and exp-gain as well as the damagetypes)
    -you can change the effects if a unit gets damage(standard is a little blood)
     or gets healed(standard is the effect from vapiric aura)
    -you can edit what is happening when a unit gets damaged, healed or when a unit dies
    
    Pros and Cons:
    
    Pros:
    -great variety of damagetypes for example fireattack or siege and such
    -the function "OnUnitDeath" offers space for code, so no extra trigger is needed for "A Unit Dies"
    -the function "OnUnitDamage" offer space for code, so you can realize things like fire buff, which
     burn the enemy hit
    -you can easily adjust gold- and exp-gain
    -no leaks
    
    Cons:
    -only works with triggered spells
    -with a big army the numbers are a bit annoying during battle
    
    So, I hope it's useful for you and if you find some more Cons or Pros or a leak, a bug, whatever,
    contact me.
    
    E-mail: [email protected]
    Hiveworkshop: Crixx
    */
    
    globals
        // Feel free to add some
        constant integer DMG_Physical                   = 0
        constant integer DMG_Magic                      = 1
        constant integer DMG_True                       = 2
        // Change this to your needs
        constant integer CONSTANT_UNIT_Gold             = 7     // Base Gold that a unit gives
        constant integer CONSTANT_UNIT_Gold_Variance    = 3     // Base Gold +- this is the gold you acquire
        constant integer CONSTANT_UNIT_EXP_Per_LvL      = 5     // EXP per Unitlevel
        constant integer CONSTANT_HERO_Gold             = 50    // Same as for normal units just for heros
        constant integer CONSTANT_HERO_Gold_Variance    = 10    // -"-
        constant integer CONSTANT_HERO_EXP_Per_LvL      = 25    // -"-
    endglobals
    
    // Feel free to add code to "OnUnitDmg" and "OnUnitDeath"
    
    function OnUnitDmg takes unit source, unit target, real damage, integer dmgtype returns nothing 
        local real x
        local real y
        local texttag t = CreateTextTag()
        // Just a little Blood-Effect
        if(IsUnitType(GetTriggerUnit(), UNIT_TYPE_STRUCTURE) == false) then
            call DestroyEffect( AddSpecialEffectTarget("Objects\\Spawnmodels\\Critters\\Albatross\\CritterBloodAlbatross.mdl", target, "origin") )
        endif
        // The Damageindicator which shows the damage you did
        // First the Coords
        set x = GetUnitX(target) + GetRandomReal(-25.00, 25.00)
        set y = GetUnitY(target) + GetRandomReal(-25.00, 25.00)
        // Now setting up the texttag
        call SetTextTagText(t, I2S(R2I(damage)), .0161)
        call SetTextTagPos(t, x, y, 0.)
        call SetTextTagFadepoint(t, .35)
        call SetTextTagLifespan(t, 2.35)
        call SetTextTagVelocity(t, .05546875 * Cos(90. * bj_DEGTORAD), .05546875 * Sin(90. * bj_DEGTORAD))
        call SetTextTagVisibility(t, false)
        // Only showing to the involved players so you don't have 100 numbers on screen
        if(GetLocalPlayer() == GetOwningPlayer(source)) then
            call SetTextTagVisibility(t, true)
        endif
        if(GetLocalPlayer() == GetOwningPlayer(target)) then
            call SetTextTagVisibility(t, true)
        endif
        call SetTextTagPermanent(t, false)
        // Some eye-candy showing diffrent colors for the diffrent damage-types
        if(dmgtype == DMG_Physical) then
            call SetTextTagColor(t, 255, 0, 0, 0)
        elseif(dmgtype == DMG_Magic) then       
            call SetTextTagColor(t, 175, 0, 175, 0)
        else
            call SetTextTagColor(t, 255, 255, 255, 0)
        endif
        
        // Your Code
        
    endfunction
    
    function OnUnitHeal takes unit source, unit target, real amount returns nothing 
        local real x
        local real y
        local texttag t = CreateTextTag()
        // Just a little Heal-Effect
        if(IsUnitType(GetTriggerUnit(), UNIT_TYPE_STRUCTURE) == false) then
            call DestroyEffect( AddSpecialEffectTarget("Abilities\\Spells\\Undead\\VampiricAura\\VampiricAuraTarget.mdl", target, "origin") )
        endif
        // The Healindicator which shows the amount you healed
        // First the Coords
        set x = GetUnitX(target) + GetRandomReal(-25.00, 25.00)
        set y = GetUnitY(target) + GetRandomReal(-25.00, 25.00)
        // Setting up the texttag... again
        call SetTextTagText(t, I2S(R2I(amount)), .0161)
        call SetTextTagPos(t, x, y, 0.)
        call SetTextTagFadepoint(t, .35)
        call SetTextTagLifespan(t, 2.35)
        call SetTextTagVelocity(t, .05546875 * Cos(90. * bj_DEGTORAD), .05546875 * Sin(90. * bj_DEGTORAD))
        call SetTextTagVisibility(t, false)
        // Only showing to the involved players so you don't have 100 numbers on screen
        if(GetLocalPlayer() == GetOwningPlayer(source)) then
            call SetTextTagVisibility(t, true)
        endif
        if(GetLocalPlayer() == GetOwningPlayer(target)) then
            call SetTextTagVisibility(t, true)
        endif
        call SetTextTagPermanent(t, false)
        call SetTextTagColor(t, 0, 255, 0, 0)
        
        // Your Code
        
    endfunction
    
    function OnUnitDeath takes unit killer, unit dying returns nothing
        local real x = GetUnitX(dying) + GetRandomReal(-25.00, 25.00)
        local real y = GetUnitY(dying) + GetRandomReal(-25.00, 25.00)
        local integer gold
        local integer exp
        local texttag t = CreateTextTag()
        // Set the gold- and exp-values dependent on the type
        if(IsUnitType(dying, UNIT_TYPE_HERO)) then
            set gold = GetHeroLevel(dying) * CONSTANT_HERO_Gold + GetRandomInt(-1 * CONSTANT_HERO_Gold_Variance, CONSTANT_HERO_Gold_Variance)
            set exp = GetHeroLevel(dying) * CONSTANT_HERO_EXP_Per_LvL
        else
            set gold = GetUnitLevel(dying) * CONSTANT_UNIT_Gold + GetRandomInt(-1 * CONSTANT_UNIT_Gold_Variance, CONSTANT_UNIT_Gold_Variance)
            set exp = GetUnitLevel(dying) * CONSTANT_UNIT_EXP_Per_LvL
        endif
        // Setting up the texttag.... the 3rd time now :)
        call SetTextTagText(t, "+" + I2S(gold) + "G", .023)
        call SetTextTagPos(t, x, y, 0.)
        call SetTextTagFadepoint(t, .35)
        call SetTextTagLifespan(t, 2.35)
        call SetTextTagVelocity(t, .05546875 * Cos(90. * bj_DEGTORAD), .05546875 * Sin(90. * bj_DEGTORAD))
        call SetTextTagVisibility(t, false)
        call SetTextTagColor(t, 255, 204, 0, 0)
        call SetTextTagPermanent(t, false)
        if(GetLocalPlayer() == GetOwningPlayer(killer)) then
            call SetTextTagVisibility(t, true)
        endif            
        // Give EXP and gold to the killer
        call AddHeroXP(killer, exp, true) 
        call SetPlayerState(GetOwningPlayer(killer), PLAYER_STATE_RESOURCE_GOLD, GetPlayerState(GetOwningPlayer(killer), PLAYER_STATE_RESOURCE_GOLD) + gold)
        
        // Your Code
        
    endfunction
    
    // "GetArmor" should remain like this until you change the armor-system of the game
    
    private function GetArmor takes unit u returns real
        local real life = GetWidgetLife(u)
        local real red
        call SetWidgetLife(u, 20.)
        call UnitDamageTarget(u, u, 10., true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, null)
        set red = (GetWidgetLife(u) - 10.) / 10.
        call SetWidgetLife(u, life)
        if(red > 1.) then
            return 1.
        else
            return red
        endif
    endfunction
    
    private function GetResistence takes unit u returns real
        // Change this to your needs
        return ((GetUnitLevel(u) - 1) * (15.08 - Pow(1.2, GetUnitLevel(u)))) / 100
    endfunction
    
    // Change "DamageTarget" in case you added some DMG_*** - types
    
    function DamageTarget takes unit source,unit target,real damage,integer dmgtype returns real
        local integer p = GetPlayerId(GetOwningPlayer(source))
        local real life = GetWidgetLife(target)
        local real red = 0.
        local real realdmg = 0.
        local integer i = 0
        // Dead ones cannot get damage or deal damage
        if(life < .405 or GetWidgetLife(source) < .405) then
            return 0.
        endif
        // Decide whether armor or resistence is needed to be calculated
        if(dmgtype == DMG_Physical) then
            set red = GetArmor(target)
            set realdmg = damage * (1 - red)
        elseif(dmgtype == DMG_Magic) then
            set red = GetResistence(target)
            set realdmg = damage * (1 - red)
        else
            set realdmg = damage
        endif
        // less than 1 dmg is nothing
        if(realdmg < 1.) then
            return 0.
        endif
        // Decide whether it kills the target or not
        if(life <= realdmg) then
            call KillUnit(target)
            call OnUnitDmg(source, target, realdmg, dmgtype)
            call OnUnitDeath(source, target)
        else
            call SetWidgetLife(target, life - realdmg)
            call OnUnitDmg(source, target, realdmg, dmgtype)
            // Wake up sleeping creeps
            if(UnitIsSleeping(target)) then
                call UnitWakeUp(target)
                call IssueTargetOrder(target, "attack", source)
            endif
        endif
        return realdmg
    endfunction
    
endlibrary

Only for the completeness here is the additional trigger that captures the basic attacks:

JASS:
/*
   For Basic attacks I needed a little trick. So I made up this trigger.
   Thistrigger notices all incoming damage that is NOT caused by the system, for example basic attacks.
   ATTENTION! Damage from untriggered spells will also be noticed.
   
   Just in case:
   This trigger usually doesn't need to get changed. It only captures the basic attack for the
   functions "OnUnitDeath" and "OnUnitDmg" as well as for the Indicator.
*/

function Trig_Damagedetection_Actions takes nothing returns nothing
    if(GetEventDamage() >= 1.) then
        call OnUnitDmg(GetEventDamageSource(), GetTriggerUnit(), GetEventDamage(), DMG_Physical)
        if(GetWidgetLife(GetTriggerUnit()) < GetEventDamage()) then
            call OnUnitDeath(GetEventDamageSource(), GetTriggerUnit())
        endif
    endif
endfunction

function Trig_Damagedetection_AddUnit takes nothing returns nothing
	call TriggerRegisterUnitEvent(gg_trg_System_Damagedetection, GetEnumUnit() , EVENT_UNIT_DAMAGED)  
endfunction

function Trig_Damagedetection_UnitEnter takes nothing returns nothing
    call TriggerRegisterUnitEvent(gg_trg_System_Damagedetection, GetTriggerUnit() , EVENT_UNIT_DAMAGED)  
endfunction  

function InitTrig_System_Damagedetection takes nothing returns nothing
    local trigger t 
    local group g = CreateGroup()
    
    set gg_trg_System_Damagedetection = CreateTrigger()
    call TriggerAddAction(gg_trg_System_Damagedetection, function Trig_Damagedetection_Actions)
    
    set t = CreateTrigger()
    call TriggerRegisterEnterRectSimple(t, GetWorldBounds())  
    call TriggerAddAction(t, function Trig_Damagedetection_UnitEnter)  
    
    call GroupEnumUnitsInRect(g, GetWorldBounds(), null)
    call ForGroup(g, function Trig_Damagedetection_AddUnit)
    call DestroyGroup(g)
endfunction

As far as I have testet it is leakless and bugless. If leaks or bugs occur just tell me and I fix as fast as possible.

Keywords:
Alternative, Damage, System, Damagesystem
Contents

Damagesystem by Crixx (Map)

Reviews
12th Dec 2015 IcemanBo: For long time as NeedsFix. Rejected. 12:10, 21st Sep 2014 TriggerHappy: You need to replace your DDS with one that works properly. It seems like you're only checking the damage event which as far as I know isn't...

Moderator

M

Moderator

12th Dec 2015
IcemanBo: For long time as NeedsFix. Rejected.

12:10, 21st Sep 2014
TriggerHappy:

You need to replace your DDS with one that works properly. It seems like you're only checking the damage event which as far as I know isn't accurate and neither is your detection of units entering maps.
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
sorry to be harsh, but unless you hook this to DDS you will not succeed in getting this approved, because your method may crash the map if the maps uses many many units that are created throughout the game. Also your function GetResistence should be at the top because it is configurable, which should be sticked to the top of your code. People dont want to crawl over your code just to find something that is meant to be configurable
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
it will keep decreasing the performance of the map because as unit spawn in the game the trigger will keep adding and adding them until eventually the game will crash because you can only have so many units registered onto one trigger.

The problem with damage detection is the fact that when unit dies and gets removed from the game it will not get removed from the triggers it is registered into
 
Level 2
Joined
Apr 29, 2013
Messages
21
the only alternative i come think of is for each unit an extra trigger and then destroying it but is this ok? i mean will it leak or something?

Edit: I've just have changed the DDS trigger.

JASS:
function Trig_Damagedetection_Actions takes nothing returns nothing
    if(GetEventDamage() >= 1.) then
        call OnUnitDmg(GetEventDamageSource(), GetTriggerUnit(), GetEventDamage(), DMG_Physical)
        if(GetWidgetLife(GetTriggerUnit()) < GetEventDamage()) then
            call OnUnitDeath(GetEventDamageSource(), GetTriggerUnit())
            call DestroyTrigger(GetTriggeringTrigger())
        endif
    endif
endfunction

function Trig_Damagedetection_AddUnit takes nothing returns nothing
    local trigger t = CreateTrigger()
	call TriggerRegisterUnitEvent(t, GetEnumUnit() , EVENT_UNIT_DAMAGED)
    call TriggerAddAction(t, function Trig_Damagedetection_Actions)  
endfunction

function Trig_Damagedetection_UnitEnter takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterUnitEvent(t, GetTriggerUnit() , EVENT_UNIT_DAMAGED) 
    call TriggerAddAction(t, function Trig_Damagedetection_Actions)   
endfunction  

function InitTrig_System_Damagedetection takes nothing returns nothing
    local group g = CreateGroup()
    
    set gg_trg_System_Damagedetection = CreateTrigger()
    call TriggerRegisterEnterRectSimple(gg_trg_System_Damagedetection, GetWorldBounds())  
    call TriggerAddAction(gg_trg_System_Damagedetection, function Trig_Damagedetection_UnitEnter)  
    
    call GroupEnumUnitsInRect(g, GetWorldBounds(), null)
    call ForGroup(g, function Trig_Damagedetection_AddUnit)
    call DestroyGroup(g)
endfunction

Would it work better now? I mean every trigger is destroyed after use and also triggers don't leak as far as I know.
 
Last edited:
Level 19
Joined
Aug 8, 2007
Messages
2,765
its still not as efficient as, say, Nes's, that only uses one trigger and only leaks a maximum of 50-100 events

the way its done is by keeping a list of units and after say 50 units are removed, than remove the previous trigger and recreate it with the list of units
 
Level 10
Joined
Aug 21, 2010
Messages
316
the only alternative i come think of is for each unit an extra trigger and then destroying it but is this ok? i mean will it leak or something?

Edit: I've just have changed the DDS trigger.

JASS:
function Trig_Damagedetection_Actions takes nothing returns nothing
    if(GetEventDamage() >= 1.) then
        call OnUnitDmg(GetEventDamageSource(), GetTriggerUnit(), GetEventDamage(), DMG_Physical)
        if(GetWidgetLife(GetTriggerUnit()) < GetEventDamage()) then
            call OnUnitDeath(GetEventDamageSource(), GetTriggerUnit())
            call DestroyTrigger(GetTriggeringTrigger())
        endif
    endif
endfunction

function Trig_Damagedetection_AddUnit takes nothing returns nothing
    local trigger t = CreateTrigger()
	call TriggerRegisterUnitEvent(t, GetEnumUnit() , EVENT_UNIT_DAMAGED)
    call TriggerAddAction(t, function Trig_Damagedetection_Actions)  
endfunction

function Trig_Damagedetection_UnitEnter takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterUnitEvent(t, GetTriggerUnit() , EVENT_UNIT_DAMAGED) 
    call TriggerAddAction(t, function Trig_Damagedetection_Actions)   
endfunction  

function InitTrig_System_Damagedetection takes nothing returns nothing
    local group g = CreateGroup()
    
    set gg_trg_System_Damagedetection = CreateTrigger()
    call TriggerRegisterEnterRectSimple(gg_trg_System_Damagedetection, GetWorldBounds())  
    call TriggerAddAction(gg_trg_System_Damagedetection, function Trig_Damagedetection_UnitEnter)  
    
    call GroupEnumUnitsInRect(g, GetWorldBounds(), null)
    call ForGroup(g, function Trig_Damagedetection_AddUnit)
    call DestroyGroup(g)
endfunction

Would it work better now? I mean every trigger is destroyed after use and also triggers don't leak as far as I know.

JASS:
    function Trig_Damagedetection_AddUnit takes nothing returns nothing
        local trigger t = CreateTrigger()
        call TriggerRegisterUnitEvent(t, GetEnumUnit() , EVENT_UNIT_DAMAGED)
        call TriggerAddAction(t, function Trig_Damagedetection_Actions)  
    endfunction

    function Trig_Damagedetection_UnitEnter takes nothing returns nothing
        local trigger t = CreateTrigger()
        call TriggerRegisterUnitEvent(t, GetTriggerUnit() , EVENT_UNIT_DAMAGED)
        call TriggerAddAction(t, function Trig_Damagedetection_Actions)  
    endfunction

    //------------------->>>>>>>>>
    // For complete details see the whole "main code"


    function Trig_Damagedetection_AddUnit takes nothing returns nothing
        local unit u = GetEnumUnit()
       // You can add some conditions here.Depending on the needs of
       // if (something) then
            call TriggerRegisterUnitEvent( udg_YourTrigger, u, EVENT_UNIT_DAMAGED )
       // endif
        set u = null
    endfunction
   
    function Trig_Damagedetection_UnitEnter takes nothing returns nothing
        local unit u = GetTriggerUnit()
        // You can add some conditions here.Depending on the needs of
        // if (something) then
            call TriggerRegisterUnitEvent( udg_YourTrigger, u, EVENT_UNIT_DAMAGED )
        // endif
        set u = null
    endfunction

JASS:
    set gg_trg_System_Damagedetection = CreateTrigger()
    call TriggerRegisterEnterRectSimple(gg_trg_System_Damagedetection, GetWorldBounds())  
    call TriggerAddAction(gg_trg_System_Damagedetection, function Trig_Damagedetection_UnitEnter)

->

JASS:
     local code e = function Trig_Damagedetection_UnitEnter
     local region r = CreateRegion()
     local trigger t = CreateTrigger()
     call RegionAddRect( r, bj_mapInitialPlayableArea )
     call TriggerRegisterEnterRegion( t, r,  null )
     call TriggerAddCondition( t, Filter( e ) )
     set r = null
     set t = null
     set e = null

JASS:
    local group g = CreateGroup()
    call GroupEnumUnitsInRect(g, GetWorldBounds(), null)
    call ForGroup(g, function Trig_Damagedetection_AddUnit)
    call DestroyGroup(g)

->

JASS:
     local code mi = function Trig_Damagedetection_AddUnit
     call GroupEnumUnitsInRect( bj_lastCreatedGroup, bj_mapInitialPlayableArea,  null )
     call ForGroup( bj_lastCreatedGroup, mi ) 
     set mi = null

***********
The main code
***********

JASS:
    //Function names are arbitrary so fuck them

    //*----------------------------------------------------------------------------------
    //*
    //*                          Functions for color text and more things
    //*                          With this function, your main code will be much shorter                       
    //*
    //*----------------------------------------------------------------------------------
    function CreateTextTagUnitEx takes unit u, string s, real size, real offset, real speed, real angle, integer red, integer blu, integer gre, integer trans, real life, real fade, boolean show, boolean permanent, boolean suspend returns texttag
        local texttag tt = CreateTextTag()
        local real vel=(speed*.071)/128
        local real xvel=vel*Cos( angle * .01745 )
        local real yvel=vel*Sin( angle * .01745 )
        call SetTextTagText(tt,s,(size*0.023)/10)
        call SetTextTagPos(tt,GetUnitX(u),GetUnitY(u),offset)
        call SetTextTagColor(tt,red,blu,gre,255-trans)
        call SetTextTagVisibility(tt,show)
        call SetTextTagPermanent(tt,permanent)
        call SetTextTagSuspended(tt,suspend)
        call SetTextTagVelocity(tt,xvel,yvel)
        if permanent!=true then
            call SetTextTagLifespan(tt,life)
            call SetTextTagFadepoint(tt,fade)
        endif
        return tt
    endfunction

    function YourCode takes nothing returns nothing
        // This is the main function
        // Magic happens here
        // Here we are going to register some things
        // e.g
        set DMGSource = GetEventDamageSource()
        set DMGTarget = GetTriggerUnit()
        set DMGAmount = GetEventDamage()
        set udg_EnableSystem = 1.
        set udg_EnableSystem = 0.
        // etc.
    endfunction

    function ClearTrigger takes nothing returns nothing
        local unit u = GetEnumUnit()
        if GetWidgetLife( u ) >= .406 then
            call TriggerRegisterUnitEvent( udg_YourTrigger, u, EVENT_UNIT_DAMAGED )
        endif
        set u = null
    endfunction

    function FlushMemory takes nothing returns nothing
        local code c = function YourCode
        local code ct = function ClearTrigger
        call GroupEnumUnitsInRect( bj_lastCreatedGroup, bj_mapInitialPlayableArea,  null )
        call ResetTrigger( udg_YourTrigger )
        call DestroyTrigger( udg_YourTrigger )
        set udg_YourTrigger = null
        set udg_YourTrigger = CreateTrigger()
        call TriggerAddCondition( udg_YourTrigger, Filter( c ) )
        call ForGroup( bj_lastCreatedGroup, ct )
        set c = null
        set ct = null
    endfunction

    function MapInit takes nothing returns nothing 
        local unit u = GetEnumUnit() 
       // You can add some conditions here.Depending on the needs of
       // if (something) then
            call TriggerRegisterUnitEvent( udg_YourTrigger, u, EVENT_UNIT_DAMAGED )
       // endif
        set u = null
    endfunction
    
    function UnitEntersMap takes nothing returns nothing
        local unit u = GetTriggerUnit()
        // You can add some conditions here.Depending on the needs of
        // if (something) then
            call TriggerRegisterUnitEvent( udg_YourTrigger, u, EVENT_UNIT_DAMAGED )
        // endif
        set u = null
    endfunction

    //This goes on map init

    function Register takes nothing returns nothing
        local code c = function YourCode
        local code e = function UnitEntersMap
        local code m = function FlushMemory
        local code mi = function MapInit
        local region r = CreateRegion()
        local trigger t = CreateTrigger()
        local trigger cm = CreateTrigger()
        set udg_YourTrigger = CreateTrigger()
        set udg_EnableSystem = 0.
        // registering units which are already on the map
        call TriggerAddCondition( udg_YourTrigger, Filter( c ) )
        call GroupEnumUnitsInRect( bj_lastCreatedGroup, bj_mapInitialPlayableArea,  null )
        call ForGroup( bj_lastCreatedGroup, mi ) 
        // registering units which are currently entered
        call RegionAddRect( r, bj_mapInitialPlayableArea )
        call TriggerRegisterEnterRegion( t, r,  null )
        call TriggerAddCondition( t, Filter( e ) )                                            
        // This function resets the memory
        // The value of 30 should be configured but this is just fucking example
        //40.50.60. and so on...
        call TriggerRegisterTimerEvent( cm, 30., true )
        call TriggerAddCondition( cm, Filter( m ) )
        set c = null
        set e = null
        set m = null
        set r = null
        set t = null
        set cm = null
        set mi = null
    endfunction


     //This goes on map init

    function DamageActions takes nothing returns boolean
        // Example
        if DMGAmount > 0. then
            call DisplayTextToPlayer( GetLocalPlayer(), 0, 0, R2S( DMGAmount ) )
        endif
        return false
    endfunction

    function RegisterDmageEvent takes nothing returns nothing
        local trigger t = CreateTrigger()
        local code c = function DamageActions
        call TriggerRegisterVariableEvent( t, "EnableSystem", EQUAL, 1.0 )
        call TriggerClearConditions( t )
        call TriggerAddCondition( t, Filter( c ) )
        set t = null
        set c = null
    endfunction
 
Last edited:
Level 10
Joined
Aug 21, 2010
Messages
316
huhwhat? the only changes you made were making code variables and passing them in which is incredibly inefficient. why would u even do that.

bj_lastCreatedGroup won't work btw


bj_lastCreatedGroup won't work btw ????????

The most ridiculous thing I've heard lately

You're crazy, man muhahahahahhahahahhahahahah

Before you say something stupid,first think carefully muhahahahha bj_lastCreatedGroup won't work omg Fuck, I'll die of laughter muhahahah
 
Level 10
Joined
Aug 21, 2010
Messages
316
Yes, it won't work.


false

It is possible that only works in my version of the editor
muhahahah

JASS:
    // Blizzard.j ( define Jass2 functions that need to be in every map script )
    // Last X'd vars
    unit               bj_lastCreatedUnit          = null
    item               bj_lastCreatedItem          = null
    item               bj_lastRemovedItem          = null
    unit               bj_lastHauntedGoldMine      = null
    destructable       bj_lastCreatedDestructable  = null
   // **********************************************
    group              bj_lastCreatedGroup         = CreateGroup()
   //**********************************************
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
I am not here to talk to an idiot.
I said that it won't work, just as Arhowk did and you're being stupid to ridicule us for that.

It won't work because in your whole code you NEVER EVER use a function that assigns anything to bj_lastCreatedGroup. This bj variable is only ever used in GUI functions, as it is utterly pointless in JASS.

tl;dr - This will be extremely buggy for anyone that extensively uses GUI, because it makes no sense.
 
Level 10
Joined
Aug 21, 2010
Messages
316
I am not here to talk to an idiot.
I said that it won't work, just as Arhowk did and you're being stupid to ridicule us for that.

It won't work because in your whole code you NEVER EVER use a function that assigns anything to bj_lastCreatedGroup. This bj variable is only ever used in GUI functions, as it is utterly pointless in JASS.

tl;dr - This will be extremely buggy for anyone that extensively uses GUI, because it makes no sense.

I can not believe,another idiot
After all, think what you want and be stupid all your life
I'm sorry I can not get down to your level[level of intelligence]
As for me, the discussion is finished
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
The reason why a new DDS would be approved is because it would have a different design philosophy or some other pro/con that could not be measured against a current DDS.

Why this one over the others? It doesn't support third party resources, it's difficult to maintain, it's hard to configure, and it has poor trigger recycling. Please let everyone know what the pros are that outweigh the costs. I, for one, don't see them. You say that you use this for your map? Keep it that way; it's ill suited to be a public resource.
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
I can not believe,another idiot
After all, think what you want and be stupid all your life
I'm sorry I can not get down to your level[level of intelligence]
As for me, the discussion is finished

Please don't flame, this is just a hobby site. If you truly believe your claims are true, post proof that assigns values to bj_lastCreatedGroup.

The reason why a new DDS would be approved is because it would have a different design philosophy or some other pro/con that could not be measured against a current DDS.

Why this one over the others? It doesn't support third party resources, it's difficult to maintain, it's hard to configure, and it has poor trigger recycling. Please let everyone know what the pros are that outweigh the costs. I, for one, don't see them. You say that you use this for your map? Keep it that way; it's ill suited to be a public resource.

To translate....

The Hive doesn't like keeping duplicate resources and this resource is a duplicate of quite a few others that does the same exact thing less efficiently. If you want this to be approved, you either have to do it more efficiently than Bribes / LFH or do it differently that would make it worth using.
 
Level 4
Joined
Jul 13, 2012
Messages
86
The reason why a new DDS would be approved is because it would have a different design philosophy or some other pro/con that could not be measured against a current DDS.

Why this one over the others? It doesn't support third party resources, it's difficult to maintain, it's hard to configure, and it has poor trigger recycling. Please let everyone know what the pros are that outweigh the costs. I, for one, don't see them. You say that you use this for your map? Keep it that way; it's ill suited to be a public resource.

Don't be silly, this one is an alternate only :/
 
Last edited:
Level 2
Joined
Apr 29, 2013
Messages
21
Hm, as I said I only uploaded this cuz it could have been useful for someone.
Sure it isn't easy to configure and it doesn't look diffrent like other dds/damage output before. It is for me just a tool to determine damage in a better way for example magic(reduced by resistence in my map), physical(armor reduced) and true damage(completly ignore any reduction). But that you told me that it's inefficient is something I#m thankful for.

Now that you say it wouldn't get approved, should I delete it?

Edit: If it's better to configure/approve I could also make more constants that can be changed for example the effects.
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
I think the fundamental problem with this system is that is is both a damage handler and a damage detection system.
This forces people to use a subpar damage detection/modification(yours) in order to more comfortably do something that they could do with the existing damage detection systems.

If you made it run off of lfh's damage detection, for instance, then it would be a very useful system.
 
Level 2
Joined
Apr 29, 2013
Messages
21
If you made it run off of lfh's damage detection, for instance, then it would be a very useful system.

Ok, I don't really understand :/

Should I remove the dds trigger? I don't know if I mentioned this but it's simple to capture the basic attacks so that for example when a unit dies you get the credit( gold and exp) for it.

I'll update this definetly with better configureability later(maybe tommorow or today in the evening).
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
The thing is that DamageEngine by lfh supports more and is better to configure. Try it out.

Features that it has:
*Automatic damage type detection
*Properly modify damage taken, even when health is full.
*Prevent units from dying when they're not supposed to(damage reduction).
*Easy to configure through adding damage handlers.
*Easy damage modification(only have to change 1 variable and everything will work)

The problem with your system is that it tries to do everything, but in the end doesn't do it as well as other resources.

*Damage detection and modification should be a separate resource.
*Bounty should be separate.
*Also, if a person is able to trigger all his spells(detecting basics attacks requires them to do so with this system), then he is also likely able to create his own damage type system with ease.
*The system shouldn't automatically create blood effects, because it has nothing to do with damage detection/modification and is easy to add in any proper damage system anyway.
 
Level 2
Joined
Apr 29, 2013
Messages
21
It can't be helped then.

I'm only a hobby programmer. If have giant ideas but the time is limited. And the fact that I always do my projects alone doesn't make it better. I didn't learned Java or C#, C++, and C through a book or teacher or something. I told me everything myself. Jass is no exception. I' currently trying to do something equal to League of Legends or DotA. It already took it's time but it doesn't seem to proceed. And before I cancel the project I decided to at least share the Damagesystem. Is inefficient and there are better ones. What a suprise. Maybe later I have more ambition to finish the project or to better the system.

But thanks for the replys.

Edit: "I didn't learned Java or C#, C++, and C through a book or teacher or something. I told me everything myself." This should mean that I just learned through GUI and such^^ so by converting GUI to Jass
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
not compliment, but I dont want you to feel that your system is bad or anything. Its good for your own use if you feel its good(obviously), but you know, there is certain bar that must be met before it can be publically usable without constraits on potential crashes etc
 
Level 2
Joined
Apr 29, 2013
Messages
21
to be honest i have much much more settings in the original system, which is also coupled to the xe-system(custom missilses and such). In my map are really a lot of units created and i was wondering wheres the leak. so if it is still leaking i know where to ask^^ but i didn't created the system when its no use so youre right ^^ dont even know if my whole code is leakless. also i have some problems with my buffs :( but thats the wrong thread for this^^
 
Top