- Joined
- Mar 16, 2008
- Messages
- 941
This version is pulsing around the position of the caster and doesn't follows him (for sure it doesnt', but it pulses)
THIS version neither pulses nor follows the caster, why?
Hope you can help me
Greets, Justify
JASS:
scope FrostnovaScope
public struct FrostnovaData
unit caster = GetTriggerUnit()
unit array missle [36]
group enemys = CreateGroup()
real maxdist = 500
real mindist = 100
real damage
real move = 400.0*0.035
real cx
real cy
real array x [36]
real array y [36]
real array dist [36]
real array cos [36]
real array sin [36]
integer out = 0
endstruct
globals
timer FrostnovaTimer = CreateTimer()
FrostnovaData array Frostnova
integer FrostnovaMax = 0
private integer tempint = 0
endglobals
function Frostnova_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A00Z'
endfunction
function Frostnova_Enemys takes nothing returns boolean
local FrostnovaData data = Frostnova[tempint]
return IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(data.caster)) and not IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) and GetWidgetLife(GetFilterUnit()) > 0.405
endfunction
function Frostnova_Movement takes nothing returns nothing
local FrostnovaData data
local unit enemy
local group enemys
local player owner
local real x
local real y
local integer i = 0
local integer j = 0
loop
exitwhen i >= FrostnovaMax
set data = Frostnova[i]
loop
exitwhen j >= 36
if (data.dist[j] <= data.maxdist and data.out == 0) then
set data.dist[j] = data.dist[j]+data.move
set data.x[j] = data.x[j]+data.move*data.cos[j]
set data.y[j] = data.y[j]+data.move*data.sin[j]
call SetUnitPosition(data.missle[j], data.x[j], data.y[j])
set enemys = CreateGroup()
set tempint = i
call GroupEnumUnitsInRange(enemys, data.x[j], data.y[j], 50, Condition(function Frostnova_Enemys))
loop
set enemy = FirstOfGroup(enemys)
exitwhen enemy == null
call IssueImmediateOrder(enemy, "stop")
call SetUnitPosition(enemy, GetUnitX(enemy)+data.move*data.cos[j], GetUnitY(enemy)+data.move*data.sin[j])
if(not IsUnitInGroup(enemy, data.enemys)) then
call UnitDamageTarget(data.caster, enemy, data.damage, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_COLD, WEAPON_TYPE_WHOKNOWS)
call GroupAddUnit(data.enemys, enemy)
endif
call GroupRemoveUnit(enemys, enemy)
endloop
elseif (data.dist[j] >= data.mindist) then
set data.dist[j] = data.dist[j]-data.move
set data.x[j] = data.x[j]-data.move*data.cos[j]
set data.y[j] = data.y[j]-data.move*data.sin[j]
call SetUnitPosition(data.missle[j], data.x[j], data.y[j])
set data.out = 1
else
set data.out = 0
loop
set enemy = FirstOfGroup(data.enemys)
exitwhen enemy == null
call GroupRemoveUnit(enemys, enemy)
endloop
endif
set j = j+1
endloop
set j = 0
set i = i+1
endloop
endfunction
function Frostnova_Actions takes nothing returns nothing
local FrostnovaData data = FrostnovaData.create()
local player owner
local real x
local real y
local real angle = 0
local integer loopindex = 0
set owner = GetOwningPlayer(data.caster)
set data.damage = GetUnitAbilityLevel(data.caster, 'A00Z')*75
set x = GetUnitX(data.caster)
set y = GetUnitY(data.caster)
loop
exitwhen loopindex >= 36
set data.cos[loopindex] = Cos(angle*bj_DEGTORAD)
set data.sin[loopindex] = Sin(angle*bj_DEGTORAD)
set data.x[loopindex] = x+data.mindist*data.cos[loopindex]
set data.y[loopindex] = y+data.mindist*data.sin[loopindex]
set data.missle[loopindex] = CreateUnit(owner, 'n01D', data.x[loopindex], data.y[loopindex], 0)
set data.dist[loopindex] = 0
set loopindex = loopindex+1
set angle = angle+10
endloop
set Frostnova[FrostnovaMax] = data
set FrostnovaMax = FrostnovaMax+1
if (FrostnovaMax == 1) then
call TimerStart(FrostnovaTimer, 0.035, true, function Frostnova_Movement)
endif
endfunction
//===========================================================================
function InitTrig_Frostnova takes nothing returns nothing
set gg_trg_Frostnova = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Frostnova, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Frostnova, Condition( function Frostnova_Conditions ) )
call TriggerAddAction( gg_trg_Frostnova, function Frostnova_Actions )
endfunction
endscope
THIS version neither pulses nor follows the caster, why?
JASS:
scope FrostnovaScope
public struct FrostnovaData
unit caster = GetTriggerUnit()
unit array missle [36]
group enemys = CreateGroup()
real maxdist = 500
real mindist = 100
real damage
real move = 400.0*0.035
real cx
real cy
real array x [36]
real array y [36]
real array dist [36]
real array cos [36]
real array sin [36]
integer out = 0
endstruct
globals
timer FrostnovaTimer = CreateTimer()
FrostnovaData array Frostnova
integer FrostnovaMax = 0
private integer tempint = 0
endglobals
function Frostnova_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A00Z'
endfunction
function Frostnova_Enemys takes nothing returns boolean
local FrostnovaData data = Frostnova[tempint]
return IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(data.caster)) and not IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) and GetWidgetLife(GetFilterUnit()) > 0.405
endfunction
function Frostnova_Movement takes nothing returns nothing
local FrostnovaData data
local unit enemy
local group enemys
local player owner
local real x
local real y
local integer i = 0
local integer j = 0
set data.cx = GetUnitX(data.caster) //new
set data.cy = GetUnitY(data.caster) //new
loop
exitwhen i >= FrostnovaMax
set data = Frostnova[i]
loop
exitwhen j >= 36
if (data.dist[j] <= data.maxdist and data.out == 0) then
set data.dist[j] = data.dist[j]+data.move
set data.x[j] = data.cx+data.dist[j]*data.cos[j] //changed
set data.y[j] = data.cy+data.dist[j]*data.sin[j] //changed
call SetUnitPosition(data.missle[j], data.x[j], data.y[j]) //changed
set enemys = CreateGroup()
set tempint = i
call GroupEnumUnitsInRange(enemys, data.x[j], data.y[j], 50, Condition(function Frostnova_Enemys))
loop
set enemy = FirstOfGroup(enemys)
exitwhen enemy == null
call IssueImmediateOrder(enemy, "stop")
call SetUnitPosition(enemy, GetUnitX(enemy)+data.move*data.cos[j], GetUnitY(enemy)+data.move*data.sin[j])
if(not IsUnitInGroup(enemy, data.enemys)) then
call UnitDamageTarget(data.caster, enemy, data.damage, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_COLD, WEAPON_TYPE_WHOKNOWS)
call GroupAddUnit(data.enemys, enemy)
endif
call GroupRemoveUnit(enemys, enemy)
endloop
elseif (data.dist[j] >= data.mindist) then
set data.dist[j] = data.dist[j]-data.move
set data.x[j] = data.x[j]-data.move*data.cos[j]
set data.y[j] = data.y[j]-data.move*data.sin[j]
call SetUnitPosition(data.missle[j], data.x[j], data.y[j])
set data.out = 1
else
set data.out = 0
loop
set enemy = FirstOfGroup(data.enemys)
exitwhen enemy == null
call GroupRemoveUnit(enemys, enemy)
endloop
endif
set j = j+1
endloop
set j = 0
set i = i+1
endloop
endfunction
function Frostnova_Actions takes nothing returns nothing
local FrostnovaData data = FrostnovaData.create()
local player owner
local real x
local real y
local real angle = 0
local integer loopindex = 0
set owner = GetOwningPlayer(data.caster)
set data.damage = GetUnitAbilityLevel(data.caster, 'A00Z')*75
set x = GetUnitX(data.caster)
set y = GetUnitY(data.caster)
loop
exitwhen loopindex >= 36
set data.cos[loopindex] = Cos(angle*bj_DEGTORAD)
set data.sin[loopindex] = Sin(angle*bj_DEGTORAD)
set data.x[loopindex] = x+data.mindist*data.cos[loopindex]
set data.y[loopindex] = y+data.mindist*data.sin[loopindex]
set data.missle[loopindex] = CreateUnit(owner, 'n01D', data.x[loopindex], data.y[loopindex], 0)
set data.dist[loopindex] = 0
set loopindex = loopindex+1
set angle = angle+10
endloop
set Frostnova[FrostnovaMax] = data
set FrostnovaMax = FrostnovaMax+1
if (FrostnovaMax == 1) then
call TimerStart(FrostnovaTimer, 0.035, true, function Frostnova_Movement)
endif
endfunction
//===========================================================================
function InitTrig_Frostnova takes nothing returns nothing
set gg_trg_Frostnova = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Frostnova, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Frostnova, Condition( function Frostnova_Conditions ) )
call TriggerAddAction( gg_trg_Frostnova, function Frostnova_Actions )
endfunction
endscope
Hope you can help me
Greets, Justify
Last edited: