+ dmg from unit in area

Jedimindtrixxx

┻━┻ ︵ ¯\(ツ)/¯ ︵ ┻━┻
Reaction score
168
JASS:
function FuncTypeCond takes nothing returns boolean
    return ( GetUnitTypeId(GetTriggerUnit()) == 'n01E' )
endfunction

function Actions takes nothing returns nothing
    local location HUnterPOINT = GetUnitLoc(GetTriggerUnit( ))
    local group PIGGROUP = GetUnitsInRangeOfLocMatching(512, HUnterPOINT, Condition(function FuncTypeCond))
    call SetUnitAbilityLevelSwapped( 'A000', GetTriggerUnit( ), CountUnitsInGroup( PIGGROUP ))
    call SetUnitAbilityLevelSwapped( 'A025', GetTriggerUnit( ), CountUnitsInGroup( PIGGROUP ))
    set HUnterPOINT = null
    set PIGGROUP = null
endfunction

//===========================================================================
function Init takes nothing returns nothing
    local trigger Hoag_Train
    set Hoag_Train = CreateTrigger(  )
    call TriggerRegisterTimerEventPeriodic( Hoag_Train, 0.50 )
    call TriggerRegisterAnyUnitEventBJ( Hoag_Train, EVENT_PLAYER_UNIT_RESEARCH_FINISH )
    call TriggerAddAction( Hoag_Train, function Actions )
endfunction


what its supposed to do is, for every Naga Royal Guard in a 1000 range around the "Hoag Train" (name of unit), it sets the level of a spell: level of spell = # of units in the area, one of the spells is based off of endurance aura that targets himself only, and for every unit it increases by 5% the atk speed, (unit is immobile, no ms added) and a spell based of claws of attack given as an ability which increases his dmg by 50 every level

the problem is it doesnt work. at all. i get a normal save, like it doesnt give me any syntax but it doesnt work ingame for some reason

any1 know why?
 

Expelliarmus

Where to change the sig?
Reaction score
48
JASS:
function FuncTypeCond takes nothing returns boolean
    return ( GetUnitTypeId(GetTriggerUnit()) == 'n01E' )
endfunction

Should be:
JASS:
function FuncTypeCond takes nothing returns boolean
    return ( GetUnitTypeId(GetFilterUnit()) == 'n01E' )
endfunction

JASS:
 call SetUnitAbilityLevelSwapped( 'A000', GetTriggerUnit( ), CountUnitsInGroup( PIGGROUP ))
    call SetUnitAbilityLevelSwapped( 'A025', GetTriggerUnit( ), CountUnitsInGroup( PIGGROUP ))

can be
JASS:
call SetUnitAbilityLevel( GetTriggerUnit( ), 'A000', CountUnitsInGroup( PIGGROUP ))
    call SetUnitAbilityLevel(  GetTriggerUnit( ), 'A025', CountUnitsInGroup( PIGGROUP )) // remove BJ where possible

Add
JASS:
call RemoveLocation(HUnterPOINT) // remove leaks; nulling isn't enough

JASS:
call DestroyGroup(PIGGROUP) //remove leaks; nulling isn't enough


And Im pretty sure
JASS:
local trigger Hoag_Train
set Hoag_Train = CreateTrigger(  )

can just be
JASS:
local trigger Hoag_Train = CreateTrigger( )
 

Andrewgosu

The Silent Pandaren Helper
Reaction score
716
Are you sure there is a "Triggering unit" with "TriggerRegisterTimerEventPeriodic" kind of an event?

Don't think there is...


And you should remove the local trigger declaration part in the initialization trigger and stick to the global one.
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
> Are you sure there is a "Triggering unit" with "TriggerRegisterTimerEventPeriodic" kind of an event?

I guess he hopes this to apply to the "finishes research" one that also on that trigger for some unknown reason...


"Matching unit" = GetFilterUnit() btw.


> remove the local trigger declaration part in the initialization trigger and stick to the global one.

Assuming that Init actually runs, that makes no difference.
 

Jedimindtrixxx

┻━┻ ︵ ¯\(ツ)/¯ ︵ ┻━┻
Reaction score
168
hmm still doesnt seem to work. would there be a better event/unit command action other than triggerunit?
thx in advance
forgot to mention, hoag train isnt a hero, its a building

EDIT:
hmm changed it a bit seems like it should work now but it doesnt =\
code:
JASS:
function FuncTypeCond takes nothing returns boolean
    return ( GetUnitTypeId(GetFilterUnit()) == 'n01E' )
endfunction

