FroznYoghurt
New Member
- Reaction score
- 37
wouldnt be quite the same since locust seeks out the enemies (homing) would be a bit imba with the stun. Gals "locusts" just move around and simply collide with nearby units.
//*****************************************************************************************\\
// Spell Name: Borealis Beam \\
// Spell Author: Pyrogasm \\
// \\
// Follows the JESP Standard \\
//*****************************************************************************************\\
//*****************************************************************************************\\
// Configuration \\
//*****************************************************************************************\\
constant function BB_AbilityId takes nothing returns integer
return 039;A001039;
endfunction
constant function BB_WaveUnitId takes nothing returns integer
return 039;h000039;
endfunction
constant function BB_CasterUnitId takes nothing returns integer
return 039;h002039;
endfunction
constant function BB_PathUnitId takes nothing returns integer
return 039;h001039;
endfunction
constant function BB_SlowAbilityId takes nothing returns integer
return 039;A002039;
endfunction
constant function BB_StunAbilityId takes nothing returns integer
return 039;A000039;
endfunction
constant function BB_SpawnOffset takes integer Level returns real
return 100.00
endfunction
constant function BB_Duration takes integer Level returns real
return 5.00
endfunction
constant function BB_Damage takes integer Level returns real
return 15.00+10.00*Level
endfunction
function BB_SoundCreation takes sound LoopSound, sound ImpactSound, integer Level returns nothing
set LoopSound = CreateSound("Abilities\\Spells\\Human\\Flare\\FlareTarget1.wav", false, true, true, 10, 10, "SpellsEAX")
call SetSoundParamsFromLabel(LoopSound, "Flare1")
call SetSoundDuration(LoopSound, 3581 )
set ImpactSound = CreateSound("Abilities\\Spells\\Human\\Flare\\FlareTarget2.wav", false, true, true, 10, 10, "SpellsEAX")
call SetSoundParamsFromLabel(ImpactSound, "Flare2")
call SetSoundDuration(ImpactSound, 1343)
endfunction
constant function BB_MoveInterval takes nothing returns real
return 0.04
endfunction
constant function BB_MoveSpeed takes nothing returns real
return 400.00
endfunction
constant function BB_HeightLimit takes integer Level returns real
return 50.00
endfunction
constant function BB_CollisionRadius takes nothing returns real
return 77.00
endfunction
function BB_CollisionFilter takes unit FilterUnit, player CasterOwner, integer Level returns boolean
return GetWidgetLife(FilterUnit) > 0.405
endfunction
constant function BB_KillDestructibles takes integer Level returns boolean
return true
endfunction
function BB_DestructibleFilter takes nothing returns boolean
return GetDestructableLife(GetFilterDestructable()) > 0.405 and not(IsDestructableInvulnerable(GetFilterDestructable()))
endfunction
constant function BB_StunRadius takes integer Level returns real
return 200.00
endfunction
function BB_StunFilter takes unit FilterUnit, player CasterOwner, integer Level returns boolean
return GetWidgetLife(FilterUnit) > 0.405
endfunction
constant function BB_ExplodeEffect takes integer Level returns string
return "Units\\NightElf\\Wisp\\WispExplode.mdl"
endfunction
constant function BB_SafeSpot takes string Dimension returns real
if Dimension == "X" then
return 200.00
elseif Dimension == "Y" then
return 663.00
endif
return 0.00 //Safety Return; do not touch
endfunction
//*****************************************************************************************\\
// End Configuration \\
//*****************************************************************************************\\
function BB_CastConditions takes nothing returns boolean
return GetSpellAbilityId() == BB_AbilityId()
endfunction
function BB_UnitConditions takes nothing returns boolean
return BB_CollisionFilter(GetFilterUnit(), bj_forceRandomCurrentPick, bj_meleeTwinkedHeroes[44])
endfunction
function BB_StunConditions takes nothing returns boolean
return BB_StunFilter(GetFilterUnit(), bj_forceRandomCurrentPick, bj_meleeTwinkedHeroes[44])
endfunction
function BB_GetDestructible takes nothing returns nothing
local destructable D = GetEnumDestructable()
local real DX = bj_meleeNearestMineDist-GetDestructableX(D)
local real DY = bj_randomSubGroupChance-GetDestructableY(D)
if DX*DX + DY*DY <= 110.00*110.00 then
set bj_elevatorNeighbor = D
endif
set D = null
endfunction
function BB_Callback takes nothing returns nothing
local real Period = BB_MoveInterval()
local real Speed = BB_MoveSpeed()
local real Radius = BB_CollisionRadius()
local boolean KillDestructibles
local real X
local real Y
local real X2
local real Y2
local real TX
local real TY
local real L
local real P
local real XDir
local real YDir
local unit Target
local boolean None
local boolean Terrain
local integer I = 0
local string TTable = GetAttachmentTable(udg_BB_Timer)
local integer End = GetTableInt(TTable, "BB Number")
local integer Countup
local integer ArrayIndex
local unit U
local integer Level
local sound ImpactSound
local integer WaveId = BB_WaveUnitId()
local real SafeX = BB_SafeSpot("X")
local real SafeY = BB_SafeSpot("Y")
local rect R = Rect(0.00, 0.00, 0.00, 0.00)
local unit DummyCaster
local integer DummyId = BB_CasterUnitId()
local integer SlowId = BB_SlowAbilityId()
local integer StunId = BB_StunAbilityId()
local real StunRadius
local group G
local real MinX = GetRectMinX(bj_mapInitialPlayableArea)
local real MaxX = GetRectMaxX(bj_mapInitialPlayableArea)
local real MinY = GetRectMinY(bj_mapInitialPlayableArea)
local real MaxY = GetRectMaxY(bj_mapInitialPlayableArea)
loop
set I = I+1
exitwhen I > End
set ArrayIndex = GetTableInt(TTable, "BB Array "+I2S(I))
set Countup = GetArrayInt(ArrayIndex, 2)+1
set Level = GetArrayInt(ArrayIndex, 9)
if Countup <= R2I(BB_Duration(Level)/Period) then
call SetArrayInt(ArrayIndex, 2, Countup)
set U = GetArrayUnit(ArrayIndex, 1)
set Target = null
set None = true
set Terrain = false
call StartSound(GetArraySound(ArrayIndex, 7))
set XDir = GetArrayReal(ArrayIndex, 5)
set YDir = GetArrayReal(ArrayIndex, 6)
set X = GetArrayReal(ArrayIndex, 3)+Speed*Period*XDir
set Y = GetArrayReal(ArrayIndex, 4)+Speed*Period*YDir
if ((X>MaxX) or (X<MinX)) then
set XDir = -XDir
set None = false
endif
if ((Y>MaxY) or (Y<MinY)) then
set YDir = -YDir
set None = false
endif
if not None then
set ImpactSound = GetArraySound(ArrayIndex, 8)
call StartSound(ImpactSound)
call KillUnit(U)
set U = CreateUnit(GetOwningPlayer(U), WaveId, X, Y, Atan2(YDir, XDir)*57.2957795)
call AttachSoundToUnit(ImpactSound, U)
call AttachSoundToUnit(GetArraySound(ArrayIndex, 6), U)
call SetArrayObject(ArrayIndex, 1, U)
endif
set bj_forceRandomCurrentPick = GetOwningPlayer(U)
set bj_meleeTwinkedHeroes[44] = Level
call GroupEnumUnitsInRange(udg_BB_Group, X, Y, Radius, Condition(function BB_UnitConditions))
call GroupRemoveUnit(udg_BB_Group, U)
if FirstOfGroup(udg_BB_Group) != null then
set Target = FirstOfGroup(udg_BB_Group)
set X2 = GetUnitX(Target)-X
set Y2 = GetUnitY(Target)-Y
set None = false
call GroupClear(udg_BB_Group)
endif
if None then
set bj_elevatorNeighbor = null
call SetRect(R, X-Radius, Y-Radius, X+Radius, Y+Radius)
set bj_meleeNearestMineDist = X
set bj_randomSubGroupChance = Y
set bj_elevatorNeighbor = null
call EnumDestructablesInRect(R, Condition(function BB_DestructibleFilter), function BB_GetDestructible)
if bj_elevatorNeighbor != null then
set X2 = GetDestructableX(bj_elevatorNeighbor)-X
set Y2 = GetDestructableY(bj_elevatorNeighbor)-Y
if BB_KillDestructibles(Level) then
call KillDestructable(bj_elevatorNeighbor)
endif
set None = false
endif
endif
if None then
call SetUnitX(U, SafeX)
call SetUnitY(U, SafeY)
call SetUnitPosition(udg_BB_PathabilityUnit, X, Y)
set TX = GetUnitX(udg_BB_PathabilityUnit)-X
set TY = GetUnitY(udg_BB_PathabilityUnit)-Y
call SetUnitX(udg_BB_PathabilityUnit, SafeX)
call SetUnitY(udg_BB_PathabilityUnit, SafeY)
call SetUnitX(U, X)
call SetUnitY(U, Y)
if TX*TX+TY*TY > 100.00 then
call MoveLocation(udg_BB_Location1, X, Y)
call MoveLocation(udg_BB_Location2, X+XDir*Radius, Y+YDir*Radius)
if (GetLocationZ(udg_BB_Location2)-GetLocationZ(udg_BB_Location1)) > BB_HeightLimit(Level) then
call MoveLocation(udg_BB_Location1, X-Radius, Y)
call MoveLocation(udg_BB_Location2, X+Radius, Y)
set X2 = GetLocationZ(udg_BB_Location1)-GetLocationZ(udg_BB_Location2)
call MoveLocation(udg_BB_Location1, X, Y-Radius)
call MoveLocation(udg_BB_Location2, X, Y+Radius)
set Y2 = GetLocationZ(udg_BB_Location1)-GetLocationZ(udg_BB_Location2)
set None = false
set Terrain = true
endif
endif
endif
if not None then
set L = SquareRoot(X2*X2+Y2*Y2)
set X2 = X2/L
set Y2 = Y2/L
set TX = XDir*Speed
set TY = YDir*Speed
set P = TX*X2 + TY*Y2
if (P > 0.00) or Terrain then
if Target != null then
call UnitDamageTarget(U, Target, BB_Damage(Level), false, true, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNIVERSAL, null)
set DummyCaster = CreateUnit(GetOwningPlayer(U), DummyId, GetUnitX(Target), GetUnitY(Target), 0.00)
call UnitAddAbility(DummyCaster, SlowId)
call SetUnitAbilityLevel(DummyCaster, SlowId, Level)
call IssueTargetOrder(DummyCaster, "slow", Target)
call UnitApplyTimedLife(DummyCaster, 039;BTLF039;, 2.00)
set DummyCaster = null
set Target = null
endif
set TX = TX-(X2*P*2.00)
set TY = TY-(Y2*P*2.00)
set L = SquareRoot(TX*TX+TY*TY)
set XDir = TX/L
set YDir = TY/L
set ImpactSound = GetArraySound(ArrayIndex, 8)
call StartSound(ImpactSound)
call KillUnit(U)
set U = CreateUnit(GetOwningPlayer(U), WaveId, X, Y, Atan2(YDir, XDir)*57.2957795)
call SetArrayObject(ArrayIndex, 1, U)
call AttachSoundToUnit(GetArraySound(ArrayIndex, 7), U)
call AttachSoundToUnit(ImpactSound, U)
set ImpactSound = null
endif
endif
call SetArrayReal(ArrayIndex, 3, GetUnitX(U))
call SetArrayReal(ArrayIndex, 4, GetUnitY(U))
call SetArrayReal(ArrayIndex, 5, XDir)
call SetArrayReal(ArrayIndex, 6, YDir)
set U = null
else
if End == 1 then
call PauseTimer(udg_BB_Timer)
elseif I < End then
call SetTableInt(TTable, "BB Array "+I2S(I), GetTableInt(TTable, "BB Array "+I2S(End)))
call SetTableInt(TTable, "BB Array "+I2S(End), 0)
set I = I-1
endif
set End = End-1
call SetTableInt(TTable, "BB Number", End)
set U = GetArrayUnit(ArrayIndex, 1)
set X = GetArrayReal(ArrayIndex, 3)
set Y = GetArrayReal(ArrayIndex, 4)
set bj_forceRandomCurrentPick = GetOwningPlayer(U)
call DestroyEffect(AddSpecialEffect(BB_ExplodeEffect(Level), X, Y))
set DummyCaster = CreateUnit(bj_forceRandomCurrentPick, DummyId, X, Y, 0.00)
call UnitAddAbility(DummyCaster, StunId)
call SetUnitAbilityLevel(DummyCaster, StunId, Level)
call UnitApplyTimedLife(DummyCaster, 039;BTLF039;, 2.00)
set bj_meleeTwinkedHeroes[44] = Level
set G = CreateGroup()
call GroupEnumUnitsInRange(G, X, Y, BB_StunRadius(Level), Condition(function BB_StunConditions))
loop
set Target = FirstOfGroup(G)
exitwhen Target == null
call IssueTargetOrder(DummyCaster, "thunderbolt", Target)
call GroupRemoveUnit(G, Target)
endloop
call DestroyGroup(G)
call KillUnit(U)
set ImpactSound = GetArraySound(ArrayIndex, 8)
call StartSound(ImpactSound)
call KillSoundWhenDone(ImpactSound)
call StopSound(GetArraySound(ArrayIndex, 7), true, true)
call DestroyArray(ArrayIndex)
set ImpactSound = null
set G = null
set U = null
set DummyCaster = null
endif
endloop
endfunction
function BB_Cast takes nothing returns nothing
local unit U = GetTriggerUnit()
local integer Level = GetUnitAbilityLevel(U, BB_AbilityId())
local real X = GetUnitX(U)
local real Y = GetUnitY(U)
local location L = GetSpellTargetLoc()
local real X2
local real Y2
local unit U2
local real Angle
local real SpawnOffset = BB_SpawnOffset(Level)
local integer ArrayIndex = NewArray(10, false)
local real XDir
local real YDir
local sound LoopSound = null
local sound ImpactSound = null
local integer Index = GetAttachedInt(udg_BB_Timer, "BB Number")+1
if L == null then
set U2 = GetSpellTargetUnit()
set X2 = GetUnitX(U2)
set Y2 = GetUnitY(U2)
set U2 = null
else
set X2 = GetLocationX(L)
set Y2 = GetLocationY(L)
call RemoveLocation(L)
set L = null
endif
set Angle = Atan2((Y2-Y),(X2-X))
set XDir = Cos(Angle)
set YDir = Sin(Angle)
set X2 = X+XDir*SpawnOffset
set Y2 = Y+YDir*SpawnOffset
set U2 = CreateUnit(GetOwningPlayer(U), BB_WaveUnitId(), X2, Y2, Angle*57.2957795)
call BB_SoundCreation(LoopSound, ImpactSound, Level)
call AttachSoundToUnit(LoopSound, U2)
call AttachSoundToUnit(ImpactSound, U2)
call StartSound(LoopSound)
call SetArrayObject(ArrayIndex, 1, U2)
call SetArrayInt(ArrayIndex, 2, 0) //Because it's not initialized
call SetArrayReal(ArrayIndex, 3, X2)
call SetArrayReal(ArrayIndex, 4, Y2)
call SetArrayReal(ArrayIndex, 5, XDir)
call SetArrayReal(ArrayIndex, 6, YDir)
call SetArrayObject(ArrayIndex, 7, LoopSound)
call SetArrayObject(ArrayIndex, 8, ImpactSound)
call SetArrayInt(ArrayIndex, 9, Level)
call AttachInt(udg_BB_Timer, "BB Number", Index)
call AttachInt(udg_BB_Timer, "BB Array "+I2S(Index), ArrayIndex)
if Index == 1 then
call TimerStart(udg_BB_Timer, BB_MoveInterval(), true, function BB_Callback)
endif
set U = null
set U2 = null
set LoopSound = null
set ImpactSound = null
endfunction
//===========================================================================
function InitTrig_BB takes nothing returns nothing
set gg_trg_BB = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_BB, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(gg_trg_BB, Condition(function BB_CastConditions))
call TriggerAddAction(gg_trg_BB, function BB_Cast)
set udg_BB_Location1 = Location(0.00, 0.00)
set udg_BB_Location2 = Location(0.00, 0.00)
set udg_BB_PathabilityUnit = CreateUnit(Player(15), BB_PathUnitId(), BB_SafeSpot("X"), BB_SafeSpot("Y"), 0.00)
endfunction
Because when people running Windows XP/Vista open my map in the World Editor to look at the code, every linebreak (the space between a line) is replaced with a weird character that looks like this: ⌷.~GaLs~ said:Just why dont you upload your map instead of zipping? Along with the code.
foolproof