- Joined
- Oct 16, 2008
- Messages
- 10,454
This is a script for my spell Omniblast which I made in the map that I'm working on.. I just want to hear your comments or suggestions about it.. About the waits/TSA I need them there and I don't really need that much accuracy....
Here's the script
Here's the script
JASS:
function Trig_OmniBlast_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A00L' ) ) then
return false
endif
return true
endfunction
function check takes nothing returns boolean
return (GetOwningPlayer(GetFilterUnit()) != GetOwningPlayer(GetTriggerUnit()))
endfunction
function Trig_OmniBlast_Actions takes nothing returns nothing
local unit a = GetTriggerUnit()
local location b = GetUnitLoc(a)
local location c = GetSpellTargetLoc()
local integer d = GetUnitAbilityLevel(a, GetSpellAbilityId())
local integer e = 0
local real x
local real y
local real z = Atan2(GetLocationY(c) - GetLocationY(b), GetLocationX(c) - GetLocationX(b))
local player g = GetOwningPlayer(a)
local unit h
local group i = CreateGroup()
local group j = CreateGroup()
local location l
local effect m
local unit u
local unit v
loop
exitwhen e == 7
set x = GetLocationX(b) + (100*e) * Cos(z)
set y = GetLocationY(b) + (100*e) * Sin(z)
set h = CreateUnit(g, 'h004', x, y, 0.00)
set l = Location(x,y)
call GroupEnumUnitsInRangeOfLoc(i, l, 225, Condition(function check))
loop
set u = FirstOfGroup(i)
exitwhen u == null
set v = CreateUnit(g, 'h002', x, y, 0.00)
call UnitAddAbility(v, 'A00T')
call UnitApplyTimedLife(v,'BTLF', 1.00)
call IssueTargetOrder(v, "cripple", u)
call GroupRemoveUnit(i, u)
endloop
call UnitApplyTimedLife(h,'BTLF', 1.5 + I2R(e)*.1)
set e = e + 1
endloop
set e = 0
call TriggerSleepAction(.9)
loop
exitwhen e == 7
set x = GetLocationX(b) + (100*e) * Cos(z)
set y = GetLocationY(b) + (100*e) * Sin(z)
set m = AddSpecialEffect("Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl",x,y)
call DestroyEffect(m)
set l = Location(x,y)
call GroupEnumUnitsInRangeOfLoc(i, l, 225, Condition(function check))
loop
set u = FirstOfGroup(i)
exitwhen u == null
if IsUnitInGroup(u, j) == false then
call UnitDamageTarget(a, u, 125*(1 + I2R(d)), false, false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_FIRE, WEAPON_TYPE_WHOKNOWS)
call GroupAddUnit(j, u)
endif
call GroupRemoveUnit(i, u)
endloop
call RemoveLocation(l)
set e = e + 1
call TriggerSleepAction(.1)
endloop
call DestroyGroup(i)
call DestroyGroup(j)
call RemoveLocation(b)
call RemoveLocation(c)
set a = null
set b = null
set c = null
set h = null
set g = null
set l = null
set i = null
set m = null
set u = null
set j = null
set v = null
endfunction
//===========================================================================
function InitTrig_OmniBlast takes nothing returns nothing
set gg_trg_OmniBlast = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_OmniBlast, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_OmniBlast, Condition( function Trig_OmniBlast_Conditions ) )
call TriggerAddAction( gg_trg_OmniBlast, function Trig_OmniBlast_Actions )
endfunction
Last edited: