PurgeandFire
zxcvmkgdfg
- Reaction score
- 509
Ok... I know the code sucks right now but I'll fix it. I'm not a perfectionist atm I just want to get it to work. Anyone have any idea why it doesn't display "Woohoo!" in the "Revolve" function?
Thank ya if you can help.
It revolves, it just doesn't... you know... Display "woohoo".
JASS:
scope FireSpawn
globals
private constant integer r = 039;A000039;
private constant integer dr = 039;n001039;
private integer angle = 0
private integer times = 0
private constant string sfx = "Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile.mdl"
private unit Caster
endglobals
struct Fire
unit u
unit d
unit F
real x
real y
real dx
real dy
static method Filt takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(Caster)) and not IsUnitDeadBJ(GetFilterUnit())
endmethod
endstruct
//! runtextmacro HSAS_Static("Fire","")
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == r
endfunction
private function Blast takes nothing returns nothing
local timer t = GetExpiredTimer()
local Fire f = GetAttachedStructFire(t)
local real ang = bj_RADTODEG*Atan2(GetUnitY(f.F)-f.dy,GetUnitX(f.F)-f.dx)
local real X = GetUnitX(f.F)-f.dx
local real Y = GetUnitY(f.F)-f.dy
local real dist = SquareRoot(X*X+Y*Y)
call DestroyEffect(AddSpecialEffect(sfx,f.dx,f.dy))
set f.dx = f.dx+10*Cos(ang*bj_DEGTORAD)
set f.dy = f.dy+10*Sin(ang*bj_DEGTORAD)
call SetUnitPosition(f.d,f.dx,f.dy)
if dist<10 then
call PauseTimer(t)
call DestroyTimer(t)
call UnitDamageTarget(f.d,f.F,((GetUnitAbilityLevel(f.u,r)*25)+25),true,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
endif
endfunction
private function Revolve takes nothing returns nothing
local timer t = GetExpiredTimer()
local group g = CreateGroup()
local Fire f = GetAttachedStructFire(t)
local integer ang = angle
local real dist
set angle = angle + 10
set ang = angle
if angle == 360 then
set angle = 0
endif
set f.x = GetUnitX(f.u)
set f.y = GetUnitY(f.u)
set f.dx = f.x + 150 * Cos(angle*bj_DEGTORAD)
set f.dy = f.y + 150 * Sin(angle*bj_DEGTORAD)
call SetUnitPosition(f.d,f.dx,f.dy)
call GroupEnumUnitsInRange(g,f.dx,f.dy,500.,Condition(function Fire.Filt))
if FirstOfGroup(g) != null then
set f.F = FirstOfGroup(g)
call PauseTimer(t)
call AttachStructFire(t,f)
//
//
//=============================
call BJDebugMsg("Woohoo!")
//It doesn't display Woohoo!
//
//
call TimerStart(t,0.1,true,function Blast)
endif
call DestroyGroup(g)
set g = null
set t = null
endfunction
private function FireSpawn takes nothing returns nothing
local Fire f = Fire.create()
local timer t = CreateTimer()
set f.u = GetTriggerUnit()
set f.x = GetUnitX(f.u)
set f.y = GetUnitY(f.u)
set f.d = CreateUnit(GetOwningPlayer(f.u),dr,GetUnitX(f.u),GetUnitY(f.u),270)
set Caster = GetTriggerUnit()
call AttachStructFire(t,f)
call TimerStart(t,0.05,true,function Revolve)
endfunction
//===========================================================================
function InitTrig_FireSpawn takes nothing returns nothing
local trigger t = CreateTrigger()
local integer i = 0
loop
call TriggerRegisterPlayerUnitEvent(t,Player(i),EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
set i = i + 1
exitwhen i == bj_MAX_PLAYER_SLOTS
endloop
call TriggerAddCondition(t,Condition(function Conditions))
call TriggerAddAction(t, function FireSpawn )
set t = null
endfunction
endscope
Thank ya if you can help.
It revolves, it just doesn't... you know... Display "woohoo".