Name | Type | is_array | initial_value |
//TESH.scrollpos=182
//TESH.alwaysfold=0
scope DarkLightningNova initializer init
/***********************************************************************************/
/* Dark Lightning Nova v1.3 */
/* by: msongyyy */
/* */
/* requires: JNGP 1.5e or better */
/* WorldBounds by Nestharus */
/* */
/* Big thanks to JetFangInferno for the DarkLightningNova and DarkLightning Models */
/* */
/* HOW TO IMPORT Dark Lightning Nova */
/* 1. Copy the dummy/spell into your map */
/* 2. Import the icon/models to the correct paths */
/* 3. Set the first 4 configurables to the right path */
/* the DLN_NOVA = the imported DarkLightningNova path */
/* the DLN_LIGHT = the imported DarkLightning path */
/* the DLN_ID = Spell Rawcode ID for Dark Lightning Nova */
/* the DLN_VISION_DUMMY = Unit Rawcode ID for Vision Dummy */
/* 4. Set the rest of the configurables to your liking ^^ */
/* */
/* */
/* ENJOY - PLEASE REPORT ALL BUGS TO ME */
/* AT HIVEWORKSHOP.COM */
/* */
/***********************************************************************************/
globals
private constant string NOVA = "war3mapImported\\DarkLightningNova.mdx"
private constant string LIGHT = "war3mapImported\\DarkLightning.mdx"
private constant integer ID = 'A000'
private constant integer VISION_DUMMY = 'h001'
/***********************************************************************************/
/* */
/* START OF CONFIGURABLES :) */
/* LEVEL = Level of DLN for unit - not really a configurable lol */
/* */
/* NOVA_AOE = AoE real of the initial lightning */
/* LIGHT_AOE = AoE real of the lightning lines after initial */
/* */
/* MAX_DIST_INC = Increment of max distance traveled by LEVEL */
/* MAX_DIST_BASE = Base distance traveled by DLN */
/* MAX_DIST = MAX_DIST_INC * LEVEL + MAX_DIST_BASE */
/* */
/* NDMG_INC = Increment of damage of initial lightning by LEVEL */
/* NDMG_BASE = Base damage of initial lightning */
/* NOVA_DAMAGE = NDMG_INC * LEVEL + NDMG_BASE (Total Damage) */
/* */
/* LDMG_INC = Increment of damage of lightning after initial by LEVEL */
/* LDMG_BASE = Base damage of lightning after initial */
/* LIGHT_DAMAGE = LDMG_INC * LEVEL + LDMG_BASE (Total Damage) */
/* */
/* TIME_INC = How often each lighting strike fires off */
/* DIST_INC = Distance between each instance */
/* */
/***********************************************************************************/
private constant real NOVA_AOE = 250.00
private constant real LIGHT_AOE = 135.00
private constant real MAX_DIST_INC = 500.00
private constant real MAX_DIST_BASE = 500.00
private constant real NDMG_INC = 100.00
private constant real NDMG_BASE = 50.00
private constant real LDMG_INC = 50.00
private constant real LDMG_BASE = 25.00
private constant real DIST_INC = 50.00
private constant real TIME_INC = .05
private timer TMR = CreateTimer()
endglobals
/***********************************************************************************/
/* DLN_MAX_DIST = Max distance traveled by DLN */
/***********************************************************************************/
private constant function MAX_DIST takes real level returns real
return level*MAX_DIST_INC + MAX_DIST_BASE
endfunction
/***********************************************************************************/
/* DLN_NOVA_DAMAGE = Dealt by the initial lightning */
/***********************************************************************************/
private constant function NOVA_DAMAGE takes real level returns real
return level*NDMG_INC + NDMG_BASE
endfunction
/***********************************************************************************/
/* DLN_LIGHT_DAMAGE = Damage dealt by each of the lightning strikes after the */
/* initial lightning */
/***********************************************************************************/
private constant function LIGHT_DAMAGE takes real level returns real
return level*LDMG_INC + LDMG_BASE
endfunction
/***********************************************************************************/
/* DLN_LEVEL = Just gets the level of DLN for a unit to make code a lil cleaner :) */
/***********************************************************************************/
private function LEVEL takes unit u returns real
return I2R(GetUnitAbilityLevel(u, ID))
endfunction
/***********************************************************************************/
/* */
/* END OF CONFIGURABLES, DON'T TOUCH PAST HERE :( */
/* */
/***********************************************************************************/
globals
private group g = CreateGroup()
private unit fog
private unit array caster
private unit array dummy
private player array play
private real array x
private real array y
private real array dist
private real array ang
private integer array next
private integer array prev
private integer array rn
private integer ic = 0
endglobals
private function dlnLight takes nothing returns nothing
local integer this = next[0]
loop
if next[0] == 0 then
call PauseTimer(TMR)
endif
if dist[this] > MAX_DIST(LEVEL(caster[this])) then
set caster[this] = null
set play[this] = null
set prev[next[this]] = prev[this]
set next[prev[this]] = next[this]
set rn[this] = rn[0]
set rn[0] = this
return
else
if dist[this] == 0 then
call DestroyEffect(AddSpecialEffect(NOVA, x[this], y[this]))
call DestroyEffect(AddSpecialEffect(LIGHT, x[this], y[this]))
call GroupEnumUnitsInRange(g, x[this], y[this], NOVA_AOE, null)
loop
set fog = FirstOfGroup(g)
exitwhen fog == null
if IsUnitEnemy(fog, GetOwningPlayer(caster[this])) then
call UnitDamageTarget(caster[this], fog, NOVA_DAMAGE(LEVEL(caster[this])), false, false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_NORMAL, null)
endif
call GroupRemoveUnit(g, fog)
endloop
elseif dist[this] >= NOVA_AOE and dist[this] <= MAX_DIST(LEVEL(caster[this])) then
call DestroyEffect(AddSpecialEffect(LIGHT, x[this], y[this]))
call GroupEnumUnitsInRange(g, x[this], y[this], LIGHT_AOE, null)
loop
set fog = FirstOfGroup(g)
exitwhen fog == null
if IsUnitEnemy(fog, GetOwningPlayer(caster[this])) then
call UnitDamageTarget(caster[this], fog, LIGHT_DAMAGE(LEVEL(caster[this])), false, false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_NORMAL, null)
endif
call GroupRemoveUnit(g, fog)
endloop
endif
endif
set dummy[this] = CreateUnit(play[this], VISION_DUMMY, x[this], y[this], 0)
call UnitApplyTimedLife(dummy[this], 'BTLF', .6)
set dummy[this] = null
set dist[this] = dist[this] + DIST_INC
set x[this] = x[this] + DIST_INC * Cos(ang[this])
set y[this] = y[this] + DIST_INC * Sin(ang[this])
if x[this] > I2R(WorldBounds.maxX) then
set x[this] = I2R(WorldBounds.maxX) - 25
endif
if x[this] < I2R(WorldBounds.minX) then
set x[this] = I2R(WorldBounds.minX) + 25
endif
if y[this] > I2R(WorldBounds.maxY) then
set y[this] = I2R(WorldBounds.maxY) - 25
endif
if y[this] < I2R(WorldBounds.minY) then
set y[this] = I2R(WorldBounds.minY) + 25
endif
set this = next[this]
exitwhen this == 0
endloop
endfunction
private function dlnCreate takes unit u, real xc, real yc, real r returns nothing
local integer this = rn[0]
if this == 0 then
set ic = ic + 1
set this = ic
else
set rn[0] = rn[this]
endif
set caster[this] = u
set dist[this] = 0
set x[this] = xc
set y[this] = yc
set ang[this] = r
set play[this] = GetOwningPlayer(caster[this])
set next[this] = 0
set prev[this] = prev[0]
set next[prev[0]] = this
set prev[0] = this
if prev[this] == 0 then
call TimerStart(TMR, TIME_INC, true, function dlnLight)
endif
endfunction
private function dlnNova takes nothing returns boolean
local unit lvUnit = GetTriggerUnit()
local real lvAng = Atan2(GetSpellTargetY() - GetUnitY(lvUnit), GetSpellTargetX() - GetUnitX(lvUnit))
if GetSpellAbilityId() == ID then
call dlnCreate(lvUnit, GetSpellTargetX(), GetSpellTargetY(), lvAng)
endif
set lvUnit = null
return false
endfunction
private function init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition(function dlnNova))
set t = null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
library_once WorldBounds /* v2.0.0.0
************************************************************************************
*
* struct WorldBounds extends array
* readonly static integer maxX
* readonly static integer maxY
* readonly static integer minX
* readonly static integer minY
* readonly static integer centerX
* readonly static integer centerY
* readonly static rect world
* readonly static region worldRegion
*
************************************************************************************/
private module WorldBoundInit
private static method onInit takes nothing returns nothing
set world=bj_mapInitialPlayableArea
set maxX=R2I(GetRectMaxX(world))
set maxY=R2I(GetRectMaxY(world))
set minX=R2I(GetRectMinX(world))
set minY=R2I(GetRectMinY(world))
set centerX=R2I((maxX+minX)/2)
set centerY=R2I((minY+maxY)/2)
set worldRegion=CreateRegion()
call RegionAddRect(worldRegion,world)
endmethod
endmodule
struct WorldBounds extends array
readonly static integer maxX
readonly static integer maxY
readonly static integer minX
readonly static integer minY
readonly static integer centerX
readonly static integer centerY
readonly static rect world
readonly static region worldRegion
implement WorldBoundInit
endstruct
endlibrary
//TESH.scrollpos=34
//TESH.alwaysfold=0
library Setup initializer init
globals
constant timer S_TMR = CreateTimer()
constant integer array CREEPS
private group g = CreateGroup()
private unit fog
endglobals
private function sCond takes nothing returns boolean
call SetUnitState(gg_unit_H000_0001, UNIT_STATE_LIFE, 99999)
call SetUnitState(gg_unit_H000_0001, UNIT_STATE_MANA, 99999)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl", gg_unit_H000_0001, "origin"))
return false
endfunction
private function rCond takes nothing returns boolean
local unit lvUnit = GetTriggerUnit()
if IsUnitType(lvUnit, UNIT_TYPE_HERO) then
call ReviveHero(lvUnit, 0, 0, true)
call PanCameraToTimed(0, 0, .5)
endif
set lvUnit = null
return false
endfunction
private function createCreeps takes nothing returns nothing
local integer i = 0
local integer i2 = GetRandomInt(3, 6)
local location lvLoc = GetRandomLocInRect(GetPlayableMapRect())
call GroupEnumUnitsOfPlayer(g, Player(12), null)
loop
set fog = FirstOfGroup(g)
exitwhen fog == null
if GetUnitState(fog, UNIT_STATE_LIFE) > 0 then
set i = i + 1
endif
call GroupRemoveUnit(g, fog)
endloop
if i < 50 then
loop
exitwhen i2 == 0 or i >= 50
call CreateUnitAtLoc(Player(12), CREEPS[GetRandomInt(0,5)], lvLoc, 0)
set i2 = i2 - 1
endloop
endif
call RemoveLocation(lvLoc)
set lvLoc = null
endfunction
private function init takes nothing returns nothing
local trigger t = CreateTrigger()
local trigger t2 = CreateTrigger()
set CREEPS[0] = 'nanm'
set CREEPS[1] = 'nenc'
set CREEPS[2] = 'nftr'
set CREEPS[3] = 'nfrl'
set CREEPS[4] = 'nltc'
set CREEPS[5] = 'nslr'
call TimerStart(S_TMR, 5, true, function createCreeps)
call DisplayTimedTextToPlayer(Player(0), 0, 0, 99999999, "Dark Lightning Nova by msongyyy, models by JetFangInferno")
call DisplayTimedTextToPlayer(Player(0), 0, 0, 99999999, "Enjoy!!!!")
call DisplayTimedTextToPlayer(Player(0), 0, 0, 99999999, "Press ESC to heal fully")
call TriggerRegisterPlayerEvent(t, Player(0), EVENT_PLAYER_END_CINEMATIC)
call TriggerAddCondition(t, function sCond)
call TriggerRegisterAnyUnitEventBJ(t2, EVENT_PLAYER_UNIT_DEATH)
call TriggerAddCondition(t2, function rCond)
set t = null
endfunction
endlibrary