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

ASS + Bribe Damage Engine?

Status
Not open for further replies.
Level 12
Joined
Jan 2, 2016
Messages
973
Hmm, can't you try something like:
When a unit takes damage - put the damage source into a unit group, and start a timer for xx seconds. When the timer expires - remove the unit from the group.
And when a hero dies - check who is in the "Assist" group, and give them assistances.
~I kind a realize that this is easier said than done. Tried to post an example code, but figured it wouldn't be so simle. Not impossible tho if you have time to think it over~

EDIT: it may actually not be so hard to do if each player can have only 1 hero.
Then you can just use constant Unit Group (Array) for each player.
You can even keep the timers constant, instead of dynamically create/destroy them, tho you'd need more timers:
Timer for Player 1 when attacking Player 2; Timer when 1 attacks 3, 1 attacks 4, etc... then 2 attacks 1, 2 attacks 3, etc...
You can check this if you are wondering how to deal with their indexes

EDIT 2: Here's an example code:
JASS:
local unit c = udg_//damage source
local unit t = udg_//damaged unit
local integer pc = GetPlayerId(GetOwningPlayer(c))
local integer pt = GetPlayerId(GetOwningPlayer(t))
local integer i = // the amount of enemy players ( 5, if the map is 5v5; 3 if it's 3v3, 6 if it's 6 v 3 ~the higher value in these cases~)
local integer j = /* if the players are like: 2, 3, 4, 5, 6 in team 1, and 8, 9, 10, 11, 12 in team 2, then set j to 1/2/3/4/5 for team 1 
(depending on the player), and 1/2/3/4/5 again for team 2. You'd need an if or a Module func for this */
call GroupAddUnit( udg_AssGroup[pt], c )
call TimerStart ( udg_AssTimer[(pc*i)+j] , 10.00, false, function RemoveFromAssGroup )
 
Last edited:
Level 31
Joined
Jul 10, 2007
Messages
6,306
You can edit it just fine

Add in Bribe's or PDD or whatever else you want

JASS:
            static if LIBRARY_DamageEvent then
                set p = GetOwningPlayer(DamageEvent.source)
                set id = GetPlayerId(p)
                set damageTarget = DamageEvent.target
                set damageTargetId = DamageEvent.targetId
                set damageSourceId = DamageEvent.sourceId
            elseif LIBRARY_Damage then
                static if DAMAGE_BY_JESUS4LYF then
                    set p = GetOwningPlayer(GetEventDamageSource())
                    set id = GetPlayerId(p)
                    set damageTarget = GetTriggerUnit()
                    set damageTargetId = GetUnitId(damageTarget)
                    set damageSourceId = GetUnitId(GetEventDamageSource())
                else
                    set p = GetOwningPlayer(Damage.source)
                    set id = GetPlayerId(p)
                    set damageTarget = Damage.target
                    set damageTargetId = Damage.targetId
                    set damageSourceId = Damage.sourceId
                endif
            endif

JASS:
            static if LIBRARY_DamageEvent then
                call DamageEvent.ANY.register(Condition(function thistype.onDamage), 0)
            elseif LIBRARY_Damage then
                static if DAMAGE_BY_JESUS4LYF then
                    call Damage_RegisterEvent(t)
                    call TriggerAddCondition(t, Condition(function thistype.onDamage))
                    set t = null
                else
                    call RegisterGlobalDamage(function thistype.onDamage)
                endif
            else
                call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, "ERROR: NO DAMAGE DETECTING SYSTEM FOUND.")
                call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, "SHUTING DOWN IN: 5")
                call TriggerSleepAction(1)
                call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, "4")
                call TriggerSleepAction(1)
                call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, "3")
                call TriggerSleepAction(1)
                call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, "2")
                call TriggerSleepAction(1)
                call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, "1")
                call TriggerSleepAction(1)
                call Exit()
            endif

You'll need to account for unit indexer too. You'd add in Bribe's here.

JASS:
        private static method getIndexed takes nothing returns unit
            static if LIBRARY_UnitIndexer then
                return GetIndexedUnit()
            elseif LIBRARY_AIDS then
                return AIDS_GetEnteringIndexUnit()
            else
                return crashThread
            endif
        endmethod
        
        private static method getIndexedId takes nothing returns integer
            static if LIBRARY_UnitIndexer then
                return GetIndexedUnitId()
            elseif LIBRARY_AIDS then
                return AIDS_GetIndexOfEnteringUnitAllocated()
            else
                return crashThreadInt
            endif
        endmethod
        
        private static method getDeindexed takes nothing returns unit
            static if LIBRARY_UnitIndexer then
                return GetIndexedUnit()
            elseif LIBRARY_AIDS then
                return GetIndexUnit(AIDS_GetDecayingIndex())
            else
                return crashThread
            endif
        endmethod
        
        private static method getDeindexedId takes nothing returns integer
            static if LIBRARY_UnitIndexer then
                return GetIndexedUnitId()
            elseif LIBRARY_AIDS then
                return AIDS_GetDecayingIndex()
            else
                return crashThreadInt
            endif
        endmethod

JASS:
            static if LIBRARY_UnitIndexer then
                call RegisterUnitIndexEvent(Condition(function thistype.index), UnitIndexer.INDEX)
                call RegisterUnitIndexEvent(Condition(function thistype.deindex), UnitIndexer.DEINDEX)
            elseif LIBRARY_AIDS then
                call AIDS_RegisterOnEnterAllocated(Condition(function thistype.index))
                call AIDS_RegisterOnDeallocate(Condition(function thistype.deindex))
            else
                call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, "ERROR: NO UNIT INDEXING SYSTEM FOUND.")
                call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, "SHUTING DOWN IN: 5")
                call TriggerSleepAction(1)
                call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, "4")
                call TriggerSleepAction(1)
                call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, "3")
                call TriggerSleepAction(1)
                call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, "2")
                call TriggerSleepAction(1)
                call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, "1")
                call TriggerSleepAction(1)
                call Exit()
            endif
 
Status
Not open for further replies.
Top