- Joined
- Mar 10, 2009
- Messages
- 5,016
EDIT 3:
CASE CLOSED!/SOVED!
Spell working, full code reposted for future uses...
CASE CLOSED!/SOVED!
Spell working, full code reposted for future uses...
JASS:
//Spell Name: Circling Blast
//Made by: Mckill2009
scope CrisCross initializer cris
globals
private constant hashtable HASH = InitHashtable() //Dont touch!
private constant integer SPELL_ID = 'A002' //Based on Roar
private constant integer DUMMY_SPELL_ID = 'A000' //Based on Carrion Swarn
private constant integer DUMMY_ID = 'h001' //Model, Troll/witch doctor missle
private constant integer ORDER_ID = 852218
private constant integer DUMMY_QTY = 12 //sets how many waves created
private constant real ROTATION_DIST = 20 //recommended setting is 20
private constant real START_OFFSET = 600
private constant real CAST_SPEED = 0.1
private constant real TIMEOUT = 0.03125 //Recommended, dont touch!
private constant real PULL_SPEED = 5
private constant string SFX1 = "Abilities\\Spells\\Human\\Thunderclap\\ThunderClapCaster.mdl"
endglobals
private struct CC
unit caster
integer level
integer counter
real cast
real castgo
real x
real y
real offset
unit array dummy[DUMMY_QTY]
real array facing[DUMMY_QTY]
static method looper takes nothing returns nothing
local timer t = GetExpiredTimer()
local CC data = LoadInteger(HASH, GetHandleId(t), 1)
local integer i = 0
local real x1
local real y1
if data.offset > 0 then
set data.offset = data.offset - PULL_SPEED
loop
set i = i + 1
call SetUnitX(data.dummy[i], data.x+data.offset*Cos(data.facing[i]*bj_DEGTORAD))
call SetUnitY(data.dummy[i], data.y+data.offset*Sin(data.facing[i]*bj_DEGTORAD))
set data.facing[i] = data.facing[i] + ROTATION_DIST
exitwhen i==DUMMY_QTY
endloop
call SetUnitX(data.caster, data.x)
call SetUnitY(data.caster, data.y)
else
set data.cast = data.cast + TIMEOUT
if data.cast >= data.castgo then
set data.castgo = data.castgo + CAST_SPEED
set data.counter = data.counter + 1
set x1 = data.x+100*Cos(data.facing[data.counter]*bj_DEGTORAD)
set y1 = data.y+100*Sin(data.facing[data.counter]*bj_DEGTORAD)
call UnitAddAbility(data.dummy[data.counter], DUMMY_SPELL_ID)
call SetUnitAbilityLevel(data.dummy[data.counter], DUMMY_SPELL_ID, data.level)
call IssuePointOrderById(data.dummy[data.counter], ORDER_ID, x1, y1)
call UnitApplyTimedLife(data.dummy[data.counter], 'BTLF', 1.0)
call SetUnitX(data.caster, data.x)
call SetUnitY(data.caster, data.y)
call DestroyEffect(AddSpecialEffect(SFX1, GetUnitX(data.caster), GetUnitY(data.caster)))
if data.counter >= DUMMY_QTY then
set i = 0
loop
set i = i + 1
set data.dummy[i] = null
set data.facing[i] = 0
exitwhen i==DUMMY_QTY
endloop
call ShowUnit(data.caster, false)
call UnitAddAbility(data.caster, 'Aloc')
call ShowUnit(data.caster, true)
call data.destroy(data)
call FlushChildHashtable(HASH, GetHandleId(t))
call PauseTimer(t)
call DestroyTimer(t)
endif
endif
endif
set t = null
endmethod
static method create takes unit u returns CC
local CC data = CC.allocate()
local timer t = CreateTimer()
local integer i = 0
local real r = 0
set data.caster = u
set data.level = GetUnitAbilityLevel(u, SPELL_ID)
set data.x = GetUnitX(u)
set data.y = GetUnitY(u)
set data.offset = START_OFFSET
set data.counter = 0
set data.cast = 0
set data.castgo = 0
call UnitAddAbility(u, 'Aloc')
loop
set i = i + 1
set data.dummy[i] = CreateUnit(GetTriggerPlayer(), DUMMY_ID, 0, 0, 0)
set data.facing[i] = data.facing[i]+r
set r = r + ROTATION_DIST
//call BJDebugMsg(R2S(data.facing[i]))
exitwhen i==DUMMY_QTY
endloop
call SaveInteger(HASH, GetHandleId(t), 1, data)
call TimerStart(t, TIMEOUT, true, function CC.looper)
set t = null
return data
endmethod
endstruct
private function CrisCond takes nothing returns boolean
if GetSpellAbilityId()==SPELL_ID then
call CC.create(GetTriggerUnit())
endif
return false
endfunction
private function cris takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition(function CrisCond))
set t = null
endfunction
endscope
Last edited: