Name | Type | is_array | initial_value |
//TESH.scrollpos=49
//TESH.alwaysfold=0
//! textmacro CostumInterface takes Loop,End,path,periodic
library CostumInterface$path$ initializer init
interface $path$Loop
boolean active=false
boolean paused=false
method $Loop$ takes nothing returns nothing
method $End$ takes nothing returns nothing
endinterface
globals
private $path$Loop array $path$_loopObject
private integer $path$_size=0
private trigger $path$_loop
constant real $path$_periodic=$periodic$
endglobals
function AddObjectTo$path$ takes $path$Loop loopObject returns integer
set $path$_loopObject[$path$_size]=loopObject
set $path$_loopObject[$path$_size].active=true
set $path$_size=$path$_size+1
if not IsTriggerEnabled($path$_loop) then
call EnableTrigger($path$_loop)
endif
return $path$_size
endfunction
private function Loop$path$ takes nothing returns nothing
local integer index=0
loop
exitwhen index==$path$_size
if $path$_loopObject[index].active and not $path$_loopObject[index].paused then
call $path$_loopObject[index].$Loop$.execute()
set index=index+1
elseif $path$_loopObject[index].paused then
set index=index+1
else
call $path$_loopObject[index].$End$()
set $path$_size=$path$_size-1
set $path$_loopObject[index]=$path$_loopObject[$path$_size]
endif
endloop
if $path$_size<=0 then
call DisableTrigger($path$_loop)
endif
endfunction
private function init takes nothing returns nothing
set $path$_loop=CreateTrigger()
call TriggerRegisterTimerEvent($path$_loop,$path$_periodic,true)
call TriggerAddAction($path$_loop,function Loop$path$)
call DisableTrigger($path$_loop)
endfunction
endlibrary
//! endtextmacro
//! runtextmacro CostumInterface("motion","endmotion","Motion","0.03")
//! runtextmacro CostumInterface("missilemove","endmissilemove","Missile","0.03")
library Walkable initializer init
globals
private item getWalkable=null
private constant integer getWalkable_id='sehr'
endglobals
function IsPointWalkable takes real x,real y returns boolean
call SetItemPosition(getWalkable,x,y)
call SetItemVisible(getWalkable,false)
return GetItemX(getWalkable)==x and GetItemY(getWalkable)==y
endfunction
private function init takes nothing returns nothing
set getWalkable=CreateItem(getWalkable_id,0,0)
call SetItemVisible(getWalkable,false)
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
//===========================================================================
//===========================================================================
//=================================Fire=Impact=v1.3==========================
//===========================================================================
//==================================By=xD.Schurke============================
//===========================================================================
//[email protected]================
//===========================================================================
//===========================================================================
scope fireimpact initializer fireInt
//==============CONSTANTS=====================
globals
private constant integer DUMMY = 'h000' //Dummy Raw-Code => Change to your map specific dummy raw code
private constant integer SPELL_RAW = 'A000' //Spell Raw-Code => Change to your map specific spell raw code
private constant integer TIMED_LIFE = 'BTLF' //Timed Life Raw-Code => DO NOT CHANGE! //(L33t comment from Dynasti: lol ^^)
private constant string MISSILE_SFX = "Abilities\\Weapons\\FireBallMissile\\FireBallMissile.mdl" //The effect of the missiles (Firebolt)
private constant string IMPACT_SFX = "Objects\\Spawnmodels\\Human\\FragmentationShards\\FragBoomSpawn.mdl" //The effect which is created when firebolt hits an unit or mini firebolts end
private constant real MISSILE_SPEED = 20. //Speed of the missiles => Increase/Decrease to change speed of the missiles
private constant real MISSILE_RADIUS = 50. //The radius where unit collision is checked (Normal Missiles)
private constant real MINI_MISSILE_RADIUS = 35. //The radius where unit collision is checked (Mini Missiles)
private constant real MISSILE_EXPLUSION_RADIUS = 200. //When missile hits a target all units in this range get damaged
private constant real MISSILE_RANGE = 600. //the range from creation point to center of the targeted area
private constant real MINI_MISSILE_RANGE = 1200. //the range , the mini missiles will move
private constant real MISSILE_COLLISION_RANGE = 550. //only in this range (from creation point to center) the units will be hit by the missiles else they move to the mid and explode
private constant real MISSILE_DAMAGE = 30. //damage of the normal missiles
private constant real MISSILE_DAMAGE_INCREASE = 10. //damage increase per lvl for normal missiles
private constant real MINI_MISSILE_DAMAGE = 20. //damage of the mini missiles
private constant real MINI_MISSILE_DAMAGE_INCREASE = 7.5 //damage increase per lvl for mini missiles
private constant real EXPLUSION_DAMAGE = 20. //damage for the explusion when missiles reach the center
private constant real EXPLUSION_DAMAGE_INCREASE = 12. //damage increase for explusion
private constant real EXPLUSION_RADIUS = 550. //explusion damage radius
private constant integer MAX_MISSLES = 10 //how many missiles will spawn when casted
private constant integer MISSILE_INCREASE = 4 //how many missiles added per lvl
private constant integer COLLISION_MISSILES = 4 //the number of mini missiles created
//attatchement points
private constant string chest = "chest"
private constant string origin = "origin"
private constant real DUMMY_DURATION = 2. //the duration of the explusion effect dummy
//================END=CONSTANTS==================
//group specific things => DO NOT CHANGE
private group tmpG=CreateGroup()
private player tmpP
private boolexpr Cond
endglobals
//formulars for damage and missiles and the filter
private constant function explusionDamage takes integer lvl returns real
return EXPLUSION_DAMAGE + ( EXPLUSION_DAMAGE_INCREASE * ( lvl - 1 ) )
endfunction
private constant function missileDamage takes integer lvl returns real
return MISSILE_DAMAGE + ( MISSILE_DAMAGE_INCREASE * ( lvl - 1 ) )
endfunction
private constant function miniMissileDamage takes integer lvl returns real
return MINI_MISSILE_DAMAGE + ( MINI_MISSILE_DAMAGE_INCREASE * ( lvl - 1 ) )
endfunction
private constant function missilesLevel takes integer lvl returns integer
return MAX_MISSLES+( MISSILE_INCREASE * ( lvl - 1 ) )
endfunction
private function filter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),tmpP) and (GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>0) and IsUnitType(GetFilterUnit(),UNIT_TYPE_GROUND) and (GetUnitTypeId(GetFilterUnit())!=DUMMY)
endfunction
//struct for the minimissiles
private struct missileStruct extends MissileLoop
unit caster
unit missile
player p
real x = 0
real y = 0
real ang = 0
effect sfx
real dis = 0
boolean b = false
method missilemove takes nothing returns nothing
local unit u
local real x = .x + MISSILE_SPEED * Cos(.ang * bj_DEGTORAD)
local real y = .y + MISSILE_SPEED * Sin(.ang * bj_DEGTORAD)
set .dis = .dis + MISSILE_SPEED
set tmpP = .p
call GroupEnumUnitsInRange(tmpG,x,y,MINI_MISSILE_RADIUS,Cond)
loop
set u = FirstOfGroup(tmpG)
exitwhen u == null
set .active = false
set .b = true
call GroupRemoveUnit(tmpG,u)
set u = null
endloop
if .dis<MINI_MISSILE_RANGE and IsPointWalkable(x,y) then
call SetUnitPosition(.missile,x,y)
else
set .active = false
endif
set .x = x
set .y = y
endmethod
method endmissilemove takes nothing returns nothing
local unit u
if IMPACT_SFX != "" then
call DestroyEffect(AddSpecialEffect(IMPACT_SFX,.x,.y))
endif
if .b == true then
set tmpP = .p
call GroupEnumUnitsInRange(tmpG,.x,.y,MISSILE_EXPLUSION_RADIUS,Cond)
loop
set u = FirstOfGroup(tmpG)
exitwhen u == null
call UnitDamageTarget(.caster,u,miniMissileDamage(GetUnitAbilityLevel(.caster,SPELL_RAW)),false,true,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_FIRE,WEAPON_TYPE_WHOKNOWS)
call GroupRemoveUnit(tmpG,u)
set u = null
endloop
endif
call RemoveUnit(.missile)
call DestroyEffect(.sfx)
set .missile = null
set .caster = null
set .sfx = null
set .p = null
call .destroy()
endmethod
endstruct
//struct for normal missiles and explusion
private struct ImpactStruct extends MotionLoop
unit caster
unit missile
player p
real x = 0
real y = 0
real ang = 0
effect sfx
real dis = 0
boolean b = false
method motion takes nothing returns nothing
local unit u = null
local real x = .x + MISSILE_SPEED * Cos(.ang * bj_DEGTORAD)
local real y = .y + MISSILE_SPEED * Sin(.ang * bj_DEGTORAD)
set .dis = .dis + MISSILE_SPEED
if .dis <= MISSILE_COLLISION_RANGE then
set tmpP = .p
call GroupEnumUnitsInRange(tmpG,x,y,MISSILE_RADIUS,Cond)
loop
set u = FirstOfGroup(tmpG)
exitwhen u == null
set .active = false
set .b = true
call GroupRemoveUnit(tmpG,u)
set u = null
endloop
endif
if .dis<MISSILE_RANGE and IsPointWalkable(x,y) then
call SetUnitPosition(.missile,x,y)
else
set .active = false
endif
set .x = x
set .y = y
endmethod
method endmotion takes nothing returns nothing
local missileStruct M
local integer int = 0
local unit u
if .b == true then
if IMPACT_SFX != "" then
call DestroyEffect(AddSpecialEffect(IMPACT_SFX,.x,.y))
endif
set tmpP = .p
call GroupEnumUnitsInRange(tmpG,.x,.y,MISSILE_EXPLUSION_RADIUS,Cond)
loop
set u = FirstOfGroup(tmpG)
exitwhen u == null
call UnitDamageTarget(.caster,u,missileDamage(GetUnitAbilityLevel(.caster,SPELL_RAW)),false,true,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_FIRE,WEAPON_TYPE_WHOKNOWS)
call GroupRemoveUnit(tmpG,u)
set u = null
endloop
loop
exitwhen int >= COLLISION_MISSILES
set M = missileStruct.create()
set M.x = .x
set M.y = .y
set M.ang = GetRandomReal(0,360)
set M.missile = CreateUnit(GetOwningPlayer(.missile),DUMMY,M.x,M.y,M.ang)
set M.sfx = AddSpecialEffectTarget(MISSILE_SFX,M.missile,chest)
set M.caster = .caster
set M.p = .p
call AddObjectToMissile(M)
set int = int + 1
endloop
else
set u = CreateUnit(GetOwningPlayer(.caster),DUMMY,.x,.y,0)
call SetUnitScale(u,4,4,4)
call AddSpecialEffectTarget(IMPACT_SFX,u,origin)
call UnitApplyTimedLife(u,TIMED_LIFE,DUMMY_DURATION)
set tmpP = GetOwningPlayer(.missile)
call GroupEnumUnitsInRange(tmpG,.x,.y,EXPLUSION_RADIUS,Cond)
loop
set u = FirstOfGroup(tmpG)
exitwhen u == null
call UnitDamageTarget(.caster,u,explusionDamage(GetUnitAbilityLevel(.caster,SPELL_RAW)),false,true,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_FIRE,WEAPON_TYPE_WHOKNOWS)
if IMPACT_SFX != "" then
call DestroyEffect(AddSpecialEffect(IMPACT_SFX,GetUnitX(u),GetUnitY(u)))
endif
call GroupRemoveUnit(tmpG,u)
set u = null
endloop
endif
call RemoveUnit(.missile)
call DestroyEffect(.sfx)
set .missile = null
set .caster = null
set .sfx = null
set .p = null
call .destroy()
endmethod
endstruct
private function fireCond takes nothing returns boolean
return GetSpellAbilityId() == SPELL_RAW
endfunction
private function fireActions takes nothing returns nothing
local ImpactStruct I
local location loc = GetSpellTargetLoc()
local real rnd
local integer index = 0
local player p
loop
exitwhen index >= missilesLevel(GetUnitAbilityLevel(GetTriggerUnit(),SPELL_RAW))
set p=GetOwningPlayer(GetTriggerUnit())
set I = ImpactStruct.create()
set I.caster = GetTriggerUnit()
set rnd = GetRandomReal(0,360)
set I.x = GetLocationX(loc) + MISSILE_RANGE * Cos(rnd * bj_DEGTORAD)
set I.y = GetLocationY(loc) + MISSILE_RANGE * Sin(rnd * bj_DEGTORAD)
set I.ang = bj_RADTODEG * Atan2(GetLocationY(loc) - I.y, GetLocationX(loc) - I.x)
set I.missile = CreateUnit(GetOwningPlayer(I.caster),DUMMY,I.x,I.y,I.ang)
set I.sfx = AddSpecialEffectTarget(MISSILE_SFX,I.missile,chest)
set I.p = p
call SetUnitScale(I.missile,1.5,1.5,1.5)
call AddObjectToMotion(I)
set index = index + 1
endloop
call RemoveLocation(loc)
set loc = null
set p = null
endfunction
private function fireInt takes nothing returns nothing
local trigger int = CreateTrigger()
local integer index = 0
loop
call TriggerRegisterPlayerUnitEvent(int, Player(index), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
set index = index + 1
exitwhen index == bj_MAX_PLAYER_SLOTS
endloop
call TriggerAddCondition(int,Condition(function fireCond))
call TriggerAddAction(int,function fireActions)
set Cond=Condition(function filter)
set int = null
//Preload
call Preload(MISSILE_SFX)
call Preload(IMPACT_SFX)
call PreloadStart()
endfunction
endscope