• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

Help me! JAWS are eating me.

Status
Not open for further replies.
Oh man, you get less sleep than I do, you must be popular with the girls, I need to sleep less often! Darn! Darn! Aaaaaaaah! *takes chill pill* Oh. Pardon me. :D
 
Endblock.jpg


At the very end of (life) code.
 
JASS:
function InitialDeath_Actions takes nothing returns nothing
    local real f
    local real r
    if ( GetUnitTypeId(GetTriggerUnit()) == 'H001' ) or ( GetUnitTypeId(GetTriggerUnit()) == 'H000' ) then
        set f = GetUnitX(GetTriggerUnit())
        set r = GetUnitY(GetTriggerUnit())
        call DestroyEffect(AddSpecialEffect("Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl", f, r ))
    endif
    if ( GetUnitAbilityLevel(GetTriggerUnit(), 'A03K') > 0 ) then
        set udg_A = 1
        loop
            exitwhen udg_A > udg_GB_Index
            if ( GetTriggerUnit() == udg_GB_Caster[udg_A] ) and ( GetTriggerUnit() == udg_GB_Target[udg_A] ) then
                set udg_TempReals[0] = GetUnitX(GetTriggerUnit())
                set udg_TempReals[1] = GetUnitY(GetTriggerUnit())
                set udg_TempTag = CreateTextTag()
                call SetTextTagText(udg_TempTag, ( udg_PlayerColor[GetConvertedPlayerId(GetOwningPlayer(GetKillingUnit()))] + ( udg_PlayerName[GetConvertedPlayerId(GetOwningPlayer(GetKillingUnitBJ()))] + ( " has won " + ( I2S(( 6 + ( 3 * GetUnitAbilityLevel(udg_GB_Caster[udg_A], 'A01W') ) )) + " Vitality!|r" ) ) ) ), 0.00)
                call SetTextTagPos(udg_TempTag, f, r, 0.00)
                call SetTextTagColor(udg_TempTag, PercentTo255(100.00), PercentTo255(100.00), PercentTo255(100.00), PercentTo255(100.0-100.00))
                call SetTextTagVelocityBJ( udg_TempTag, 124.00, 90 )
                call SetTextTagSuspended( udg_TempTag, false )
                call SetTextTagPermanent( udg_TempTag, false )
                call SetTextTagLifespan( udg_TempTag, 3.00 )
                call SetTextTagFadepoint( udg_TempTag, 1.50 )
                call SetHeroStr(GetKillingUnit(), ( 6 + ( 3 * GetUnitAbilityLevel(udg_GB_Caster[udg_A], 'A01W') ) ), true )
                set udg_GB_Duration[udg_A] = 0.00
                call UnitRemoveAbility(GetKillingUnit(), 'B019' )
                call UnitRemoveAbility(GetTriggerUnit(), 'B019' )
            else
            endif
            set udg_A = udg_A + 1
        endloop
    else
    endif
    if ( GetTriggerPlayer() == Player(PLAYER_NEUTRAL_AGGRESSIVE) ) then
    
    else
    endif
endfunction
 
Post the whole trigger with init functions and everything :)
Also you have some bad coding pratice :
- Store GetTriggerUnit into a variable since you're using twice or more.
- Don't use useless BJ like Percent to 255 and SettextTagVelocityBJ or GetConvertedPlayerId
- Also Player(PLAYER_NEUTRAL_AGGRESSIVE) -> Player(12) or Player(13) or Player(14) have to find.
 
Don't use useless BJ like Percent to 255 and SettextTagVelocityBJ or GetConvertedPlayerId

I need the second since it does what I need to do. And is pretty long.

