- Joined
- Dec 13, 2008
- Messages
- 222
This is my new spell. It leaks like hell. Can someone help me. (it mustbe done in JASS not vJASS)
It creates 3 orbs which spin around caster and damage units when they come into collision with them. Then, orb destroys itself, deals damage and heals caster.
Pls, help... :S
It creates 3 orbs which spin around caster and damage units when they come into collision with them. Then, orb destroys itself, deals damage and heals caster.
Pls, help... :S
JASS:
function Trig_Jiriki_2_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A03D'
endfunction
function OrbDamage takes unit orb1, unit orb2, unit orb3, integer level, unit u returns nothing
local location p
local unit target
local group g
set p = GetUnitLoc (orb1)
set g = GetUnitsInRangeOfLocAll(75.00, p)
if orb1 != null then
loop
set target = FirstOfGroup(g)
exitwhen target == null
call GroupRemoveUnit(g,target)
if (IsPlayerEnemy(GetOwningPlayer(orb1), GetOwningPlayer(target)) and (not(IsUnitType(target, UNIT_TYPE_STRUCTURE))) and (IsUnitAliveBJ (target))) then
call CreateNUnitsAtLoc( 1, 'h00L', GetOwningPlayer(orb1), p, 0.00 )
call UnitAddAbilityBJ( 'A01W', GetLastCreatedUnit() )
call SetUnitAbilityLevelSwapped( 'A01W', GetLastCreatedUnit(), 25 + 25*level - 1 )
call IssueTargetOrderBJ( GetLastCreatedUnit(), "attackonce", target )
call AddSpecialEffectLoc ("Abilities\\Spells\\Undead\\DeathCoil\\DeathCoilSpecialArt.mdl", p)
call DestroyEffect( GetLastCreatedEffectBJ() )
call UnitApplyTimedLifeBJ( 1.00, 'BTLF', GetLastCreatedUnit() )
call KillUnit( orb1 )
call GroupClear( g )
call SetUnitState( u, UNIT_STATE_LIFE, GetUnitState(u, UNIT_STATE_LIFE) + 25 + 25*level )
endif
endloop
endif
set p = GetUnitLoc (orb2)
set g = GetUnitsInRangeOfLocAll(75.00, p)
if orb2 != null then
loop
set target = FirstOfGroup(g)
exitwhen target == null
call GroupRemoveUnit(g,target)
if (IsPlayerEnemy(GetOwningPlayer(orb2), GetOwningPlayer(target)) and (not(IsUnitType(target, UNIT_TYPE_STRUCTURE))) and (IsUnitAliveBJ (target))) then
call CreateNUnitsAtLoc( 1, 'h00L', GetOwningPlayer(orb2), p, 0.00 )
call UnitAddAbilityBJ( 'A01W', GetLastCreatedUnit() )
call SetUnitAbilityLevelSwapped( 'A01W', GetLastCreatedUnit(), 25 + 25*level - 1 )
call IssueTargetOrderBJ( GetLastCreatedUnit(), "attackonce", target )
call AddSpecialEffectLoc ("Abilities\\Spells\\Undead\\DeathCoil\\DeathCoilSpecialArt.mdl", p)
call DestroyEffect( GetLastCreatedEffectBJ() )
call UnitApplyTimedLifeBJ( 1.00, 'BTLF', GetLastCreatedUnit() )
call KillUnit( orb2 )
call GroupClear( g )
call SetUnitState( u, UNIT_STATE_LIFE, GetUnitState(u, UNIT_STATE_LIFE) + 25 + 25*level )
endif
endloop
endif
set p = GetUnitLoc (orb3)
set g = GetUnitsInRangeOfLocAll(75.00, p)
if orb3 != null then
loop
set target = FirstOfGroup(g)
exitwhen target == null
call GroupRemoveUnit(g,target)
if (IsPlayerEnemy(GetOwningPlayer(orb3), GetOwningPlayer(target)) and (not(IsUnitType(target, UNIT_TYPE_STRUCTURE))) and (IsUnitAliveBJ (target))) then
call CreateNUnitsAtLoc( 1, 'h00L', GetOwningPlayer(orb3), p, 0.00 )
call UnitAddAbilityBJ( 'A01W', GetLastCreatedUnit() )
call SetUnitAbilityLevelSwapped( 'A01W', GetLastCreatedUnit(), 25 + 25*level - 1 )
call IssueTargetOrderBJ( GetLastCreatedUnit(), "attackonce", target )
call AddSpecialEffectLoc ("Abilities\\Spells\\Undead\\DeathCoil\\DeathCoilSpecialArt.mdl", p)
call DestroyEffect( GetLastCreatedEffectBJ() )
call UnitApplyTimedLifeBJ( 1.00, 'BTLF', GetLastCreatedUnit() )
call KillUnit( orb3 )
call GroupClear( g )
call SetUnitState( u, UNIT_STATE_LIFE, GetUnitState(u, UNIT_STATE_LIFE) + 25 + 25*level )
endif
endloop
endif
call RemoveLocation(p)
set target = null
set orb1 = null
set orb2 = null
set orb3 = null
call DestroyGroup(g)
endfunction
function OrbCircle takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = GetHandleUnit(t, "u")
local integer level = GetHandleInt(t, "level")
local unit orb1 = GetHandleUnit(t, "orb1")
local unit orb2 = GetHandleUnit(t, "orb2")
local unit orb3 = GetHandleUnit(t, "orb3")
local location p
local real ang1 = GetHandleReal (t, "ang1")
local real ang2 = GetHandleReal (t, "ang2")
local real ang3 = GetHandleReal (t, "ang3")
local location loc1
local location loc2
local location loc3
local integer steps = GetHandleInt(t, "steps")
set p = GetUnitLoc(u)
set ang1 = ang1 + 10.00
if ang1 == 360.00 then
set ang1 = 0
endif
call SetHandleReal(t, "ang1", ang1)
set loc1 = PolarProjectionBJ(p, 100.00, ang1)
set p = GetUnitLoc(u)
set ang2 = ang2 + 10.00
if ang2 == 360.00 then
set ang2 = 0
endif
call SetHandleReal(t, "ang2", ang2)
set loc2 = PolarProjectionBJ(p, 100.00, ang2)
set p = GetUnitLoc(u)
set ang3 = ang3 + 10.00
if ang3 == 360.00 then
set ang3 = 0
endif
call SetHandleReal(t, "ang3", ang3)
set loc3 = PolarProjectionBJ(p, 100.00, ang3)
if orb1 != null then
call SetUnitPositionLoc( orb1, loc1)
endif
if orb2 != null then
call SetUnitPositionLoc( orb2, loc2)
endif
if orb3 != null then
call SetUnitPositionLoc( orb3, loc3)
endif
call OrbDamage(orb1, orb2, orb3, level, u)
call RemoveLocation(p)
call RemoveLocation(loc1)
call RemoveLocation(loc2)
call RemoveLocation(loc3)
set steps = steps - 1
if (steps == 0 or (orb1==null and orb2==null and orb3==null)) then
call RemoveUnit( orb1 )
call RemoveUnit( orb2 )
call RemoveUnit( orb3 )
set orb1 = null
set orb2 = null
set orb3 = null
call FlushHandleLocals(t)
call DestroyTimer(t)
endif
set orb1 = null
set orb2 = null
set orb3 = null
endfunction
function CreateOrbs takes unit u, integer level, real duration returns nothing
local unit orb1
local unit orb2
local unit orb3
local location p = GetUnitLoc(u)
local real ang1 = 120.00
local real ang2 = 240.00
local real ang3 = 360.00
local location loc1 = PolarProjectionBJ(p, 100.00, ang1)
local location loc2 = PolarProjectionBJ(p, 100.00, ang2)
local location loc3 = PolarProjectionBJ(p, 100.00, ang3)
local timer t = CreateTimer()
local integer steps = 375
call CreateNUnitsAtLoc( 1, 'h01M', GetOwningPlayer(u), loc1, 0.00 )
call UnitApplyTimedLifeBJ( 15.00, 'BTLF', GetLastCreatedUnit() )
set orb1 = GetLastCreatedUnit()
call CreateNUnitsAtLoc( 1, 'h01M', GetOwningPlayer(u), loc2, 0.00 )
call UnitApplyTimedLifeBJ( 15.00, 'BTLF', GetLastCreatedUnit() )
set orb2 = GetLastCreatedUnit()
call CreateNUnitsAtLoc( 1, 'h01M', GetOwningPlayer(u), loc3, 0.00 )
call UnitApplyTimedLifeBJ( 15.00, 'BTLF', GetLastCreatedUnit() )
set orb3 = GetLastCreatedUnit()
call SetHandleHandle (t,"orb1",orb1)
call SetHandleHandle (t,"orb2",orb2)
call SetHandleHandle (t,"orb3",orb3)
call SetHandleHandle (t,"u", u)
call SetHandleReal(t, "ang1", ang1)
call SetHandleReal(t, "ang2", ang2)
call SetHandleReal(t, "ang3", ang3)
call SetHandleInt(t, "level", level)
call SetHandleInt(t, "steps", steps)
call TimerStart(t, 0.04, true, function OrbCircle)
call RemoveLocation(p)
call RemoveLocation(loc1)
call RemoveLocation(loc2)
call RemoveLocation(loc3)
set orb1 = null
set orb2 = null
set orb3 = null
endfunction
function Trig_Jiriki_2_Actions takes nothing returns nothing
local unit u = GetSpellAbilityUnit()
local integer level = GetUnitAbilityLevelSwapped('A03D', u)
local real duration = 15.00
call CreateOrbs(u, level, duration)
set u = null
endfunction
//===========================================================================
function InitTrig_Jiriki_2 takes nothing returns nothing
set gg_trg_Jiriki_2 = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Jiriki_2, EVENT_PLAYER_UNIT_SPELL_FINISH )
call TriggerAddCondition( gg_trg_Jiriki_2, Condition( function Trig_Jiriki_2_Conditions ) )
call TriggerAddAction( gg_trg_Jiriki_2, function Trig_Jiriki_2_Actions )
endfunction