Jass Spell Issue

Status
Not open for further replies.
Level 8
Joined
Feb 17, 2007
Messages
368
Can someone fix the issue in this part of this Jass spell? Whenever I save my map I get the error: "Line 39623: Identifier redeclared X. And it has this line highlighted: local real x = GetLocationX(l2)"

JASS:
function Chidori_Condition takes nothing returns boolean
    return GetUnitAbilityLevel(GetAttacker(), 'B01J') > 0
endfunction


function ChidoriLoop takes nothing returns nothing
    local timer t           = GetExpiredTimer ()
    local unit u1           = LoadUnitHandle(udg_t2,GetHandleId(t),1)
    local unit u2           = LoadUnitHandle(udg_t2,GetHandleId(t),2)
    local real x            = LoadReal(udg_t2,GetHandleId(t),3)
    local real y            = LoadReal(udg_t2,GetHandleId(t),4)
    local string Effect1    = LoadStringBJ(6, GetHandleId(t), udg_t2)
    local string Effect2    = LoadStringBJ(10, GetHandleId(t), udg_t2)
    local real MaxDistance  = LoadReal(udg_t2,GetHandleId(t),7)
    local integer distance  = LoadInteger(udg_t2,GetHandleId(t),5)
    local integer Speed     = LoadInteger(udg_t2,GetHandleId(t),8)
    local real Angle        = LoadReal(udg_t2,GetHandleId(t),9)
    local location l        = GetUnitLoc(u2)
    local location l2       = PolarProjectionBJ(l, Speed, Angle)

    local real x            = GetLocationX(l2)
    local real y            = GetLocationY(l2) 

    call SetUnitPosition(u2,x,y)
    call DestroyEffect(AddSpecialEffect(Effect1,x,y))
    call DestroyEffect(AddSpecialEffect(Effect2,x,y))
    call RemoveLocation(l)
    call RemoveLocation(l2)

    if distance >= MaxDistance then

        call FlushChildHashtable(udg_t2,GetHandleId(t))
        set t = null
        set u1 = null
        set u2 = null
        call DestroyTimer(GetExpiredTimer())

    else
    call SaveInteger(udg_t2,GetHandleId(t),5,distance+Speed)
    set t = null
    set u1 = null
    set u2 = null

    endif
endfunction

function Chidori_Actions takes nothing returns nothing
//Don't touch it
    local timer t               = CreateTimer ()
    local unit u1               = GetAttacker()
    local unit u2               = GetTriggerUnit()
    local integer distance      = 0
//Set it as you wish
    local real DamagePerLvl     = 75.00
    local real MaxDistance      = 400.00
    local real Intervival       = 0.03
    local integer SpellID       = 'A04I'
    local integer BuffID        = 'B01J'
    local integer Speed         = 7
    local string Effect1        = "Abilities\\Weapons\\AncientProtectorMissile\\AncientProtectorMissile.mdl"
    local string Effect2        = "Abilities\\Weapons\\Bolt\\BoltImpact.mdl"
    local string Animation      = "Spell Two"
    local attacktype AttackType = ATTACK_TYPE_MAGIC
    local damagetype DamageType = DAMAGE_TYPE_LIGHTNING
//Don't touch it
    local real damage           = DamagePerLvl *  I2R(GetUnitAbilityLevel(u1,SpellID))
    local real x                = GetUnitX(u2)
    local real y                = GetUnitY(u2)
    local location l3           = GetUnitLoc(u1)
    local location l4           = GetUnitLoc(u2)
    local real Angle            = AngleBetweenPoints(l3, l4)
    local real DeafultMoveSpeed = GetUnitDefaultMoveSpeed(u1)
    
    call SetUnitMoveSpeed(u1, DeafultMoveSpeed)
    call SetUnitAnimation(u1, Animation)
    call UnitRemoveAbility(u1,BuffID)
    call UnitDamageTarget(u1,u2,damage,true,false,AttackType,DamageType,WEAPON_TYPE_WHOKNOWS)
    call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl",x,y))
    call SetUnitMoveSpeed( u1, GetUnitDefaultMoveSpeed(u1) )

    call SaveUnitHandle(udg_t2,GetHandleId(t),1,u1)
    call SaveUnitHandle(udg_t2,GetHandleId(t),2,u2)
    call SaveReal(udg_t2,GetHandleId(t),3,x)
    call SaveReal(udg_t2,GetHandleId(t),4,y)
    call SaveInteger(udg_t2,GetHandleId(t),5,distance)
    call SaveStringBJ(Effect1, 6, GetHandleId(t), udg_t2)
    call SaveReal(udg_t2,GetHandleId(t),7,MaxDistance)
    call SaveInteger(udg_t2,GetHandleId(t),8,Speed)
    call SaveReal(udg_t2,GetHandleId(t),9,Angle)
    call SaveStringBJ(Effect2, 10, GetHandleId(t), udg_t2)

    call TimerStart(t,Intervival,true,function ChidoriLoop)

    call RemoveLocation(l3)
    call RemoveLocation(l4)
    
    set t   = null
    set u1  = null
    set u2  = null
endfunction

//===========================================================================
function InitTrig_Chidori_Hit takes nothing returns nothing
    local trigger hit = CreateTrigger( )
    call TriggerRegisterAnyUnitEventBJ( hit, EVENT_PLAYER_UNIT_ATTACKED )
    call TriggerAddCondition( hit, Condition( function Chidori_Condition ) )
    call TriggerAddAction( hit, function Chidori_Actions  )
    set hit = null
endfunction
 
Status
Not open for further replies.
Top