function Actions takes nothing returns nothing
    local location HTPOINT = GetUnitLoc(GetEnumUnit( ))
    local group HTGROUP = GetUnitsInRangeOfLocMatching(512, HTPOINT, Condition(function FuncTypeCond))
    local integer HTINT = CountUnitsInGroup( HTGROUP )
    call UnitRemoveAbility( GetEnumUnit( ), 'A026' )
    call UnitAddAbility( GetEnumUnit( ), 'A000' )
        call UnitAddAbility( GetEnumUnit( ), 'A025' )
    call SetUnitAbilityLevel( GetEnumUnit( ), 'A000', HTINT )
        call SetUnitAbilityLevel(  GetEnumUnit( ), 'A025', HTINT )
    set HTPOINT = null
    set HTGROUP = null
    call RemoveLocation(HTPOINT)
    call DestroyGroup(HTGROUP)
  if (HTINT == 0 ) then
    call UnitAddAbility( GetEnumUnit( ), 'A026' )
  endif
endfunction

function HoagTrainActions takes nothing returns nothing
    local group UGROUP = GetUnitsOfTypeIdAll('n01J')
    call ForGroup( UGROUP, function Actions )
    set UGROUP = null
    call DestroyGroup( UGROUP )
endfunction

//===========================================================================
function Init takes nothing returns nothing
    set gg_trg_Hoag_Train = CreateTrigger(  )
    call TriggerRegisterTimerEventPeriodic( gg_trg_Hoag_Train, 0.50 )
    call TriggerAddAction( gg_trg_Hoag_Train, function HoagTrainActions )
endfunction
 

Jedimindtrixxx

┻━┻ ︵ ¯\(ツ)/¯ ︵ ┻━┻
Reaction score
168
Trigger won't execute

well i tried to make a trigger execute when i hit ESC and tell me how much times my trigger ran to see if it was running but just not executing, or if it wasnt running at all, and when i hit ESC in-game nothing showed up.

can some1 please help me figure out why the text wont show

code:
JASS:
function FuncTypeCond takes nothing returns boolean
    return ( GetUnitTypeId(GetFilterUnit()) == 'n01E' )
endfunction

function Actions takes nothing returns nothing
    local location HTPOINT = GetUnitLoc(GetEnumUnit( ))
    local group HTGROUP = GetUnitsInRangeOfLocMatching(1000, HTPOINT, Condition(function FuncTypeCond))
    local integer HTINT = CountUnitsInGroup( HTGROUP )
    call UnitRemoveAbility( GetEnumUnit( ), 'A026' )
    call UnitAddAbility( GetEnumUnit( ), 'A000' )
        call UnitAddAbility( GetEnumUnit( ), 'A025' )
    call SetUnitAbilityLevel( GetEnumUnit( ), 'A000', HTINT )
        call SetUnitAbilityLevel(  GetEnumUnit( ), 'A025', HTINT )
    set HTPOINT = null
    set HTGROUP = null
    call RemoveLocation(HTPOINT)
    call DestroyGroup(HTGROUP)
  if (HTINT == 0 ) then
    call UnitAddAbility( GetEnumUnit( ), 'A026' )
  endif
endfunction

function HoagTrainActions takes nothing returns nothing
    local group UGROUP = GetUnitsOfTypeIdAll('n01J')
    call ForGroup( UGROUP, function Actions )
    set UGROUP = null
    call DestroyGroup( UGROUP )
endfunction

function ToExecute takes nothing returns nothing
call DisplayTextToForce(GetPlayersAll(), "Number of times it went off :" + I2S(GetTriggerExecCount(gg_trg_Hoag_Train) ) ) //supposed to display how much times my trigger ran
endfunction

//===========================================================================
function Init takes nothing returns nothing
    local trigger t = CreateTrigger( )
    call TriggerRegisterTimerEventPeriodic( gg_trg_Hoag_Train, 0.50 )
    call TriggerAddAction( gg_trg_Hoag_Train, function HoagTrainActions )
    
    set t = CreateTrigger( )
    call TriggerAddAction(t,function ToExecute)
    call TriggerRegisterPlayerEvent(t,Player(0),EVENT_PLAYER_END_CINEMATIC) //when i hit ESC it supposedly runs the trigger

 set t=null

endfunction


what its supposed to do is when i hit ESC for it to tell me how much times the trigger ran.
JASS seems so ez in the tuts but not-so-easy actually doing it :banghead:
 

Artificial

Without Intelligence
Reaction score
326

Jedimindtrixxx

┻━┻ ︵ ¯\(ツ)/¯ ︵ ┻━┻
Reaction score
168
edit: HAR HAR got it to work! mod can close if they wish
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top