- Joined
- Mar 3, 2006
- Messages
- 1,564
Is this a good script for making a spell like lightning shield
I know there must be a struct and all that vJASS stuff but I am talking about the formula and functions in this spell are they correct for such spell ?
JASS:
library FireShield initializer Init
globals
constant real t = 0.001
constant integer charges = 3
constant real r = 128
constant real dA = 0.5
constant real Shift = 360 / charges
unit array u
unit caster
location centre
timer RotSpd = CreateTimer()
real A
endglobals
function Move takes nothing returns nothing
local integer i = 0
local real tempA = 0
set tempA = A
loop
exitwhen i == charges
call SetUnitPositionLoc( u[i] , PolarProjectionBJ( GetUnitLoc(caster) , r , tempA))
set i = i + 1
set tempA = tempA + Shift
endloop
set A = A + dA
if A >= 360 then
set A = 0
endif
endfunction
function Create takes nothing returns nothing
local integer i = 0
local real tempA = 0
call DisplayTextToPlayer(Player(0) , 0 , 0 , "WORKS")
set centre = Location( 0 , 0 )
set caster = CreateUnitAtLoc(Player(0) , 'Hblm' , centre , 0)
set A = 0
loop
exitwhen i == charges
set u[i] = CreateUnitAtLoc( Player(0) , 'e000' , PolarProjectionBJ(GetUnitLoc(caster) , r , tempA) , 0)
set tempA = tempA + Shift
set i = i + 1
endloop
call TimerStart(RotSpd , t , true , function Move)
endfunction
function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerEvent( t , Player(0) , EVENT_PLAYER_END_CINEMATIC )
call TriggerAddAction(t , function Create)
endfunction
endlibrary
I know there must be a struct and all that vJASS stuff but I am talking about the formula and functions in this spell are they correct for such spell ?