JASS:
library InitialDeath
function InitialDeath_Actions takes nothing returns nothing
    local real f
    local real r
    local unit u
    if ( GetUnitTypeId(GetTriggerUnit()) == 'H001' ) or ( GetUnitTypeId(GetTriggerUnit()) == 'H000' ) then
        set u = GetTriggerUnit()
        set f = GetUnitX(u)
        set r = GetUnitY(u)
        call DestroyEffect(AddSpecialEffect("Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl", f, r ))
    endif
    if ( GetUnitAbilityLevel(u, 'A03K') > 0 ) then
        set udg_A = 1
        loop
            exitwhen udg_A > udg_GB_Index
            if ( u == udg_GB_Caster[udg_A] ) or ( u == udg_GB_Target[udg_A] ) then
                set udg_TempReals[0] = GetUnitX(u)
                set udg_TempReals[1] = GetUnitY(u)
                set udg_TempTag = CreateTextTag()
                call SetTextTagText(udg_TempTag, ( udg_PlayerColor[GetPlayerId(GetOwningPlayer(GetKillingUnit()))] + ( udg_PlayerName[GetConvertedPlayerId(GetOwningPlayer(GetKillingUnitBJ()))] + ( " has won " + ( I2S(( 6 + ( 3 * GetUnitAbilityLevel(udg_GB_Caster[udg_A], 'A01W') ) )) + " Vitality!|r" ) ) ) ), 0.00)
                call SetTextTagPos(udg_TempTag, f, r, 0.00)
                call SetTextTagColor(udg_TempTag, 255.00, 255.00, 255.00, 0.00)
                call SetTextTagVelocityBJ( udg_TempTag, 124.00, 90 )
                call SetTextTagSuspended( udg_TempTag, false )
                call SetTextTagPermanent( udg_TempTag, false )
                call SetTextTagLifespan( udg_TempTag, 3.00 )
                call SetTextTagFadepoint( udg_TempTag, 1.50 )
                call SetHeroStr(GetKillingUnit(), ( 6 + ( 3 * GetUnitAbilityLevel(udg_GB_Caster[udg_A], 'A01W') ) ), true )
                set udg_GB_Duration[udg_A] = 0.00
                call UnitRemoveAbility(GetKillingUnit(), 'B019' )
                call UnitRemoveAbility(u, 'B019' )
            else
            endif
            set udg_A = udg_A + 1
        endloop
    else
    endif
    if ( GetTriggerPlayer() == Player(12) ) then
    //Neutral Stuff
    else
    endif
    set u = null
endfunction

//===========================================================================
private function AddEventID takes nothing returns nothing
    local trigger t = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddAction( t, function InitialDeath_Actions )
    set t = null
endfunction

endlibrary
 
How about the 'takes' problem? Everything is throwing an error at my face.

Try rewriting the library, and not CnP or looking what have done and doing the same, just erase, and repeat, you have a backup if you need to

Dude it's just inadmissible. :( The libraries are too long.
 
What do you think about this :
JASS:
library LineDamage

    globals
        private constant attacktype ATTACK_TYPE = ATTACK_TYPE_MAGIC
        private constant damagetype DAMAGE_TYPE = DAMAGE_TYPE_MAGIC
    endglobals
    
    struct LineDamage extends array
        private static group G
        private static rect R
        
        static method add takes real x1, real y1, real x2, real y2, real dmg, unit caster, boolean hitAlly, boolean hitCaster returns nothing
            local unit u
            local player p = GetOwningPlayer(caster)
            set R = Rect(x1, y1, x2, y2)
            call GroupEnumUnitsInRect(G, R, null)
            if not hitCaster then
                call GroupRemoveUnit(G, caster)
            endif
            loop
                set u = FirstOfGroup(G)
                exitwhen u == null
                call GroupRemoveUnit(G,u)
                if hitAlly or IsUnitEnemy(u, p) then
                    call UnitDamageTarget(caster, u, dmg, true, false, ATTACK_TYPE, DAMAGE_TYPE, null)
                endif
            endloop
            set p = null
            call RemoveRect(R)
            set R = null
        endmethod
        
        private static method onInit takes nothing returns nothing
            set G = CreateGroup()
        endmethod
    endstruct
endlibrary

To add one to this
JASS:
call LineDamage.add(x1, y1, x2, y2, damage, caster, hitally, hitcaster)
The coordinates are the ones of point A and point B :
Code:
A
|----------------------------------------|
|                                                 |
|----------------------------------------|B
 
Btw it is untested but I don't think it will bug on something like thiis :)

EDIT:
JASS:
library LineDamage
    
    struct LineDamage extends array
        private static group G
        private static rect R
        
        static method add takes real x1, real y1, real x2, real y2, real dmg, unit caster, boolean hitAlly, boolean hitCaster, attacktype a_type, damagetype d_type returns nothing
            local unit u
            local player p = GetOwningPlayer(caster)
            set R = Rect(x1, y1, x2, y2)
            call GroupEnumUnitsInRect(G, R, null)
            if not hitCaster then
                call GroupRemoveUnit(G, caster)
            endif
            loop
                set u = FirstOfGroup(G)
                exitwhen u == null
                call GroupRemoveUnit(G,u)
                if hitAlly or IsUnitEnemy(u, p) then
                    call UnitDamageTarget(caster, u, dmg, true, false, a_type, d_type, null)
                endif
            endloop
            set p = null
            call RemoveRect(R)
            set R = null
        endmethod
        
        private static method onInit takes nothing returns nothing
            set G = CreateGroup()
        endmethod
    endstruct
endlibrary

call LineDamage.add(x1,y1,x2,y2,dmg,caster,hitAlly,hitCaster,a_type,d_type)
 
Along the line from whence the enemies are picked. And if possible, I will create the dummies manually, so I can set their facing angle configurably. So the argument would take a unit, not a sfx to be created on the dummy.

Wait. We can use items as dummies right? Though some configurability is lost, with Item Cleanup, it is admissible, right? because items are cleaned and units leak.
 
Status
Not open for further replies.
Back
Top