- Joined
- Oct 18, 2007
- Messages
- 930
Ok im making a spell where you shoot rockets into the air then they fall down another place. The coding is kinda messy right now but it is because i stopped in the middle of my coding trying to figure out the problem.
The problem is that the units wont decrease fly height for sum reason.
Any questions or you maybe have the solution, PLEASE POST thx
Here is the struct that the problem lies in
The problem is that the units wont decrease fly height for sum reason.
Any questions or you maybe have the solution, PLEASE POST thx
Here is the struct that the problem lies in
JASS:
private struct MissileDown
unit Missile
unit Caster
unit tmpUnit
group G
real MissileX
real MissileY
real EndX
real EndY
real Z
integer lvl
timer T
boolexpr G_Filter
player P
static method MoveMissile takes nothing returns nothing
local MissileDown m = GetTimerData(GetExpiredTimer())
if m.Z < Z_Minimum then
set tmpPlayer = GetOwningPlayer(m.Missile)
call GroupEnumUnitsInRange(m.G,m.EndX,m.EndY,Radius,m.G_Filter)
loop
set m.tmpUnit = FirstOfGroup(m.G)
exitwhen m.tmpUnit == null
call DestroyEffect(AddSpecialEffectTarget(Targ_Effect, m.tmpUnit, "chest"))
call UnitDamageTarget(m.Caster, m.tmpUnit, Damage(m.lvl),false,true,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
call GroupRemoveUnit(m.G, m.tmpUnit)
set m.tmpUnit = null
endloop
call DestroyEffect(AddSpecialEffect(End_Effect, m.EndX, m.EndY ))
call m.destroy()
else
set m.Z = m.Z - Z_Minus
call SetUnitFlyHeight(m.Missile,m.Z,10000000)
endif
endmethod
static method create takes player P, real StartX, real StartY, unit Caster, integer lvl, real Angle returns MissileDown
local MissileDown m = MissileDown.allocate()
set m.G = CreateGroup()
set m.lvl = lvl
set m.Caster = Caster
set m.EndX = StartX + GetRandomReal(0, 300) * Cos(Angle)
set m.EndY = StartY + GetRandomReal(0, 300) * Sin(Angle)
set m.Missile = CreateUnit(P,Type_Missile_Down,m.EndX,m.EndY,Angle)
call SetUnitPathing(m.Missile,false)
call SetUnitFlyHeight(m.Missile, 2000, 10000000)
set m.G_Filter = Condition(function Filter)
set m.Z = 2000
set m.T = NewTimer()
call SetTimerData(m.T,m)
call TimerStart(m.T,0.015,true,function MissileDown.MoveMissile)
return m
endmethod
method onDestroy takes nothing returns nothing
call ReleaseTimer(.T)
call DestroyGroup(.G)
call RemoveUnit(.Missile)
set .Caster = null
set .Missile = null
set .T = null
endmethod
endstruct
Attachments
Last edited: