- Joined
- Nov 10, 2006
- Messages
- 181
Right now , I am trying to create a spell that expands outwards from the caster to the caster, for some reason I don't want to use Polarprojection BJ so I decided to do this.
Yet it does not work , any ideas or clues to help me ?
Yet it does not work , any ideas or clues to help me ?
JASS:
scope Fire initializer Init
globals
private constant integer SPELL = 'A002'
private constant string EFFECT = "Abilities\\Spells\\Human\\FlameStrike\\FlameStrike1.mdl"
endglobals
private struct data
location CasterLoc
unit caster
real distance
real angle
real x
real y
static method create takes nothing returns data
local data d = data.allocate()
set d.caster = GetTriggerUnit()
set d.x = GetUnitX(d.caster)
set d.y = GetUnitY(d.caster)
set d.distance = 350
set d.angle = 30
return d
endmethod
endstruct
//..function PolarProjectionBJ takes location source, real dist, real angle returns location
// local real x = GetLocationX(source) + dist * Cos(angle * bj_DEGTORAD)
// local real y = GetLocationY(source) + dist * Sin(angle * bj_DEGTORAD)
// return Location(x, y)
//endfunction
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == SPELL
endfunction
private function Actions takes nothing returns nothing
local data d = data.create()
local integer i = 0
local real x
local real y
loop
exitwhen i > 12
set d.x = d.x + d.distance * Cos(d.angle * i )
set d.y = d.y + d.distance * Sin(d.angle * i )
call DestroyEffect(AddSpecialEffect(EFFECT,d.x,d.y))
set i = i + 1
endloop
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local trigger t= CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(t,Condition(function Conditions))
call TriggerAddAction( t, function Actions )
endfunction
endscope