Damage Target

warroom99

New Member
Reaction score
15
i am new at jass so this trigger is mostly composes of converted texts.

JASS:
function railgun_damage takes nothing returns nothing
<span style="color: Red">    call UnitDamageTargetBJ( u, GetEnumUnit(), I2R(( GetUnitAbilityLevelSwapped(&#039;A001&#039;, u ) * 250 )), ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNIVERSAL )</span>
endfunction

function Trig_RailGun_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == &#039;A001&#039; ) ) then
        return false
    endif
    return true
endfunction

function Trig_RailGun_Func005002003001001 takes nothing returns boolean
    return ( IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) == false )
endfunction

function Trig_RailGun_Func005002003001002 takes nothing returns boolean
    return ( IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit())) == true )
endfunction

function Trig_RailGun_Func005002003001 takes nothing returns boolean
    return GetBooleanAnd( Trig_RailGun_Func005002003001001(), Trig_RailGun_Func005002003001002() )
endfunction

function Trig_RailGun_Func005002003002 takes nothing returns boolean
    return ( IsUnitHiddenBJ(GetFilterUnit()) == false )
endfunction

function Trig_RailGun_Func005002003 takes nothing returns boolean
    return GetBooleanAnd( Trig_RailGun_Func005002003001(), Trig_RailGun_Func005002003002() )
endfunction

function Trig_RailGun_Func006Func003001003001001 takes nothing returns boolean
    return ( IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) == false )
endfunction

function Trig_RailGun_Func006Func003001003001002 takes nothing returns boolean
    return ( IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit())) == true )
endfunction

function Trig_RailGun_Func006Func003001003001 takes nothing returns boolean
    return GetBooleanAnd( Trig_RailGun_Func006Func003001003001001(), Trig_RailGun_Func006Func003001003001002() )
endfunction

function Trig_RailGun_Func006Func003001003002 takes nothing returns boolean
    return ( IsUnitInGroup(GetFilterUnit(), udg_RailGroup) == false )
endfunction

function Trig_RailGun_Func006Func003001003 takes nothing returns boolean
    return GetBooleanAnd( Trig_RailGun_Func006Func003001003001(), Trig_RailGun_Func006Func003001003002() )
endfunction

function Trig_RailGun_Func006Func003002 takes nothing returns nothing
    call GroupAddUnitSimple( GetEnumUnit(), udg_RailGroup )
endfunction

function Trig_RailGun_Actions takes nothing returns nothing
    local integer a = 1
    local unit u = GetTriggerUnit()
    local location p = GetUnitLoc(u)
    local location po = GetSpellTargetLoc()
    local real b = AngleBetweenPoints(p, po)
    set udg_RailGroup = GetUnitsInRangeOfLocMatching(100.00, p, Condition(function Trig_RailGun_Func005002003))
    loop
        exitwhen a &gt; 60
        set p = PolarProjectionBJ(p, 75.00, b)
        set bj_wantDestroyGroup = true
        call ForGroupBJ( GetUnitsInRangeOfLocMatching(150.00, p, Condition(function Trig_RailGun_Func006Func003001003)), function Trig_RailGun_Func006Func003002 )
        call AddSpecialEffectLocBJ( p, &quot;Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl&quot; )
        call DestroyEffectBJ( GetLastCreatedEffectBJ() )
        call AddSpecialEffectLocBJ( p, &quot;Abilities\\Spells\\Items\\TomeOfRetraining\\TomeOfRetrainingCaster.mdl&quot; )
        call DestroyEffectBJ( GetLastCreatedEffectBJ() )
        call AddSpecialEffectLocBJ( p, &quot;Abilities\\Spells\\Undead\\DarkRitual\\DarkRitualTarget.mdl&quot; )
        call DestroyEffectBJ( GetLastCreatedEffectBJ() )
        call AddSpecialEffectLocBJ( p, &quot;Abilities\\Spells\\Other\\Monsoon\\MonsoonBoltTarget.mdl&quot; )
        call DestroyEffectBJ( GetLastCreatedEffectBJ() )
        set a = a + 1
    endloop
    call ForGroupBJ( udg_RailGroup, function railgun_damage )
    call GroupClear( udg_RailGroup )
    call RemoveLocation(p)    
    call RemoveLocation(po)
endfunction

//===========================================================================
function InitTrig_RailGun takes nothing returns nothing
    set gg_trg_RailGun = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_RailGun, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_RailGun, Condition( function Trig_RailGun_Conditions ) )
    call TriggerAddAction( gg_trg_RailGun, function Trig_RailGun_Actions )
endfunction


the red texts is the one causing the problem
whats wrong with it?
 

AceLegend90

New Member
Reaction score
6
You forget that locals are only exclusive to the function they are in. In this case, your "u" variable does not exist since it has not actually been declared in that function. Add a "local unit u = GetTriggerUnit()" line at the top of that function.
 
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