Doom-Angel
Jass User (Just started using NewGen)
- Reaction score
- 167
im too busy in school exams and i don't think i will have enough time to do my spell till then (i had a nice idea...)
Im considering adding a third option to it; if no units are hit. But that won't fit in the tooltip . Wadda i do?
I have a question, can i use a SimError function ? Because i want to detect a minimun range and display an error >.<
scope IceBurst
//Made by: Überplayer
//Credits: Cohadar - for ABC
// INSTRUCTIONS (How to use?)
//
// 1. Copy the "Ice Burst" spell from the Object Editor.
// 2. Copy the "[Dummy Freeze] - Ice Burst" spell from the Object Editor.
// 3. Copy the "[Dummy Caster] - Ice Burst" unit from the Object Editor.
// 4. Copy the "[Dummy "Solid Ice"] - Ice Burst" unit from the Object Editor.
// 5. If you don't already have ABC v5.1 in your map, then copy the "ABC" trigger.
// 6. If you don't already have a Knockback System in your map, then copy the
// "Knockback System" trigger. The version in this map doesn't use BorderSafety.
// You can get the correct version from: "http://www.thehelper.net/forums/showthread.php?t=77371".
//
// 7. Then you can copy this trigger to your map.
//
// 8. Make sure that the rawcodes from this spells CONFIGURATION MENU match the ones
// in your map. You can also change the other values inside the CONFIGURATION MENU,
// so you change the spell to your liking. Something can be changed from the Object Editor
// also.
//
// 9. Have fun!
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//CONFIGURATION MENU
globals
//RAWCODE/ORDER SETTINGS
//Rawcode of the spell
private constant integer spellId = 039;A000039;
//Rawcode of the dummy ice
private constant integer dummyIceId = 039;h001039;
//Rawcode of the dummy caster
private constant integer dummyCasterId = 039;h002039;
//Rawcode of the dummy spell
private constant integer dummySpellId = 039;A001039;
//Order string of the dummy spell
private constant string dummySpellOrder = "slow"
//BURST SETTINGS
//How often do the bursts happen
private constant real interval = 0.15
//How long is the lifetime of a dummyIce
private constant real iceLifetime = 1.00
//Model path of the burst effect (remember double slashes "\\")
private constant string burstPath = "Abilities\\Spells\\Undead\\FrostNova\\FrostNovaTarget.mdl"
//ID of the terrain type under the paths (set to 0, if you don't want the terrain to change)
private constant integer terrainId = 039;Iice039;
//How long does the changed terrain last for
private constant real terrainDuration = 2.25
//How big is the area where to units are damaged from the paths
private constant real damageArea = 128.00
//How much do the paths spread (angle value)
private constant real pathSpread = 70.00
//KNOCKBACK SETTINGS
//How far the units are knocked back
private constant real knockDistance = 256.00
//Duration of the knockback
private constant real knockDuration = 0.80
//Model path of the knockback effect
private constant string knockPath = "Abilities\\Weapons\\FrostWyrmMissile\\FrostWyrmMissile.mdl"
//Attach point of the knockback effect
private constant string attachPoint = "chest"
endglobals
private constant function PathDistance takes integer level returns real
//How far will the paths travel
return 400.00 + (level * 200.00)
endfunction
private constant function PathDuration takes integer level returns real
//How long does it last for the paths to travel their distance
return 1.00 + (level * 0.35)
endfunction
private constant function DamageDealt takes integer level returns real
//How much damage does the spell deal
return 25.00 + (level * 50.00)
endfunction
private function DamageFilter takes unit caster, unit target returns boolean
//What kind of units get damaged
//"caster" is the caster of this spell
//"target" is the unit which is going to take damage if this function returns true
return (IsUnitEnemy(target, GetOwningPlayer(caster))) and (IsUnitType(target, UNIT_TYPE_GROUND)) and (GetUnitState(target, UNIT_STATE_LIFE) > 0.00)
endfunction
//END OF CONFIGURATION MENU
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
private struct IBdata
unit caster
integer level
real current1X
real current1Y
real current2X
real current2Y
real direction
real damage
real periodDistance
timer myTimer = CreateTimer()
integer ticks
integer count
group damageGroup = CreateGroup()
static method create takes unit caster, integer level, real distance, real duration, real damage returns IBdata
local IBdata dat = IBdata.allocate()
set dat.caster = caster
set dat.level = level
set dat.current1X = GetUnitX(dat.caster)
set dat.current1Y = GetUnitY(dat.caster)
set dat.current2X = dat.current1X
set dat.current2Y = dat.current1Y
set dat.direction = GetUnitFacing(dat.caster)
set dat.damage = damage
set dat.periodDistance = (distance / duration * interval)
set dat.ticks = R2I(duration/interval)
set dat.count= dat.ticks
call SetTimerStructA(dat.myTimer, dat)
return dat
endmethod
method onDestroy takes nothing returns nothing
call ClearTimerStructA(.myTimer)
call PauseTimer(.myTimer)
call DestroyTimer(.myTimer)
call DestroyGroup(.damageGroup)
endmethod
endstruct
private function ResetTerrain takes real x, real y, integer terrainType, integer terrainVariance returns nothing
call PolledWait(terrainDuration)
call SetTerrainType(x, y, terrainType, terrainVariance, 1, 0)
endfunction
private function FadeDummies takes unit d returns nothing
local integer index = 0
call PolledWait(iceLifetime)
loop
exitwhen (index == 10)
call SetUnitVertexColor(d, 255, 255, 255, R2I((100 - (100/10*index)) * I2R(255) * 0.01))
call TriggerSleepAction(0.00)
set index = index + 1
endloop
call RemoveUnit(d)
endfunction
private function IceBurstHandler_actions takes nothing returns nothing
local timer exprTimer = GetExpiredTimer()
local IBdata dat = GetTimerStructA(exprTimer)
local real tempX
local real tempY
local group g = CreateGroup()
local group g2 = CreateGroup()
local unit f
local real angle
local unit d
local unit a
if (dat.ticks <= 0) then
call dat.destroy()
else
set dat.ticks = dat.ticks - 1
set dat.current1X = dat.current1X + dat.periodDistance * Cos((dat.direction + (((pathSpread / 2) / dat.count) * (dat.count - dat.ticks))) * bj_DEGTORAD)
set dat.current1Y = dat.current1Y + dat.periodDistance * Sin((dat.direction + (((pathSpread / 2) / dat.count) * (dat.count - dat.ticks))) * bj_DEGTORAD)
set dat.current2X = dat.current2X + dat.periodDistance * Cos((dat.direction - (((pathSpread / 2) / dat.count) * (dat.count - dat.ticks))) * bj_DEGTORAD)
set dat.current2Y = dat.current2Y + dat.periodDistance * Sin((dat.direction - (((pathSpread / 2) / dat.count) * (dat.count - dat.ticks))) * bj_DEGTORAD)
call DestroyEffect(AddSpecialEffect(burstPath, dat.current1X, dat.current1Y))
set d = CreateUnit(GetOwningPlayer(dat.caster), dummyIceId, dat.current1X, dat.current1Y, GetRandomReal(0.00, 359.00))
call SetUnitPosition(d, dat.current1X, dat.current1Y)
call FadeDummies.execute(d)
call GroupEnumUnitsInRange(g, dat.current1X, dat.current1Y, damageArea, null)
if ((terrainId != 0) and (GetTerrainType(dat.current1X, dat.current1Y) != terrainId)) then
call ResetTerrain.execute(dat.current1X, dat.current1Y, GetTerrainType(dat.current1X, dat.current1Y), GetTerrainVariance(dat.current1X, dat.current1Y))
call SetTerrainType(dat.current1X, dat.current1Y, terrainId, -1, 1, 0)
endif
call DestroyEffect(AddSpecialEffect(burstPath, dat.current2X, dat.current2Y))
set d = CreateUnit(GetOwningPlayer(dat.caster), dummyIceId, dat.current2X, dat.current2Y, GetRandomReal(0.00, 359.00))
call SetUnitPosition(d, dat.current2X, dat.current2Y)
call FadeDummies.execute(d)
call GroupEnumUnitsInRange(g2, dat.current2X, dat.current2Y, damageArea, null)
if ((terrainId != 0) and (GetTerrainType(dat.current2X, dat.current2Y) != terrainId)) then
call ResetTerrain.execute(dat.current2X, dat.current2Y, GetTerrainType(dat.current2X, dat.current2Y), GetTerrainVariance(dat.current2X, dat.current2Y))
call SetTerrainType(dat.current2X, dat.current2Y, terrainId, -1, 1, 0)
endif
call GroupAddGroup(g2, g)
loop
set f = FirstOfGroup(g)
exitwhen (f == null)
call GroupRemoveUnit(g, f)
if ((DamageFilter(dat.caster, f)) and (IsUnitInGroup(f, dat.damageGroup) == false)) then
set a = CreateUnit(GetOwningPlayer(dat.caster), dummyCasterId, dat.current1X, dat.current1Y, 0.00)
set angle = bj_RADTODEG * Atan2(GetUnitY(f) - GetUnitY(a), GetUnitX(f) - GetUnitX(a))
call UnitKnockTargetEx(a, f, angle, knockDistance, dat.damage, knockDuration, knockPath, attachPoint)
call UnitAddAbility(a, dummySpellId)
call SetUnitAbilityLevel(a, dummySpellId, dat.level)
call IssueTargetOrder(a, dummySpellOrder, f)
call UnitApplyTimedLife(a, 0, 2.00)
call GroupAddUnit(dat.damageGroup, f)
endif
endloop
set d = null
set f = null
set a = null
endif
set exprTimer = null
call DestroyGroup(g)
set g = null
call DestroyGroup(g2)
set g2 = null
endfunction
private function IceBurstMain_conditions takes nothing returns boolean
return GetSpellAbilityId() == spellId
endfunction
private function IceBurstMain_actions takes nothing returns nothing
local unit caster = GetTriggerUnit()
local integer level = GetUnitAbilityLevel(caster, spellId)
local IBdata dat = IBdata.create(caster, level, PathDistance(level), PathDuration(level), DamageDealt(level))
call TimerStart(dat.myTimer, interval, true, function IceBurstHandler_actions)
set caster = null
endfunction
function InitTrig_Ice_Burst takes nothing returns nothing
local trigger trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(trig, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddAction(trig, function IceBurstMain_actions)
call TriggerAddCondition(trig, Condition(function IceBurstMain_conditions))
call Preload(burstPath)
call Preload(knockPath)
set trig = null
endfunction
endscope