- Joined
- May 16, 2012
- Messages
- 644
Hello Hive, can someone please help me find what is wrong with this piece of code. The pjass syntax checker tells me that a statement is outside a function but i've read the code 100 times already and i cant find anything wrong.
the errors

the I080 Trigger is beaing created somewhere else, btw.
please some light.
JASS:
scope LegendaryBladeFL initializer Init
globals
integer array FlamingBladeFLCounter
integer array FlamingBladeFLCheck
real array UnitLastDamageFL
endglobals
private struct BladeMissile extends xehomingmissile
private unit source
private unit target
private real damage
private integer type
static method create takes unit source, unit target, real damage, integer type, string fxpath, real x, real y, real z returns BladeMissile
local BladeMissile this = BladeMissile.allocate(x, y, z, target, BlzGetUnitZ(target) + 60.0)
set this.source = source
set this.target = target
set this.damage = damage
set this.type = type
set this.fxpath = fxpath
set this.scale = 1.0
call this.launch(1000.0, 0.05)
return this
endmethod
method onHit takes nothing returns nothing
if this.type == 0 then
call DamageOverTimeEx(this.source, this.target, this.damage, 2, ATTACK_TYPE_HERO, DAMAGE_TYPE_FIRE, "FireMissile.mdx", "chest")
elseif this.type == 1 then
call UnitDamageTarget(this.source, this.target, (this.damage / 3), true, false, ATTACK_TYPE_HERO, DAMAGE_TYPE_DIVINE, null)
call SetWidgetLife(this.source, GetWidgetLife(this.source) + damage)
call DestroyEffect(AddSpecialEffectTarget("HolyLight.mdx", this.source, "origin"))
endif
set this.source = null
set this.target = null
endmethod
endstruct
private function Orbit takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle(udg_HeroHash, GetHandleId(t), 1)
local real angle = LoadReal(udg_HeroHash, GetHandleId(t), 2)
local effect fire = LoadEffectHandle(udg_HeroHash, GetHandleId(u), 12)
local effect light = LoadEffectHandle(udg_HeroHash, GetHandleId(u), 13)
local real toX
local real toY
local real toZ
local real x
local real y
if UnitHasItemOfType(u, 'I080') > 0 then
set x = GetUnitX(u)
set y = GetUnitY(u)
set angle = (angle + 2.5*0.017453)
set toX = (x + 150*Cos(angle))
set toY = (y + 150*Sin(angle))
set toZ = BlzGetUnitZ(u) + 60
call BlzSetSpecialEffectPosition(fire, toX, toY, toZ)
set toX = (x + 150*Cos(angle + 180))
set toY = (y + 150*Sin(angle + 180))
call BlzSetSpecialEffectPosition(light, toX, toY, toZ)
call SaveReal(udg_HeroHash, GetHandleId(t), 2, angle)
else
set FlamingBladeFLCheck[GetUnitUserData(u)] = 0
call DestroyEffect(fire)
call DestroyEffect(light)
call RemoveSavedHandle(udg_HeroHash, GetHandleId(u), 12)
call RemoveSavedHandle(udg_HeroHash, GetHandleId(u), 13)
call FlushChildHashtable(udg_HeroHash, GetHandleId(t))
call PauseTimer(t)
call DestroyTimer(t)
endif
set t = null
set u = null
set fire = null
set light = null
endfunction
private function OnPickUp_Conditions takes nothing returns nothing
local item i = GetManipulatedItem()
local unit u = GetManipulatingUnit()
local timer t
local effect fire
local effect light
local real x
local real y
local real z
local real angle
if GetItemTypeId(i) == 'I080' then
set FlamingBladeFLCheck[GetUnitUserData(u)] = FlamingBladeFLCheck[GetUnitUserData(u)] + 1
if FlamingBladeFLCheck[GetUnitUserData(u)] == 1 then
set t = CreateTimer()
set x = GetUnitX(u)
set y = GetUnitY(u)
set z = BlzGetUnitZ(u) + 60
set angle = 0
set fire = AddSpecialEffect("FireOrb.mdx", x, y)
set light = AddSpecialEffect("LightOrb.mdx", x, y)
call BlzSetSpecialEffectPosition(fire, x, y, z)
call BlzSetSpecialEffectPosition(light, x, y, z)
call SaveUnitHandle(udg_HeroHash, GetHandleId(t), 1, u)
call SaveReal(udg_HeroHash, GetHandleId(t), 2, angle)
call SaveEffectHandle(udg_HeroHash, GetHandleId(u), 12, fire)
call SaveEffectHandle(udg_HeroHash, GetHandleId(u), 13, light)
call TimerStart(t, 0.05, true, function Orbit)
endif
endif
set i = null
set u = null
set t = null
set fire = null
set light = null
endfunction
private function Conditions takes nothing returns nothing
local unit attacker = GetEventDamageSource()
local unit attacked = BlzGetEventDamageTarget()
local real damage_heal
local real x
local real y
local real z
local effect fire
local effect light
local BladeMissile s
if (UnitHasItemOfType(attacker, 'I080') > 0 and IsUnitEnemy(attacked, GetOwningPlayer(attacker)) and BlzGetEventDamageType() == DAMAGE_TYPE_NORMAL and not IsUnitType(attacked, UNIT_TYPE_STRUCTURE)) then
set UnitLastDamageFL[GetUnitUserData(attacker)] = GetEventDamage()
set FlamingBladeFLCounter[GetUnitUserData(attacker)] = FlamingBladeFLCounter[GetUnitUserData(attacker)] + 1
if FlamingBladeFLCounter[GetUnitUserData(attacker)] == 3 then
set FlamingBladeFLCounter[GetUnitUserData(attacker)] = 0
set damage_heal = UnitLastDamageFL[GetUnitUserData(attacker)] * 3
set fire = LoadEffectHandle(udg_HeroHash, GetHandleId(attacker), 12)
set light = LoadEffectHandle(udg_HeroHash, GetHandleId(attacker), 13)
set x = BlzGetLocalSpecialEffectX(fire)
set y = BlzGetLocalSpecialEffectY(fire)
set z = BlzGetLocalSpecialEffectZ(fire)
set s = BladeMissile.create(attacker, attacked, damage_heal, 0, "Rain of Fire Vol. II Missile.mdx", x, y, z)
set x = BlzGetLocalSpecialEffectX(light)
set y = BlzGetLocalSpecialEffectY(light)
set z = BlzGetLocalSpecialEffectZ(light)
set s = BladeMissile.create(attacker, attacked, damage_heal, 1, "Shot II Yellow.mdx", x, y, z)
endif
endif
set fire = null
set light = null
set attacker = null
set attacked = null
endfunction
//===========================================================================
private function Init takes nothing returns nothing
set I080 = CreateTrigger()
call DisableTrigger(I080)
call TriggerRegisterAnyUnitEventBJ(I080, EVENT_PLAYER_UNIT_DAMAGED)
call TriggerAddCondition(I080, Condition(function Conditions))
call RegisterPlayerUnitEvent(EVENT_PLAYER_UNIT_PICKUP_ITEM, function OnPickUp_Conditions)
endfunction
endscope
the errors

the I080 Trigger is beaing created somewhere else, btw.
please some light.