//TESH.scrollpos=0
//TESH.alwaysfold=0
Name | Type | is_array | initial_value |
//TESH.scrollpos=67
//TESH.alwaysfold=0
scope ObjectGeneration initializer init
globals
private constant real WAIT = 0.01
endglobals
private function Cinematics takes nothing returns nothing
local integer i = 0
loop
exitwhen i > MAXPLAYER
call SetPlayerAllianceBJ( Player(i), ALLIANCE_SHARED_VISION, true, Player(10) )
call SetPlayerAllianceBJ( Player(10), ALLIANCE_SHARED_VISION, true, Player(i) )
set i = i + 1
endloop
call CinematicFadeBJ( bj_CINEFADETYPE_FADEIN, 4.,CINEM_MASK,0,0,0,0)
if RandomCinem<=10 then
call StartCinematic1()
elseif RandomCinem >10 and RandomCinem <= 20 then
call StartCinematic2()
elseif RandomCinem >20 and RandomCinem <= 30 then
call StartCinematic3()
elseif RandomCinem >30 and RandomCinem <= 40 then
call StartCinematic4()
elseif RandomCinem >40 and RandomCinem <= 50 then
call StartCinematic5()
elseif RandomCinem >50 and RandomCinem <= 60 then
call StartCinematic6()
elseif RandomCinem >60 and RandomCinem <= 70 then
call StartCinematic7()
elseif RandomCinem >70 and RandomCinem <= 80 then
call StartCinematic8()
elseif RandomCinem >80 and RandomCinem <= 90 then
call StartCinematic9()
elseif RandomCinem >90 then
call StartCinematic10()
endif
endfunction
private function ForceAddRaven takes nothing returns boolean
local unit filtered = GetFilterUnit()
if GetUnitAbilityLevel(filtered,RAVEN)<= 0 then
call UnitAddAbility(filtered,RAVEN)
call UnitRemoveAbility(filtered,RAVEN)
else
call UnitRemoveAbility(filtered,RAVEN)
endif
if IsUnitType(filtered,UNIT_TYPE_STRUCTURE) or IsUnitType(filtered,UNIT_TYPE_MECHANICAL) then
call UnitIgnoreAlarm(filtered,true)
endif
set filtered = null
return true
endfunction
private function MakeWalkerSleep takes nothing returns boolean
if IsUnitType(GetFilterUnit(),UNIT_TYPE_MECHANICAL) then
call AddUnitAnimationProperties(GetFilterUnit(), "Alternate", true)
endif
if IsUnitType(GetFilterUnit(),UNIT_TYPE_FLYING) then
call SetUnitFlyHeight(GetFilterUnit(),0.,0.)
endif
return true
endfunction
private function Actions takes nothing returns nothing
set ChapterIntermission = true
call SetSkyModel(SKY)
call CinematicModeBJ(true,bj_FORCE_ALL_PLAYERS)
call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUT, 0.,CINEM_MASK,0,0,0,0)
call DisplayAll("Control","Downloading files to your internal CPU")
call SuspendTimeOfDay(true)
call SetTimeOfDayScale(0.)
call SetFloatGameState(GAME_STATE_TIME_OF_DAY, 0.)
call QuestUnitGenerator()
call WallGenerator()
call TriggerSleepAction(0.5)
call PilotUnitGenerator()
call DestructableGenerator()
call TriggerSleepAction(0.5)
call DecorUnitGenerator()
call TriggerSleepAction(0.5)
call TreeGenerator()
call TriggerSleepAction(0.5)
call AddTavern()
call GroupEnumUnitsInRect(ENUM_GROUP,bj_mapInitialPlayableArea, Filter(function MakeWalkerSleep))
call GroupEnumUnitsInRect(ENUM_GROUP,bj_mapInitialPlayableArea,Filter(function ForceAddRaven))
call TriggerSleepAction(0.5)
call Cinematics()
//call InitializeGame()
endfunction
public function init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterTimerEvent(t, WAIT,false)
call TriggerAddAction(t,function Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
library TreeGenerator
globals
private constant integer TREE_ID = 'ATtr'
endglobals
private function AddTree takes real x, real y returns nothing
call CreateDestructable(TREE_ID,x,y,GetRandomReal(0.,360.),GetRandomReal(1.25,2.),GetRandomInt(0,4))
endfunction
function TreeGenerator takes nothing returns nothing
call AddTree(-8320.,-13952.)
call AddTree(-5824.,-13888.)
call AddTree(-5440.,-13952.)
call AddTree(-3072.,-13888.)
call AddTree(-1152.,-13952.)
call AddTree(-64.,-13952.)
call AddTree(1728.,-13952.)
call AddTree(2176.,-13952.)
call AddTree(2688.,-13888.)
call AddTree(4608.,-13888.)
call AddTree(7296.,-13888.)
call AddTree(8192.,-14016.)
call AddTree(8640.,-13952.)
call AddTree(-13696.,-13760.)
call AddTree(-11840.,-13696.)
call AddTree(-11392.,-13632.)
call AddTree(-9920.,-13760.)
call AddTree(-9088.,-13696.)
call AddTree(-8704.,-13632.)
call AddTree(-5632.,-13824.)
call AddTree(-4672.,-13632.)
call AddTree(-4608.,-13760.)
call AddTree(-4096.,-13632.)
call AddTree(-3584.,-13760.)
call AddTree(-2624.,-13824.)
call AddTree(-704.,-13824.)
call AddTree(704.,-13760.)
call AddTree(3264.,-13696.)
call AddTree(3456.,-13824.)
call AddTree(3776.,-13696.)
call AddTree(4224.,-13760.)
call AddTree(5504.,-13696.)
call AddTree(5888.,-13696.)
call AddTree(6336.,-13824.)
call AddTree(6656.,-13696.)
call AddTree(6976.,-13632.)
call AddTree(6912.,-13824.)
call AddTree(7872.,-13824.)
call AddTree(8384.,-13824.)
call AddTree(11264.,-13632.)
call AddTree(13696.,-13824.)
call AddTree(14016.,-13632.)
call AddTree(-13504.,-13504.)
call AddTree(-12288.,-13568.)
call AddTree(-11456.,-13504.)
call AddTree(-10816.,-13568.)
call AddTree(-7872.,-13376.)
call AddTree(-7616.,-13504.)
call AddTree(-7360.,-13504.)
call AddTree(-7424.,-13376.)
call AddTree(-5440.,-13440.)
call AddTree(-5312.,-13568.)
call AddTree(-4160.,-13376.)
call AddTree(-3264.,-13440.)
call AddTree(-3264.,-13568.)
call AddTree(-2368.,-13568.)
call AddTree(-1856.,-13568.)
call AddTree(-512.,-13440.)
call AddTree(-192.,-13440.)
call AddTree(512.,-13376.)
call AddTree(3072.,-13568.)
call AddTree(4992.,-13376.)
call AddTree(5312.,-13440.)
call AddTree(11008.,-13376.)
call AddTree(13632.,-13504.)
call AddTree(13824.,-13568.)
call AddTree(-11968.,-13120.)
call AddTree(-10304.,-13248.)
call AddTree(-8192.,-13248.)
call AddTree(-5824.,-13312.)
call AddTree(-3968.,-13184.)
call AddTree(-3392.,-13120.)
call AddTree(-3200.,-13248.)
call AddTree(-3072.,-13184.)
call AddTree(-2624.,-13120.)
call AddTree(-2176.,-13120.)
call AddTree(-896.,-13248.)
call AddTree(0.,-13184.)
call AddTree(1984.,-13248.)
call AddTree(2240.,-13248.)
call AddTree(2496.,-13184.)
call AddTree(3392.,-13248.)
call AddTree(4096.,-13248.)
call AddTree(4352.,-13312.)
call AddTree(6528.,-13248.)
call AddTree(7104.,-13184.)
call AddTree(7552.,-13312.)
call AddTree(7808.,-13184.)
call AddTree(8128.,-13120.)
call AddTree(8960.,-13120.)
call AddTree(9216.,-13184.)
call AddTree(-13952.,-13056.)
call AddTree(-13952.,-12864.)
call AddTree(-13440.,-12864.)
call AddTree(-13184.,-12992.)
call AddTree(-6784.,-12992.)
call AddTree(-5760.,-12928.)
call AddTree(-5184.,-12992.)
call AddTree(-4928.,-12864.)
call AddTree(-4224.,-12928.)
call AddTree(-1984.,-12864.)
call AddTree(256.,-12864.)
call AddTree(4096.,-12928.)
call AddTree(5056.,-12864.)
call AddTree(5504.,-12992.)
call AddTree(6016.,-13056.)
call AddTree(6784.,-12928.)
call AddTree(7104.,-12928.)
call AddTree(7872.,-12864.)
call AddTree(10880.,-12928.)
call AddTree(11328.,-12992.)
call AddTree(13760.,-13056.)
call AddTree(-13952.,-12736.)
call AddTree(-13760.,-12800.)
call AddTree(-13504.,-12672.)
call AddTree(-12416.,-12736.)
call AddTree(-11840.,-12608.)
call AddTree(-10944.,-12800.)
call AddTree(-10624.,-12800.)
call AddTree(-7232.,-12608.)
call AddTree(-6528.,-12672.)
call AddTree(-5760.,-12672.)
call AddTree(-3968.,-12800.)
call AddTree(-4096.,-12608.)
call AddTree(-3520.,-12736.)
call AddTree(-3008.,-12608.)
call AddTree(-1408.,-12736.)
call AddTree(512.,-12672.)
call AddTree(1984.,-12672.)
call AddTree(2048.,-12800.)
call AddTree(2368.,-12672.)
call AddTree(3520.,-12800.)
call AddTree(3904.,-12608.)
call AddTree(4416.,-12608.)
call AddTree(7424.,-12608.)
call AddTree(7744.,-12736.)
call AddTree(8768.,-12736.)
call AddTree(9088.,-12672.)
call AddTree(9408.,-12800.)
call AddTree(11008.,-12736.)
call AddTree(13760.,-12800.)
call AddTree(-13824.,-12480.)
call AddTree(-12928.,-12416.)
call AddTree(-12608.,-12416.)
call AddTree(-10816.,-12544.)
call AddTree(-10560.,-12480.)
call AddTree(-10048.,-12352.)
call AddTree(-6720.,-12416.)
call AddTree(-4224.,-12480.)
call AddTree(-3840.,-12416.)
call AddTree(-3008.,-12480.)
call AddTree(-2560.,-12544.)
call AddTree(-2176.,-12352.)
call AddTree(0.,-12352.)
call AddTree(2944.,-12544.)
call AddTree(3904.,-12416.)
call AddTree(4352.,-12416.)
call AddTree(4800.,-12352.)
call AddTree(5376.,-12416.)
call AddTree(-13248.,-12288.)
call AddTree(-12480.,-12224.)
call AddTree(-12288.,-12096.)
call AddTree(-11648.,-12224.)
call AddTree(-11008.,-12224.)
call AddTree(-9472.,-12160.)
call AddTree(-5440.,-12288.)
call AddTree(-4992.,-12288.)
call AddTree(-4416.,-12288.)
call AddTree(-3456.,-12224.)
call AddTree(-1344.,-12288.)
call AddTree(2432.,-12224.)
call AddTree(3136.,-12096.)
call AddTree(8576.,-12288.)
call AddTree(8768.,-12224.)
call AddTree(8960.,-12224.)
call AddTree(9216.,-12224.)
call AddTree(10816.,-12096.)
call AddTree(11136.,-12096.)
call AddTree(13696.,-12096.)
call AddTree(-13312.,-11904.)
call AddTree(-11072.,-12032.)
call AddTree(-10944.,-11840.)
call AddTree(-10368.,-11840.)
call AddTree(-9408.,-11840.)
call AddTree(-8960.,-11968.)
call AddTree(-3264.,-12032.)
call AddTree(-2752.,-11904.)
call AddTree(-448.,-11968.)
call AddTree(448.,-11968.)
call AddTree(1728.,-11968.)
call AddTree(2752.,-12032.)
call AddTree(8320.,-12032.)
call AddTree(8256.,-11904.)
call AddTree(9088.,-12032.)
call AddTree(11328.,-11904.)
call AddTree(-13888.,-11712.)
call AddTree(-13184.,-11712.)
call AddTree(-12288.,-11584.)
call AddTree(-10816.,-11776.)
call AddTree(-8256.,-11648.)
call AddTree(-5184.,-11584.)
call AddTree(-3904.,-11584.)
call AddTree(-4096.,-11648.)
call AddTree(-1856.,-11584.)
call AddTree(128.,-11648.)
call AddTree(640.,-11712.)
call AddTree(2560.,-11648.)
call AddTree(3520.,-11648.)
call AddTree(4032.,-11712.)
call AddTree(4352.,-11648.)
call AddTree(4544.,-11712.)
call AddTree(5504.,-11712.)
call AddTree(8512.,-11648.)
call AddTree(8576.,-11776.)
call AddTree(9088.,-11776.)
call AddTree(10752.,-11712.)
call AddTree(-13568.,-11392.)
call AddTree(-11200.,-11520.)
call AddTree(-10368.,-11328.)
call AddTree(-9920.,-11456.)
call AddTree(-8960.,-11456.)
call AddTree(-4544.,-11520.)
call AddTree(-3392.,-11392.)
call AddTree(-2304.,-11520.)
call AddTree(-1600.,-11328.)
call AddTree(-320.,-11520.)
call AddTree(832.,-11328.)
call AddTree(2176.,-11392.)
call AddTree(2944.,-11328.)
call AddTree(4160.,-11456.)
call AddTree(4544.,-11520.)
call AddTree(5248.,-11520.)
call AddTree(5376.,-11456.)
call AddTree(8576.,-11392.)
call AddTree(9024.,-11456.)
call AddTree(11008.,-11392.)
call AddTree(-13504.,-11136.)
call AddTree(-12608.,-11072.)
call AddTree(-12352.,-11200.)
call AddTree(-11904.,-11136.)
call AddTree(-11328.,-11200.)
call AddTree(-10816.,-11072.)
call AddTree(-9920.,-11200.)
call AddTree(-9472.,-11072.)
call AddTree(-8576.,-11264.)
call AddTree(-8064.,-11200.)
call AddTree(-7616.,-11264.)
call AddTree(-7168.,-11200.)
call AddTree(-7168.,-11072.)
call AddTree(-3904.,-11200.)
call AddTree(-3072.,-11200.)
call AddTree(-2816.,-11072.)
call AddTree(-960.,-11072.)
call AddTree(-640.,-11072.)
call AddTree(-128.,-11136.)
call AddTree(320.,-11264.)
call AddTree(1088.,-11072.)
call AddTree(2496.,-11136.)
call AddTree(4352.,-11264.)
call AddTree(4608.,-11264.)
call AddTree(5312.,-11072.)
call AddTree(5248.,-11264.)
call AddTree(8704.,-11200.)
call AddTree(9216.,-11072.)
call AddTree(11456.,-11072.)
call AddTree(-9216.,-10816.)
call AddTree(-6720.,-10880.)
call AddTree(-1408.,-11008.)
call AddTree(512.,-11008.)
call AddTree(1152.,-10880.)
call AddTree(3072.,-10880.)
call AddTree(3392.,-10944.)
call AddTree(4480.,-10944.)
call AddTree(5184.,-10816.)
call AddTree(5376.,-10880.)
call AddTree(8384.,-10880.)
call AddTree(8896.,-10880.)
call AddTree(13760.,-10944.)
call AddTree(-13376.,-10560.)
call AddTree(-11520.,-10752.)
call AddTree(-10048.,-10752.)
call AddTree(-8640.,-10752.)
call AddTree(-7552.,-10624.)
call AddTree(-6976.,-10688.)
call AddTree(-6912.,-10560.)
call AddTree(-5952.,-10624.)
call AddTree(-2112.,-10624.)
call AddTree(-1536.,-10688.)
call AddTree(-640.,-10688.)
call AddTree(0.,-10752.)
call AddTree(2304.,-10624.)
call AddTree(2752.,-10688.)
call AddTree(2688.,-10560.)
call AddTree(5248.,-10560.)
call AddTree(8128.,-10624.)
call AddTree(8128.,-10752.)
call AddTree(9088.,-10624.)
call AddTree(9408.,-10624.)
call AddTree(9344.,-10752.)
call AddTree(-13824.,-10304.)
call AddTree(-13760.,-10432.)
call AddTree(-13056.,-10368.)
call AddTree(-10944.,-10368.)
call AddTree(-8256.,-10432.)
call AddTree(-6528.,-10368.)
call AddTree(-5696.,-10432.)
call AddTree(640.,-10368.)
call AddTree(1280.,-10496.)
call AddTree(2624.,-10432.)
call AddTree(2816.,-10496.)
call AddTree(3328.,-10496.)
call AddTree(4032.,-10368.)
call AddTree(4352.,-10432.)
call AddTree(4544.,-10496.)
call AddTree(5184.,-10432.)
call AddTree(8128.,-10304.)
call AddTree(8192.,-10496.)
call AddTree(9728.,-10496.)
call AddTree(10048.,-10496.)
call AddTree(10368.,-10432.)
call AddTree(-12864.,-10176.)
call AddTree(-11392.,-10112.)
call AddTree(-10368.,-10240.)
call AddTree(-9856.,-10176.)
call AddTree(-9024.,-10240.)
call AddTree(-8000.,-10240.)
call AddTree(-7744.,-10048.)
call AddTree(-6912.,-10240.)
call AddTree(-6656.,-10048.)
call AddTree(-5952.,-10048.)
call AddTree(-3520.,-10048.)
call AddTree(128.,-10240.)
call AddTree(1024.,-10176.)
call AddTree(2688.,-10240.)
call AddTree(2624.,-10112.)
call AddTree(3136.,-10240.)
call AddTree(3584.,-10240.)
call AddTree(4544.,-10240.)
call AddTree(4608.,-10112.)
call AddTree(5312.,-10240.)
call AddTree(5888.,-10176.)
call AddTree(6336.,-10048.)
call AddTree(6464.,-10048.)
call AddTree(7552.,-10176.)
call AddTree(7680.,-10048.)
call AddTree(8832.,-10240.)
call AddTree(13696.,-10176.)
call AddTree(-13184.,-9984.)
call AddTree(-10816.,-9920.)
call AddTree(-8256.,-9984.)
call AddTree(-7040.,-9984.)
call AddTree(-6912.,-9920.)
call AddTree(-6720.,-9856.)
call AddTree(-6592.,-9792.)
call AddTree(-5568.,-9984.)
call AddTree(-5120.,-9792.)
call AddTree(-4736.,-9984.)
call AddTree(-4544.,-9920.)
call AddTree(-4224.,-9984.)
call AddTree(-3008.,-9856.)
call AddTree(2816.,-9792.)
call AddTree(3008.,-9856.)
call AddTree(3904.,-9984.)
call AddTree(5376.,-9984.)
call AddTree(5824.,-9856.)
call AddTree(6016.,-9856.)
call AddTree(6208.,-9792.)
call AddTree(6400.,-9792.)
call AddTree(6656.,-9856.)
call AddTree(6848.,-9920.)
call AddTree(7936.,-9920.)
call AddTree(8192.,-9984.)
call AddTree(8768.,-9984.)
call AddTree(9216.,-9984.)
call AddTree(9600.,-9856.)
call AddTree(10176.,-9856.)
call AddTree(-13696.,-9728.)
call AddTree(-11712.,-9728.)
call AddTree(-10816.,-9664.)
call AddTree(-9920.,-9728.)
call AddTree(-9536.,-9600.)
call AddTree(-7552.,-9728.)
call AddTree(-6656.,-9600.)
call AddTree(-5824.,-9728.)
call AddTree(-5760.,-9536.)
call AddTree(-5632.,-9664.)
call AddTree(-4736.,-9536.)
call AddTree(-4096.,-9664.)
call AddTree(-3072.,-9728.)
call AddTree(-2176.,-9536.)
call AddTree(-1408.,-9536.)
call AddTree(-1088.,-9536.)
call AddTree(3136.,-9600.)
call AddTree(4096.,-9536.)
call AddTree(5248.,-9664.)
call AddTree(5568.,-9536.)
call AddTree(6592.,-9536.)
call AddTree(7040.,-9536.)
call AddTree(7296.,-9664.)
call AddTree(7744.,-9728.)
call AddTree(7680.,-9536.)
call AddTree(8768.,-9664.)
call AddTree(8960.,-9600.)
call AddTree(9408.,-9664.)
call AddTree(10048.,-9600.)
call AddTree(10496.,-9728.)
call AddTree(13632.,-9728.)
call AddTree(-13312.,-9472.)
call AddTree(-12864.,-9344.)
call AddTree(-10304.,-9472.)
call AddTree(-9984.,-9344.)
call AddTree(-8896.,-9472.)
call AddTree(-8064.,-9472.)
call AddTree(-7168.,-9280.)
call AddTree(-6720.,-9472.)
call AddTree(-5888.,-9344.)
call AddTree(-5440.,-9408.)
call AddTree(-5248.,-9472.)
call AddTree(-4992.,-9344.)
call AddTree(-4288.,-9280.)
call AddTree(-3712.,-9344.)
call AddTree(-2880.,-9344.)
call AddTree(-1664.,-9472.)
call AddTree(-1792.,-9408.)
call AddTree(-832.,-9344.)
call AddTree(-512.,-9280.)
call AddTree(3648.,-9408.)
call AddTree(6336.,-9408.)
call AddTree(6720.,-9408.)
call AddTree(7872.,-9408.)
call AddTree(8448.,-9280.)
call AddTree(8768.,-9472.)
call AddTree(9344.,-9344.)
call AddTree(13760.,-9280.)
call AddTree(-13632.,-9216.)
call AddTree(-13120.,-9216.)
call AddTree(-8384.,-9216.)
call AddTree(-5824.,-9216.)
call AddTree(-3328.,-9152.)
call AddTree(-2560.,-9088.)
call AddTree(-1408.,-9088.)
call AddTree(-896.,-9088.)
call AddTree(-256.,-9152.)
call AddTree(320.,-9088.)
call AddTree(1024.,-9152.)
call AddTree(3584.,-9088.)
call AddTree(3968.,-9152.)
call AddTree(5376.,-9024.)
call AddTree(6080.,-9088.)
call AddTree(6976.,-9088.)
call AddTree(7616.,-9024.)
call AddTree(8384.,-9024.)
call AddTree(8896.,-9024.)
call AddTree(9152.,-9024.)
call AddTree(9344.,-9152.)
call AddTree(9664.,-9216.)
call AddTree(13696.,-9024.)
call AddTree(-13440.,-8960.)
call AddTree(-8576.,-8960.)
call AddTree(-7552.,-8960.)
call AddTree(-7296.,-8896.)
call AddTree(-6912.,-8960.)
call AddTree(-6528.,-8832.)
call AddTree(-5440.,-8960.)
call AddTree(-5632.,-8768.)
call AddTree(-5312.,-8832.)
call AddTree(-5056.,-8960.)
call AddTree(-4736.,-8960.)
call AddTree(-3008.,-8832.)
call AddTree(-1152.,-8960.)
call AddTree(-832.,-8832.)
call AddTree(-448.,-8832.)
call AddTree(-256.,-8896.)
call AddTree(1408.,-8960.)
call AddTree(1792.,-8832.)
call AddTree(3136.,-8960.)
call AddTree(3648.,-8896.)
call AddTree(4352.,-8896.)
call AddTree(6656.,-8960.)
call AddTree(6912.,-8832.)
call AddTree(7232.,-8832.)
call AddTree(7488.,-8960.)
call AddTree(8192.,-8768.)
call AddTree(8576.,-8832.)
call AddTree(8640.,-8960.)
call AddTree(9024.,-8832.)
call AddTree(13632.,-8768.)
call AddTree(13824.,-8960.)
call AddTree(-13696.,-8704.)
call AddTree(-12928.,-8640.)
call AddTree(-11328.,-8576.)
call AddTree(-8640.,-8576.)
call AddTree(-8448.,-8512.)
call AddTree(-7552.,-8576.)
call AddTree(-7168.,-8704.)
call AddTree(-5888.,-8512.)
call AddTree(-4032.,-8704.)
call AddTree(-3392.,-8576.)
call AddTree(-384.,-8512.)
call AddTree(256.,-8640.)
call AddTree(704.,-8640.)
call AddTree(1088.,-8576.)
call AddTree(1472.,-8512.)
call AddTree(2048.,-8640.)
call AddTree(3840.,-8640.)
call AddTree(4032.,-8576.)
call AddTree(4224.,-8576.)
call AddTree(6208.,-8512.)
call AddTree(6528.,-8704.)
call AddTree(6720.,-8576.)
call AddTree(8000.,-8640.)
call AddTree(8384.,-8704.)
call AddTree(8960.,-8576.)
call AddTree(-13376.,-8384.)
call AddTree(-12928.,-8448.)
call AddTree(-13056.,-8320.)
call AddTree(-12928.,-8320.)
call AddTree(-6912.,-8448.)
call AddTree(-6656.,-8320.)
call AddTree(-5952.,-8384.)
call AddTree(-4224.,-8320.)
call AddTree(-832.,-8448.)
call AddTree(256.,-8384.)
call AddTree(896.,-8320.)
call AddTree(1728.,-8384.)
call AddTree(2176.,-8448.)
call AddTree(2496.,-8256.)
call AddTree(4544.,-8320.)
call AddTree(6592.,-8256.)
call AddTree(7360.,-8256.)
call AddTree(7616.,-8320.)
call AddTree(8640.,-8384.)
call AddTree(-9984.,-8064.)
call AddTree(-6656.,-8064.)
call AddTree(-5888.,-8064.)
call AddTree(-5632.,-8064.)
call AddTree(-5312.,-8064.)
call AddTree(-3712.,-8128.)
call AddTree(-3840.,-8000.)
call AddTree(-2432.,-8128.)
call AddTree(-1728.,-8000.)
call AddTree(-320.,-8192.)
call AddTree(1280.,-8192.)
call AddTree(1984.,-8064.)
call AddTree(2624.,-8000.)
call AddTree(4160.,-8000.)
call AddTree(6208.,-8064.)
call AddTree(6528.,-8000.)
call AddTree(8128.,-8192.)
call AddTree(8960.,-8064.)
call AddTree(13760.,-8000.)
call AddTree(13888.,-8192.)
call AddTree(-6720.,-7872.)
call AddTree(-6592.,-7872.)
call AddTree(-6016.,-7872.)
call AddTree(-4992.,-7872.)
call AddTree(-4672.,-7808.)
call AddTree(-4096.,-7872.)
call AddTree(-2688.,-7744.)
call AddTree(-2304.,-7744.)
call AddTree(-640.,-7808.)
call AddTree(-128.,-7808.)
call AddTree(448.,-7936.)
call AddTree(896.,-7872.)
call AddTree(1600.,-7936.)
call AddTree(4288.,-7808.)
call AddTree(4608.,-7872.)
call AddTree(5312.,-7808.)
call AddTree(5760.,-7808.)
call AddTree(5632.,-7872.)
call AddTree(6016.,-7936.)
call AddTree(7040.,-7744.)
call AddTree(7296.,-7936.)
call AddTree(7936.,-7872.)
call AddTree(8256.,-7872.)
call AddTree(-11328.,-7616.)
call AddTree(-9920.,-7552.)
call AddTree(-1984.,-7680.)
call AddTree(-1600.,-7488.)
call AddTree(5248.,-7552.)
call AddTree(5312.,-7680.)
call AddTree(6336.,-7680.)
call AddTree(6976.,-7552.)
call AddTree(7360.,-7616.)
call AddTree(7552.,-7552.)
call AddTree(8192.,-7488.)
call AddTree(8832.,-7552.)
call AddTree(13696.,-7488.)
call AddTree(-12992.,-7296.)
call AddTree(-5952.,-7296.)
call AddTree(-5568.,-7296.)
call AddTree(-5248.,-7296.)
call AddTree(-4992.,-7232.)
call AddTree(-4480.,-7296.)
call AddTree(-4160.,-7232.)
call AddTree(-2624.,-7360.)
call AddTree(-1920.,-7360.)
call AddTree(-704.,-7296.)
call AddTree(-192.,-7296.)
call AddTree(64.,-7296.)
call AddTree(384.,-7232.)
call AddTree(704.,-7232.)
call AddTree(896.,-7296.)
call AddTree(7680.,-7296.)
call AddTree(8192.,-7232.)
call AddTree(13888.,-7296.)
call AddTree(-13888.,-7104.)
call AddTree(-13504.,-7104.)
call AddTree(-13120.,-7040.)
call AddTree(-11264.,-7040.)
call AddTree(-9920.,-7040.)
call AddTree(-6720.,-7104.)
call AddTree(-6528.,-7040.)
call AddTree(-5312.,-6976.)
call AddTree(-4736.,-7040.)
call AddTree(-3648.,-7104.)
call AddTree(-2240.,-7168.)
call AddTree(-832.,-6976.)
call AddTree(5376.,-7040.)
call AddTree(5632.,-7040.)
call AddTree(5888.,-6976.)
call AddTree(6656.,-7168.)
call AddTree(7616.,-7168.)
call AddTree(8448.,-7104.)
call AddTree(-6848.,-6848.)
call AddTree(-6336.,-6720.)
call AddTree(-6016.,-6784.)
call AddTree(-4928.,-6848.)
call AddTree(-4736.,-6912.)
call AddTree(-4288.,-6912.)
call AddTree(-3840.,-6784.)
call AddTree(-448.,-6784.)
call AddTree(-64.,-6912.)
call AddTree(320.,-6912.)
call AddTree(704.,-6720.)
call AddTree(3456.,-6784.)
call AddTree(6208.,-6912.)
call AddTree(6784.,-6720.)
call AddTree(6976.,-6784.)
call AddTree(7424.,-6912.)
call AddTree(7744.,-6784.)
call AddTree(8000.,-6912.)
call AddTree(13696.,-6784.)
call AddTree(-13312.,-6464.)
call AddTree(-13056.,-6656.)
call AddTree(-11264.,-6656.)
call AddTree(-9920.,-6592.)
call AddTree(-7360.,-6592.)
call AddTree(-7232.,-6656.)
call AddTree(-7040.,-6592.)
call AddTree(-6656.,-6592.)
call AddTree(-6272.,-6592.)
call AddTree(-6336.,-6464.)
call AddTree(-5056.,-6656.)
call AddTree(-4480.,-6528.)
call AddTree(-4160.,-6464.)
call AddTree(-2752.,-6656.)
call AddTree(-1920.,-6592.)
call AddTree(-1472.,-6528.)
call AddTree(-1088.,-6656.)
call AddTree(2880.,-6592.)
call AddTree(3200.,-6656.)
call AddTree(3456.,-6592.)
call AddTree(3712.,-6656.)
call AddTree(5632.,-6528.)
call AddTree(6016.,-6464.)
call AddTree(7040.,-6528.)
call AddTree(7424.,-6656.)
call AddTree(7488.,-6528.)
call AddTree(-13696.,-6272.)
call AddTree(-12992.,-6272.)
call AddTree(-9920.,-6208.)
call AddTree(-8512.,-6272.)
call AddTree(-8064.,-6336.)
call AddTree(-7872.,-6336.)
call AddTree(-7616.,-6400.)
call AddTree(-7296.,-6400.)
call AddTree(-6464.,-6208.)
call AddTree(-6592.,-6336.)
call AddTree(-5568.,-6400.)
call AddTree(-4864.,-6400.)
call AddTree(-3712.,-6272.)
call AddTree(-2368.,-6336.)
call AddTree(-1984.,-6336.)
call AddTree(-1024.,-6208.)
call AddTree(-640.,-6272.)
call AddTree(-256.,-6208.)
call AddTree(384.,-6400.)
call AddTree(640.,-6400.)
call AddTree(2880.,-6272.)
call AddTree(3648.,-6336.)
call AddTree(3840.,-6336.)
call AddTree(4096.,-6336.)
call AddTree(6016.,-6272.)
call AddTree(7104.,-6208.)
call AddTree(7424.,-6400.)
call AddTree(13696.,-6336.)
call AddTree(-13184.,-6144.)
call AddTree(-11264.,-6144.)
call AddTree(-8256.,-6144.)
call AddTree(-8384.,-6016.)
call AddTree(-7872.,-6016.)
call AddTree(-7424.,-5952.)
call AddTree(-6976.,-6144.)
call AddTree(-6528.,-6080.)
call AddTree(-5440.,-6144.)
call AddTree(-4672.,-6144.)
call AddTree(-4480.,-5952.)
call AddTree(-3904.,-6016.)
call AddTree(-2752.,-5952.)
call AddTree(-2432.,-5952.)
call AddTree(-1088.,-5952.)
call AddTree(2944.,-6080.)
call AddTree(3264.,-5952.)
call AddTree(3712.,-5952.)
call AddTree(3584.,-5952.)
call AddTree(6464.,-6144.)
call AddTree(-13184.,-5824.)
call AddTree(-8576.,-5824.)
call AddTree(-8128.,-5696.)
call AddTree(-6848.,-5760.)
call AddTree(-6528.,-5888.)
call AddTree(-5888.,-5824.)
call AddTree(-5504.,-5888.)
call AddTree(-3456.,-5760.)
call AddTree(-1600.,-5760.)
call AddTree(-1088.,-5824.)
call AddTree(-64.,-5696.)
call AddTree(128.,-5824.)
call AddTree(7168.,-5760.)
call AddTree(9280.,-5824.)
call AddTree(9600.,-5696.)
call AddTree(-13376.,-5632.)
call AddTree(-11264.,-5632.)
call AddTree(-8448.,-5440.)
call AddTree(-7936.,-5440.)
call AddTree(-5952.,-5632.)
call AddTree(-5184.,-5632.)
call AddTree(-4288.,-5504.)
call AddTree(-2112.,-5568.)
call AddTree(512.,-5440.)
call AddTree(1088.,-5632.)
call AddTree(1344.,-5440.)
call AddTree(1280.,-5568.)
call AddTree(1536.,-5504.)
call AddTree(1792.,-5504.)
call AddTree(2816.,-5504.)
call AddTree(4672.,-5440.)
call AddTree(4992.,-5568.)
call AddTree(8896.,-5504.)
call AddTree(-13568.,-5312.)
call AddTree(-13120.,-5312.)
call AddTree(-7168.,-5248.)
call AddTree(-6272.,-5248.)
call AddTree(-5952.,-5248.)
call AddTree(-5248.,-5248.)
call AddTree(-4864.,-5184.)
call AddTree(-3072.,-5376.)
call AddTree(-2496.,-5248.)
call AddTree(-2176.,-5312.)
call AddTree(-1216.,-5376.)
call AddTree(-512.,-5248.)
call AddTree(768.,-5248.)
call AddTree(1856.,-5312.)
call AddTree(2240.,-5376.)
call AddTree(2560.,-5312.)
call AddTree(5056.,-5184.)
call AddTree(5248.,-5376.)
call AddTree(-13056.,-4992.)
call AddTree(-12160.,-4992.)
call AddTree(-11264.,-5056.)
call AddTree(-9536.,-4928.)
call AddTree(-8960.,-4928.)
call AddTree(-8192.,-4992.)
call AddTree(-7872.,-4992.)
call AddTree(-7552.,-5120.)
call AddTree(-7360.,-4992.)
call AddTree(-6592.,-4992.)
call AddTree(-4672.,-4992.)
call AddTree(-4032.,-5120.)
call AddTree(-3712.,-5056.)
call AddTree(-3264.,-4928.)
call AddTree(-3072.,-5056.)
call AddTree(-2752.,-5056.)
call AddTree(-1728.,-5056.)
call AddTree(-1088.,-4928.)
call AddTree(-576.,-4992.)
call AddTree(-192.,-4928.)
call AddTree(1728.,-5120.)
call AddTree(4416.,-4992.)
call AddTree(5440.,-5120.)
call AddTree(5760.,-5120.)
call AddTree(9088.,-5120.)
call AddTree(9472.,-5056.)
call AddTree(-13184.,-4672.)
call AddTree(-12928.,-4736.)
call AddTree(-12608.,-4672.)
call AddTree(-12032.,-4736.)
call AddTree(-11648.,-4800.)
call AddTree(-11328.,-4736.)
call AddTree(-11072.,-4736.)
call AddTree(-9344.,-4800.)
call AddTree(-8448.,-4736.)
call AddTree(-6848.,-4672.)
call AddTree(-5696.,-4800.)
call AddTree(-5184.,-4736.)
call AddTree(-3392.,-4736.)
call AddTree(-1984.,-4736.)
call AddTree(-576.,-4864.)
call AddTree(1024.,-4800.)
call AddTree(1792.,-4672.)
call AddTree(1856.,-4800.)
call AddTree(2368.,-4864.)
call AddTree(6080.,-4672.)
call AddTree(8896.,-4672.)
call AddTree(8704.,-4864.)
call AddTree(9280.,-4736.)
call AddTree(-12672.,-4416.)
call AddTree(-11904.,-4480.)
call AddTree(-11584.,-4480.)
call AddTree(-11328.,-4608.)
call AddTree(-11264.,-4416.)
call AddTree(-10752.,-4416.)
call AddTree(-10048.,-4544.)
call AddTree(-10048.,-4416.)
call AddTree(-9856.,-4544.)
call AddTree(-9408.,-4608.)
call AddTree(-7552.,-4608.)
call AddTree(-6080.,-4544.)
call AddTree(-5184.,-4544.)
call AddTree(-4544.,-4544.)
call AddTree(-3712.,-4544.)
call AddTree(-2688.,-4416.)
call AddTree(-2368.,-4480.)
call AddTree(-1408.,-4608.)
call AddTree(0.,-4416.)
call AddTree(192.,-4608.)
call AddTree(448.,-4608.)
call AddTree(1216.,-4544.)
call AddTree(1984.,-4480.)
call AddTree(2240.,-4608.)
call AddTree(3648.,-4544.)
call AddTree(4032.,-4480.)
call AddTree(4416.,-4544.)
call AddTree(4864.,-4608.)
call AddTree(5184.,-4544.)
call AddTree(5568.,-4608.)
call AddTree(8832.,-4544.)
call AddTree(9536.,-4544.)
call AddTree(-13568.,-4352.)
call AddTree(-12160.,-4224.)
call AddTree(-11328.,-4288.)
call AddTree(-9664.,-4160.)
call AddTree(-9344.,-4352.)
call AddTree(-8896.,-4224.)
call AddTree(-8256.,-4352.)
call AddTree(-7808.,-4352.)
call AddTree(-7104.,-4160.)
call AddTree(-5056.,-4160.)
call AddTree(-4352.,-4288.)
call AddTree(-3008.,-4288.)
call AddTree(-2368.,-4224.)
call AddTree(-832.,-4352.)
call AddTree(704.,-4352.)
call AddTree(3392.,-4160.)
call AddTree(3840.,-4160.)
call AddTree(5632.,-4224.)
call AddTree(6464.,-4288.)
call AddTree(8896.,-4352.)
call AddTree(-12992.,-3904.)
call AddTree(-12800.,-4096.)
call AddTree(-12224.,-4032.)
call AddTree(-11968.,-4032.)
call AddTree(-11136.,-4096.)
call AddTree(-10816.,-4096.)
call AddTree(-10368.,-3968.)
call AddTree(-8640.,-4032.)
call AddTree(-8128.,-3904.)
call AddTree(-7936.,-4032.)
call AddTree(-6912.,-4032.)
call AddTree(-6016.,-4096.)
call AddTree(-4928.,-3968.)
call AddTree(-4224.,-4032.)
call AddTree(-3904.,-4096.)
call AddTree(-2752.,-3968.)
call AddTree(-2432.,-3968.)
call AddTree(-1728.,-3904.)
call AddTree(-1280.,-4096.)
call AddTree(192.,-4032.)
call AddTree(640.,-3968.)
call AddTree(960.,-4096.)
call AddTree(1216.,-4032.)
call AddTree(3648.,-3904.)
call AddTree(4224.,-3968.)
call AddTree(4992.,-4032.)
call AddTree(5952.,-3904.)
call AddTree(6976.,-3904.)
call AddTree(8960.,-4032.)
call AddTree(9408.,-3904.)
call AddTree(10752.,-3904.)
call AddTree(-13696.,-3712.)
call AddTree(-12864.,-3712.)
call AddTree(-13056.,-3776.)
call AddTree(-12352.,-3648.)
call AddTree(-12288.,-3840.)
call AddTree(-11904.,-3712.)
call AddTree(-11712.,-3648.)
call AddTree(-11328.,-3840.)
call AddTree(-11136.,-3840.)
call AddTree(-11200.,-3648.)
call AddTree(-10880.,-3712.)
call AddTree(-11008.,-3776.)
call AddTree(-11008.,-3648.)
call AddTree(-10368.,-3648.)
call AddTree(-10112.,-3840.)
call AddTree(-9472.,-3840.)
call AddTree(-8896.,-3648.)
call AddTree(-8704.,-3648.)
call AddTree(-7424.,-3712.)
call AddTree(-7232.,-3840.)
call AddTree(-6528.,-3840.)
call AddTree(-5056.,-3776.)
call AddTree(-4032.,-3648.)
call AddTree(-3712.,-3840.)
call AddTree(-2880.,-3776.)
call AddTree(-2496.,-3840.)
call AddTree(-2112.,-3712.)
call AddTree(-1280.,-3840.)
call AddTree(-320.,-3648.)
call AddTree(2752.,-3648.)
call AddTree(3968.,-3776.)
call AddTree(4096.,-3648.)
call AddTree(4672.,-3776.)
call AddTree(5312.,-3840.)
call AddTree(6464.,-3712.)
call AddTree(7424.,-3776.)
call AddTree(9152.,-3840.)
call AddTree(9600.,-3776.)
call AddTree(9984.,-3840.)
call AddTree(10304.,-3840.)
call AddTree(10752.,-3776.)
call AddTree(11136.,-3648.)
call AddTree(-13440.,-3392.)
call AddTree(-12928.,-3392.)
call AddTree(-12032.,-3392.)
call AddTree(-11456.,-3520.)
call AddTree(-10944.,-3456.)
call AddTree(-8512.,-3392.)
call AddTree(-8320.,-3520.)
call AddTree(-7680.,-3456.)
call AddTree(-6080.,-3520.)
call AddTree(-5632.,-3584.)
call AddTree(-5504.,-3392.)
call AddTree(-4288.,-3520.)
call AddTree(-3584.,-3520.)
call AddTree(-2624.,-3584.)
call AddTree(-1792.,-3392.)
call AddTree(448.,-3520.)
call AddTree(576.,-3456.)
call AddTree(896.,-3584.)
call AddTree(2496.,-3392.)
call AddTree(4480.,-3392.)
call AddTree(4864.,-3456.)
call AddTree(5632.,-3520.)
call AddTree(6016.,-3584.)
call AddTree(9600.,-3520.)
call AddTree(11392.,-3392.)
call AddTree(-13760.,-3200.)
call AddTree(-13248.,-3264.)
call AddTree(-12352.,-3264.)
call AddTree(-11136.,-3328.)
call AddTree(-10432.,-3200.)
call AddTree(-10240.,-3328.)
call AddTree(-9536.,-3136.)
call AddTree(-9024.,-3200.)
call AddTree(-8768.,-3200.)
call AddTree(-7744.,-3136.)
call AddTree(-7232.,-3200.)
call AddTree(-7424.,-3136.)
call AddTree(-6720.,-3328.)
call AddTree(-5824.,-3328.)
call AddTree(-3904.,-3136.)
call AddTree(-3456.,-3264.)
call AddTree(-2496.,-3328.)
call AddTree(-1216.,-3136.)
call AddTree(-448.,-3136.)
call AddTree(-512.,-3328.)
call AddTree(2496.,-3136.)
call AddTree(3648.,-3328.)
call AddTree(3904.,-3264.)
call AddTree(5312.,-3328.)
call AddTree(5568.,-3328.)
call AddTree(6208.,-3136.)
call AddTree(6592.,-3328.)
call AddTree(6912.,-3264.)
call AddTree(7360.,-3200.)
call AddTree(9728.,-3264.)
call AddTree(10240.,-3328.)
call AddTree(10688.,-3328.)
call AddTree(11200.,-3264.)
call AddTree(-13504.,-2944.)
call AddTree(-12800.,-2880.)
call AddTree(-12160.,-2880.)
call AddTree(-9984.,-2944.)
call AddTree(-8768.,-2944.)
call AddTree(-8000.,-3008.)
call AddTree(-3520.,-3008.)
call AddTree(-3328.,-3072.)
call AddTree(-2432.,-3072.)
call AddTree(-2112.,-2944.)
call AddTree(-1600.,-3072.)
call AddTree(-1216.,-3008.)
call AddTree(-1216.,-2880.)
call AddTree(-320.,-3072.)
call AddTree(448.,-3008.)
call AddTree(1472.,-2880.)
call AddTree(2368.,-3008.)
call AddTree(2752.,-2944.)
call AddTree(3520.,-3008.)
call AddTree(4544.,-2944.)
call AddTree(6016.,-3072.)
call AddTree(6336.,-2880.)
call AddTree(6912.,-2880.)
call AddTree(8000.,-2880.)
call AddTree(9856.,-3072.)
call AddTree(12480.,-2880.)
call AddTree(-13184.,-2688.)
call AddTree(-13312.,-2688.)
call AddTree(-12288.,-2688.)
call AddTree(-10816.,-2816.)
call AddTree(-9984.,-2688.)
call AddTree(-9344.,-2752.)
call AddTree(-9024.,-2816.)
call AddTree(-8256.,-2752.)
call AddTree(-6912.,-2816.)
call AddTree(-5376.,-2624.)
call AddTree(-4992.,-2624.)
call AddTree(-3072.,-2752.)
call AddTree(-1984.,-2752.)
call AddTree(-1728.,-2624.)
call AddTree(-960.,-2816.)
call AddTree(0.,-2752.)
call AddTree(896.,-2624.)
call AddTree(2944.,-2752.)
call AddTree(3776.,-2624.)
call AddTree(4672.,-2816.)
call AddTree(5248.,-2624.)
call AddTree(7296.,-2752.)
call AddTree(7616.,-2816.)
call AddTree(10048.,-2816.)
call AddTree(10368.,-2752.)
call AddTree(12224.,-2624.)
call AddTree(-12928.,-2432.)
call AddTree(-12672.,-2496.)
call AddTree(-9472.,-2496.)
call AddTree(-8704.,-2368.)
call AddTree(-8320.,-2432.)
call AddTree(-6016.,-2560.)
call AddTree(-2880.,-2432.)
call AddTree(-2560.,-2368.)
call AddTree(-704.,-2560.)
call AddTree(-512.,-2432.)
call AddTree(-128.,-2368.)
call AddTree(448.,-2432.)
call AddTree(2368.,-2368.)
call AddTree(4224.,-2368.)
call AddTree(4736.,-2368.)
call AddTree(5440.,-2560.)
call AddTree(5824.,-2432.)
call AddTree(5696.,-2560.)
call AddTree(9792.,-2368.)
call AddTree(12032.,-2432.)
call AddTree(13952.,-2560.)
call AddTree(-13632.,-2112.)
call AddTree(-12032.,-2304.)
call AddTree(-12032.,-2112.)
call AddTree(-10496.,-2176.)
call AddTree(-9536.,-2112.)
call AddTree(-8192.,-2304.)
call AddTree(-7488.,-2304.)
call AddTree(-4928.,-2240.)
call AddTree(-3072.,-2176.)
call AddTree(-2880.,-2304.)
call AddTree(-2304.,-2112.)
call AddTree(1344.,-2112.)
call AddTree(2816.,-2304.)
call AddTree(5184.,-2176.)
call AddTree(5440.,-2240.)
call AddTree(6848.,-2112.)
call AddTree(6976.,-2112.)
call AddTree(7104.,-2112.)
call AddTree(7296.,-2112.)
call AddTree(7552.,-2304.)
call AddTree(8000.,-2304.)
call AddTree(9728.,-2240.)
call AddTree(11200.,-2112.)
call AddTree(11520.,-2176.)
call AddTree(11776.,-2304.)
call AddTree(12352.,-2304.)
call AddTree(12288.,-2176.)
call AddTree(-12480.,-2048.)
call AddTree(-11392.,-1984.)
call AddTree(-10816.,-1920.)
call AddTree(-9856.,-1984.)
call AddTree(-8256.,-1920.)
call AddTree(-5696.,-1920.)
call AddTree(-2752.,-2048.)
call AddTree(-2624.,-1984.)
call AddTree(-2112.,-1920.)
call AddTree(448.,-1856.)
call AddTree(960.,-2048.)
call AddTree(2368.,-2048.)
call AddTree(2368.,-1920.)
call AddTree(2880.,-1984.)
call AddTree(3648.,-1920.)
call AddTree(4288.,-1984.)
call AddTree(6720.,-2048.)
call AddTree(7936.,-1984.)
call AddTree(11520.,-1984.)
call AddTree(11584.,-1856.)
call AddTree(11968.,-1856.)
call AddTree(12288.,-2048.)
call AddTree(13376.,-1920.)
call AddTree(13760.,-1920.)
call AddTree(-13760.,-1792.)
call AddTree(-13568.,-1664.)
call AddTree(-9280.,-1600.)
call AddTree(-9088.,-1792.)
call AddTree(-8960.,-1792.)
call AddTree(-8704.,-1664.)
call AddTree(-7552.,-1600.)
call AddTree(-6976.,-1792.)
call AddTree(-6080.,-1600.)
call AddTree(-5248.,-1792.)
call AddTree(-2304.,-1728.)
call AddTree(1088.,-1600.)
call AddTree(2624.,-1600.)
call AddTree(5120.,-1728.)
call AddTree(5568.,-1664.)
call AddTree(10432.,-1600.)
call AddTree(10688.,-1664.)
call AddTree(12736.,-1728.)
call AddTree(13248.,-1792.)
call AddTree(13952.,-1600.)
call AddTree(-9536.,-1408.)
call AddTree(-7872.,-1408.)
call AddTree(-7424.,-1536.)
call AddTree(-6400.,-1408.)
call AddTree(-4160.,-1408.)
call AddTree(-2240.,-1344.)
call AddTree(-1792.,-1536.)
call AddTree(-1472.,-1344.)
call AddTree(832.,-1536.)
call AddTree(3328.,-1536.)
call AddTree(5184.,-1472.)
call AddTree(9728.,-1344.)
call AddTree(10048.,-1408.)
call AddTree(11264.,-1408.)
call AddTree(13120.,-1472.)
call AddTree(-13184.,-1216.)
call AddTree(-12736.,-1216.)
call AddTree(-10304.,-1088.)
call AddTree(-9920.,-1216.)
call AddTree(-9664.,-1280.)
call AddTree(-7040.,-1280.)
call AddTree(-6144.,-1088.)
call AddTree(-5568.,-1280.)
call AddTree(-2624.,-1280.)
call AddTree(-2240.,-1088.)
call AddTree(-1600.,-1088.)
call AddTree(1024.,-1152.)
call AddTree(1344.,-1088.)
call AddTree(1536.,-1280.)
call AddTree(2496.,-1216.)
call AddTree(2496.,-1088.)
call AddTree(3008.,-1216.)
call AddTree(4608.,-1088.)
call AddTree(5248.,-1216.)
call AddTree(5632.,-1152.)
call AddTree(10432.,-1152.)
call AddTree(11136.,-1152.)
call AddTree(12288.,-1152.)
call AddTree(12736.,-1152.)
call AddTree(13952.,-1088.)
call AddTree(-13888.,-896.)
call AddTree(-13632.,-960.)
call AddTree(-12032.,-1024.)
call AddTree(-11712.,-960.)
call AddTree(-11776.,-832.)
call AddTree(-11136.,-960.)
call AddTree(-10048.,-832.)
call AddTree(-10048.,-960.)
call AddTree(-9856.,-832.)
call AddTree(-9728.,-1024.)
call AddTree(-8256.,-960.)
call AddTree(-8320.,-832.)
call AddTree(-7744.,-1024.)
call AddTree(-7680.,-832.)
call AddTree(-6784.,-960.)
call AddTree(-5760.,-896.)
call AddTree(-5376.,-832.)
call AddTree(-3072.,-832.)
call AddTree(-2880.,-960.)
call AddTree(-2624.,-960.)
call AddTree(-2240.,-896.)
call AddTree(-1856.,-1024.)
call AddTree(2624.,-960.)
call AddTree(5376.,-896.)
call AddTree(6144.,-832.)
call AddTree(7552.,-832.)
call AddTree(7744.,-832.)
call AddTree(9216.,-896.)
call AddTree(9984.,-896.)
call AddTree(10880.,-896.)
call AddTree(11904.,-896.)
call AddTree(12672.,-960.)
call AddTree(13248.,-1024.)
call AddTree(13184.,-832.)
call AddTree(-13760.,-704.)
call AddTree(-13440.,-704.)
call AddTree(-13184.,-640.)
call AddTree(-12800.,-576.)
call AddTree(-10496.,-704.)
call AddTree(-10240.,-640.)
call AddTree(-9344.,-704.)
call AddTree(-6144.,-768.)
call AddTree(-3776.,-704.)
call AddTree(-2048.,-704.)
call AddTree(-1792.,-640.)
call AddTree(-1408.,-576.)
call AddTree(1024.,-640.)
call AddTree(1536.,-576.)
call AddTree(2624.,-704.)
call AddTree(2816.,-576.)
call AddTree(3136.,-640.)
call AddTree(3392.,-576.)
call AddTree(3456.,-768.)
call AddTree(4480.,-576.)
call AddTree(5760.,-768.)
call AddTree(7296.,-704.)
call AddTree(7552.,-640.)
call AddTree(9536.,-768.)
call AddTree(11328.,-768.)
call AddTree(11904.,-704.)
call AddTree(13248.,-576.)
call AddTree(13952.,-640.)
call AddTree(-12224.,-448.)
call AddTree(-11904.,-384.)
call AddTree(-11264.,-384.)
call AddTree(-10688.,-448.)
call AddTree(-10368.,-512.)
call AddTree(-6528.,-448.)
call AddTree(-5888.,-448.)
call AddTree(-5440.,-512.)
call AddTree(-4864.,-512.)
call AddTree(-4160.,-448.)
call AddTree(-3328.,-448.)
call AddTree(-3008.,-448.)
call AddTree(-2368.,-448.)
call AddTree(1280.,-448.)
call AddTree(4800.,-448.)
call AddTree(5184.,-384.)
call AddTree(5952.,-512.)
call AddTree(6336.,-384.)
call AddTree(6592.,-384.)
call AddTree(9344.,-448.)
call AddTree(9792.,-448.)
call AddTree(10240.,-448.)
call AddTree(10624.,-512.)
call AddTree(11136.,-448.)
call AddTree(11904.,-512.)
call AddTree(12096.,-384.)
call AddTree(12672.,-384.)
call AddTree(12928.,-448.)
call AddTree(13824.,-448.)
call AddTree(-12672.,128.)
call AddTree(-12160.,192.)
call AddTree(-12032.,64.)
call AddTree(-11328.,192.)
call AddTree(-11008.,192.)
call AddTree(-10688.,192.)
call AddTree(-10560.,128.)
call AddTree(-10432.,192.)
call AddTree(-8960.,128.)
call AddTree(-8832.,192.)
call AddTree(-8640.,192.)
call AddTree(-8448.,192.)
call AddTree(-8128.,128.)
call AddTree(-7872.,192.)
call AddTree(-7680.,192.)
call AddTree(-6720.,128.)
call AddTree(-6592.,128.)
call AddTree(-6336.,128.)
call AddTree(-5504.,192.)
call AddTree(-4928.,128.)
call AddTree(-5056.,192.)
call AddTree(-4736.,128.)
call AddTree(-4416.,64.)
call AddTree(-4544.,192.)
call AddTree(-4224.,128.)
call AddTree(-3776.,192.)
call AddTree(-3520.,192.)
call AddTree(-3136.,128.)
call AddTree(-2944.,192.)
call AddTree(-2432.,128.)
call AddTree(-2176.,128.)
call AddTree(-1792.,128.)
call AddTree(3776.,192.)
call AddTree(4160.,128.)
call AddTree(4544.,192.)
call AddTree(4800.,192.)
call AddTree(5248.,192.)
call AddTree(6080.,128.)
call AddTree(6336.,128.)
call AddTree(6720.,128.)
call AddTree(8896.,192.)
call AddTree(9472.,128.)
call AddTree(9920.,192.)
call AddTree(10304.,192.)
call AddTree(10752.,128.)
call AddTree(11072.,192.)
call AddTree(11392.,192.)
call AddTree(12032.,128.)
call AddTree(12352.,192.)
call AddTree(12544.,128.)
call AddTree(12800.,192.)
call AddTree(13120.,192.)
call AddTree(13696.,128.)
call AddTree(-12608.,448.)
call AddTree(-12416.,320.)
call AddTree(-11264.,320.)
call AddTree(-10944.,448.)
call AddTree(-10560.,320.)
call AddTree(-10368.,320.)
call AddTree(-10496.,448.)
call AddTree(-10368.,448.)
call AddTree(-10240.,256.)
call AddTree(-9984.,256.)
call AddTree(-9344.,256.)
call AddTree(-9344.,384.)
call AddTree(-9152.,256.)
call AddTree(-9024.,256.)
call AddTree(-7424.,320.)
call AddTree(-7296.,320.)
call AddTree(-3200.,256.)
call AddTree(-3008.,448.)
call AddTree(-2624.,256.)
call AddTree(-2816.,320.)
call AddTree(1024.,320.)
call AddTree(1280.,256.)
call AddTree(1536.,320.)
call AddTree(1856.,256.)
call AddTree(2176.,256.)
call AddTree(2304.,448.)
call AddTree(3392.,256.)
call AddTree(3648.,448.)
call AddTree(5504.,448.)
call AddTree(6080.,384.)
call AddTree(6592.,448.)
call AddTree(8576.,384.)
call AddTree(9216.,448.)
call AddTree(12416.,448.)
call AddTree(12608.,448.)
call AddTree(13440.,256.)
call AddTree(-11648.,704.)
call AddTree(-11456.,512.)
call AddTree(-11200.,704.)
call AddTree(-11008.,576.)
call AddTree(-10432.,576.)
call AddTree(-10240.,704.)
call AddTree(-9408.,640.)
call AddTree(-9280.,576.)
call AddTree(-8896.,704.)
call AddTree(1536.,704.)
call AddTree(4224.,640.)
call AddTree(4544.,640.)
call AddTree(5184.,512.)
call AddTree(6272.,576.)
call AddTree(8384.,640.)
call AddTree(9664.,576.)
call AddTree(9984.,512.)
call AddTree(10432.,576.)
call AddTree(11072.,704.)
call AddTree(11392.,576.)
call AddTree(11904.,704.)
call AddTree(12928.,576.)
call AddTree(13184.,576.)
call AddTree(13760.,640.)
call AddTree(-12672.,832.)
call AddTree(-11648.,896.)
call AddTree(-11008.,960.)
call AddTree(-10752.,960.)
call AddTree(-10176.,832.)
call AddTree(-9088.,768.)
call AddTree(-3008.,960.)
call AddTree(1856.,960.)
call AddTree(3840.,832.)
call AddTree(4736.,896.)
call AddTree(5312.,832.)
call AddTree(6080.,832.)
call AddTree(8320.,768.)
call AddTree(9984.,896.)
call AddTree(12672.,832.)
call AddTree(12992.,896.)
call AddTree(13312.,960.)
call AddTree(13568.,960.)
call AddTree(-11520.,1088.)
call AddTree(-10240.,1088.)
call AddTree(-9344.,1216.)
call AddTree(-576.,1088.)
call AddTree(320.,1216.)
call AddTree(640.,1088.)
call AddTree(1216.,1024.)
call AddTree(1600.,1216.)
call AddTree(2368.,1024.)
call AddTree(4224.,1152.)
call AddTree(5056.,1088.)
call AddTree(5504.,1216.)
call AddTree(6016.,1024.)
call AddTree(9600.,1152.)
call AddTree(10112.,1152.)
call AddTree(11136.,1152.)
call AddTree(11456.,1088.)
call AddTree(11904.,1152.)
call AddTree(12288.,1024.)
call AddTree(13760.,1024.)
call AddTree(-12480.,1408.)
call AddTree(-11328.,1472.)
call AddTree(-11008.,1408.)
call AddTree(-10688.,1408.)
call AddTree(-10432.,1344.)
call AddTree(-10176.,1408.)
call AddTree(1280.,1472.)
call AddTree(2176.,1344.)
call AddTree(4672.,1408.)
call AddTree(-12288.,1728.)
call AddTree(-10816.,1664.)
call AddTree(-10432.,1600.)
call AddTree(-1856.,1664.)
call AddTree(448.,1664.)
call AddTree(896.,1600.)
call AddTree(1664.,1600.)
call AddTree(1984.,1664.)
call AddTree(3136.,1728.)
call AddTree(4288.,1728.)
call AddTree(4416.,1536.)
call AddTree(4992.,1536.)
call AddTree(5504.,1600.)
call AddTree(-11840.,1984.)
call AddTree(-11008.,1856.)
call AddTree(-10752.,1984.)
call AddTree(-10112.,1792.)
call AddTree(-10240.,1920.)
call AddTree(-1920.,1792.)
call AddTree(-1088.,1920.)
call AddTree(-320.,1792.)
call AddTree(704.,1920.)
call AddTree(1600.,1984.)
call AddTree(2816.,1792.)
call AddTree(4416.,1920.)
call AddTree(5376.,1856.)
call AddTree(-12416.,2176.)
call AddTree(-12032.,2048.)
call AddTree(-11648.,2112.)
call AddTree(-9536.,2112.)
call AddTree(-1536.,2112.)
call AddTree(-704.,2112.)
call AddTree(-192.,2048.)
call AddTree(1024.,2048.)
call AddTree(2624.,2112.)
call AddTree(3264.,2240.)
call AddTree(5312.,2176.)
call AddTree(5504.,2048.)
call AddTree(-11712.,2432.)
call AddTree(-11392.,2432.)
call AddTree(-10944.,2304.)
call AddTree(-10176.,2304.)
call AddTree(-9216.,2432.)
call AddTree(-1856.,2304.)
call AddTree(-1792.,2432.)
call AddTree(-1408.,2368.)
call AddTree(-1152.,2432.)
call AddTree(-640.,2432.)
call AddTree(-512.,2432.)
call AddTree(-256.,2368.)
call AddTree(512.,2368.)
call AddTree(1280.,2432.)
call AddTree(1728.,2432.)
call AddTree(2432.,2432.)
call AddTree(2944.,2368.)
call AddTree(4864.,2496.)
call AddTree(4992.,2304.)
call AddTree(6016.,2368.)
call AddTree(-13056.,2688.)
call AddTree(-12736.,2560.)
call AddTree(-12480.,2560.)
call AddTree(-11712.,2752.)
call AddTree(-10496.,2624.)
call AddTree(-10176.,2560.)
call AddTree(-10048.,2624.)
call AddTree(-9344.,2624.)
call AddTree(-1856.,2624.)
call AddTree(-1536.,2688.)
call AddTree(-1472.,2560.)
call AddTree(-832.,2560.)
call AddTree(704.,2624.)
call AddTree(1408.,2624.)
call AddTree(2368.,2688.)
call AddTree(5120.,2624.)
call AddTree(-14016.,2816.)
call AddTree(-13824.,2816.)
call AddTree(-13760.,3008.)
call AddTree(-12160.,2816.)
call AddTree(-11904.,2816.)
call AddTree(-10880.,2816.)
call AddTree(-10112.,3008.)
call AddTree(2304.,3008.)
call AddTree(3072.,2944.)
call AddTree(3520.,2880.)
call AddTree(4864.,2816.)
call AddTree(7296.,3008.)
call AddTree(-11072.,3072.)
call AddTree(-10816.,3200.)
call AddTree(-10432.,3072.)
call AddTree(-9984.,3264.)
call AddTree(-9408.,3072.)
call AddTree(-9088.,3200.)
call AddTree(-192.,3072.)
call AddTree(192.,3264.)
call AddTree(1600.,3264.)
call AddTree(1920.,3136.)
call AddTree(2688.,3136.)
call AddTree(3648.,3200.)
call AddTree(7488.,3200.)
call AddTree(-13952.,3328.)
call AddTree(-10176.,3392.)
call AddTree(-9408.,3392.)
call AddTree(-8960.,3392.)
call AddTree(-8704.,3520.)
call AddTree(-1536.,3456.)
call AddTree(-1152.,3328.)
call AddTree(-1088.,3520.)
call AddTree(-448.,3328.)
call AddTree(1344.,3456.)
call AddTree(2112.,3328.)
call AddTree(2368.,3456.)
call AddTree(7488.,3392.)
call AddTree(7808.,3328.)
call AddTree(-12864.,3584.)
call AddTree(-12672.,3584.)
call AddTree(-12416.,3648.)
call AddTree(-12224.,3648.)
call AddTree(-11904.,3712.)
call AddTree(-10880.,3712.)
call AddTree(-10752.,3712.)
call AddTree(-10112.,3712.)
call AddTree(-9344.,3648.)
call AddTree(-8960.,3776.)
call AddTree(-1856.,3584.)
call AddTree(-1088.,3648.)
call AddTree(-128.,3648.)
call AddTree(192.,3648.)
call AddTree(0.,3648.)
call AddTree(320.,3776.)
call AddTree(2176.,3584.)
call AddTree(3072.,3712.)
call AddTree(3712.,3712.)
call AddTree(4800.,3648.)
call AddTree(-12672.,3904.)
call AddTree(-12224.,3840.)
call AddTree(-12032.,3968.)
call AddTree(-11840.,3968.)
call AddTree(-11648.,3840.)
call AddTree(-10496.,3968.)
call AddTree(-8576.,3840.)
call AddTree(-7936.,4032.)
call AddTree(-6784.,4032.)
call AddTree(384.,4032.)
call AddTree(1664.,3904.)
call AddTree(2752.,3904.)
call AddTree(3328.,3840.)
call AddTree(7104.,3968.)
call AddTree(7808.,3840.)
call AddTree(8064.,3904.)
call AddTree(8448.,4032.)
call AddTree(-12608.,4288.)
call AddTree(-12800.,4160.)
call AddTree(-11712.,4224.)
call AddTree(-10944.,4096.)
call AddTree(-10880.,4224.)
call AddTree(-10112.,4096.)
call AddTree(-9472.,4096.)
call AddTree(-8768.,4096.)
call AddTree(-8512.,4160.)
call AddTree(-7808.,4224.)
call AddTree(-7232.,4160.)
call AddTree(-5504.,4288.)
call AddTree(0.,4224.)
call AddTree(576.,4096.)
call AddTree(2240.,4224.)
call AddTree(2048.,4224.)
call AddTree(2496.,4224.)
call AddTree(3520.,4224.)
call AddTree(7232.,4096.)
call AddTree(9088.,4288.)
call AddTree(9664.,4288.)
call AddTree(10432.,4288.)
call AddTree(10944.,4224.)
call AddTree(11264.,4224.)
call AddTree(12096.,4224.)
call AddTree(12288.,4160.)
call AddTree(13312.,4224.)
call AddTree(13888.,4288.)
call AddTree(-14016.,4416.)
call AddTree(-12416.,4352.)
call AddTree(-12096.,4416.)
call AddTree(-12224.,4416.)
call AddTree(-11904.,4480.)
call AddTree(-10496.,4416.)
call AddTree(-10176.,4416.)
call AddTree(-9344.,4352.)
call AddTree(-8704.,4544.)
call AddTree(-8256.,4544.)
call AddTree(-7872.,4416.)
call AddTree(-7232.,4416.)
call AddTree(-7040.,4480.)
call AddTree(-4928.,4480.)
call AddTree(-2496.,4544.)
call AddTree(128.,4480.)
call AddTree(576.,4544.)
call AddTree(512.,4416.)
call AddTree(2752.,4544.)
call AddTree(7552.,4416.)
call AddTree(8000.,4352.)
call AddTree(8448.,4544.)
call AddTree(8704.,4544.)
call AddTree(9408.,4416.)
call AddTree(10560.,4352.)
call AddTree(11072.,4480.)
call AddTree(11712.,4352.)
call AddTree(11648.,4544.)
call AddTree(12608.,4416.)
call AddTree(13632.,4352.)
call AddTree(-10944.,4608.)
call AddTree(-10752.,4800.)
call AddTree(-10496.,4672.)
call AddTree(-10112.,4800.)
call AddTree(-9408.,4800.)
call AddTree(-9024.,4608.)
call AddTree(-7552.,4608.)
call AddTree(-7424.,4672.)
call AddTree(-6976.,4608.)
call AddTree(-6720.,4672.)
call AddTree(-5504.,4672.)
call AddTree(-5120.,4736.)
call AddTree(-2368.,4672.)
call AddTree(512.,4672.)
call AddTree(1600.,4672.)
call AddTree(1920.,4800.)
call AddTree(2432.,4800.)
call AddTree(2880.,4608.)
call AddTree(3264.,4672.)
call AddTree(9024.,4736.)
call AddTree(10048.,4672.)
call AddTree(11008.,4736.)
call AddTree(11328.,4800.)
call AddTree(12480.,4800.)
call AddTree(13248.,4672.)
call AddTree(13888.,4800.)
call AddTree(-13760.,4864.)
call AddTree(-13568.,4992.)
call AddTree(-12992.,4992.)
call AddTree(-10944.,4864.)
call AddTree(-10432.,4864.)
call AddTree(-10112.,4992.)
call AddTree(-9152.,4928.)
call AddTree(-8832.,4864.)
call AddTree(-7360.,4928.)
call AddTree(-7168.,5056.)
call AddTree(-6848.,4928.)
call AddTree(-4928.,5056.)
call AddTree(320.,4864.)
call AddTree(1600.,4992.)
call AddTree(2304.,5056.)
call AddTree(2560.,5056.)
call AddTree(2752.,5056.)
call AddTree(3008.,4992.)
call AddTree(3264.,5056.)
call AddTree(3136.,4928.)
call AddTree(7808.,5056.)
call AddTree(8064.,5056.)
call AddTree(9344.,4928.)
call AddTree(9664.,5056.)
call AddTree(10496.,5056.)
call AddTree(-13632.,5120.)
call AddTree(-12608.,5120.)
call AddTree(-12544.,5248.)
call AddTree(-12480.,5120.)
call AddTree(-12032.,5312.)
call AddTree(-11840.,5248.)
call AddTree(-11392.,5184.)
call AddTree(-10240.,5120.)
call AddTree(-9472.,5120.)
call AddTree(-9152.,5312.)
call AddTree(-8768.,5120.)
call AddTree(-7360.,5120.)
call AddTree(-5440.,5120.)
call AddTree(256.,5312.)
call AddTree(1280.,5312.)
call AddTree(1600.,5120.)
call AddTree(3008.,5120.)
call AddTree(7040.,5184.)
call AddTree(7424.,5312.)
call AddTree(8704.,5312.)
call AddTree(10368.,5312.)
call AddTree(10368.,5184.)
call AddTree(-11264.,5440.)
call AddTree(-10688.,5376.)
call AddTree(-10688.,5504.)
call AddTree(-10496.,5440.)
call AddTree(-7168.,5440.)
call AddTree(-5248.,5504.)
call AddTree(-4992.,5440.)
call AddTree(-2560.,5376.)
call AddTree(-2240.,5504.)
call AddTree(384.,5504.)
call AddTree(576.,5568.)
call AddTree(1216.,5440.)
call AddTree(1280.,5568.)
call AddTree(2304.,5440.)
call AddTree(2560.,5440.)
call AddTree(2816.,5440.)
call AddTree(2944.,5376.)
call AddTree(7744.,5504.)
call AddTree(8000.,5504.)
call AddTree(8192.,5504.)
call AddTree(9408.,5568.)
call AddTree(10048.,5440.)
call AddTree(-11008.,5824.)
call AddTree(-10048.,5760.)
call AddTree(-9408.,5824.)
call AddTree(-9152.,5696.)
call AddTree(-6656.,5632.)
call AddTree(-4672.,5632.)
call AddTree(-1600.,5824.)
call AddTree(-1728.,5696.)
call AddTree(448.,5696.)
call AddTree(1280.,5760.)
call AddTree(1536.,5760.)
call AddTree(5504.,5824.)
call AddTree(5824.,5824.)
call AddTree(6528.,5760.)
call AddTree(8512.,5632.)
call AddTree(9984.,5760.)
call AddTree(-10304.,6016.)
call AddTree(-9344.,6080.)
call AddTree(-8896.,5952.)
call AddTree(-8576.,5888.)
call AddTree(-8128.,6080.)
call AddTree(-7488.,6016.)
call AddTree(-7104.,6016.)
call AddTree(-5504.,5888.)
call AddTree(-5568.,6080.)
call AddTree(-5248.,6016.)
call AddTree(-3392.,6080.)
call AddTree(-2560.,5952.)
call AddTree(576.,6016.)
call AddTree(1472.,6080.)
call AddTree(1984.,5888.)
call AddTree(5312.,5888.)
call AddTree(5312.,6016.)
call AddTree(5632.,6016.)
call AddTree(5760.,5952.)
call AddTree(6464.,5888.)
call AddTree(8960.,5952.)
call AddTree(12608.,6080.)
call AddTree(12864.,5952.)
call AddTree(12800.,6080.)
call AddTree(13184.,6016.)
call AddTree(13440.,6080.)
call AddTree(-10304.,6336.)
call AddTree(-9984.,6144.)
call AddTree(-7808.,6144.)
call AddTree(-6784.,6272.)
call AddTree(-5568.,6336.)
call AddTree(-3968.,6272.)
call AddTree(-2624.,6336.)
call AddTree(-2304.,6336.)
call AddTree(-1984.,6144.)
call AddTree(192.,6336.)
call AddTree(1408.,6208.)
call AddTree(1920.,6336.)
call AddTree(5312.,6144.)
call AddTree(5440.,6208.)
call AddTree(5632.,6272.)
call AddTree(5760.,6336.)
call AddTree(6848.,6336.)
call AddTree(6912.,6208.)
call AddTree(7040.,6208.)
call AddTree(7360.,6144.)
call AddTree(7360.,6272.)
call AddTree(9792.,6336.)
call AddTree(12736.,6208.)
call AddTree(13120.,6208.)
call AddTree(13696.,6144.)
call AddTree(13952.,6336.)
call AddTree(13824.,6144.)
call AddTree(-14016.,6592.)
call AddTree(-13952.,6400.)
call AddTree(-13696.,6464.)
call AddTree(-13312.,6400.)
call AddTree(-13120.,6400.)
call AddTree(-12672.,6592.)
call AddTree(-12800.,6592.)
call AddTree(-10112.,6592.)
call AddTree(-9408.,6464.)
call AddTree(-9024.,6464.)
call AddTree(-8704.,6592.)
call AddTree(-7872.,6528.)
call AddTree(-7360.,6528.)
call AddTree(-6592.,6592.)
call AddTree(-5440.,6592.)
call AddTree(-4928.,6464.)
call AddTree(-4416.,6464.)
call AddTree(-3840.,6464.)
call AddTree(-3328.,6592.)
call AddTree(-3072.,6400.)
call AddTree(1408.,6400.)
call AddTree(1600.,6528.)
call AddTree(1728.,6528.)
call AddTree(2176.,6528.)
call AddTree(7040.,6400.)
call AddTree(7936.,6592.)
call AddTree(8512.,6464.)
call AddTree(9344.,6464.)
call AddTree(9536.,6528.)
call AddTree(12992.,6464.)
call AddTree(13248.,6528.)
call AddTree(13376.,6400.)
call AddTree(13568.,6464.)
call AddTree(13888.,6464.)
call AddTree(-13888.,6784.)
call AddTree(-13376.,6784.)
call AddTree(-12992.,6784.)
call AddTree(-12544.,6848.)
call AddTree(-9216.,6720.)
call AddTree(-8832.,6784.)
call AddTree(-6912.,6720.)
call AddTree(-3264.,6848.)
call AddTree(-2688.,6784.)
call AddTree(-2496.,6784.)
call AddTree(-1856.,6784.)
call AddTree(-1216.,6784.)
call AddTree(-192.,6720.)
call AddTree(-192.,6848.)
call AddTree(1600.,6720.)
call AddTree(1600.,6848.)
call AddTree(6144.,6848.)
call AddTree(7680.,6784.)
call AddTree(-13184.,6976.)
call AddTree(-13184.,7104.)
call AddTree(-12352.,7040.)
call AddTree(-12544.,7040.)
call AddTree(-12160.,6976.)
call AddTree(-11840.,7040.)
call AddTree(-11520.,7104.)
call AddTree(-11008.,6976.)
call AddTree(-9088.,7040.)
call AddTree(-8384.,6912.)
call AddTree(-1920.,6976.)
call AddTree(-768.,6976.)
call AddTree(-192.,6976.)
call AddTree(1472.,6912.)
call AddTree(3712.,6976.)
call AddTree(4032.,6976.)
call AddTree(4352.,6976.)
call AddTree(6400.,6912.)
call AddTree(6592.,6976.)
call AddTree(7424.,6912.)
call AddTree(-12864.,7168.)
call AddTree(-12864.,7360.)
call AddTree(-13056.,7360.)
call AddTree(-12096.,7232.)
call AddTree(-11328.,7232.)
call AddTree(-10816.,7168.)
call AddTree(-9344.,7296.)
call AddTree(-1984.,7168.)
call AddTree(3904.,7232.)
call AddTree(4800.,7360.)
call AddTree(7104.,7232.)
call AddTree(-12416.,7616.)
call AddTree(-11648.,7616.)
call AddTree(-9088.,7552.)
call AddTree(-7680.,7616.)
call AddTree(-6784.,7616.)
call AddTree(-5312.,7552.)
call AddTree(-1216.,7488.)
call AddTree(3328.,7552.)
call AddTree(3712.,7552.)
call AddTree(4160.,7616.)
call AddTree(10624.,7616.)
call AddTree(10752.,7552.)
call AddTree(-13120.,7808.)
call AddTree(-12672.,7808.)
call AddTree(-12032.,7808.)
call AddTree(-11328.,7744.)
call AddTree(-10816.,7808.)
call AddTree(-7296.,7680.)
call AddTree(-7104.,7808.)
call AddTree(-4928.,7680.)
call AddTree(-3904.,7872.)
call AddTree(-3456.,7808.)
call AddTree(3008.,7680.)
call AddTree(5056.,7808.)
call AddTree(4864.,7744.)
call AddTree(8256.,7872.)
call AddTree(8512.,7680.)
call AddTree(8896.,7808.)
call AddTree(8768.,7680.)
call AddTree(9024.,7744.)
call AddTree(11008.,7744.)
call AddTree(-14016.,8000.)
call AddTree(-13312.,8128.)
call AddTree(-12480.,8128.)
call AddTree(-12544.,7936.)
call AddTree(-11584.,8128.)
call AddTree(-11392.,8128.)
call AddTree(-8000.,8128.)
call AddTree(-7680.,7936.)
call AddTree(-6592.,8000.)
call AddTree(-6400.,7936.)
call AddTree(-6016.,8064.)
call AddTree(-5056.,8128.)
call AddTree(-4224.,8000.)
call AddTree(-3712.,8000.)
call AddTree(-2624.,8128.)
call AddTree(-320.,8128.)
call AddTree(2752.,8000.)
call AddTree(3776.,8064.)
call AddTree(4352.,7936.)
call AddTree(4992.,8128.)
call AddTree(8512.,8064.)
call AddTree(8768.,8064.)
call AddTree(9152.,7936.)
call AddTree(8960.,8064.)
call AddTree(-13248.,8256.)
call AddTree(-12096.,8384.)
call AddTree(-11456.,8256.)
call AddTree(-11200.,8384.)
call AddTree(-11072.,8192.)
call AddTree(-10560.,8384.)
call AddTree(-8256.,8320.)
call AddTree(-7360.,8384.)
call AddTree(-3648.,8320.)
call AddTree(-3200.,8192.)
call AddTree(-2048.,8256.)
call AddTree(-448.,8256.)
call AddTree(2688.,8384.)
call AddTree(2880.,8384.)
call AddTree(3200.,8192.)
call AddTree(4032.,8256.)
call AddTree(4672.,8384.)
call AddTree(8384.,8384.)
call AddTree(8256.,8320.)
call AddTree(8192.,8192.)
call AddTree(8576.,8192.)
call AddTree(9792.,8320.)
call AddTree(-13120.,8512.)
call AddTree(-12800.,8512.)
call AddTree(-12544.,8448.)
call AddTree(-12160.,8512.)
call AddTree(-11968.,8640.)
call AddTree(-11904.,8512.)
call AddTree(-10944.,8512.)
call AddTree(-10304.,8448.)
call AddTree(-10112.,8576.)
call AddTree(-8512.,8576.)
call AddTree(-7936.,8576.)
call AddTree(-6336.,8448.)
call AddTree(-6080.,8576.)
call AddTree(-4416.,8512.)
call AddTree(-4096.,8576.)
call AddTree(-3008.,8640.)
call AddTree(-2432.,8576.)
call AddTree(-1472.,8576.)
call AddTree(1536.,8448.)
call AddTree(1792.,8640.)
call AddTree(1984.,8512.)
call AddTree(3008.,8640.)
call AddTree(3264.,8512.)
call AddTree(3520.,8640.)
call AddTree(4416.,8512.)
call AddTree(4736.,8512.)
call AddTree(4928.,8512.)
call AddTree(7360.,8576.)
call AddTree(9088.,8640.)
call AddTree(9344.,8448.)
call AddTree(9600.,8576.)
call AddTree(10048.,8576.)
call AddTree(-13760.,8704.)
call AddTree(-13376.,8704.)
call AddTree(-13568.,8768.)
call AddTree(-12608.,8704.)
call AddTree(-12544.,8896.)
call AddTree(-11584.,8704.)
call AddTree(-11392.,8768.)
call AddTree(-11392.,8896.)
call AddTree(-10368.,8704.)
call AddTree(-10112.,8896.)
call AddTree(-9280.,8832.)
call AddTree(-9152.,8768.)
call AddTree(-9024.,8832.)
call AddTree(-8832.,8704.)
call AddTree(-8320.,8896.)
call AddTree(-8320.,8768.)
call AddTree(-6784.,8768.)
call AddTree(-5696.,8832.)
call AddTree(-5312.,8896.)
call AddTree(-2688.,8896.)
call AddTree(-2176.,8896.)
call AddTree(-1344.,8832.)
call AddTree(1536.,8896.)
call AddTree(2496.,8704.)
call AddTree(3968.,8768.)
call AddTree(3840.,8896.)
call AddTree(4160.,8704.)
call AddTree(5696.,8832.)
call AddTree(5952.,8704.)
call AddTree(6656.,8832.)
call AddTree(7040.,8704.)
call AddTree(7616.,8768.)
call AddTree(9920.,8832.)
call AddTree(10112.,8896.)
call AddTree(-12416.,8960.)
call AddTree(-11072.,9152.)
call AddTree(-11264.,9088.)
call AddTree(-10816.,9152.)
call AddTree(-10624.,9024.)
call AddTree(-9344.,8960.)
call AddTree(-8640.,9152.)
call AddTree(-8256.,9152.)
call AddTree(-7168.,9088.)
call AddTree(-4352.,9024.)
call AddTree(-3968.,9088.)
call AddTree(-3584.,9024.)
call AddTree(-3072.,9024.)
call AddTree(-1600.,9024.)
call AddTree(896.,9024.)
call AddTree(1216.,9088.)
call AddTree(2112.,8960.)
call AddTree(2816.,9152.)
call AddTree(3520.,8960.)
call AddTree(4480.,9088.)
call AddTree(5632.,8960.)
call AddTree(6208.,9024.)
call AddTree(6144.,9152.)
call AddTree(6848.,9088.)
call AddTree(6720.,9088.)
call AddTree(6976.,8960.)
call AddTree(7616.,9088.)
call AddTree(7936.,8960.)
call AddTree(9024.,9152.)
call AddTree(8960.,8960.)
call AddTree(9344.,9088.)
call AddTree(9216.,9152.)
call AddTree(10624.,9088.)
call AddTree(-13696.,9344.)
call AddTree(-13440.,9408.)
call AddTree(-13312.,9408.)
call AddTree(-12864.,9344.)
call AddTree(-12096.,9216.)
call AddTree(-12224.,9344.)
call AddTree(-11840.,9408.)
call AddTree(-11072.,9344.)
call AddTree(-10816.,9344.)
call AddTree(-10240.,9344.)
call AddTree(-9344.,9344.)
call AddTree(-8896.,9344.)
call AddTree(-7680.,9216.)
call AddTree(-7680.,9344.)
call AddTree(-4928.,9280.)
call AddTree(640.,9344.)
call AddTree(1920.,9280.)
call AddTree(5312.,9408.)
call AddTree(5568.,9216.)
call AddTree(6336.,9408.)
call AddTree(6528.,9280.)
call AddTree(6784.,9216.)
call AddTree(7296.,9216.)
call AddTree(9600.,9408.)
call AddTree(9984.,9280.)
call AddTree(10432.,9216.)
call AddTree(10880.,9344.)
call AddTree(10752.,9216.)
call AddTree(-13632.,9600.)
call AddTree(-12672.,9536.)
call AddTree(-12544.,9472.)
call AddTree(-12096.,9600.)
call AddTree(-11904.,9664.)
call AddTree(-11648.,9536.)
call AddTree(-10880.,9600.)
call AddTree(-10880.,9472.)
call AddTree(-10624.,9472.)
call AddTree(-10496.,9536.)
call AddTree(-10432.,9664.)
call AddTree(-9088.,9664.)
call AddTree(-8256.,9536.)
call AddTree(-7936.,9664.)
call AddTree(-7936.,9472.)
call AddTree(-7552.,9600.)
call AddTree(-5248.,9536.)
call AddTree(-4544.,9600.)
call AddTree(-3456.,9472.)
call AddTree(-3008.,9600.)
call AddTree(-2624.,9600.)
call AddTree(-2368.,9600.)
call AddTree(-2048.,9536.)
call AddTree(192.,9664.)
call AddTree(384.,9536.)
call AddTree(512.,9600.)
call AddTree(1024.,9472.)
call AddTree(1344.,9536.)
call AddTree(5120.,9664.)
call AddTree(5248.,9664.)
call AddTree(5568.,9664.)
call AddTree(5824.,9664.)
call AddTree(5952.,9536.)
call AddTree(9152.,9536.)
call AddTree(9344.,9600.)
call AddTree(-13440.,9792.)
call AddTree(-13120.,9856.)
call AddTree(-11456.,9728.)
call AddTree(-10688.,9856.)
call AddTree(-10432.,9856.)
call AddTree(-9344.,9728.)
call AddTree(-8896.,9792.)
call AddTree(-8704.,9856.)
call AddTree(-8448.,9792.)
call AddTree(-6784.,9792.)
call AddTree(-5888.,9728.)
call AddTree(-5504.,9728.)
call AddTree(-5120.,9856.)
call AddTree(-4608.,9920.)
call AddTree(-3840.,9920.)
call AddTree(-3328.,9728.)
call AddTree(-1472.,9728.)
call AddTree(384.,9792.)
call AddTree(256.,9792.)
call AddTree(832.,9792.)
call AddTree(1664.,9856.)
call AddTree(4928.,9856.)
call AddTree(5376.,9792.)
call AddTree(5632.,9920.)
call AddTree(6080.,9728.)
call AddTree(7872.,9920.)
call AddTree(7744.,9920.)
call AddTree(7936.,9792.)
call AddTree(8320.,9920.)
call AddTree(9280.,9920.)
call AddTree(9728.,9920.)
call AddTree(10304.,9856.)
call AddTree(10944.,9728.)
call AddTree(11072.,9728.)
call AddTree(-13632.,9984.)
call AddTree(-13120.,10112.)
call AddTree(-7168.,10112.)
call AddTree(-6464.,10048.)
call AddTree(-3072.,10048.)
call AddTree(640.,10048.)
call AddTree(960.,9984.)
call AddTree(1280.,9984.)
call AddTree(4928.,9984.)
call AddTree(5184.,10112.)
call AddTree(7232.,10112.)
call AddTree(7360.,10048.)
call AddTree(7872.,10048.)
call AddTree(8384.,10176.)
call AddTree(9472.,10048.)
call AddTree(10432.,10176.)
call AddTree(11136.,9984.)
call AddTree(11008.,10048.)
call AddTree(11136.,10112.)
call AddTree(-13184.,10432.)
call AddTree(-12928.,10368.)
call AddTree(-13056.,10432.)
call AddTree(-10560.,10432.)
call AddTree(-7936.,10368.)
call AddTree(-7424.,10304.)
call AddTree(-6016.,10304.)
call AddTree(-5632.,10240.)
call AddTree(-4032.,10304.)
call AddTree(-3584.,10368.)
call AddTree(0.,10368.)
call AddTree(1856.,10368.)
call AddTree(8000.,10304.)
call AddTree(8192.,10304.)
call AddTree(9344.,10368.)
call AddTree(9344.,10240.)
call AddTree(9664.,10368.)
call AddTree(9728.,10240.)
call AddTree(-11904.,10624.)
call AddTree(-11776.,10624.)
call AddTree(-11456.,10624.)
call AddTree(-11328.,10624.)
call AddTree(-11008.,10624.)
call AddTree(-11008.,10496.)
call AddTree(-10752.,10496.)
call AddTree(-10176.,10560.)
call AddTree(-9792.,10688.)
call AddTree(-9664.,10560.)
call AddTree(-9280.,10496.)
call AddTree(-8896.,10560.)
call AddTree(-7744.,10496.)
call AddTree(-7040.,10560.)
call AddTree(-4928.,10560.)
call AddTree(-4224.,10688.)
call AddTree(-3904.,10624.)
call AddTree(-2816.,10688.)
call AddTree(-2304.,10624.)
call AddTree(0.,10560.)
call AddTree(7232.,10688.)
call AddTree(9728.,10496.)
call AddTree(10176.,10496.)
call AddTree(10752.,10560.)
call AddTree(10944.,10496.)
call AddTree(11008.,10624.)
call AddTree(-13824.,10752.)
call AddTree(-13504.,10944.)
call AddTree(-11968.,10944.)
call AddTree(-10624.,10816.)
call AddTree(-10368.,10816.)
call AddTree(-10176.,10816.)
call AddTree(-9280.,10944.)
call AddTree(-9408.,10880.)
call AddTree(-8960.,10752.)
call AddTree(-8320.,10752.)
call AddTree(-8000.,10752.)
call AddTree(-7616.,10816.)
call AddTree(-6656.,10816.)
call AddTree(-6336.,10880.)
call AddTree(-6016.,10816.)
call AddTree(-5376.,10752.)
call AddTree(-4672.,10752.)
call AddTree(-3584.,10816.)
call AddTree(6656.,10752.)
call AddTree(7872.,10816.)
call AddTree(8192.,10944.)
call AddTree(9216.,10944.)
call AddTree(9280.,10752.)
call AddTree(9984.,10816.)
call AddTree(11136.,10944.)
call AddTree(-13696.,11200.)
call AddTree(-11968.,11136.)
call AddTree(-11456.,11136.)
call AddTree(-11200.,11136.)
call AddTree(-9088.,11072.)
call AddTree(-7296.,11008.)
call AddTree(-5888.,11200.)
call AddTree(-384.,11200.)
call AddTree(3008.,11200.)
call AddTree(3584.,11200.)
call AddTree(4864.,11136.)
call AddTree(5120.,11072.)
call AddTree(8256.,11072.)
call AddTree(8960.,11136.)
call AddTree(9344.,11200.)
call AddTree(10304.,11200.)
call AddTree(-13760.,11328.)
call AddTree(-13824.,11456.)
call AddTree(-13504.,11392.)
call AddTree(-13184.,11392.)
call AddTree(-12928.,11264.)
call AddTree(-11968.,11328.)
call AddTree(-10624.,11264.)
call AddTree(-10112.,11392.)
call AddTree(-9728.,11264.)
call AddTree(-8896.,11264.)
call AddTree(-8512.,11392.)
call AddTree(-7936.,11264.)
call AddTree(-6848.,11328.)
call AddTree(-6144.,11392.)
call AddTree(-5376.,11328.)
call AddTree(-3072.,11392.)
call AddTree(-640.,11264.)
call AddTree(-512.,11264.)
call AddTree(2688.,11392.)
call AddTree(2688.,11264.)
call AddTree(3072.,11328.)
call AddTree(3392.,11456.)
call AddTree(4224.,11392.)
call AddTree(4608.,11264.)
call AddTree(4928.,11456.)
call AddTree(8896.,11456.)
call AddTree(9408.,11392.)
call AddTree(10752.,11392.)
call AddTree(-12928.,11520.)
call AddTree(-11712.,11648.)
call AddTree(-11392.,11584.)
call AddTree(-10944.,11648.)
call AddTree(-10496.,11584.)
call AddTree(-9280.,11584.)
call AddTree(-9024.,11648.)
call AddTree(-8832.,11584.)
call AddTree(-7168.,11648.)
call AddTree(-4800.,11648.)
call AddTree(-4416.,11712.)
call AddTree(-3520.,11584.)
call AddTree(-1024.,11584.)
call AddTree(-896.,11520.)
call AddTree(2688.,11520.)
call AddTree(2944.,11648.)
call AddTree(3968.,11712.)
call AddTree(4352.,11584.)
call AddTree(4608.,11584.)
call AddTree(5120.,11584.)
call AddTree(8960.,11712.)
call AddTree(9344.,11520.)
call AddTree(9792.,11520.)
call AddTree(10176.,11584.)
call AddTree(10432.,11584.)
call AddTree(11200.,11584.)
call AddTree(-13568.,11776.)
call AddTree(-12608.,11840.)
call AddTree(-12160.,11840.)
call AddTree(-8128.,11840.)
call AddTree(-5120.,11776.)
call AddTree(-3904.,11776.)
call AddTree(-1216.,11840.)
call AddTree(64.,11968.)
call AddTree(128.,11776.)
call AddTree(2688.,11840.)
call AddTree(3072.,11840.)
call AddTree(4096.,11904.)
call AddTree(4288.,11776.)
call AddTree(4352.,11904.)
call AddTree(4608.,11776.)
call AddTree(5120.,11904.)
call AddTree(8896.,11840.)
call AddTree(-13760.,12224.)
call AddTree(-12544.,12032.)
call AddTree(-12288.,12160.)
call AddTree(-11968.,12032.)
call AddTree(-11520.,12096.)
call AddTree(-10944.,12032.)
call AddTree(-10752.,12224.)
call AddTree(-10176.,12096.)
call AddTree(-9920.,12032.)
call AddTree(-9664.,12032.)
call AddTree(-8384.,12160.)
call AddTree(-4672.,12160.)
call AddTree(-4160.,12096.)
call AddTree(64.,12160.)
call AddTree(2560.,12224.)
call AddTree(3712.,12032.)
call AddTree(4096.,12096.)
call AddTree(5120.,12160.)
call AddTree(7360.,12224.)
call AddTree(7552.,12160.)
call AddTree(7488.,12032.)
call AddTree(7680.,12160.)
call AddTree(9088.,12160.)
call AddTree(-13376.,12352.)
call AddTree(-12800.,12416.)
call AddTree(-12608.,12480.)
call AddTree(-11328.,12288.)
call AddTree(-9408.,12352.)
call AddTree(-8000.,12288.)
call AddTree(-6336.,12480.)
call AddTree(64.,12288.)
call AddTree(2496.,12352.)
call AddTree(2752.,12288.)
call AddTree(3072.,12352.)
call AddTree(3648.,12288.)
call AddTree(4480.,12416.)
call AddTree(5056.,12416.)
call AddTree(5440.,12288.)
call AddTree(7808.,12416.)
call AddTree(9920.,12352.)
call AddTree(9792.,12352.)
call AddTree(10176.,12352.)
call AddTree(10496.,12288.)
call AddTree(10816.,12416.)
call AddTree(11008.,12352.)
call AddTree(-13696.,12608.)
call AddTree(-11520.,12544.)
call AddTree(-10880.,12736.)
call AddTree(-9088.,12544.)
call AddTree(-8448.,12672.)
call AddTree(-7296.,12736.)
call AddTree(-4288.,12672.)
call AddTree(-1152.,12736.)
call AddTree(320.,12736.)
call AddTree(1856.,12672.)
call AddTree(2496.,12736.)
call AddTree(2944.,12672.)
call AddTree(3776.,12672.)
call AddTree(5568.,12544.)
call AddTree(5952.,12608.)
call AddTree(9408.,12544.)
call AddTree(9600.,12736.)
call AddTree(10304.,12608.)
call AddTree(10688.,12544.)
call AddTree(-13696.,12928.)
call AddTree(-12800.,12928.)
call AddTree(-12224.,12864.)
call AddTree(-11328.,12928.)
call AddTree(-10944.,12992.)
call AddTree(-10816.,12992.)
call AddTree(-10432.,12992.)
call AddTree(-8832.,12992.)
call AddTree(-8512.,12800.)
call AddTree(-8000.,12864.)
call AddTree(-6464.,12992.)
call AddTree(-5696.,12928.)
call AddTree(-1216.,12992.)
call AddTree(-832.,12800.)
call AddTree(-320.,12992.)
call AddTree(448.,12864.)
call AddTree(704.,12800.)
call AddTree(1216.,12800.)
call AddTree(2176.,12864.)
call AddTree(2752.,12992.)
call AddTree(3520.,12928.)
call AddTree(3712.,12864.)
call AddTree(4096.,12864.)
call AddTree(6272.,12992.)
call AddTree(9024.,12800.)
call AddTree(9344.,12992.)
call AddTree(9344.,12800.)
call AddTree(11072.,12928.)
call AddTree(-13824.,13248.)
call AddTree(-13376.,13120.)
call AddTree(-13056.,13120.)
call AddTree(-12480.,13120.)
call AddTree(-11072.,13184.)
call AddTree(-11264.,13248.)
call AddTree(-10816.,13184.)
call AddTree(-9472.,13120.)
call AddTree(-9024.,13248.)
call AddTree(-9216.,13056.)
call AddTree(-8640.,13120.)
call AddTree(-8000.,13184.)
call AddTree(-7744.,13120.)
call AddTree(-6912.,13056.)
call AddTree(-5952.,13248.)
call AddTree(-1792.,13120.)
call AddTree(-1216.,13184.)
call AddTree(-832.,13248.)
call AddTree(-256.,13248.)
call AddTree(832.,13056.)
call AddTree(1344.,13184.)
call AddTree(1856.,13184.)
call AddTree(2496.,13184.)
call AddTree(3520.,13056.)
call AddTree(3840.,13248.)
call AddTree(4032.,13056.)
call AddTree(4544.,13056.)
call AddTree(4992.,13248.)
call AddTree(5312.,13056.)
call AddTree(5888.,13184.)
call AddTree(6592.,13248.)
call AddTree(8768.,13184.)
call AddTree(9152.,13184.)
call AddTree(10368.,13248.)
call AddTree(-11904.,13440.)
call AddTree(-9024.,13376.)
call AddTree(-9024.,13504.)
call AddTree(-4672.,13312.)
call AddTree(-2432.,13504.)
call AddTree(-1472.,13504.)
call AddTree(-704.,13312.)
call AddTree(-192.,13376.)
call AddTree(256.,13440.)
call AddTree(3520.,13312.)
call AddTree(3584.,13440.)
call AddTree(6272.,13504.)
call AddTree(6336.,13312.)
call AddTree(6784.,13376.)
call AddTree(8512.,13504.)
call AddTree(9664.,13376.)
call AddTree(10048.,13376.)
call AddTree(-13888.,13760.)
call AddTree(-13568.,13568.)
call AddTree(-13248.,13632.)
call AddTree(-12736.,13568.)
call AddTree(-12352.,13568.)
call AddTree(-12544.,13760.)
call AddTree(-10368.,13568.)
call AddTree(-10048.,13632.)
call AddTree(-9792.,13568.)
call AddTree(-9152.,13696.)
call AddTree(-8448.,13632.)
call AddTree(-2112.,13632.)
call AddTree(-1984.,13696.)
call AddTree(-1792.,13632.)
call AddTree(-1152.,13568.)
call AddTree(-640.,13568.)
call AddTree(-512.,13696.)
call AddTree(448.,13696.)
call AddTree(640.,13696.)
call AddTree(512.,13568.)
call AddTree(1152.,13760.)
call AddTree(1472.,13696.)
call AddTree(1344.,13696.)
call AddTree(1920.,13760.)
call AddTree(3456.,13760.)
call AddTree(4416.,13632.)
call AddTree(5248.,13568.)
call AddTree(6912.,13760.)
call AddTree(7040.,13632.)
call AddTree(7104.,13760.)
call AddTree(8256.,13696.)
call AddTree(9088.,13568.)
call AddTree(9408.,13632.)
call AddTree(-12992.,13888.)
call AddTree(-12352.,13888.)
call AddTree(-12544.,14016.)
call AddTree(-11648.,13952.)
call AddTree(-11776.,13952.)
call AddTree(-9152.,13824.)
call AddTree(2112.,13824.)
call AddTree(8448.,13824.)
call AddTree(9728.,14016.)
call AddTree(10240.,13824.)
call AddTree(10560.,13824.)
endfunction
endlibrary
//TESH.scrollpos=47
//TESH.alwaysfold=0
library DecorUnitGenerator
function DecorUnitGenerator takes nothing returns nothing
//Primary Observatory Tower
call CreateUnit(Player(15),'h00S',448.,11712.,269.)
call CreateUnit(Player(15),'h00S',4096.,10816.,269.)
call CreateUnit(Player(15),'h00S',448.,10752.,269.)
call CreateUnit(Player(15),'h00S',2368.,10368.,269.)
call CreateUnit(Player(15),'h00S',4032.,9600.,269.)
call CreateUnit(Player(15),'h00S',12288.,9600.,269.)
call CreateUnit(Player(15),'h00S',2368.,9600.,269.)
call CreateUnit(Player(15),'h00S',12224.,8448.,269.)
call CreateUnit(Player(15),'h00S',-576.,5952.,269.)
call CreateUnit(Player(15),'h00S',-512.,5312.,269.)
call CreateUnit(Player(15),'h00S',-1216.,4096.,269.)
call CreateUnit(Player(15),'h00S',-2048.,1280.,269.)
call CreateUnit(Player(15),'h00S',7168.,-1024.,269.)
call CreateUnit(Player(15),'h00S',-832.,-832.,269.)
call CreateUnit(Player(15),'h00S',576.,-832.,269.)
call CreateUnit(Player(15),'h00S',512.,576.,269.)
call CreateUnit(Player(15),'h00S',9920.,-4224.,269.)
call CreateUnit(Player(15),'h00S',10944.,-4224.,269.)
call CreateUnit(Player(15),'h00S',11968.,-4224.,269.)
call CreateUnit(Player(15),'h00S',13888.,-4288.,269.)
call CreateUnit(Player(15),'h00S',13888.,-5824.,269.)
call CreateUnit(Player(15),'h00S',9920.,-6528.,269.)
call CreateUnit(Player(15),'h00S',1024.,-6912.,269.)
call CreateUnit(Player(15),'h00S',2432.,-6912.,269.)
call CreateUnit(Player(15),'h00S',10816.,-7488.,269.)
call CreateUnit(Player(15),'h00S',6400.,-1792.,269.)
//Container
call CreateUnit(Player(15),'o01O',8274.,1146.,0.)
call CreateUnit(Player(15),'o01O',8269.,1062.,0.)
call CreateUnit(Player(15),'o01O',1044.,11759.,89.)
call CreateUnit(Player(15),'o01O',1285.,11759.,89.)
call CreateUnit(Player(15),'o01O',1538.,11767.,89.)
call CreateUnit(Player(15),'o01O',2051.,11756.,89.)
call CreateUnit(Player(15),'o01O',1803.,11785.,89.)
call CreateUnit(Player(15),'o01O',1549.,12282.,89.)
call CreateUnit(Player(15),'o01O',2061.,12271.,89.)
call CreateUnit(Player(15),'o01O',1026.,12304.,89.)
call CreateUnit(Player(15),'o01O',1295.,12318.,89.)
call CreateUnit(Player(15),'o01O',1826.,12298.,89.)
call CreateUnit(Player(15),'o01O',1014.,10749.,89.)
call CreateUnit(Player(15),'o01O',1538.,10727.,89.)
call CreateUnit(Player(15),'o01O',1793.,10738.,89.)
call CreateUnit(Player(15),'o01O',1268.,10756.,89.)
call CreateUnit(Player(15),'o01O',1024.,11282.,89.)
call CreateUnit(Player(15),'o01O',1285.,11285.,89.)
call CreateUnit(Player(15),'o01O',1795.,11276.,89.)
call CreateUnit(Player(15),'o01O',1548.,11260.,89.)
//Capsule
call CreateUnit(Player(15),'o01T',-4525.,-12598.,179.)
call CreateUnit(Player(15),'o01T',-13229.,-11318.,179.)
call CreateUnit(Player(15),'o01T',-4653.,-2166.,179.)
call CreateUnit(Player(15),'o01T',8019.,6025.,179.)
call CreateUnit(Player(15),'o01T',9939.,13193.,179.)
call CreateUnit(Player(15),'o01T',-5549.,11529.,179.)
//GW-Worker
call CreateUnit(Player(15),'n00P',12210.,9024.,0.)
//Teleporter Receptor
call CreateUnit(Player(15),'n004',7360.,-1728.,269.)
call CreateUnit(Player(15),'n004',7360.,-1472.,269.)
call CreateUnit(Player(15),'n004',7360.,-1216.,269.)
call CreateUnit(Player(15),'n004',7744.,-1472.,269.)
call CreateUnit(Player(15),'n004',-1472.,832.,269.)
//Energetic Structure
call CreateUnit(Player(15),'o02C',13802.,1431.,70.)
call CreateUnit(Player(15),'o02C',13795.,1700.,70.)
//Console
call CreateUnit(Player(15),'o01N',-1305.,5442.,76.)
call CreateUnit(Player(15),'o01N',8008.,5985.,269.)
call CreateUnit(Player(15),'o01N',-4541.,-12666.,269.)
call CreateUnit(Player(15),'o01N',-13240.,-11358.,269.)
call CreateUnit(Player(15),'o01N',-4664.,-2206.,269.)
call CreateUnit(Player(15),'o01N',7197.,-1593.,179.)
call CreateUnit(Player(15),'o01N',7191.,-1305.,179.)
call CreateUnit(Player(15),'o01N',-1504.,4669.,325.)
call CreateUnit(Player(15),'o01N',13738.,9775.,89.)
call CreateUnit(Player(15),'o01N',13739.,9735.,269.)
call CreateUnit(Player(15),'o01N',-5560.,11489.,269.)
call CreateUnit(Player(15),'o01N',9928.,13153.,269.)
//Factory
call CreateUnit(Player(15),'o02G',10678.,1054.,134.)
endfunction
endlibrary
//TESH.scrollpos=124
//TESH.alwaysfold=0
library DestructableGenerator
globals
integer array Barrel [3]
integer BarrelMax
endglobals
function DestructableGenerator takes nothing returns nothing
//Barrels
set Barrel[0] = 'LTbx'
set Barrel[1] = 'LTbr'
set Barrel[2] = 'LTbs'
set BarrelMax = 2
call CreateDestructable(Barrel[GetRandomInt(0,BarrelMax)],13764.,10079.,310.,0.5,1)
call CreateDestructable(Barrel[GetRandomInt(0,BarrelMax)],13746.,10138.,241.,0.5,1)
call CreateDestructable(Barrel[GetRandomInt(0,BarrelMax)],13810.,10138.,257.,0.5,1)
call CreateDestructable(Barrel[GetRandomInt(0,BarrelMax)],13776.,10216.,145.,0.5,1)
call CreateDestructable(Barrel[GetRandomInt(0,BarrelMax)],13999.,10069.,151.,0.5,1)
call CreateDestructable(Barrel[GetRandomInt(0,BarrelMax)],13954.,10072.,108.,0.5,1)
call CreateDestructable(Barrel[GetRandomInt(0,BarrelMax)],13909.,10072.,179.,0.5,1)
call CreateDestructable(Barrel[GetRandomInt(0,BarrelMax)],13837.,10069.,299.,0.5,1)
call CreateDestructable(Barrel[GetRandomInt(0,BarrelMax)],13883.,10126.,285.,0.5,1)
call CreateDestructable(Barrel[GetRandomInt(0,BarrelMax)],13934.,10131.,207.,0.5,1)
call CreateDestructable(Barrel[GetRandomInt(0,BarrelMax)],13997.,10121.,10.,0.5,1)
call CreateDestructable(Barrel[GetRandomInt(0,BarrelMax)],14008.,10216.,308.,0.5,1)
call CreateDestructable(Barrel[GetRandomInt(0,BarrelMax)],13917.,10214.,116.,0.5,1)
call CreateDestructable(Barrel[GetRandomInt(0,BarrelMax)],13838.,10219.,308.,0.5,1)
call CreateDestructable(Barrel[GetRandomInt(0,BarrelMax)],13024.,8058.,68.,0.5,1)
call CreateDestructable(Barrel[GetRandomInt(0,BarrelMax)],13040.,7984.,330.,0.5,1)
call CreateDestructable(Barrel[GetRandomInt(0,BarrelMax)],13054.,8030.,18.,0.5,1)
call CreateDestructable(Barrel[GetRandomInt(0,BarrelMax)],12988.,8033.,310.,0.5,1)
call CreateDestructable(Barrel[GetRandomInt(0,BarrelMax)],13076.,8051.,68.,0.5,1)
call CreateDestructable(Barrel[GetRandomInt(0,BarrelMax)],13097.,8015.,68.,0.5,1)
call CreateDestructable(Barrel[GetRandomInt(0,BarrelMax)],13108.,8083.,68.,0.5,1)
call CreateDestructable(Barrel[GetRandomInt(0,BarrelMax)],13122.,8026.,171.,0.5,1)
call CreateDestructable(Barrel[GetRandomInt(0,BarrelMax)],12261.,9277.,114.,0.5,1)
call CreateDestructable(Barrel[GetRandomInt(0,BarrelMax)],12225.,9292.,300.,0.5,1)
call CreateDestructable(Barrel[GetRandomInt(0,BarrelMax)],12216.,9332.,256.,0.5,1)
call CreateDestructable(Barrel[GetRandomInt(0,BarrelMax)],12249.,9382.,345.,0.5,1)
call CreateDestructable(Barrel[GetRandomInt(0,BarrelMax)],12199.,9394.,15.,0.5,1)
//Crates
call CreateDestructable('LTcr',5991.,-1328.,354.,0.5,GetRandomInt(0,1))
call CreateDestructable('LTcr',6016.,-1416.,333.,0.5,GetRandomInt(0,1))
call CreateDestructable('LTcr',6039.,-1366.,7.,0.5,GetRandomInt(0,1))
call CreateDestructable('LTcr',6128.,-1360.,247.,0.5,GetRandomInt(0,1))
call CreateDestructable('LTcr',6067.,-1315.,48.,0.5,GetRandomInt(0,1))
call CreateDestructable('LTcr',6124.,-1333.,273.,0.5,GetRandomInt(0,1))
call CreateDestructable('LTcr',5992.,-1349.,7.,0.5,GetRandomInt(0,1))
call CreateDestructable('LTcr',6058.,-1281.,38.,0.5,GetRandomInt(0,1))
call CreateDestructable('LTcr',6103.,-1263.,101.,0.5,GetRandomInt(0,1))
call CreateDestructable('LTcr',6028.,-1195.,301.,0.5,GetRandomInt(0,1))
call CreateDestructable('LTcr',6130.,-1220.,168.,0.5,GetRandomInt(0,1))
call CreateDestructable('LTcr',-1693.,4482.,1.,0.5,GetRandomInt(0,1))
call CreateDestructable('LTcr',-1785.,4584.,132.,0.5,GetRandomInt(0,1))
call CreateDestructable('LTcr',-1757.,4502.,195.,0.5,GetRandomInt(0,1))
call CreateDestructable('LTcr',-1754.,4423.,238.,0.5,GetRandomInt(0,1))
call CreateDestructable('LTcr',-1756.,4664.,2.,0.5,GetRandomInt(0,1))
call CreateDestructable('LTcr',13955.,8514.,1.,0.5,GetRandomInt(0,1))
call CreateDestructable('LTcr',13967.,8654.,60.,0.5,GetRandomInt(0,1))
call CreateDestructable('LTcr',14009.,8568.,132.,0.5,GetRandomInt(0,1))
call CreateDestructable('LTcr',13967.,8585.,2.,0.5,GetRandomInt(0,1))
call CreateDestructable('LTcr',13997.,8534.,195.,0.5,GetRandomInt(0,1))
call CreateDestructable('LTcr',14014.,8625.,238.,0.5,GetRandomInt(0,1))
call CreateDestructable('LTcr',13976.,8746.,104.,0.5,GetRandomInt(0,1))
//Military Building
call CreateDestructable('B001',11870.,-5540.,89.,1.,1)
call CreateDestructable('B001',11870.,-4997.,89.,1.,1)
call CreateDestructable('B001',6417.,-1109.,89.,1.,1)
call CreateDestructable('B001',8702.,1946.,89.,1.,1)
call CreateDestructable('B001',8697.,2153.,89.,1.,1)
call CreateDestructable('B001',9028.,2138.,89.,1.,1)
call CreateDestructable('B001',7503.,2463.,89.,1.,1)
call CreateDestructable('B001',13952.,9015.,0.,1.,1)
call CreateDestructable('B001',2944.,9681.,89.,1.,1)
call CreateDestructable('B001',3543.,9695.,89.,1.,1)
call CreateDestructable('B001',3539.,10368.,89.,1.,1)
//Deads ships
call CreateDestructable('B000',-7761.,-11909.,33.,3.,1)
call CreateDestructable('B000',7688.,-5569.,136.,3.,1)
//Building -House
call CreateDestructable('B002',-7474.,-8208.,221.,2.,1)
call CreateDestructable('B002',-7803.,-8176.,221.,2.,1)
call CreateDestructable('B002',-8371.,-7201.,355.,2.,1)
//City Building
call CreateDestructable('B003',8408.,2456.,89.,2.,1)
call CreateDestructable('B003',8894.,2446.,0.,2.,1)
call CreateDestructable('B003',9337.,2456.,89.,2.,1)
call CreateDestructable('B003',8390.,2021.,89.,2.,1)
call CreateDestructable('B003',10832.,2660.,179.,2.,1)
call CreateDestructable('B003',10138.,3484.,89.,2.,1)
call CreateDestructable('B003',10867.,3520.,89.,2.,1)
call CreateDestructable('B003',12707.,3545.,0.,2.,1)
call CreateDestructable('B003',13400.,3533.,89.,2.,1)
//Bench stone
call CreateDestructable('B004',-8261.,-8000.,0.,0.5,1)
//Crane
call CreateDestructable('B005',7159.,-10497.,248.,0.5,1)
call CreateDestructable('B005',6120.,-10477.,148.,0.5,1)
call CreateDestructable('B005',12738.,1446.,248.,0.5,1)
call CreateDestructable('B005',11900.,1803.,289.,0.5,1)
call CreateDestructable('B005',8099.,3785.,248.,0.5,1)
call CreateDestructable('B005',13438.,10170.,248.,0.5,1)
//Dead walkers
call CreateDestructable('B006',-5637.,-6269.,326.,0.6,1)
call CreateDestructable('B006',-2777.,-2688.,275.,0.6,1)
call CreateDestructable('B006',-12680.,10208.,88.,0.6,1)
call CreateDestructable('B006',-11272.,11165.,163.,0.6,1)
call CreateDestructable('B007',4930.,8046.,48.,0.4,1)
call CreateDestructable('B007',9217.,8426.,48.,0.4,1)
//Building - City Factory
call CreateDestructable('B008',7376.,3552.,306.,1.4,1)
//Building - City Workhouse
call CreateDestructable('B009',11503.,2688.,269.,1.4,1)
call CreateDestructable('B009',9314.,2084.,0.,1.4,1)
//Building - City Post
call CreateDestructable('B00A',7539.,1649.,0.,1.4,1)
call CreateDestructable('B00A',10134.,2651.,0.,1.4,1)
call CreateDestructable('B00A',12678.,2809.,179.,1.4,1)
//Building - City Garage
call CreateDestructable('B00B',10143.,1922.,89.,1.4,1)
//Building - City Foundry
call CreateDestructable('B00C',11547.,1927.,29.,2.,1)
//Building - City Great House
call CreateDestructable('B00D',11560.,3517.,269.,1.4,1)
call CreateDestructable('B00D',13500.,2816.,269.,1.4,1)
call CreateDestructable('B00D',10823.,1923.,269.,1.4,1)
//Building - Farm
call CreateDestructable('B00E',-8433.,-7946.,19.,2.,1)
//Building - Granary
call CreateDestructable('B00F',-7201.,-7251.,329.,2.,1)
//Building - Inn
call CreateDestructable('B00G',-7641.,-6976.,182.,2.,1)
endfunction
endlibrary
//TESH.scrollpos=1
//TESH.alwaysfold=0
library PilotUnitGenerator
function PilotUnitGenerator takes nothing returns nothing
//AW Titan
call CreateUnit(Player(15),'n010',12784.,-5595.,224.)
call CreateUnit(Player(15),'n010',12778.,-5090.,224.)
call CreateUnit(Player(15),'n010',12780.,-4567.,224.)
//Apache
call CreateUnit(Player(15),'n00Z',13291.,-5081.,224.)
call CreateUnit(Player(15),'n00Z',13313.,-4543.,224.)
//GW Transport
call CreateUnit(Player(15),'n01H',3105.,10835.,203.)
call CreateUnit(Player(15),'n01H',3362.,10837.,203.)
//Hurricane
call CreateUnit(Player(15),'h01G',1246.,-6251.,203.)
call CreateUnit(Player(15),'h01G',1246.,-6451.,203.)
//Humvee
call CreateUnit(Player(15),'n011',2200.,-6251.,203.)
call CreateUnit(Player(15),'n011',2200.,-6451.,203.)
call CreateUnit(Player(15),'n011',2200.,-6651.,203.)
call CreateUnit(Player(15),'n011',2200.,-6851.,203.)
call CreateUnit(Player(15),'n011',1900.,-6651.,203.)
call CreateUnit(Player(15),'n011',-2000.,1100.,203.)
call CreateUnit(Player(15),'n011',-2000.,600.,203.)
//Bradley
call CreateUnit(Player(15),'h01E',1700.,-6251.,203.)
call CreateUnit(Player(15),'h01E',1700.,-6451.,203.)
call CreateUnit(Player(15),'h01E',1700.,-6651.,203.)
//Shilka
call CreateUnit(Player(15),'h01F',1900.,-6251.,203.)
call CreateUnit(Player(15),'h01F',1900.,-6451.,203.)
endfunction
endlibrary
//TESH.scrollpos=60
//TESH.alwaysfold=0
library QuestUnitGenerator
globals
destructable MainGate
unit AirfieldChopper
unit AirfieldGenerator
unit array AirfieldPlane [3]
unit BarrackBunker
unit array EnergeticFactoryGenerator [4]
unit EntranceGenerator
unit ExternalOutpostCapsule
unit ExternalOutpostGenerator
unit MechBunker
unit MechFactory
unit array MechFrog [3]
unit array MechFury [3]
unit array MechSentry [3]
unit array MechWorker [3]
unit NukeReactor
unit array Ship [2]
unit array TeleporterReceptor [4]
unit WarehouseBunker
unit array Raptor [3]
endglobals
function QuestUnitGenerator takes nothing returns nothing
set MainGate = CreateDeadDestructable('DTg1',-12427.,11230.,0.,2.,1)
set AirfieldChopper = CreateUnit(Player(15),'n00B',13320.,-5529.,335.)
set AirfieldGenerator = CreateUnit(Player(15),'o02A',12517.,-6125.,335.)
set AirfieldPlane[0] = CreateUnit(Player(15),'n00M',10107.,-4490.,335.)
set AirfieldPlane[1] = CreateUnit(Player(15),'n00M',10107.,-5022.,335.)
set AirfieldPlane[2] = CreateUnit(Player(15),'n00M',10107.,-5500.,335.)
set BarrackBunker = CreateUnit(Player(15),'o00Y',2956.,10400.,GetRandomReal(0.,360.))
set EnergeticFactoryGenerator[0] = CreateUnit(Player(15),'o02B',7470.,-1165.,GetRandomReal(0.,360.))
set EnergeticFactoryGenerator[1] = CreateUnit(Player(15),'o02C',7480.,-1680.,GetRandomReal(0.,360.))
set EnergeticFactoryGenerator[2] = CreateUnit(Player(15),'o02D',7700.,-1450.,GetRandomReal(0.,360.))
set EnergeticFactoryGenerator[3] = CreateUnit(Player(15),'n004',7700.,-1450.,GetRandomReal(0.,360.))
set EntranceGenerator = CreateUnit(Player(15),'o035',-12520.,9780.,GetRandomReal(0.,360.))
set ExternalOutpostCapsule = CreateUnit(Player(15),'o01T',-1498.,1160.,GetRandomReal(0.,360.))
set ExternalOutpostGenerator = CreateUnit(Player(15),'o00C',0.,0.,GetRandomReal(0.,360.))
set MechBunker = CreateUnit(Player(15),'o00Y',6860.,-12100.,90.)
set Raptor[0] = CreateUnit(Player(15),'n013',10506.,-7105.,329.)
set Raptor[1] = CreateUnit(Player(15),'n013',10486.,-6608.,329.)
set Raptor[2] = CreateUnit(Player(15),'n013',10104.,-6053.,329.)
set MechFactory = CreateUnit(Player(15),'o02G',6230.,-13000.,GetRandomReal(0.,360.))
set MechFrog[0] = CreateUnit(Player(15),'n006',7450.,-10723.,GetRandomReal(0.,360.))
set MechFrog[1] = CreateUnit(Player(15),'n006',7450.,-11100.,GetRandomReal(0.,360.))
set MechFrog[2] = CreateUnit(Player(15),'n006',7450.,-11486.,GetRandomReal(0.,360.))
set MechFury[0] = CreateUnit(Player(15),'h001',5900.,-10723.,GetRandomReal(0.,360.))
set MechFury[1] = CreateUnit(Player(15),'h001',5900.,-11100.,GetRandomReal(0.,360.))
set MechFury[2] = CreateUnit(Player(15),'h001',5900.,-11486.,GetRandomReal(0.,360.))
set MechSentry[0] = CreateUnit(Player(15),'n00I',6430.,-10723.,GetRandomReal(0.,360.))
set MechSentry[1] = CreateUnit(Player(15),'n00I',6430.,-11100.,GetRandomReal(0.,360.))
set MechSentry[2] = CreateUnit(Player(15),'n00I',6430.,-11486.,GetRandomReal(0.,360.))
set MechWorker[0] = CreateUnit(Player(15),'n00P',6940.,-10723.,GetRandomReal(0.,360.))
set MechWorker[1] = CreateUnit(Player(15),'n00P',6940.,-11100.,GetRandomReal(0.,360.))
set MechWorker[2] = CreateUnit(Player(15),'n00P',6940.,-11486.,GetRandomReal(0.,360.))
set NukeReactor = CreateUnit(Player(15),'o02E',13141.,1782.,GetRandomReal(0.,360.))
set Ship[0] = CreateUnit(Player(15),'n00L',11891.,8447.,270.)
set Ship[1] = CreateUnit(Player(15),'n00L',13154.,10498.,90.)
set TeleporterReceptor[0] = CreateUnit(Player(15),'n004',-1344.,4736.,269.)
set TeleporterReceptor[1] = CreateUnit(Player(15),'n004',-1344.,5120.,269.)
set TeleporterReceptor[2] = CreateUnit(Player(15),'n004',-1344.,4928.,269.)
set TeleporterReceptor[3] = CreateUnit(Player(15),'n004',-1344.,5312.,269.)
set WarehouseBunker = CreateUnit(Player(15),'o00Y',1440.,-6874.,90.)
call SetUnitInvulnerable(AirfieldChopper,true)
call UnitAddAbility(AirfieldChopper,GARN)
call SetUnitInvulnerable(AirfieldGenerator,true)
call SetUnitInvulnerable(AirfieldPlane[0],true)
call SetUnitInvulnerable(AirfieldPlane[1],true)
call SetUnitInvulnerable(AirfieldPlane[2],true)
call SetUnitInvulnerable(BarrackBunker,true)
call SetUnitInvulnerable(EnergeticFactoryGenerator[0],true)
call SetUnitInvulnerable(EnergeticFactoryGenerator[1],true)
call SetUnitInvulnerable(EnergeticFactoryGenerator[2],true)
call SetUnitInvulnerable(EnergeticFactoryGenerator[3],true)
call SetUnitInvulnerable(EntranceGenerator,true)
call SetUnitInvulnerable(ExternalOutpostCapsule,true)
call SetUnitInvulnerable(ExternalOutpostGenerator,true)
call SetUnitFlyHeight(Raptor[0],0.,0.)
call SetUnitFlyHeight(Raptor[1],0.,0.)
call SetUnitFlyHeight(Raptor[2],0.,0.)
call SetUnitInvulnerable(Raptor[0],true)
call SetUnitInvulnerable(Raptor[1],true)
call SetUnitInvulnerable(Raptor[2],true)
call SetUnitInvulnerable(MechBunker,true)
call SetUnitInvulnerable(MechFactory,true)
call SetUnitInvulnerable(MechFrog[0],true)
call SetUnitInvulnerable(MechFrog[1],true)
call SetUnitInvulnerable(MechFrog[2],true)
call SetUnitInvulnerable(MechFury[0],true)
call SetUnitInvulnerable(MechFury[1],true)
call SetUnitInvulnerable(MechFury[2],true)
call SetUnitInvulnerable(MechSentry[0],true)
call SetUnitInvulnerable(MechSentry[1],true)
call SetUnitInvulnerable(MechSentry[2],true)
call SetUnitInvulnerable(MechWorker[0],true)
call SetUnitInvulnerable(MechWorker[1],true)
call SetUnitInvulnerable(MechWorker[2],true)
call SetUnitInvulnerable(NukeReactor,true)
call SetUnitInvulnerable(Ship[0],true)
call SetUnitInvulnerable(Ship[1],true)
call SetUnitInvulnerable(Tavern[0],true)
call SetUnitInvulnerable(Tavern[1],true)
call SetUnitInvulnerable(Tavern[2],true)
call SetUnitInvulnerable(WarehouseBunker,true)
//Secondary Generator
call SetUnitInvulnerable(CreateUnit(Player(15),'n00U',-4608.,-12608.,269.),true)
call SetUnitInvulnerable(CreateUnit(Player(15),'n00U',-13312.,-11328.,269.),true)
call SetUnitInvulnerable(CreateUnit(Player(15),'n00U',-4736.,-2176.,269.),true)
call SetUnitInvulnerable(CreateUnit(Player(15),'n00U',7936.,6016.,269.),true)
call SetUnitInvulnerable(CreateUnit(Player(15),'n00U',-5632.,11520.,269.),true)
call SetUnitInvulnerable(CreateUnit(Player(15),'n00U',9856.,13184.,269.),true)
//Primary Defensive Towers
call CreateUnit(Player(15),'o001',5696.,-12160.,269.)
call CreateUnit(Player(15),'o001',7808.,-12160.,269.)
call CreateUnit(Player(15),'o001',5696.,-11776.,269.)
call CreateUnit(Player(15),'o001',7808.,-11776.,269.)
call CreateUnit(Player(15),'o001',384.,-384.,269.)
call CreateUnit(Player(15),'o001',-896.,64.,269.)
call CreateUnit(Player(15),'o001',-320.,-896.,269.)
call CreateUnit(Player(15),'o001',64.,640.,269.)
call CreateUnit(Player(15),'o001',-704.,4160.,269.)
call CreateUnit(Player(15),'o001',12736.,8064.,269.)
call CreateUnit(Player(15),'o001',13440.,8064.,269.)
call CreateUnit(Player(15),'o001',12800.,10176.,269.)
call CreateUnit(Player(15),'o001',-12736.,11072.,269.)
call CreateUnit(Player(15),'o001',-12096.,11072.,269.)
//Emergency Teleportation Beacon
call SetUnitInvulnerable(CreateUnit(Player(15),'n00F',6464.,-12096.,269.),true)
call SetUnitInvulnerable(CreateUnit(Player(15),'n00F',12672.,-6208.,269.),true)
call SetUnitInvulnerable(CreateUnit(Player(15),'n00F',448.,448.,269.),true)
call SetUnitInvulnerable(CreateUnit(Player(15),'n00F',-768.,4416.,269.),true)
call SetUnitInvulnerable(CreateUnit(Player(15),'n00F',13824.,8704.,269.),true)
call SetUnitInvulnerable(CreateUnit(Player(15),'n00F',576.,12288.,269.),true)
//Primary Radar Tower
call SetUnitInvulnerable(CreateUnit(Player(15),'o00O',-8064.,5376.,269.),true)
call SetUnitInvulnerable(CreateUnit(Player(15),'o00O',5504.,-8448.,269.),true)
call SetUnitInvulnerable(CreateUnit(Player(15),'o00O',64.,-896.,269.),true)
call SetUnitInvulnerable(CreateUnit(Player(15),'o00O',-896.,-320.,269.),true)
call SetUnitInvulnerable(CreateUnit(Player(15),'o00O',576.,128.,269.),true)
call SetUnitInvulnerable(CreateUnit(Player(15),'o00O',-320.,640.,269.),true)
call SetUnitInvulnerable(CreateUnit(Player(15),'o00O',9152.,1280.,269.),true)
endfunction
endlibrary
//TESH.scrollpos=90
//TESH.alwaysfold=0
library WallGenerator
function WallGenerator takes nothing returns nothing
call CreateDestructable('ZTw0',5792.,-12256.,0.,1.,1)
call CreateDestructable('ZTw0',6112.,-12256.,0.,1.,1)
call CreateDestructable('ZTw0',6432.,-12256.,0.,1.,1)
call CreateDestructable('ZTw0',6752.,-12256.,0.,1.,1)
call CreateDestructable('ZTw0',7072.,-12256.,0.,1.,1)
call CreateDestructable('ZTw0',7392.,-12256.,0.,1.,1)
call CreateDestructable('ZTw0',7712.,-12256.,0.,1.,1)
call CreateDestructable('ZTw0',5856.,-11680.,0.,1.,1)
call CreateDestructable('ITw2',5664.,-11552.,0.,1.,1)
call CreateDestructable('ITw2',6240.,-11552.,0.,1.,1)
call CreateDestructable('ZTw0',6432.,-11680.,0.,1.,1)
call CreateDestructable('ITw2',6752.,-11552.,0.,1.,1)
call CreateDestructable('ZTw0',6944.,-11680.,0.,1.,1)
call CreateDestructable('ITw2',7264.,-11552.,0.,1.,1)
call CreateDestructable('ZTw0',7456.,-11680.,0.,1.,1)
call CreateDestructable('ITw2',7840.,-11552.,0.,1.,1)
call CreateDestructable('ZTw0',5856.,-11360.,0.,1.,1)
call CreateDestructable('ZTw0',6432.,-11360.,0.,1.,1)
call CreateDestructable('ZTw0',6944.,-11360.,0.,1.,1)
call CreateDestructable('ZTw0',7456.,-11360.,0.,1.,1)
call CreateDestructable('ZTw0',5856.,-11040.,0.,1.,1)
call CreateDestructable('ITw2',5664.,-11232.,0.,1.,1)
call CreateDestructable('ITw2',6240.,-11232.,0.,1.,1)
call CreateDestructable('ZTw0',6432.,-11040.,0.,1.,1)
call CreateDestructable('ITw2',6752.,-11232.,0.,1.,1)
call CreateDestructable('ZTw0',6944.,-11040.,0.,1.,1)
call CreateDestructable('ITw2',7264.,-11232.,0.,1.,1)
call CreateDestructable('ZTw0',7456.,-11040.,0.,1.,1)
call CreateDestructable('ITw2',7840.,-11232.,0.,1.,1)
call CreateDestructable('ITw2',5664.,-10912.,0.,1.,1)
call CreateDestructable('ITw2',6240.,-10912.,0.,1.,1)
call CreateDestructable('ITw2',6752.,-10912.,0.,1.,1)
call CreateDestructable('ITw2',7264.,-10912.,0.,1.,1)
call CreateDestructable('ITw2',7840.,-10912.,0.,1.,1)
call CreateDestructable('ZTw0',5856.,-10720.,0.,1.,1)
call CreateDestructable('ITw2',5664.,-10592.,0.,1.,1)
call CreateDestructable('ITw2',6240.,-10592.,0.,1.,1)
call CreateDestructable('ZTw0',6432.,-10720.,0.,1.,1)
call CreateDestructable('ITw2',6752.,-10592.,0.,1.,1)
call CreateDestructable('ZTw0',6944.,-10720.,0.,1.,1)
call CreateDestructable('ITw2',7264.,-10592.,0.,1.,1)
call CreateDestructable('ZTw0',7456.,-10720.,0.,1.,1)
call CreateDestructable('ITw2',7840.,-10592.,0.,1.,1)
call CreateDestructable('ZTw0',5792.,-10400.,0.,1.,1)
call CreateDestructable('ZTw0',6112.,-10400.,0.,1.,1)
call CreateDestructable('ZTw0',6432.,-10400.,0.,1.,1)
call CreateDestructable('ZTw0',6752.,-10400.,0.,1.,1)
call CreateDestructable('ZTw0',7072.,-10400.,0.,1.,1)
call CreateDestructable('ZTw0',7392.,-10400.,0.,1.,1)
call CreateDestructable('ZTw0',7712.,-10400.,0.,1.,1)
call CreateDestructable('ITw2',-992.,-800.,0.,1.,1)
call CreateDestructable('ZTw0',-864.,-992.,0.,1.,1)
call CreateDestructable('ZTw0',-544.,-992.,0.,1.,1)
call CreateDestructable('ZTw0',224.,-992.,0.,1.,1)
call CreateDestructable('ITw2',672.,-800.,0.,1.,1)
call CreateDestructable('ZTw0',544.,-992.,0.,1.,1)
call CreateDestructable('ITw2',-992.,-480.,0.,1.,1)
call CreateDestructable('ITw2',672.,-480.,0.,1.,1)
call CreateDestructable('ITw2',-992.,224.,0.,1.,1)
call CreateDestructable('ITw2',672.,224.,0.,1.,1)
call CreateDestructable('ZTw0',-2080.,416.,0.,1.,1)
call CreateDestructable('ZTw0',-1760.,416.,0.,1.,1)
call CreateDestructable('ZTw0',-1440.,416.,0.,1.,1)
call CreateDestructable('ZTw0',-1120.,416.,0.,1.,1)
call CreateDestructable('ITw2',-2208.,608.,0.,1.,1)
call CreateDestructable('ZTw0',-800.,736.,0.,1.,1)
call CreateDestructable('ZTw0',-480.,736.,0.,1.,1)
call CreateDestructable('ZTw0',224.,736.,0.,1.,1)
call CreateDestructable('ITw2',672.,544.,0.,1.,1)
call CreateDestructable('ZTw0',544.,736.,0.,1.,1)
call CreateDestructable('ITw2',-2208.,928.,0.,1.,1)
call CreateDestructable('ITw2',-992.,928.,0.,1.,1)
call CreateDestructable('ITw2',-2208.,1248.,0.,1.,1)
call CreateDestructable('ITw2',-992.,1248.,0.,1.,1)
call CreateDestructable('ZTw0',-2080.,1440.,0.,1.,1)
call CreateDestructable('ZTw0',-1760.,1440.,0.,1.,1)
call CreateDestructable('ZTw0',-1440.,1440.,0.,1.,1)
call CreateDestructable('ZTw0',-1120.,1440.,0.,1.,1)
call CreateDestructable('ZTw0',480.,10592.,0.,1.,1)
call CreateDestructable('ZTw0',800.,10592.,0.,1.,1)
call CreateDestructable('ZTw0',1120.,10592.,0.,1.,1)
call CreateDestructable('ZTw0',1440.,10592.,0.,1.,1)
call CreateDestructable('ZTw0',1760.,10592.,0.,1.,1)
call CreateDestructable('ZTw0',2080.,10592.,0.,1.,1)
call CreateDestructable('ITw2',352.,10784.,0.,1.,1)
call CreateDestructable('ITw2',2272.,11360.,0.,1.,1)
call CreateDestructable('ITw2',352.,11616.,0.,1.,1)
call CreateDestructable('ITw2',2272.,11680.,0.,1.,1)
call CreateDestructable('ITw2',352.,11936.,0.,1.,1)
call CreateDestructable('ITw2',2272.,12000.,0.,1.,1)
call CreateDestructable('ITw2',352.,12256.,0.,1.,1)
call CreateDestructable('ZTw0',480.,12448.,0.,1.,1)
call CreateDestructable('ZTw0',800.,12448.,0.,1.,1)
call CreateDestructable('ZTw0',1120.,12448.,0.,1.,1)
call CreateDestructable('ZTw0',1440.,12448.,0.,1.,1)
call CreateDestructable('ZTw0',1760.,12448.,0.,1.,1)
call CreateDestructable('ITw2',2272.,12320.,0.,1.,1)
call CreateDestructable('ZTw0',2080.,12448.,0.,1.,1)
call CreateDestructable('ZTw0',1056.,-7072.,0.,1.,1)
call CreateDestructable('ZTw0',1376.,-7072.,0.,1.,1)
call CreateDestructable('ZTw0',2080.,-7072.,0.,1.,1)
call CreateDestructable('ZTw0',2400.,-7072.,0.,1.,1)
call CreateDestructable('ZTw0',1056.,-5792.,0.,1.,1)
call CreateDestructable('ZTw0',1376.,-5792.,0.,1.,1)
call CreateDestructable('ZTw0',1696.,-5792.,0.,1.,1)
call CreateDestructable('ZTw0',2016.,-5792.,0.,1.,1)
call CreateDestructable('ZTw0',2336.,-5792.,0.,1.,1)
call CreateDestructable('ITw2',864.,-6944.,0.,1.,1)
call CreateDestructable('ITw2',2528.,-6880.,0.,1.,1)
call CreateDestructable('ITw2',864.,-6624.,0.,1.,1)
call CreateDestructable('ITw2',2528.,-6560.,0.,1.,1)
call CreateDestructable('ITw2',864.,-6304.,0.,1.,1)
call CreateDestructable('ITw2',2528.,-6240.,0.,1.,1)
call CreateDestructable('ITw2',864.,-5984.,0.,1.,1)
call CreateDestructable('ITw2',2528.,-5920.,0.,1.,1)
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope globalsvar initializer init
globals
//Abilities
constant integer GARN = 'Abun' //Garnison ability (no attack)
constant integer AWAN = 'Awan'
constant integer RAVEN = 'Amrf' //Raven crows (fly)
constant integer DUMMY = 'e004'
constant real TIMEOUT = 0.05
constant integer MAXPLAYER = 9 //amount max of player - 1
integer PlayerAmount = 0
integer RandomQuest
string array PlayerColor [10]
integer array PlayerColorRed [10]
integer array PlayerColorBlue [10]
integer array PlayerColorGreen [10]
boolean XpAvailable = false
real MapXMin
real MapYMin
real MapXMax
real MapYMax
endglobals
private function Conditions takes nothing returns boolean
local unit entering = GetTriggerUnit()
if GetUnitAbilityLevel(entering,RAVEN)<= 0 then
call UnitAddAbility(entering,RAVEN)
call UnitRemoveAbility(entering,RAVEN)
else
call UnitRemoveAbility(entering,RAVEN)
endif
call UnitIgnoreAlarm(entering,true)
set entering = null
return false
endfunction
public function init takes nothing returns nothing
local trigger t = CreateTrigger()
call AbilityPreload(GARN)
call AbilityPreload(RAVEN)
call AbilityPreload(AWAN)
set MapXMin = GetRectMinX(bj_mapInitialPlayableArea)
set MapYMin = GetRectMinY(bj_mapInitialPlayableArea)
set MapXMax = GetRectMaxX(bj_mapInitialPlayableArea)
set MapYMax = GetRectMaxY(bj_mapInitialPlayableArea)
set PlayerColor[0] = "|c00ff0000"
set PlayerColor[1] = "|c000000ff"
set PlayerColor[2] = "|c0000ffff"
set PlayerColor[3] = "|c00800080"
set PlayerColor[4] = "|c00ffff00"
set PlayerColor[5] = "|c00ff8000"
set PlayerColor[6] = "|c0000ff00"
set PlayerColor[7] = "|c00ff00ff"
set PlayerColor[8] = "|c00AAAAAA"
set PlayerColor[9] = "|c00AAAAFF"
//red
set PlayerColorRed [0] = 255
set PlayerColorGreen [0] = 2
set PlayerColorBlue [0] = 2
//blue
set PlayerColorRed [1] = 0
set PlayerColorGreen [1] = 65
set PlayerColorBlue [1] = 255
//teal
set PlayerColorRed [2] = 27
set PlayerColorGreen [2] = 230
set PlayerColorBlue [2] = 184
//purple
set PlayerColorRed [3] = 83
set PlayerColorGreen [3] = 0
set PlayerColorBlue [3] = 128
//yellow
set PlayerColorRed [4] = 255
set PlayerColorGreen [4] = 204
set PlayerColorBlue [4] = 0
//orange
set PlayerColorRed [5] = 255
set PlayerColorGreen [5] = 137
set PlayerColorBlue [5] = 13
//green
set PlayerColorRed [6] = 31
set PlayerColorGreen [6] = 191
set PlayerColorBlue [6] = 0
//pink
set PlayerColorRed [7] = 229
set PlayerColorGreen [7] = 90
set PlayerColorBlue [7] = 175
//grey
set PlayerColorRed [8] = 148
set PlayerColorGreen [8] = 149
set PlayerColorBlue [8] = 150
//light blue
set PlayerColorRed [9] = 125
set PlayerColorGreen [9] = 190
set PlayerColorBlue [9] = 241
call TriggerRegisterEnterRectSimple(t, bj_mapInitialPlayableArea)
call TriggerAddCondition(t, Condition(function Conditions))
endfunction
endscope
//TESH.scrollpos=80
//TESH.alwaysfold=0
library StartGame initializer init needs TimerUtils,NightmareEffects,ChapterSurvival, TextDisplay, LeaderBoard, MeteoSystem,StorySystem,HeroSelection,Chapter1,ChapterLastStand,ChapterSiege,ChapterAssaut
globals
constant integer DUMMYPICKER = 'o024'
private dialog GameModeDialog
private button Button1
private button Button2
private button Button3
private button Button4
private button Button5
private button Button6
private integer ModePickerId = 0
private constant integer RankUpgrade = 'R003'
private constant real WAIT1 = 0.01
private constant real WAIT2 = 10.
private constant string LIGHT_TERRAIN = "Environment\\DNC\\DNCDalaran\\DNCDalaranTerrain\\DNCDalaranTerrain.mdx"
private constant string LIGHT_UNIT = "Environment\\DNC\\DNCDalaran\\DNCDalaranUnit\\DNCDalaranUnit.mdx"
endglobals
private function StartGame takes nothing returns nothing
local integer i = 0
local integer j = 0
call SuspendTimeOfDay(true)
call SetTimeOfDayScale(0.)
call SetFloatGameState(GAME_STATE_TIME_OF_DAY, 0.)
call SetSkyModel(SKY)
call SetDayNightModels(LIGHT_TERRAIN,LIGHT_UNIT)
call CinematicFadeBJ( bj_CINEFADETYPE_FADEIN, 0.,CINEM_MASK,0,0,0,0)
call SetPlayerFlagBJ(PLAYER_STATE_GIVES_BOUNTY, false, Player(11) )
call SetPlayerFlagBJ(PLAYER_STATE_GIVES_BOUNTY, false, Player(13) )
call SetPlayerFlagBJ(PLAYER_STATE_GIVES_BOUNTY, false, Player(14) )
call SetPlayerName(Player(11),".")
call SetPlayerName(Player(13),".")
call SetPlayerName(Player(14),".")
call SetPlayerColorBJ(Player(11), PLAYER_COLOR_BROWN, true )
call SetPlayerColorBJ(Player(13), PLAYER_COLOR_BROWN, true )
call SetPlayerColorBJ(Player(14), PLAYER_COLOR_BROWN, true )
call SetPlayerAllianceStateBJ( Player(11), Player(13), bj_ALLIANCE_ALLIED_VISION)
call SetPlayerAllianceStateBJ( Player(13), Player(11), bj_ALLIANCE_ALLIED_VISION)
call SetPlayerAllianceStateBJ( Player(11), Player(14), bj_ALLIANCE_ALLIED_VISION)
call SetPlayerAllianceStateBJ( Player(14), Player(11), bj_ALLIANCE_ALLIED_VISION)
call SetPlayerAllianceStateBJ( Player(13), Player(14), bj_ALLIANCE_ALLIED_VISION)
call SetPlayerAllianceStateBJ( Player(14), Player(13), bj_ALLIANCE_ALLIED_VISION)
loop
exitwhen i > MAXPLAYER+1
set j = 0
loop
exitwhen j > MAXPLAYER+1
call SetPlayerAllianceStateBJ(Player(i),Player(j),bj_ALLIANCE_ALLIED)
set j = j + 1
endloop
call SetPlayerAllianceStateBJ(Player(i),Player(11),bj_ALLIANCE_UNALLIED)
call SetPlayerAllianceStateBJ(Player(i),Player(13),bj_ALLIANCE_UNALLIED)
call SetPlayerAllianceStateBJ(Player(i),Player(14),bj_ALLIANCE_UNALLIED)
call SetPlayerAllianceStateBJ( Player(11), Player(i), bj_ALLIANCE_UNALLIED)
call SetPlayerAllianceStateBJ( Player(13), Player(i), bj_ALLIANCE_UNALLIED)
call SetPlayerAllianceStateBJ( Player(14), Player(i), bj_ALLIANCE_UNALLIED)
call SetPlayerAbilityAvailable(Player(i),RAVEN,false)
set i = i + 1
endloop
set i = 0
loop
exitwhen i > MAXPLAYER
if GetPlayerSlotState(Player(i))==PLAYER_SLOT_STATE_PLAYING and GetPlayerController(Player(i)) == MAP_CONTROL_USER then
set Hero[i] = CreateUnit(Player(i),DUMMYPICKER,GetRectCenterX(gg_rct_Tavern),GetRectCenterY(gg_rct_Tavern),0.)
call SetPlayerTechResearched(Player(i),RankUpgrade,1)
set HeroPicked[i]=false
set HeroRepicked[i]=false
if GetLocalPlayer() == Player(i) then
call PanCameraToTimed(GetRectCenterX(gg_rct_Tavern),GetRectCenterY(gg_rct_Tavern),0.)
endif
call SelectUnitForPlayerSingle(Tavern[0],Player(i))
call SetPlayerState(Player(i),PLAYER_STATE_RESOURCE_GOLD,200)
set PlayerAmount = PlayerAmount + 1
endif
set i = i + 1
endloop
if PlayerAmount <= 1 then
set XpAvailable = false
call DisplayAll("Game", "Not enough players. Experience is disabled")
else
set XpAvailable = true
endif
set i = 0
loop
exitwhen i > MAXPLAYER
call SetPlayerHandicapXP(Player(i), (1. + 0.01*((MAXPLAYER+1)-PlayerAmount) ) )
set i = i + 1
endloop
call SetPlayerState(Player(10),PLAYER_STATE_RESOURCE_GOLD,99999)
call SetPlayerState(Player(10),PLAYER_STATE_RESOURCE_LUMBER,99999)
call FogEnable(true)
call FogMaskEnable(true)
set ChapterIntermission = false
call InitializeHeroStock()
call StartMeteo()
call StartStory()
call StartHelpSpam()
endfunction
private function StartFirstChapter takes nothing returns nothing
local quest mode = CreateQuest()
call InitialiseBoard()
if GameMode == 1 then
call Chapter1()
call QuestSetTitle(mode, "Normal mode")
call QuestSetDescription(mode,"Follow the missions ordered to your squad." )
elseif GameMode == 2 then
call Chapter1()
call QuestSetTitle(mode, "Nightmare mode")
call QuestSetDescription(mode,"Follow the missions ordered to your squad.")
elseif GameMode == 3 then
call ChapterSurvival()
call QuestSetTitle(mode,"Survival mode" )
call QuestSetDescription(mode, "Survive through several waves since the RC staff has failed to erradicate the threat")
elseif GameMode == 4 then
call ChapterLastStand()
call QuestSetTitle(mode,"Last Stand mode" )
call QuestSetDescription(mode, "Defend the Database in the external outpost. A Game Mode proposed by Namorax")
elseif GameMode == 5 then
call ChapterSiege()
call QuestSetTitle(mode,"Siege mode" )
call QuestSetDescription(mode, "Defend the Impulsion Generator in the base chosen by your superiors")
elseif GameMode == 6 then
call ChapterAssaut()
call QuestSetTitle(mode,"Assaut mode" )
call QuestSetDescription(mode, "Find, search and destroy the base of the RC601's staff")
endif
call QuestSetIconPath(mode,"ReplaceableTextures\\CommandButtons\\BTNAmbush.blp")
call QuestSetRequired(mode, false)
call QuestSetDiscovered(mode, true)
call QuestSetCompleted(mode, true)
call QuestSetEnabled(mode,true)
endfunction
private function QuestSetGameMode takes integer whichMode returns nothing
set GameMode = whichMode
call DisplayAll("Game", "mode set to "+GameName[GameMode])
if GameMode == 2 then
call StartNightmareEffect()
endif
endfunction
private function SetMode takes nothing returns boolean
if GameMode==0 then
if GetClickedButton()==Button1 then
call QuestSetGameMode(1)
elseif GetClickedButton()==Button2 then
call QuestSetGameMode(2)
elseif GetClickedButton()==Button3 then
call QuestSetGameMode(3)
elseif GetClickedButton()==Button4 then
call QuestSetGameMode(4)
elseif GetClickedButton()==Button5 then
call QuestSetGameMode(5)
elseif GetClickedButton()==Button6 then
call QuestSetGameMode(6)
endif
endif
return false
endfunction
private function EndCooldown takes nothing returns nothing
call ReleaseTimer(GetExpiredTimer())
if GameMode == 0 then
call QuestSetGameMode(1)
call DialogDisplay( Player(ModePickerId), GameModeDialog, false)
call DialogClear(GameModeDialog)
endif
call StoryDisplay("Control","Ok ladies. Here is the deal. We have lost any contact with the Restricted Complex 601. We need to find what is going on. Let's check the area.")
call StoryDisplay("Control","The RC601 is an underground structure. You should currently walk on it. Well, actually, it's depth is something like -500 meters.")
call StartFirstChapter()
endfunction
private function ProposeGameModes takes nothing returns nothing
local integer i = 0
local timer t = NewTimer()
call StartGame()
call DisplayAll("Game","Start in 30 seconds")
loop
exitwhen i > MAXPLAYER
if GetPlayerSlotState(Player(i))==PLAYER_SLOT_STATE_PLAYING and GetPlayerController(Player(i)) == MAP_CONTROL_USER then
call DisplayAll("Game",PlayerColor[i] + GetPlayerName(Player(i)) + "|r" + " is setting the game mode")
call DialogSetMessageBJ( GameModeDialog, "Pick a Game mode" )
set Button1 = DialogAddButton(GameModeDialog,"Normal",1)
set Button2 = DialogAddButton(GameModeDialog,"Nightmare",2)
set Button3 = DialogAddButton(GameModeDialog,"Pure Survival",3)
set Button4 = DialogAddButton(GameModeDialog,"Last Stand",4)
set Button5 = DialogAddButton(GameModeDialog,"Siege",5)
set Button6 = DialogAddButton(GameModeDialog,"Assaut",6)
call DialogDisplay( Player(i), GameModeDialog, true )
set ModePickerId = i
call TimerStart(t,WAIT2,false,function EndCooldown)
return
endif
set i = i + 1
endloop
endfunction
function InitializeGame takes nothing returns nothing
local integer i = 0
call CinematicModeBJ(false,bj_FORCE_ALL_PLAYERS)
loop
exitwhen i > MAXPLAYER
call ResetToGameCameraForPlayer(Player(i),0)
set i = i + 1
endloop
call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUT, 0.,CINEM_MASK,0,0,0,0)
call FogEnable(true)
call FogMaskEnable(true)
call ProposeGameModes()
endfunction
private function init takes nothing returns nothing
local trigger t2 = CreateTrigger()
set GameModeDialog = DialogCreate()
call FogEnable(true)
call FogMaskEnable(true)
call TriggerRegisterDialogEventBJ(t2, GameModeDialog )
call TriggerAddCondition(t2, Condition(function SetMode))
endfunction
endlibrary
//TESH.scrollpos=75
//TESH.alwaysfold=0
library MeteoSystem initializer init needs TimerUtils,TextDisplay,SoundUtils
globals
private integer array WeatherId [5]
private string array WeatherText [5][4]
private constant real TIMER_MIN = 60.
private constant real TIMER_MAX = 240.
private integer WeatherMax
integer SOUND_THUNDER
private constant real WAIT = 60.
endglobals
private keyword s_Meteo
private function SetWeatherVariables takes nothing returns nothing
local integer i = 0
set WeatherId[i]='RAlr'
set WeatherText[i][0]= "Oh great, it's raining."
set WeatherText[i][1]= "It seems the sky is falling down on us."
set WeatherText[i][2]= "Sweet. Nothing like some rain to make me happy."
set WeatherText[i][3]= "I miss the damn sun. Fucking rain."
set i = i + 1
set WeatherId[i]='RLlr'
set WeatherText[i][0]= "Heaven helps those who help themselves."
set WeatherText[i][1]= "It's raining cats and dogs. Life's a bitch huh?"
set WeatherText[i][2]= "Is the beer messing with my brain or is it hard to see?"
set WeatherText[i][3]= "You ain't drunk, the clouds are!"
set i = i + 1
set WeatherId[i]='RLlr'
set WeatherText[i][0]= "Heaven helps those who help themselves, really? So what's wrong with rain!"
set WeatherText[i][1]= "If this downpour continues, we'll never see any action!"
set WeatherText[i][2]= "I bet my wife is enjoying the sun right now."
set WeatherText[i][3]= "My wife always says: There are better days ahead. I'm still waiting for those days ahead."
set i = i + 1
set WeatherId[i]='RAlr'
set WeatherText[i][0]= "Visibility is zero. Where you guys at?"
set WeatherText[i][1]= "The wind is fucking with my rockets!"
set WeatherText[i][2]= "I was only joking when I said it would rain, I swear!"
set WeatherText[i][3]= "Command says heavy rain is expected throughout the day. Really?"
set WeatherMax = i
endfunction
private struct s_Meteo
private timer ti = null
private timer tilight = null
private weathereffect array e [4]
private integer current = 0
method UpdateLight takes nothing returns nothing
local integer i = 0
local real x = GetRandomReal(MapXMin,MapXMax)
local real y = GetRandomReal(MapYMin,MapYMax)
local unit light1 = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),DUMMY,x,y,0.)
local unit light2 = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),DUMMY,x,y,0.)
call UnitApplyTimedLife(light1,'BTLF',2.)
call UnitApplyTimedLife(light2,'BTLF',2.)
call SetUnitFlyHeight(light2,800.,0.)
call Eclair(light2,light1,"CLPB",1.)
call Eclair(light2,light1,"CLSB",1.)
call RunSound(SOUND_THUNDER)
set light1 = null
set light2 = null
endmethod
method Link takes nothing returns nothing
local integer random = GetRandomInt(0,WeatherMax+4)
if .tilight != null then
call ReleaseTimer(.tilight)
set .tilight = null
endif
if .ti != null then
call ReleaseTimer(.ti)
set .ti = null
endif
if .current <= WeatherMax then
call EnableWeatherEffect(.e[.current],false)
endif
set .current = random
if .current <= WeatherMax then
call EnableWeatherEffect(.e[.current],true)
if random <= WeatherMax then
set .tilight = NewTimer()
call SetTimerData( .tilight, this )
call TimerStart( .tilight, GetRandomReal(10.,60.), true, function thistype.RunTiLight)
endif
call StoryDisplay("Marine",WeatherText[random][GetRandomInt(0,3)])
endif
set .ti = NewTimer()
call SetTimerData( .ti, this )
call TimerStart( .ti, GetRandomReal(TIMER_MIN,TIMER_MAX), false, function thistype.RunTi)
endmethod
method Update takes nothing returns nothing
call .Link()
endmethod
private static method RunTiLight takes nothing returns nothing
call thistype(GetTimerData(GetExpiredTimer())).UpdateLight()
endmethod
private static method RunTi takes nothing returns nothing
call thistype(GetTimerData(GetExpiredTimer())).Update()
endmethod
//Constructor
static method create takes nothing returns s_Meteo
local s_Meteo this = s_Meteo.allocate()
local integer i = 0
loop
exitwhen i > WeatherMax
set this.e[i] = AddWeatherEffect(bj_mapInitialPlayableArea,WeatherId[i])
call EnableWeatherEffect(this.e[i],false)
set i = i + 1
endloop
set this.tilight = null
set this.current = 0
set this.tilight = null
call this.Link()
return this
endmethod
endstruct
function StartMeteo takes nothing returns nothing
call s_Meteo.create()
endfunction
private function init takes nothing returns nothing
local integer i = 0
call SetWeatherVariables()
set SOUND_THUNDER = DefineSound("Sound\\Ambient\\DoodadEffects\\RollingThunder1.wav",3831, false, false)
endfunction
endlibrary
//TESH.scrollpos=42
//TESH.alwaysfold=0
library StorySystem initializer init needs TimerUtils,TextDisplay
globals
private constant real TIMER_HARRY = 134.
private constant real TIMER_LOG = 74.
private string array Log [100]
private integer LogMax
private string array Harry [100]
private integer HarryMax
private constant string HARRY = "Major Harry"
private constant string LOG = "News Release Entry #"
private integer HarryMessageCount = 0
private integer LogMessageCount = 0
private constant real WAIT = 65.
endglobals
private keyword str
private function SetTextVariables takes nothing returns nothing
local integer i = 0
set Harry[i]="Hello? Is anyone there?"
set i = i + 1
set Harry[i]="Can anyone hear me?"
set i = i + 1
set Harry[i]="My name is Major Harry. I am a survivor of the Security Staff of the Restricted Complex 601 "
set i = i + 1
set Harry[i]="We need your help. Could you move your team to my location?"
set i = i + 1
set Harry[i]="The situation is dire."
set i = i + 1
set Harry[i]="You should already know we were working on the regeneration of dead cells."
set i = i + 1
set Harry[i]="We were briefed on this. RC601 was a global leader in advanced research and technology, including weapons."
set i = i + 1
set Harry[i]="Well, things went wrong as we experimented on the combination of a rare mutant bacillus and a modified strand of human DNA."
set i = i + 1
set Harry[i]="The scientists began to exhibit signs of insanity en masse. Before we knew what was going on, the bloodbath had already begun."
set i = i + 1
set Harry[i]="Are you soldiers or not? Move your asses, you sons of bitches!"
set i = i + 1
set Harry[i]="We started fighting more than 10 hours ago. By my estimate, these mutations have infected the whole sector by now."
set i = i + 1
set Harry[i]="I hope you guys brought the big guns. Zombies aren't even the worst of it."
set i = i + 1
set Harry[i]="Did you know we achieved a new state of life replication?"
set i = i + 1
set Harry[i]="Clones, cyborgs and androids are nothing compared to these... these monsters."
set i = i + 1
set Harry[i]="Just hurry, I will be killed at this rate!"
set i = i + 1
set Harry[i]="These so called scientists... It disgusts me to think that my salary comes from their work."
set i = i + 1
set Harry[i]="I was stationed across many a conflict area before I became an employee here. Yet, I've never seen such abominations."
set i = i + 1
set Harry[i]="Now you know what we're up against. We led experimentations on men called Volunteer Test Subjects."
set i = i + 1
set Harry[i]= "Of course, it was all a lie. They were political or wartime prisoners grabbed from civil and miltiary jails from around the country."
set i = i + 1
set Harry[i]= "Trust me, when this is revealed to the media, heads will fall throughout the government."
set i = i + 1
set Harry[i]="Bah. Nevermind. I'll be dead before such a thing happens. I've seen too much to be allowed to live."
set i = i + 1
set Harry[i]="Anyways, I don't see how you lot could possibly survive either. This threat spreads too fast out of the Restricted Complex."
set HarryMax = i
set i = 0
set Log[i]="Staff: Restricted Complex 601 is a private structure which works for the government. It is a provider of advanced technology, like the entire Restricted Complex chain."
set i = i + 1
set Log[i]="Staff: As an employee of RC601, you will receive a salary for a variety of tasks. Most are dangerous."
set i = i + 1
set Log[i]="Staff: The RC601 is divided into multiple sectors: Employee Facilities, Power Generator, BioChemical Weapons Lab, Physics Lab, Biology Labs, Confinement areas, etc."
set i = i + 1
set Log[i]="Staff: The objective of RC601 is not only to build weapons. It is a pioneer in the research of human fundamentals."
set i = i + 1
set Log[i]="Staff: RC601 has 3 main research fields: Physics, Biology and DNA. Weapon developments here may not be very impressive, but the Physics Labs have reached new developments concerning the manipulation of gravity and time."
set i = i + 1
set Log[i]="Staff: RC601 is also the world's leader in the reanimation of dead organisms: cells, organs, bones etc..."
set i = i + 1
set Log[i]="Staff: Volunteers are also used in testing, while respecting the government's laws on the use of Human Beings in biological experimentations."
set i = i + 1
set Log[i]="Staff: As the Company always explains to journalists, no one is hurt during the tests."
set i = i + 1
set Log[i]="Staff: RC601 is well known enough, so we have no need to personally pay our test subjects"
set i = i + 1
set Log[i]="Staff: The living conditions of our test subjects are habitable: A 6 square metre common room, with a common washroom. They even received television sets 2 years ago."
set i = i + 1
set Log[i]="Staff: The average survival rate of test subjects is approximately 42%, a reflection of our increasingly successful research."
set i = i + 1
set Log[i]="Staff: RC601 is divided into 4 main categories of employees: Security Staff, Scientists, Prison 41 Test Subjects and Management/Directors"
set i = i + 1
set Log[i]="Staff: Test subjects help scientists during experimentation."
set i = i + 1
set Log[i]="Staff: Scientists lead research sessions and craft advanced technological items."
set i = i + 1
set Log[i]="Staff: Security Staff have a very important role in the facilities. They monitor and control all operations in the complex."
set i = i + 1
set Log[i]="Staff: There is never a threat of violence in the complex, as we all respect the law."
set i = i + 1
set Log[i]="Staff: There is no need to fear anything in our complex; we control all aspects of experimentations."
set i = i + 1
set Log[i]="Staff: ...Sorry for this interruption, we have a minor complication in the Biology Lab. Please excuse me for a second."
set i = i + 1
set Log[i]="Staff: Actually, Ladies and Gentlemen, as you are not familiar with our procedures, it would be safer for this tour to end now. We will contact you later to answer your questions"
set i = i + 1
set Log[i]="Journalist: What do you mean? we haven't even started to ask questions yet!"
set i = i + 1
set Log[i]="Staff: We will contact you later to answer your questions."
set i = i + 1
set Log[i]="*in the distance* AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAARGH!"
set i = i + 1
set Log[i]="Journalist: Hey, what the fuck is going on over there?"
set i = i + 1
set Log[i]="Staff: Please evacuate the complex now. The security officers will escort you."
set i = i + 1
set Log[i]="*The sound of gunfire approaches as a door is blown up*"
set i = i + 1
set Log[i]="Journalist: Oh my god! What are these things? Noooo! Kill it! Kill it! Aaaah! Get it off of me!"
set i = i + 1
set Log[i]="*several journalists howl in pain*"
set i = i + 1
set Log[i]="Staff: Contact Major Harry immediately. Initialize Global Isolation Procedures of RC601."
set i = i + 1
set Log[i]="Staff: Go! Go! Go! Eradicate all threat immediately! Why is this door still open? Seal it!"
set i = i + 1
set Log[i]="Security Officer: Sir! Behind you!"
set i = i + 1
set Log[i]="Staff Director: oh shit...*he screams*"
set i = i + 1
set Log[i]="Security Officer: There is still a journalist alive over there. We cannot let the outside world know of our situation."
set i = i + 1
set Log[i]="Journalist: Wai-wai-waiiit! No, pleas... *sound of a gunshot*"
set i = i + 1
set Log[i]="Security Officer: turn off this microphone!"
set i = i + 1
set Log[i]="End of file."
set LogMax = i
endfunction
private function UpdateLog takes nothing returns nothing
local timer t = GetExpiredTimer()
if LogMessageCount < LogMax then
call StoryDisplay(LOG+I2S(LogMessageCount),Log[LogMessageCount])
set LogMessageCount = LogMessageCount + 1
else
call ReleaseTimer(t)
endif
endfunction
private function UpdateHarry takes nothing returns nothing
local timer t = GetExpiredTimer()
if HarryMessageCount < HarryMax then
call StoryDisplay(HARRY,Harry[HarryMessageCount])
set HarryMessageCount = HarryMessageCount + 1
else
call ReleaseTimer(t)
endif
endfunction
private function Delay takes nothing returns nothing
local timer t = GetExpiredTimer()
local timer t1 = NewTimer()
local timer t2 = NewTimer()
call ReleaseTimer(t)
set HarryMessageCount = 0
set LogMessageCount = 0
call StoryDisplay("Control", "We will upload the last known data about the situation. There were a lecture with journalists organized by the RC601 Director Staff 10 hours ago.")
call TimerStart(t1,TIMER_HARRY,true,function UpdateHarry)
call TimerStart(t2,TIMER_LOG,true,function UpdateLog)
endfunction
function StartStory takes nothing returns nothing
local timer t = NewTimer()
call TimerStart(t,WAIT,false,function Delay)
endfunction
private function init takes nothing returns nothing
call SetTextVariables()
endfunction
endlibrary
//TESH.scrollpos=47
//TESH.alwaysfold=0
library LeaderBoard initializer init needs TextDisplay, MedalSystem, TimerUtils
globals
boolean BoardOk = false
integer array Ligne [20]
private constant string LEFTC = "|cff808080"
multiboard GameBoard
integer CurrentBoard //1 xp, 2 kills, 3 hits
private constant integer INDEX_XP = 1
private constant integer INDEX_KILL = 2
private constant integer INDEX_HIT = 3
private constant integer INDEX_TEAM = 4
private constant integer INDEX_MOVESPEED = 5
private constant integer INDEX_MEDAL = 6
private constant integer INDEX_RANK = 7
integer array Kill [10]
integer array Xp [10]
integer array CurrentGameXp [10]
private string CurrentTitle
player Leaver
timer TimerUpdateMs
endglobals
private function KillAllUnitsOfPlayer takes nothing returns boolean
if GetOwningPlayer(GetFilterUnit())==Leaver then
call KillUnit(GetFilterUnit())
endif
return true
endfunction
private function PlayerLeave takes nothing returns boolean
local player owner = GetTriggerPlayer()
local integer ownerId = GetPlayerId(owner)
set Leaver = owner
call GroupEnumUnitsOfPlayer(ENUM_GROUP,owner,Filter(function KillAllUnitsOfPlayer))
call DisplayAll(GetPlayerName(owner)," has left the game")
if BoardOk == true then
call MultiboardSetItemValueBJ(GameBoard,1,Ligne[ownerId],PlayerColor[ownerId]+"Left")
endif
return false
endfunction
function SetPlayerDead takes player owner returns nothing
local integer ownerId = GetPlayerId(owner)
if BoardOk == true then
call MultiboardSetItemValueBJ(GameBoard,1,Ligne[ownerId],PlayerColor[ownerId]+"Dead")
endif
endfunction
function BoardUpdateRank takes player owner returns nothing
local integer ownerId = GetPlayerId(owner)
if not (GetPlayerSlotState(owner)==PLAYER_SLOT_STATE_PLAYING) then
call MultiboardSetItemValueBJ(GameBoard,1,Ligne[ownerId],PlayerColor[ownerId]+"left")
else
if IsUnitType(Hero[ownerId],UNIT_TYPE_DEAD) then
call MultiboardSetItemValueBJ(GameBoard,1,Ligne[ownerId],PlayerColor[ownerId]+"dead")
else
call MultiboardSetItemValueBJ(GameBoard,1,Ligne[ownerId],PickedHeroBoardName[ownerId]+" "+PlayerColor[ownerId]+RankBoardPlayer[ownerId]+" "+GetPlayerName(owner))
endif
endif
endfunction
function SetBoardTitle takes string whichText returns nothing
set CurrentTitle = whichText
call MultiboardSetTitleText(GameBoard,whichText)
endfunction
function BoardUpdateXp takes player owner returns nothing
local integer ownerId = GetPlayerId(owner)
if CurrentBoard == INDEX_XP and BoardOk==true then
call MultiboardSetItemValueBJ(GameBoard,2,Ligne[ownerId],I2S(Xp[ownerId]))
call BoardUpdateRank(owner)
endif
endfunction
function BoardUpdateKill takes player owner returns nothing
local integer ownerId = GetPlayerId(owner)
if CurrentBoard == INDEX_KILL and BoardOk==true then
call MultiboardSetItemValueBJ(GameBoard,2,Ligne[ownerId],I2S(Kill[ownerId]))
call BoardUpdateRank(owner)
endif
endfunction
function BoardUpdateHit takes player owner returns nothing
local integer ownerId = GetPlayerId(owner)
if CurrentBoard == INDEX_HIT and BoardOk==true then
call MultiboardSetItemValueBJ(GameBoard,2,Ligne[ownerId],I2S(HeroHit[ownerId]))
call BoardUpdateRank(owner)
endif
endfunction
private function SwitchToBoardMedal takes nothing returns nothing
local integer i = 0
set CurrentBoard = INDEX_MEDAL
call MultiboardSetItemValueBJ(GameBoard,2,1,"Medals")
loop
exitwhen i > MAXPLAYER
if GetPlayerSlotState(Player(i))==PLAYER_SLOT_STATE_PLAYING then
//Disabled in order to prevent noob hackers to generate codes
call BoardUpdateRank(Player(i))
endif
set i = i + 1
endloop
call MultiboardMinimize(GameBoard,false)
endfunction
private function SwitchToBoardRank takes nothing returns nothing
local integer i = 0
set CurrentBoard = INDEX_RANK
call MultiboardSetItemValueBJ(GameBoard,2,1,"Rank")
loop
exitwhen i > MAXPLAYER
if GetPlayerSlotState(Player(i))==PLAYER_SLOT_STATE_PLAYING then
call MultiboardSetItemValueBJ(GameBoard,2,Ligne[i],RankPlayer[i])
call BoardUpdateRank(Player(i))
endif
set i = i + 1
endloop
call MultiboardMinimize(GameBoard,false)
endfunction
private function SwitchToBoardTeam takes nothing returns nothing
local integer i = 0
set CurrentBoard = INDEX_TEAM
call MultiboardSetItemValueBJ(GameBoard,2,1,"Team")
loop
exitwhen i > MAXPLAYER
if GetPlayerSlotState(Player(i))==PLAYER_SLOT_STATE_PLAYING then
call MultiboardSetItemValueBJ(GameBoard,2,Ligne[i],PickedHeroName[i])
call BoardUpdateRank(Player(i))
endif
set i = i + 1
endloop
call MultiboardMinimize(GameBoard,false)
endfunction
private function UpdateMs takes nothing returns nothing
local integer i = 0
loop
exitwhen i > MAXPLAYER
if GetPlayerSlotState(Player(i))==PLAYER_SLOT_STATE_PLAYING then
set HeroMs[i]=GetUnitMoveSpeed(Hero[i])
endif
set i = i + 1
endloop
if CurrentBoard == INDEX_MOVESPEED and BoardOk==true then
set i = 0
loop
exitwhen i > MAXPLAYER
if GetPlayerSlotState(Player(i))==PLAYER_SLOT_STATE_PLAYING then
call MultiboardSetItemValueBJ(GameBoard,2,Ligne[i],I2S(R2I(HeroMs[i])))
call BoardUpdateRank(Player(i))
endif
set i = i + 1
endloop
endif
endfunction
private function SwitchToBoardMovespeed takes nothing returns nothing
local integer i = 0
set CurrentBoard = INDEX_MOVESPEED
call MultiboardSetItemValueBJ(GameBoard,2,1,"Movespeed")
call MultiboardMinimize(GameBoard,false)
endfunction
private function SwitchToBoardXp takes nothing returns nothing
local integer i = 0
set CurrentBoard = INDEX_XP
call MultiboardSetItemValueBJ(GameBoard,2,1,"Xp")
loop
exitwhen i > MAXPLAYER
if GetPlayerSlotState(Player(i))==PLAYER_SLOT_STATE_PLAYING then
call MultiboardSetItemValueBJ(GameBoard,2,Ligne[i],I2S(Xp[i]))
call BoardUpdateRank(Player(i))
endif
set i = i + 1
endloop
call MultiboardMinimize(GameBoard,false)
endfunction
private function SwitchToBoardKill takes nothing returns nothing
local integer i = 0
set CurrentBoard = INDEX_KILL
call MultiboardSetItemValueBJ(GameBoard,2,1,"Kills")
loop
exitwhen i > MAXPLAYER
if GetPlayerSlotState(Player(i))==PLAYER_SLOT_STATE_PLAYING then
call MultiboardSetItemValueBJ(GameBoard,2,Ligne[i],I2S(Kill[i]))
call BoardUpdateRank(Player(i))
endif
set i = i + 1
endloop
call MultiboardMinimize(GameBoard,false)
endfunction
private function SwitchToBoardHit takes nothing returns nothing
local integer i = 0
set CurrentBoard = INDEX_HIT
call MultiboardSetItemValueBJ(GameBoard,2,1,"Hits")
loop
exitwhen i > MAXPLAYER
if GetPlayerSlotState(Player(i))==PLAYER_SLOT_STATE_PLAYING then
call MultiboardSetItemValueBJ(GameBoard,2,Ligne[i],I2S(HeroHit[i]))
call BoardUpdateRank(Player(i))
endif
set i = i + 1
endloop
call MultiboardMinimize(GameBoard,false)
endfunction
private function HideAllBoard takes nothing returns nothing
call MultiboardMinimize(GameBoard,true)
endfunction
function InitialiseBoard takes nothing returns nothing
local integer i = 0
local integer amount = 0
local integer id = 0
set CurrentBoard = INDEX_XP
set i =0
loop
exitwhen i > MAXPLAYER
if GetPlayerSlotState(Player(i))==PLAYER_SLOT_STATE_PLAYING then
set amount = amount + 1
endif
set i = i + 1
endloop
set GameBoard = CreateMultiboardBJ(2,amount+1,"Waiting for Control orders")
call MultiboardSetItemValueBJ(GameBoard,1,1,"Employee")
set i = 0
loop
exitwhen i > MAXPLAYER+3
call MultiboardSetItemWidthBJ(GameBoard,1,i,12.00 )
call MultiboardSetItemStyleBJ(GameBoard,1,i, true, false)
set i = i + 1
endloop
call MultiboardSetItemValueBJ(GameBoard,2,1,"Xp")
set i = 0
loop
exitwhen i > MAXPLAYER+3
call MultiboardSetItemWidthBJ(GameBoard,2,i,8.00 )
call MultiboardSetItemStyleBJ(GameBoard,2,i, true, false )
set i = i + 1
endloop
set i = 0
set id = 2
loop
exitwhen i > MAXPLAYER
if GetPlayerSlotState(Player(i))==PLAYER_SLOT_STATE_PLAYING then
set Ligne[i]=id
call MultiboardSetItemValueBJ(GameBoard,1,id,PlayerColor[i]+RankBoardPlayer[i]+" "+GetPlayerName(Player(i)))
call MultiboardSetItemValueBJ(GameBoard,2,id,I2S(Xp[i]))
set id = id + 1
endif
set i = i + 1
endloop
call MultiboardSetItemIconBJ( GameBoard,1,1,"ReplaceableTextures\\CommandButtons\\BTNHelmutPurple.blp")
call MultiboardSetItemIconBJ( GameBoard,2,1,"ReplaceableTextures\\WorldEditUI\\Editor-Random-Unit.blp")
call MultiboardSetItemStyleBJ(GameBoard,1,1, true, true )
call MultiboardSetItemStyleBJ(GameBoard,2,1, true, true )
set BoardOk = true
set TimerUpdateMs = NewTimer()
call TimerStart(TimerUpdateMs,0.5,true,function UpdateMs)
endfunction
private function Sitrep takes nothing returns boolean
local string s = GetEventPlayerChatString()
local player whichPlayer = GetTriggerPlayer()
if BoardOk == true then
if s == "-sitrep0" then
call HideAllBoard()
elseif s == "-sitrep1" then
call SwitchToBoardXp()
elseif s == "-sitrep2" then
call SwitchToBoardKill()
elseif s == "-sitrep3" then
call SwitchToBoardHit()
elseif s == "-sitrep4" then
call SwitchToBoardTeam()
elseif s == "-sitrep5" then
call SwitchToBoardMovespeed()
elseif s == "-sitrep6" then
call SwitchToBoardMedal()
elseif s == "-sitrep7" then
call SwitchToBoardRank()
endif
endif
set s = null
return false
endfunction
private function init takes nothing returns nothing
local trigger t1 = CreateTrigger()
local trigger t2 = CreateTrigger()
local integer i = 0
set BoardOk = false
set CurrentBoard = 0
loop
exitwhen i > MAXPLAYER
call TriggerRegisterPlayerEvent(t1, Player(i), EVENT_PLAYER_LEAVE)
call TriggerRegisterPlayerChatEvent( t2, Player(i), "-sitrep0", true)
call TriggerRegisterPlayerChatEvent( t2, Player(i), "-sitrep1", true)
call TriggerRegisterPlayerChatEvent( t2, Player(i), "-sitrep2", true)
call TriggerRegisterPlayerChatEvent( t2, Player(i), "-sitrep3", true)
call TriggerRegisterPlayerChatEvent( t2, Player(i), "-sitrep4", true)
call TriggerRegisterPlayerChatEvent( t2, Player(i), "-sitrep5", true)
call TriggerRegisterPlayerChatEvent( t2, Player(i), "-sitrep6", true)
call TriggerRegisterPlayerChatEvent( t2, Player(i), "-sitrep7", true)
set i = i + 1
endloop
call TriggerAddCondition(t1, Condition(function PlayerLeave) )
call TriggerAddCondition(t2, Condition(function Sitrep) )
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library InterfaceCommands initializer init needs TimerUtils, TextDisplay, HeroDeath, MedalSystem
globals
private constant string CLEAR = "-clear"
private constant string STORY = "-story"
private constant string REPORT = "-report"
private constant string SHOWSTATS = "-showstats"
private constant string STATS = "-stats"
private constant string MEDALS = "-medals"
private constant string SHOWMEDALS = "-showmedals"
private constant string TL = "-tl"
private constant string TEAM = "-team"
private constant string CAM_HEIGHT = "-cam"
private constant string CAM_ANGLE = "-angle"
private constant string CAM_MODE = "-view"
private constant string LOCK = "-lock"
private constant string BARRAGE1 = "-s"
private constant string BARRAGE2 = "-stock"
private constant string BONUS = "-bonus"
private constant string C = "|c00AFAAFF"
private constant string C0 = "|r "
private constant string C1 = "|c006A6A6A"
boolean array PlayerLock [12]
boolean array PlayerStory [12]
endglobals
private function ShowMedals takes player whichPlayer returns nothing
//Disabled in order to prevent noob hackers to generate codes
endfunction
private function Medals takes player whichPlayer returns nothing
//Disabled in order to prevent noob hackers to generate codes
endfunction
private function Bonus takes player whichPlayer returns nothing
local integer ownerId = GetPlayerId(whichPlayer)
call DisplayTimedTextToPlayer(whichPlayer,0.,0.,30.,C+"====Employee Rank Bonus====")
call DisplayTimedTextToPlayer(whichPlayer,0.,0.,30.,C+"Rank bonus-hit points (%) "+C0 + R2S(CurrentPlayerRank[ownerId]*0.05))
call DisplayTimedTextToPlayer(whichPlayer,0.,0.,30.,C+"Rank bonus-energy regeneration "+C0 + R2S(CurrentPlayerRank[ownerId]*0.1))
call DisplayTimedTextToPlayer(whichPlayer,0.,0.,30.,C+"Rank bonus-attack rate (%) "+C0 + R2S(CurrentPlayerRank[ownerId]*0.02))
call DisplayTimedTextToPlayer(whichPlayer,0.,0.,30.,C+"Rank bonus-movespeed: "+C0 + I2S(CurrentPlayerRank[ownerId]*5))
call DisplayTimedTextToPlayer(whichPlayer,0.,0.,30.,C+"====Employee Medal Bonus====")
//Disabled in order to prevent noob hackers to generate codes
endfunction
private function Stats takes player whichPlayer returns nothing
local integer ownerId = GetPlayerId(whichPlayer)
call DisplayTimedTextToPlayer(whichPlayer,0.,0.,30.,C+"====Employee Stats====")
call DisplayTimedTextToPlayer(whichPlayer,0.,0.,30.,C+"Employee Xp (global): "+C0 + I2S(Xp[ownerId]))
call DisplayTimedTextToPlayer(whichPlayer,0.,0.,30.,C+"Employee Xp (game): "+C0 + I2S(CurrentGameXp[ownerId]))
call DisplayTimedTextToPlayer(whichPlayer,0.,0.,30.,C+"Employee kills to get 1xp: "+C0 + I2S(HeroCoeff[ownerId]))
call DisplayTimedTextToPlayer(whichPlayer,0.,0.,30.,C+"Employee Kills: "+C0 + I2S(Kill[ownerId]))
call DisplayTimedTextToPlayer(whichPlayer,0.,0.,30.,C+"Rank hierarchy: "+C0 + I2S(CurrentPlayerRank[ownerId]))
call DisplayTimedTextToPlayer(whichPlayer,0.,0.,30.,C+"Rank name: "+C0 + RankPlayer[ownerId])
call DisplayTimedTextToPlayer(whichPlayer,0.,0.,30.,C+"Hero hit taken: "+C0 + I2S(HeroHit[ownerId]))
call DisplayTimedTextToPlayer(whichPlayer,0.,0.,30.,C+"Hero current movespeed: "+C0 + I2S(R2I(GetUnitMoveSpeed(Hero[ownerId]))))
endfunction
private function Report takes player whichPlayer returns nothing
local integer ownerId = GetPlayerId(whichPlayer)
call DisplayTimedTextToPlayer(whichPlayer,0.,0.,30.,C+"====Squad Stats====")
call DisplayTimedTextToPlayer(whichPlayer,0.,0.,30.,C+"Squad Average Xp: "+C0+ I2S(XpAverage))
call DisplayTimedTextToPlayer(whichPlayer,0.,0.,30.,C+"Squad Maximal Xp: "+C0 + I2S(XpMax))
call DisplayTimedTextToPlayer(whichPlayer,0.,0.,30.,C+"Squad Xp %: "+C0 + I2S(XpAverageCoeff))
call DisplayTimedTextToPlayer(whichPlayer,0.,0.,30.,C+"====Squad Medals====")
//Disabled in order to prevent noob hackers to generate codes
endfunction
private function ShowStats takes player whichPlayer returns nothing
local integer ownerId = GetPlayerId(whichPlayer)
local integer i = 0
loop
exitwhen i > MAXPLAYER
call DisplayTimedTextToPlayer(Player(i),0.,0.,30.,"====Employee "+PlayerColor[ownerId]+GetPlayerName(whichPlayer)+C0+" Stats====")
call DisplayTimedTextToPlayer(Player(i),0.,0.,30.,C+"Employee Xp (global): "+C0 + I2S(Xp[ownerId]))
call DisplayTimedTextToPlayer(Player(i),0.,0.,30.,C+"Employee Xp (game): "+C0 + I2S(CurrentGameXp[ownerId]))
call DisplayTimedTextToPlayer(Player(i),0.,0.,30.,C+"Employee Kills: "+C0 + I2S(Kill[ownerId]))
call DisplayTimedTextToPlayer(Player(i),0.,0.,30.,C+"Rank hierarchy: "+C0 + I2S(CurrentPlayerRank[ownerId]))
call DisplayTimedTextToPlayer(Player(i),0.,0.,30.,C+"Rank name: "+C0 + RankPlayer[ownerId])
call DisplayTimedTextToPlayer(Player(i),0.,0.,30.,C+"Hero current movespeed: "+C0 + I2S(R2I(GetUnitMoveSpeed(Hero[ownerId]))))
set i = i + 1
endloop
endfunction
private function DisplayBarrage takes player whichPlayer returns nothing
call DisplayTextToPlayer(whichPlayer,0.,0.,"Barrage shells remaining: " + I2S(BarrageShellsStock))
call DisplayTextToPlayer(whichPlayer,0.,0.,"Barrage current dispersion: " + I2S(BarrageDispersionCurrent))
call DisplayTextToPlayer(whichPlayer,0.,0.,"Barrage current amount of shells fired: " + I2S(BarrageShellsFiredCurrent))
call DisplayTextToPlayer(whichPlayer,0.,0.,"Barrage current attack rate: " + R2S(BarrageAttackRateCurrent))
call DisplayTextToPlayer(whichPlayer,0.,0.,"Barrage current delivery time: " + R2S(BarrageFireDelayCurrent))
endfunction
private function Clear takes player whichPlayer returns nothing
local integer i = 0
loop
exitwhen i > 20
call DisplayTextToPlayer(whichPlayer,0.,0.," ")
set i = i + 1
endloop
endfunction
private function TeamLocation takes nothing returns nothing
local integer i = 0
loop
exitwhen i > MAXPLAYER
if GetPlayerSlotState(Player(i))==PLAYER_SLOT_STATE_PLAYING and IsHeroDefinitelyDead(i)==false then
call PingMinimapEx(GetUnitX(Hero[i]),GetUnitY(Hero[i]),2.,PercentTo255(PlayerColorRed[i]),PercentTo255(PlayerColorGreen[i]),PercentTo255(PlayerColorBlue[i]),false)
endif
set i = i + 1
endloop
endfunction
private function CamHeight takes player whichPlayer,real height returns nothing
if GetLocalPlayer() == whichPlayer then
call SetCameraField(CAMERA_FIELD_TARGET_DISTANCE, height, 0.5)
endif
endfunction
private function CamAngle takes player whichPlayer, real angle returns nothing
if GetLocalPlayer() == whichPlayer then
call SetCameraField(CAMERA_FIELD_ANGLE_OF_ATTACK, angle, 0.5)
endif
endfunction
private function CamMode takes player whichPlayer, real height, real angle returns nothing
if GetLocalPlayer() == whichPlayer then
call SetCameraField(CAMERA_FIELD_ANGLE_OF_ATTACK, angle, 1.)
call SetCameraField(CAMERA_FIELD_TARGET_DISTANCE, height, 1.)
endif
endfunction
private function Story takes player whichPlayer returns nothing
local integer whichPlayerId = GetPlayerId(whichPlayer)
if PlayerStory[whichPlayerId] == false then
set PlayerStory[whichPlayerId] = true
call DisplayTextToPlayer(whichPlayer,0.,0., "Story messages will be displayed")
return
else
call DisplayTextToPlayer(whichPlayer,0.,0., "Story messages will be hidden")
set PlayerStory[whichPlayerId] = false
return
endif
endfunction
private function LockMode takes player whichPlayer returns nothing
local integer whichPlayerId = GetPlayerId(whichPlayer)
if PlayerLock[whichPlayerId] == false then
if (GetLocalPlayer() == whichPlayer) then
call SetCameraTargetController(Hero[whichPlayerId],0.,0.,false)
endif
set PlayerLock[whichPlayerId] = true
call DisplayTextToPlayer(whichPlayer,0.,0., "Camera locked on the Hero")
return
else
if (GetLocalPlayer() == whichPlayer) then
call ResetToGameCamera(0.)
endif
call DisplayTextToPlayer(whichPlayer,0.,0., "Camera unlocked")
set PlayerLock[whichPlayerId] = false
return
endif
endfunction
private function DisplayTeam takes player owner returns nothing
local integer i = 0
loop
exitwhen i > MAXPLAYER
if not (IsUnitType(Hero[i],UNIT_TYPE_DEAD)) and Hero[i]!=null then
call DisplayTextToPlayer(owner,0.,0.,RankPlayer[i]+" - "+PickedHeroName[i]+" - "+PlayerColor[i]+GetPlayerName(Player(i)))
endif
set i = i + 1
endloop
endfunction
private function Check takes nothing returns boolean
local player owner = GetTriggerPlayer()
local string text = GetEventPlayerChatString()
local integer sub = 0
if text == CLEAR then
call Clear(owner)
elseif text == REPORT then
call Report(owner)
elseif text == BONUS then
call Bonus(owner)
elseif text == STATS then
call Stats(owner)
elseif text == SHOWSTATS then
call ShowStats(owner)
elseif text == TL then
call TeamLocation()
elseif text == LOCK then
call LockMode(owner)
elseif text == STORY then
call Story(owner)
elseif text == MEDALS then
call Medals(owner)
elseif text == SHOWMEDALS then
call ShowMedals(owner)
elseif text == TEAM then
call DisplayTeam(owner)
elseif text == BARRAGE1 or text == BARRAGE2 then
call DisplayBarrage(owner)
elseif SubString(text,0,StringLength(CAM_ANGLE)) == CAM_ANGLE then
set sub = S2I(SubString(text,7,10))
if sub >=270 and sub <= 355 then
call CamAngle(owner,I2R(sub))
call DisplayTextToPlayer(owner,0.,0., "Camera Angle set to "+I2S(sub))
else
call ErrorSound(owner)
call DisplayTextToPlayer(owner,0.,0., "Enter a value between 270 and 355 to set the angle of the camera")
endif
elseif SubString(text,0,StringLength(CAM_HEIGHT)) == CAM_HEIGHT then
set sub = S2I(SubString(text,5,9))
if sub >=1000 and sub <= 5000 then
call CamHeight(owner,I2R(sub))
call DisplayTextToPlayer(owner,0.,0., "Camera height set to "+I2S(sub))
else
call ErrorSound(owner)
call DisplayTextToPlayer(owner,0.,0., "Enter a value between 1000 and 5000 to set the height of the camera")
endif
elseif SubString(text,0,StringLength(CAM_MODE)) == CAM_MODE then
set sub = S2I(SubString(text,6,7))
if sub >=1 and sub <= 9 then
if sub == 1 then
call CamMode(owner,1650.,304.)
elseif sub == 2 then
call CamMode(owner,2000.,270.)
elseif sub == 3 then
call CamMode(owner,3000.,270.)
elseif sub == 4 then
call CamMode(owner,4000.,270.)
elseif sub == 5 then
call CamMode(owner,5000.,270.)
elseif sub == 6 then
call CamMode(owner,1000.,355.)
elseif sub == 7 then
call CamMode(owner,3000.,330.)
elseif sub == 8 then
call CamMode(owner,4000.,340.)
elseif sub == 9 then
call CamMode(owner,500.,350.)
endif
call DisplayTextToPlayer(owner,0.,0., "Camera Mode set to "+I2S(sub))
else
call ErrorSound(owner)
call DisplayTextToPlayer(owner,0.,0., "Enter a value between 1 and 9 to set the mode of the camera")
endif
endif
set text = null
return false
endfunction
private function init takes nothing returns nothing
local trigger t = CreateTrigger()
local integer i = 0
loop
exitwhen i > MAXPLAYER
call TriggerRegisterPlayerChatEvent( t, Player(i), CLEAR, true)
call TriggerRegisterPlayerChatEvent( t, Player(i), REPORT, true)
call TriggerRegisterPlayerChatEvent( t, Player(i), SHOWSTATS, true)
call TriggerRegisterPlayerChatEvent( t, Player(i), STATS, true)
call TriggerRegisterPlayerChatEvent( t, Player(i), TL, true)
call TriggerRegisterPlayerChatEvent( t, Player(i), CAM_ANGLE, false)
call TriggerRegisterPlayerChatEvent( t, Player(i), CAM_HEIGHT, false)
call TriggerRegisterPlayerChatEvent( t, Player(i), CAM_MODE, false)
call TriggerRegisterPlayerChatEvent( t, Player(i), LOCK, true)
call TriggerRegisterPlayerChatEvent( t, Player(i), TEAM, true)
call TriggerRegisterPlayerChatEvent( t, Player(i), BARRAGE1, true)
call TriggerRegisterPlayerChatEvent( t, Player(i), BARRAGE2, true)
call TriggerRegisterPlayerChatEvent( t, Player(i), STORY, true)
call TriggerRegisterPlayerChatEvent( t, Player(i), MEDALS, true)
call TriggerRegisterPlayerChatEvent( t, Player(i), BONUS, true)
call TriggerRegisterPlayerChatEvent( t, Player(i), SHOWMEDALS, true)
set PlayerLock[i]=false
set PlayerStory[i]=true
set i = i + 1
endloop
call TriggerAddCondition(t, Condition(function Check))
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library HelpCenter initializer init needs TimerUtils, TextDisplay
globals
private constant real DUR = 30. //the text will be displayed during DUR seconds
private constant string COM = "-help" //string entered to run the trigger
private constant string LINE = "|c00AFAAFF"+"=============================================================="+"|r"//To separate text
private constant string NAME = "|c00AFAAFF"+"Help Center"+"|r" //Title displayed each time the trigger starts
private constant string INFO = "Enter -help XXXX where XXXX is one of the following key words:" //Text displayed then
string array HelpName [30] //The real title of each keyword, there, 30 keywords maximum
string array HelpText [30][15] //The content of each keywords: up to 15 sentences wroten
constant integer HelpTextMax = 14//Maximum amount of sentence displayed
integer HelpMax = 0
private StringTable Str_table
private integer HelpCommand_length
private constant integer AMOUNT = 10
endglobals
//! textmacro t__HelpSystem_Init takes TEXT_ID, TITLE1 ,TITLE2
set Str_table["$TEXT_ID$"] = $TEXT_ID$
set Str_table["$TITLE1$"] = $TEXT_ID$
set Str_table["$TITLE2$"] = $TEXT_ID$
//! endtextmacro
private function SetTextVariables takes nothing returns nothing
local integer i = 1
//Respect the order of letters is better.
set HelpName[i]= "Biologist"
set HelpText[i][0]="Build Biology (the ultimate, spellbook) to level 3 as soon as possible."
set HelpText[i][1]= "Level 3 Biology gives you defibrillation. This skill can revive dead allies."
//! runtextmacro t__HelpSystem_Init("i","biologist","bio")
set i = i + 1
//
set HelpName[i]= "Bot"
set HelpText[i][0]="A hostbot is set up on all realms except Asia. It is called RC601."
set HelpText[i][1]="Add him as a friend on Battlenet: /f add RC601"
//! runtextmacro t__HelpSystem_Init("i","bot","bots")
set i = i + 1
//
set HelpName[i]= "Commands"
set HelpText[i][0]="Enter F9 to get the command list"
set HelpText[i][1]="There are game commands, camera commands, save and load commands etc..."
//! runtextmacro t__HelpSystem_Init("i","command","commands")
set i = i + 1
//
set HelpName[i]= "Experience"
set HelpText[i][0]="Experience is the point system which allows you to receive ranks"
set HelpText[i][1]="Experience points are earnable with two ways"
set HelpText[i][2]="Kills: each class has a kill coefficient to get xp, such as 5 kills = 1 xp point for biologist or 15 kills = 1 xp point for cleaning force"
set HelpText[i][3]="Enter -report to find out the kill factor for your class."
set HelpText[i][4]="Quests: each completed quest gives experience to all players."
//! runtextmacro t__HelpSystem_Init("i","experience","xp")
set i = i + 1
//
set HelpName[i]= "Items"
set HelpText[i][0]="Look for small grey boxes (Equipment Crates)"
set HelpText[i][1]="Check minimap for black dots (unexplored)"
set HelpText[i][2]="If you see a box shoot it or use the skill called Open Equipment Crate"
set HelpText[i][3]="Most items stack or combine"
set HelpText[i][4]="Use satchels only on bosses and caves"
//! runtextmacro t__HelpSystem_Init("i","item","items")
set i = i + 1
//
set HelpName[i]= "Force Recon"
set HelpText[i][0]="If you build the skill Sentry, after level 2, you will not take benefit of it without leveling your class spellbook"
set HelpText[i][1]="Because higher levels of sentries grants abilities to the sentry which needs this spellbook"
//! runtextmacro t__HelpSystem_Init("i","force recon","fr")
set i = i + 1
//
set HelpName[i]= "Forum"
set HelpText[i][0]="You are welcome on the forum to report bugs or make suggestions."
set HelpText[i][1]="http://www.jk2pach.com"
//! runtextmacro t__HelpSystem_Init("i","forum","board")
set i = i + 1
//
set HelpName[i]= "Mechanist"
set HelpText[i][0]="Build Advanced Engineer (the ultimate, spellbook) to level 6 as soon as possible."
set HelpText[i][1]= "Level 6 Advanced Engineer grants Bio Satellite. This skill gives all players shared vision."
//! runtextmacro t__HelpSystem_Init("i","mechanist","mec")
set i = i + 1
//
set HelpName[i]= "Medals"
set HelpText[i][0]="Medals are awarned thanks to the achievement of the secondary objective and other specific heroic actions."
set HelpText[i][1]= "Each medal brings +5% health points / +1% mp regeneration / +2 speed of movement / +1% attack rate"
set HelpText[i][2]= "Medals are really harder to get than higher ranks and only pure soldiers deserve them."
//! runtextmacro t__HelpSystem_Init("i","medals","medal")
set i = i + 1
//
//
set HelpName[i]= "Quests"
set HelpText[i][0]="RC601 consists of several quests"
set HelpText[i][1]="Quests are grouped by Chapters"
set HelpText[i][2]= "Each finished quest has a chance to spawn a boss"
set HelpText[i][3]="Quest will have different objective: kill enemies, escort convoy etc..."
set HelpText[i][4]="Each quest ended has a chance to spawn a boss"
//! runtextmacro t__HelpSystem_Init("i","quest","quests")
set i = i + 1
//
set HelpName[i]= "Rank"
set HelpText[i][0]="Ranks are earned with experience points"
set HelpText[i][1]="Each ranks grants more Hero class to play and bonus"
set HelpText[i][2]="Each rank earned means: +5% health points / +2% mp regeneration / +5 speed of movement / +2% attack rate"
set HelpText[i][3]="Each ranks require a minimal amount to be granted"
set HelpText[i][4]="See Experience to get the way to earn more experience"
set HelpText[i][5]="Enter -report to know your class"
//! runtextmacro t__HelpSystem_Init("i","rank","ranks")
set i = i + 1
//
set HelpName[i]= "Tips"
set HelpText[i][0]="Recruit Rule 1: do NOT attack teammates/friendly/neutrals (Friendly Fire)"
set HelpText[i][1]="Recruit Rule 2: do NOT use AOE weapons (Grenades,Mines,Chains,Claymores)"
set HelpText[i][2]="Recruit Rule 3: do NOT tank creeps"
set HelpText[i][3]="Recruit Rule 4: do NOT take all items (Share them, they can be crafted)"
set HelpText[i][4]="Recruit Rule 5: Follow the instructions of higher ranked players."
set HelpText[i][5]="Z+N: Nightvision: +Sight range"
set HelpText[i][6]="Z+T: Sprint"
set HelpText[i][7]="Z+Q: Jump on the target point. "
set HelpText[i][8]="Look to minimap pings for mission objectives."
//! runtextmacro t__HelpSystem_Init("i","tip","tips")
set i = i + 1
//
set HelpMax = i
endfunction
private function Conditions takes nothing returns boolean
local player whichPlayer = GetTriggerPlayer()
local string text = GetEventPlayerChatString()
local integer string_length = StringLength(text)
local integer index
local integer i = 0
if SubString(text,0,HelpCommand_length) == COM then
set text = SubString(text,HelpCommand_length+1,string_length)
if text != null then
set index = Str_table[text]
call DisplayTimedTextToPlayer(whichPlayer,0.,0.,DUR,LINE)
call DisplayTimedTextToPlayer(whichPlayer,0.,0.,DUR,"|c00AFAAFF"+HelpName[index]+"|r")
loop
exitwhen i > HelpTextMax
if HelpText[index][i]!= null then
call DisplayTimedTextToPlayer(whichPlayer,0.,0.,DUR,HelpText[index][i])
endif
set i = i + 1
endloop
else
set text = "Keywords: "
call DisplayTimedTextToPlayer(whichPlayer,0.,0.,DUR,LINE)
call DisplayTimedTextToPlayer(whichPlayer,0.,0.,DUR,NAME)
call DisplayTimedTextToPlayer(whichPlayer,0.,0.,DUR,INFO)
loop
exitwhen i > HelpMax
if HelpName[i]!= null then
set text = text+" - "+HelpName[i]
endif
set i = i + 1
endloop
call DisplayTimedTextToPlayer(whichPlayer,0.,0.,DUR,text)
call DisplayTimedTextToPlayer(whichPlayer,0.,0.,DUR,LINE)
endif
endif
set text = null
return false
endfunction
private function Advert takes nothing returns nothing
call ReleaseTimer(GetExpiredTimer())
call StoryDisplay("Game","Enter -help to activate help center")
endfunction
function StartHelpSpam takes nothing returns nothing
local integer i = 0
local timer t = null
loop
exitwhen i > AMOUNT
set t = NewTimer()
call TimerStart(t,(15.+i*15.),false,function Advert)
set i = i + 1
endloop
endfunction
private function init takes nothing returns nothing
local trigger t = CreateTrigger()
local integer i = 0
set Str_table = StringTable.create()
call SetTextVariables()
set HelpCommand_length = StringLength(COM)
set i = 0
loop
exitwhen i > MAXPLAYER
call TriggerRegisterPlayerChatEvent( t, Player(i), COM, false )
set i = i + 1
endloop
call TriggerAddCondition(t, Condition(function Conditions))
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library UnitPhysic initializer init needs AutoIndex
globals
private key WEIGHT_INDEX
private hashtable HashT
endglobals
//! textmacro t__Physic_Init takes UNIT_TYPE , WEIGHT
call SaveInteger(HashT,$UNIT_TYPE$,WEIGHT_INDEX,$WEIGHT$)
//! endtextmacro
private function SetUnitVariables takes nothing returns nothing
//To find a unit, Ctrl+F (rawcode)
//! runtextmacro t__Physic_Init("'n00Z'","50")
//! runtextmacro t__Physic_Init("'n012'","20")
//! runtextmacro t__Physic_Init("'n00V'","10")
//! runtextmacro t__Physic_Init("'n00X'","5")
//! runtextmacro t__Physic_Init("'n00C'","50")
//! runtextmacro t__Physic_Init("'n00B'","50")
//! runtextmacro t__Physic_Init("'n00I'","15")
//! runtextmacro t__Physic_Init("'n007'","15")
//! runtextmacro t__Physic_Init("'n00E'","15")
//! runtextmacro t__Physic_Init("'n00D'","15")
//! runtextmacro t__Physic_Init("'n009'","15")
//! runtextmacro t__Physic_Init("'n008'","15")
//! runtextmacro t__Physic_Init("'n010'","50")
//! runtextmacro t__Physic_Init("'n00G'","50")
//! runtextmacro t__Physic_Init("'h007'","1000")
//! runtextmacro t__Physic_Init("'o01L'","10")
//! runtextmacro t__Physic_Init("'n00Y'","70")
//! runtextmacro t__Physic_Init("'n013'","70")
//! runtextmacro t__Physic_Init("'n00J'","70")
//! runtextmacro t__Physic_Init("'n003'","70")
//! runtextmacro t__Physic_Init("'n00M'","70")
//! runtextmacro t__Physic_Init("'n00A'","50")
//! runtextmacro t__Physic_Init("'h018'","50")
//! runtextmacro t__Physic_Init("'h019'","50")
//! runtextmacro t__Physic_Init("'h00Q'","20")
//! runtextmacro t__Physic_Init("'h006'","20")
//! runtextmacro t__Physic_Init("'n006'","10")
//! runtextmacro t__Physic_Init("'h001'","20")
//! runtextmacro t__Physic_Init("'h01G'","30")
//! runtextmacro t__Physic_Init("'h015'","30")
//! runtextmacro t__Physic_Init("'n006'","20")
//! runtextmacro t__Physic_Init("'n00P'","10")
//! runtextmacro t__Physic_Init("'o016'","1")
//! runtextmacro t__Physic_Init("'o014'","1")
//! runtextmacro t__Physic_Init("'o017'","1")
//! runtextmacro t__Physic_Init("'o00J'","1")
//! runtextmacro t__Physic_Init("'o013'","1")
//! runtextmacro t__Physic_Init("'o015'","1")
//! runtextmacro t__Physic_Init("'n011'","20")
//! runtextmacro t__Physic_Init("'h01E'","30")
//! runtextmacro t__Physic_Init("'h00V'","3")
//! runtextmacro t__Physic_Init("'h004'","3")
//! runtextmacro t__Physic_Init("'h00O'","3")
//! runtextmacro t__Physic_Init("'h00P'","3")
//! runtextmacro t__Physic_Init("'h009'","3")
//! runtextmacro t__Physic_Init("'h003'","3")
//! runtextmacro t__Physic_Init("'h00U'","3")
//! runtextmacro t__Physic_Init("'n00K'","1")
//! runtextmacro t__Physic_Init("'n00H'","1")
//! runtextmacro t__Physic_Init("'h01F'","30")
//! runtextmacro t__Physic_Init("'n00L'","500")
//! runtextmacro t__Physic_Init("'H01B'","3")
//! runtextmacro t__Physic_Init("'H016'","3")
//! runtextmacro t__Physic_Init("'H00D'","3")
//! runtextmacro t__Physic_Init("'H017'","3")
//! runtextmacro t__Physic_Init("'H00L'","3")
//! runtextmacro t__Physic_Init("'H01C'","3")
//! runtextmacro t__Physic_Init("'H013'","3")
//! runtextmacro t__Physic_Init("'H010'","3")
//! runtextmacro t__Physic_Init("'H00M'","3")
//! runtextmacro t__Physic_Init("'H01D'","3")
//! runtextmacro t__Physic_Init("'H00J'","3")
//! runtextmacro t__Physic_Init("'H00K'","3")
//! runtextmacro t__Physic_Init("'H000'","3")
//! runtextmacro t__Physic_Init("'H01L'","3")
//! runtextmacro t__Physic_Init("'H01P'","3")
//! runtextmacro t__Physic_Init("'H00Z'","3")
//! runtextmacro t__Physic_Init("'H00H'","3")
//! runtextmacro t__Physic_Init("'H00E'","3")
//! runtextmacro t__Physic_Init("'H00X'","3")
//! runtextmacro t__Physic_Init("'H011'","3")
//! runtextmacro t__Physic_Init("'H00I'","3")
//! runtextmacro t__Physic_Init("'H01O'","3")
//! runtextmacro t__Physic_Init("'H00R'","3")
//! runtextmacro t__Physic_Init("'o020'","1")
//! runtextmacro t__Physic_Init("'n00W'","2")
//! runtextmacro t__Physic_Init("'h00Y'","3")
//! runtextmacro t__Physic_Init("'n014'","2")
//! runtextmacro t__Physic_Init("'n016'","2")
//! runtextmacro t__Physic_Init("'n000'","2")
//! runtextmacro t__Physic_Init("'n00O'","2")
//! runtextmacro t__Physic_Init("'n00N'","2")
//! runtextmacro t__Physic_Init("'n00T'","2")
//! runtextmacro t__Physic_Init("'h01A'","50")
//! runtextmacro t__Physic_Init("'n015'","20")
//! runtextmacro t__Physic_Init("'h01N'","50")
//! runtextmacro t__Physic_Init("'h00W'","3")
//! runtextmacro t__Physic_Init("'h00T'","2")
//! runtextmacro t__Physic_Init("'h00A'","2")
//! runtextmacro t__Physic_Init("'h00F'","3")
//! runtextmacro t__Physic_Init("'n001'","2")
//! runtextmacro t__Physic_Init("'h01M'","2")
//! runtextmacro t__Physic_Init("'o00A'","2000")
//! runtextmacro t__Physic_Init("'u006'","5")
//! runtextmacro t__Physic_Init("'u01Y'","3")
//! runtextmacro t__Physic_Init("'u00H'","1")
//! runtextmacro t__Physic_Init("'u00J'","2")
//! runtextmacro t__Physic_Init("'u00E'","2")
//! runtextmacro t__Physic_Init("'u00Z'","2")
//! runtextmacro t__Physic_Init("'u00W'","1")
//! runtextmacro t__Physic_Init("'u00F'","2")
//! runtextmacro t__Physic_Init("'u004'","4")
//! runtextmacro t__Physic_Init("'u008'","2")
//! runtextmacro t__Physic_Init("'u009'","1")
//! runtextmacro t__Physic_Init("'u013'","2")
//! runtextmacro t__Physic_Init("'u00N'","1")
//! runtextmacro t__Physic_Init("'u00O'","50")
//! runtextmacro t__Physic_Init("'u00Q'","5")
//! runtextmacro t__Physic_Init("'u007'","3")
//! runtextmacro t__Physic_Init("'u00B'","5")
//! runtextmacro t__Physic_Init("'u00K'","4")
//! runtextmacro t__Physic_Init("'u00V'","1")
//! runtextmacro t__Physic_Init("'u00C'","2")
//! runtextmacro t__Physic_Init("'u00T'","2")
//! runtextmacro t__Physic_Init("'u010'","2")
//! runtextmacro t__Physic_Init("'u00Y'","2")
//! runtextmacro t__Physic_Init("'u01J'","2")
//! runtextmacro t__Physic_Init("'u001'","2")
//! runtextmacro t__Physic_Init("'u005'","2")
//! runtextmacro t__Physic_Init("'u003'","2")
//! runtextmacro t__Physic_Init("'u011'","3")
//! runtextmacro t__Physic_Init("'u00S'","30")
//! runtextmacro t__Physic_Init("'u00U'","10")
//! runtextmacro t__Physic_Init("'u00A'","10")
//! runtextmacro t__Physic_Init("'u002'","20")
//! runtextmacro t__Physic_Init("'u01L'","50")
//! runtextmacro t__Physic_Init("'u000'","40")
//! runtextmacro t__Physic_Init("'u01D'","5")
//! runtextmacro t__Physic_Init("'u01U'","30")
//! runtextmacro t__Physic_Init("'u00I'","50")
//! runtextmacro t__Physic_Init("'u01X'","30")
//! runtextmacro t__Physic_Init("'u01E'","50")
//! runtextmacro t__Physic_Init("'u01S'","30")
//! runtextmacro t__Physic_Init("'u01T'","50")
//! runtextmacro t__Physic_Init("'u01N'","30")
//! runtextmacro t__Physic_Init("'u01W'","50")
//! runtextmacro t__Physic_Init("'u01A'","30")
//! runtextmacro t__Physic_Init("'u01R'","30")
//! runtextmacro t__Physic_Init("'u018'","40")
//! runtextmacro t__Physic_Init("'u01C'","30")
//! runtextmacro t__Physic_Init("'u00R'","40")
//! runtextmacro t__Physic_Init("'u01M'","50")
//! runtextmacro t__Physic_Init("'u01K'","40")
//! runtextmacro t__Physic_Init("'u019'","20")
//! runtextmacro t__Physic_Init("'u015'","50")
//! runtextmacro t__Physic_Init("'u01P'","40")
//! runtextmacro t__Physic_Init("'u01B'","40")
//! runtextmacro t__Physic_Init("'u01Q'","40")
//! runtextmacro t__Physic_Init("'u00G'","50")
//! runtextmacro t__Physic_Init("'u01O'","20")
//! runtextmacro t__Physic_Init("'u01V'","40")
//! runtextmacro t__Physic_Init("'u014'","10")
//! runtextmacro t__Physic_Init("'u01H'","50")
//! runtextmacro t__Physic_Init("'u01I'","50")
//! runtextmacro t__Physic_Init("'u016'","40")
//! runtextmacro t__Physic_Init("'u00D'","50")
//! runtextmacro t__Physic_Init("'u01F'","20")
//! runtextmacro t__Physic_Init("'u01G'","40")
//! runtextmacro t__Physic_Init("'u017'","20")
//! runtextmacro t__Physic_Init("'u012'","50")
//! runtextmacro t__Physic_Init("'o00T'","2")
//! runtextmacro t__Physic_Init("'o00U'","2")
//! runtextmacro t__Physic_Init("'o00Q'","2")
//! runtextmacro t__Physic_Init("'o002'","3")
//! runtextmacro t__Physic_Init("'o01T'","5")
//! runtextmacro t__Physic_Init("'o00V'","1")
//! runtextmacro t__Physic_Init("'o01N'","3")
//! runtextmacro t__Physic_Init("'o01O'","10")
//! runtextmacro t__Physic_Init("'o02J'","2")
//! runtextmacro t__Physic_Init("'o00S'","2")
//! runtextmacro t__Physic_Init("'o00R'","2")
//! runtextmacro t__Physic_Init("'o029'","10")
//! runtextmacro t__Physic_Init("'o00X'","1")
//! runtextmacro t__Physic_Init("'o00W'","1")
//! runtextmacro t__Physic_Init("'o026'","50")
//! runtextmacro t__Physic_Init("'o00K'","1")
endfunction
private struct str
integer weight =0
private static method createFilter takes unit u returns boolean
return LoadInteger(HashT,GetUnitTypeId(u),WEIGHT_INDEX)>=1
endmethod
private method onCreate takes nothing returns nothing
set .weight = LoadInteger(HashT,GetUnitTypeId(me),WEIGHT_INDEX)
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
set weight = 0
endmethod
implement AutoDestroy
endstruct
function GetUnitWeight takes unit whichUnit returns real
local str dat = str[whichUnit]
local real weight = 0.
if dat == 0 or dat.weight <=0 then
set weight = 0.
else
set weight = (5/dat.weight)
endif
return weight
endfunction
private function init takes nothing returns nothing
local trigger t = CreateTrigger()
local integer i = 0
set HashT = InitHashtable()
call SetUnitVariables()
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope TestRandom initializer init
globals
integer RandomCinem
endglobals
public function init takes nothing returns nothing
set RandomCinem = GetRandomInt(0,100)
endfunction
endscope
//TESH.scrollpos=76
//TESH.alwaysfold=0
library Cinematic1 needs CinematicSystem
private function RunCinematic takes nothing returns nothing
local unit marine1 = null
local unit marine2 = null
local unit creeps = null
local unit scientist = null
local real x1 = GetRectCenterX(gg_rct_Cinem1001)
local real y1 = GetRectCenterY(gg_rct_Cinem1001)
local real x2 = GetRectCenterX(gg_rct_Cinem1002)
local real y2 = GetRectCenterY(gg_rct_Cinem1002)
local real x3 = GetRectCenterX(gg_rct_Cinem1003)
local real y3 = GetRectCenterY(gg_rct_Cinem1003)
call CamAll(gg_cam_Cin1,0.)
set marine1 = CreateUnit(Player(10),'h003',x1,y1,0.)
set marine2 = CreateUnit(Player(10),'h00P',x1,y1,0.)
call UnitAddAbility(marine1,CINEM_UNIT)
call UnitAddAbility(marine2,CINEM_UNIT)
call IssuePointOrder(marine1,"move",x2+GetRandomReal(-50.,50.),y2+GetRandomReal(-50.,50.))
call IssuePointOrder(marine2,"move",x2+GetRandomReal(-50.,50.),y2+GetRandomReal(-50.,50.))
call TriggerSleepAction(5.)
call CinemText(marine1,"Oh my god.")
call TriggerSleepAction(CINEM_DUR)
call CinemText(marine1,"What happened there?")
call TriggerSleepAction(CINEM_DUR)
call CinemText(marine2,"Control? Are you here?")
call TriggerSleepAction(CINEM_DUR)
call CinemText(marine2,"Send a squad there. Something wrong is...")
call TriggerSleepAction(CINEM_DUR)
call ModifyGateBJ( bj_GATEOPERATION_OPEN, MainGate )
set scientist = CreateUnit(Player(10),'n001',x3,y3,0.)
call UnitAddAbility(scientist,CINEM_UNIT)
call UnitAddAbility(scientist,BLOOD_FX)
call IssuePointOrder(scientist,"move",x2+GetRandomReal(-50.,50.),y2+GetRandomReal(-50.,50.))
call TriggerSleepAction(CINEM_DUR)
call ModifyGateBJ( bj_GATEOPERATION_CLOSE, MainGate )
call CinemText(scientist,"Please, help me!")
call TriggerSleepAction(CINEM_DUR)
call CinemText(marine2,"Hey! Are you hurt?")
call TriggerSleepAction(CINEM_DUR)
call CinemText(scientist,"Arrrrgh")
call KillUnit(scientist)
call TriggerSleepAction(CINEM_DUR)
call ModifyGateBJ( bj_GATEOPERATION_OPEN, MainGate )
call CinemText(marine1,"What now?")
call TriggerSleepAction(CINEM_DUR)
set creeps = CreateUnit(Player(11),'u001',x3,y3,0.)
call UnitAddAbility(creeps,CINEM_UNIT)
call IssuePointOrder(creeps,"attack",x2,y2)
call TriggerSleepAction(0.2)
set creeps = CreateUnit(Player(11),'u001',x3,y3,0.)
call UnitAddAbility(creeps,CINEM_UNIT)
call IssuePointOrder(creeps,"attack",x2,y2)
call TriggerSleepAction(0.2)
set creeps = CreateUnit(Player(11),'u005',x3,y3,0.)
call UnitAddAbility(creeps,CINEM_UNIT)
call IssuePointOrder(creeps,"attack",x2,y2)
call TriggerSleepAction(0.2)
set creeps = CreateUnit(Player(11),'u003',x3,y3,0.)
call UnitAddAbility(creeps,CINEM_UNIT)
call IssuePointOrder(creeps,"attack",x2,y2)
call TriggerSleepAction(0.2)
set creeps = CreateUnit(Player(11),'u00E',x3,y3,0.)
call UnitAddAbility(creeps,CINEM_UNIT)
call IssuePointOrder(creeps,"attack",x2,y2)
call TriggerSleepAction(0.2)
set creeps = CreateUnit(Player(11),'u00F',x3,y3,0.)
call UnitAddAbility(creeps,CINEM_UNIT)
call IssuePointOrder(creeps,"attack",x2,y2)
call TriggerSleepAction(0.2)
call ModifyGateBJ( bj_GATEOPERATION_OPEN, MainGate )
call CinemText(marine1,"Control! We have a probleme!")
call IssuePointOrder(marine1,"move",x1,y1)
call IssuePointOrder(marine2,"move",x1,y1)
call TriggerSleepAction(5.)
call CinematicEnd()
call ModifyGateBJ( bj_GATEOPERATION_CLOSE, MainGate )
set scientist = null
set marine1 = null
set marine2 = null
set creeps = null
endfunction
function StartCinematic1 takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterTimerEvent(t, 0.01,false)
call TriggerAddAction(t, function RunCinematic)
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library Cinematic2 needs CinematicSystem
private function RunCinematic takes nothing returns nothing
local unit marine = null
local unit man2 = null
local unit man = null
local unit woman = null
local unit child = null
local unit creeps = null
local real x1 = GetRectCenterX(gg_rct_Cinem2001)
local real y1 = GetRectCenterY(gg_rct_Cinem2001)
local real x2 = GetRectCenterX(gg_rct_Cinem2002)
local real y2 = GetRectCenterY(gg_rct_Cinem2002)
local real x3 = GetRectCenterX(gg_rct_Cinem2003)
local real y3 = GetRectCenterY(gg_rct_Cinem2003)
set marine = CreateUnit(Player(10),'h003',x1+GetRandomReal(-50.,50.),y1+GetRandomReal(-50.,50.),0.)
call UnitAddAbility(marine,CINEM_UNIT)
set man2 = CreateUnit(Player(10),'n000',x1+GetRandomReal(-50.,50.),y1+GetRandomReal(-50.,50.),0.)
call UnitAddAbility(man2,CINEM_UNIT)
set man = CreateUnit(Player(10),'n00O',x1+GetRandomReal(-50.,50.),y1+GetRandomReal(-50.,50.),0.)
call UnitAddAbility(man,CINEM_UNIT)
set woman = CreateUnit(Player(10),'n00N',x1+GetRandomReal(-50.,50.),y1+GetRandomReal(-50.,50.),0.)
call UnitAddAbility(woman,CINEM_UNIT)
set child = CreateUnit(Player(10),'n00T',x1+GetRandomReal(-50.,50.),y1+GetRandomReal(-50.,50.),0.)
call UnitAddAbility(child,CINEM_UNIT)
call CamAll(gg_cam_Cin2,0.)
call TriggerSleepAction(5.)
call CinemText(marine,"Stay there")
call TriggerSleepAction(CINEM_DUR)
call CinemText(child,"Mum, what's going on?")
call TriggerSleepAction(CINEM_DUR)
call CinemText(woman,"Don't worry")
call TriggerSleepAction(CINEM_DUR)
call CinemText(marine,"All will be fine")
call TriggerSleepAction(CINEM_DUR)
call CinemText(man,"I hope you have a good gun")
call TriggerSleepAction(CINEM_DUR)
set creeps = CreateUnit(Player(11),'u001',x2,y2,0.)
call UnitAddAbility(creeps,CINEM_UNIT)
call IssuePointOrder(creeps,"attack",x1,y1)
call TriggerSleepAction(0.2)
set creeps = CreateUnit(Player(11),'u001',x2,y2,0.)
call UnitAddAbility(creeps,CINEM_UNIT)
call IssuePointOrder(creeps,"attack",x1,y1)
call TriggerSleepAction(0.2)
set creeps = CreateUnit(Player(11),'u005',x2,y2,0.)
call UnitAddAbility(creeps,CINEM_UNIT)
call IssuePointOrder(creeps,"attack",x1,y1)
call TriggerSleepAction(0.2)
set creeps = CreateUnit(Player(11),'u003',x2,y2,0.)
call UnitAddAbility(creeps,CINEM_UNIT)
call IssuePointOrder(creeps,"attack",x1,y1)
call TriggerSleepAction(0.2)
set creeps = CreateUnit(Player(11),'u00E',x2,y2,0.)
call UnitAddAbility(creeps,CINEM_UNIT)
call IssuePointOrder(creeps,"attack",x1,y1)
call TriggerSleepAction(0.2)
set creeps = CreateUnit(Player(11),'u00F',x2,y2,0.)
call UnitAddAbility(creeps,CINEM_UNIT)
call IssuePointOrder(creeps,"attack",x1,y1)
call TriggerSleepAction(10.)
call CinemText(man,"Move!")
call TriggerSleepAction(CINEM_DUR)
call IssuePointOrder(man,"move",x3,y3)
call IssuePointOrder(man2,"move",x3,y3)
call IssuePointOrder(woman,"move",x3,y3)
call IssuePointOrder(child,"move",x3,y3)
call TriggerSleepAction(5.)
call CinematicEnd()
set man2 = null
set man = null
set woman = null
set child = null
set marine = null
set creeps = null
endfunction
function StartCinematic2 takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterTimerEvent(t, 0.01,false)
call TriggerAddAction(t, function RunCinematic)
endfunction
endlibrary
//TESH.scrollpos=15
//TESH.alwaysfold=0
library Cinematic3 needs CinematicSystem
private function RunCinematic takes nothing returns nothing
local unit drone = null
local unit marine1 = null
local unit marine2 = null
local unit marine3 = null
local unit marine4 = null
local unit marine5 = null
local real x1 = GetRectCenterX(gg_rct_Cinem3001)
local real y1 = GetRectCenterY(gg_rct_Cinem3001)
local real x2 = GetRectCenterX(gg_rct_Cinem3002)
local real y2 = GetRectCenterY(gg_rct_Cinem3002)
local real x3 = GetRectCenterX(gg_rct_Cinem3003)
local real y3 = GetRectCenterY(gg_rct_Cinem3003)
call CamAll(gg_cam_Cin3,0.)
set drone = CreateUnit(Player(10),'n00G',x1,y1,0.)
call SetUnitFlyHeight(drone,800.,0.)
call UnitAddAbility(drone,CINEM_UNIT)
call TriggerSleepAction(5.)
call SetUnitFlyHeight(drone,0.,200.)
call TriggerSleepAction(5.)
call CinemText(drone,"Okay, come in.")
set marine1 = CreateUnit(Player(10),'h00U',x2,y2,0.)
set marine2 = CreateUnit(Player(10),'h00U',x2,y2,0.)
set marine3 = CreateUnit(Player(10),'h00U',x2,y2,0.)
set marine4 = CreateUnit(Player(10),'h00V',x2,y2,0.)
set marine5 = CreateUnit(Player(10),'h004',x2,y2,0.)
call UnitAddAbility(marine1,CINEM_UNIT)
call UnitAddAbility(marine2,CINEM_UNIT)
call UnitAddAbility(marine3,CINEM_UNIT)
call UnitAddAbility(marine4,CINEM_UNIT)
call UnitAddAbility(marine5,CINEM_UNIT)
call IssuePointOrder(marine1,"move",x1,y1)
call IssuePointOrder(marine2,"move",x1,y1)
call IssuePointOrder(marine3,"move",x1,y1)
call IssuePointOrder(marine4,"move",x1,y1)
call IssuePointOrder(marine5,"move",x1,y1)
call TriggerSleepAction(10.)
call CinemText(drone,"Welcome, gentlemen")
call ShowUnit(marine1,false)
call ShowUnit(marine2,false)
call ShowUnit(marine3,false)
call ShowUnit(marine4,false)
call ShowUnit(marine5,false)
call TriggerSleepAction(CINEM_DUR)
call CinemText(drone,"Let's go")
call SetUnitFlyHeight(drone,700.,200.)
call CamAll(gg_cam_Cin3B,3.)
call LockAll(drone)
call TriggerSleepAction(5.)
call CinemText(drone,"Get ready to jump")
call IssuePointOrder(drone,"move",x3,y3)
call TriggerSleepAction(10.)
call CinematicEnd()
call KillUnit(drone)
set marine1 = null
set marine2 = null
set marine3 = null
set marine4 = null
set marine5 = null
set drone = null
endfunction
function StartCinematic3 takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterTimerEvent(t, 0.01,false)
call TriggerAddAction(t, function RunCinematic)
endfunction
endlibrary
//TESH.scrollpos=3
//TESH.alwaysfold=0
library Cinematic4 needs CinematicSystem
private function RunCinematic takes nothing returns nothing
local unit fury = null
local unit marine1 = null
local unit marine2 = null
local unit marine3 = null
local unit marine4 = null
local unit marine5 = null
local unit creeps = null
local real x1 = GetRectCenterX(gg_rct_Cinem4001)
local real y1 = GetRectCenterY(gg_rct_Cinem4001)
local real x2 = GetRectCenterX(gg_rct_Cinem4002)
local real y2 = GetRectCenterY(gg_rct_Cinem4002)
local real x3 = GetRectCenterX(gg_rct_Cinem4003)
local real y3 = GetRectCenterY(gg_rct_Cinem4003)
call CamAll(gg_cam_Cin4,0.)
set fury = CreateUnit(Player(10),'h001',x1+GetRandomReal(-100.,100),y1+GetRandomReal(-100.,100),0.)
set marine1 = CreateUnit(Player(10),'h00U',x1+GetRandomReal(-100.,100),y1+GetRandomReal(-100.,100),0.)
set marine2 = CreateUnit(Player(10),'h00U',x1+GetRandomReal(-100.,100),y1+GetRandomReal(-100.,100),0.)
set marine3 = CreateUnit(Player(10),'h00U',x1+GetRandomReal(-100.,100),y1+GetRandomReal(-100.,100),0.)
set marine4 = CreateUnit(Player(10),'h00V',x1+GetRandomReal(-100.,100),y1+GetRandomReal(-100.,100),0.)
set marine5 = CreateUnit(Player(10),'h004',x1+GetRandomReal(-100.,100),y1+GetRandomReal(-100.,100),0.)
call UnitAddAbility(fury,CINEM_UNIT)
call UnitAddAbility(marine1,CINEM_UNIT)
call UnitAddAbility(marine2,CINEM_UNIT)
call UnitAddAbility(marine3,CINEM_UNIT)
call UnitAddAbility(marine4,CINEM_UNIT)
call UnitAddAbility(marine5,CINEM_UNIT)
call TriggerSleepAction(3.)
call CinemText(fury,"They are incoming!")
call TriggerSleepAction(CINEM_DUR)
call CinemText(marine1,"Go!Go!Go!")
call TriggerSleepAction(CINEM_DUR)
call CinemText(marine4,"What a joke")
set creeps = CreateUnit(Player(11),'u001',x3,y3,0.)
call UnitAddAbility(creeps,CINEM_UNIT)
call IssuePointOrder(creeps,"attack",x2,y2)
call TriggerSleepAction(0.1)
set creeps = CreateUnit(Player(11),'u010',x3,y3,0.)
call UnitAddAbility(creeps,CINEM_UNIT)
call IssuePointOrder(creeps,"attack",x2,y2)
call TriggerSleepAction(0.1)
set creeps = CreateUnit(Player(11),'u010',x3,y3,0.)
call UnitAddAbility(creeps,CINEM_UNIT)
call IssuePointOrder(creeps,"attack",x2,y2)
call TriggerSleepAction(0.1)
set creeps = CreateUnit(Player(11),'u010',x3,y3,0.)
call UnitAddAbility(creeps,CINEM_UNIT)
call IssuePointOrder(creeps,"attack",x2,y2)
call TriggerSleepAction(0.1)
set creeps = CreateUnit(Player(11),'u001',x3,y3,0.)
call UnitAddAbility(creeps,CINEM_UNIT)
call IssuePointOrder(creeps,"attack",x2,y2)
call TriggerSleepAction(0.1)
set creeps = CreateUnit(Player(11),'u00Z',x3,y3,0.)
call UnitAddAbility(creeps,CINEM_UNIT)
call IssuePointOrder(creeps,"attack",x2,y2)
call TriggerSleepAction(0.1)
set creeps = CreateUnit(Player(11),'u00Z',x3,y3,0.)
call UnitAddAbility(creeps,CINEM_UNIT)
call IssuePointOrder(creeps,"attack",x2,y2)
call TriggerSleepAction(0.1)
set creeps = CreateUnit(Player(11),'u00Z',x3,y3,0.)
call UnitAddAbility(creeps,CINEM_UNIT)
call IssuePointOrder(creeps,"attack",x2,y2)
call TriggerSleepAction(0.1)
set creeps = CreateUnit(Player(11),'u005',x3,y3,0.)
call UnitAddAbility(creeps,CINEM_UNIT)
call IssuePointOrder(creeps,"attack",x2,y2)
call TriggerSleepAction(0.1)
set creeps = CreateUnit(Player(11),'u003',x3,y3,0.)
call UnitAddAbility(creeps,CINEM_UNIT)
call IssuePointOrder(creeps,"attack",x2,y2)
call TriggerSleepAction(0.1)
set creeps = CreateUnit(Player(11),'u00E',x3,y3,0.)
call UnitAddAbility(creeps,CINEM_UNIT)
call IssuePointOrder(creeps,"attack",x2,y2)
call TriggerSleepAction(0.1)
set creeps = CreateUnit(Player(11),'u00F',x3,y3,0.)
call UnitAddAbility(creeps,CINEM_UNIT)
call IssuePointOrder(creeps,"attack",x2,y2)
call TriggerSleepAction(0.1)
call CinemText(marine4,"Son of a bitch")
call TriggerSleepAction(CINEM_DUR)
call CamAll(gg_cam_Cin4B,15.)
call IssuePointOrder(fury,"attack",x2,y2)
call IssuePointOrder(marine1,"attack",x2,y2)
call IssuePointOrder(marine2,"attack",x2,y2)
call IssuePointOrder(marine3,"attack",x2,y2)
call IssuePointOrder(marine4,"attack",x2,y2)
call IssuePointOrder(marine5,"attack",x2,y2)
call CinemText(marine3,"Fire at will!")
call TriggerSleepAction(CINEM_DUR)
call TriggerSleepAction(20.)
call CinematicEnd()
set marine1 = null
set marine2 = null
set marine3 = null
set marine4 = null
set marine5 = null
set fury = null
set creeps = null
endfunction
function StartCinematic4 takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterTimerEvent(t, 0.01,false)
call TriggerAddAction(t, function RunCinematic)
endfunction
endlibrary
//TESH.scrollpos=67
//TESH.alwaysfold=0
library Cinematic5 needs CinematicSystem,TimerUtils
private struct str
unit u1
unit u2
lightning e
integer i
integer dur
real cx1
real cx2
endstruct
private function Update takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
local real x1 = GetUnitX(dat.u1)
local real y1 = GetUnitY(dat.u1)
local real z1 = GetUnitFlyHeight(dat.u1)
local real x2 = GetUnitX(dat.u2)
local real y2 = GetUnitY(dat.u2)
local real z2 = GetUnitFlyHeight(dat.u2)
if dat.i < dat.dur and GetUnitState(dat.u2, UNIT_STATE_LIFE) > 0 then
set dat.i = dat.i + 1
call MoveLightningEx(dat.e,true,x1,y1,z1+dat.cx1,x2,y2,z2+dat.cx2)
else
call DestroyLightning(dat.e)
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function AddLightningToUnit takes unit u1,unit u2,real cx1,real cx2, string s, real dur returns nothing
local timer t = NewTimer()
local str dat = str.create()
local real x1 = GetUnitX(u1)
local real y1 = GetUnitY(u1)
local real z1 = GetUnitFlyHeight(u1)
local real x2 = GetUnitX(u2)
local real y2 = GetUnitY(u2)
local real z2 = GetUnitFlyHeight(u2)
set dat.u1 = u1
set dat.u2 = u2
set dat.cx1 = cx1
set dat.cx2 = cx2
set dat.e = AddLightningEx(s,true,x1,y1,z1+dat.cx1,x2,y2,z2+dat.cx2)
set dat.i = 0
set dat.dur = R2I(dur/TIMEOUT)
call SetTimerData(t, dat)
call TimerStart (t, TIMEOUT, true, function Update )
set u1 = null
set u2 = null
set s = null
endfunction
private function RunCinematic takes nothing returns nothing
local unit marine = null
local unit scientist = null
local unit creeps = null
local unit gen1 = EnergeticFactoryGenerator[0]
local unit gen2 = EnergeticFactoryGenerator[1]
local unit gen3 = EnergeticFactoryGenerator[2]
local unit gen4 = EnergeticFactoryGenerator[3]
local unit dummy = null
local real x1 = GetRectCenterX(gg_rct_Cinem5001)
local real y1 = GetRectCenterY(gg_rct_Cinem5001)
local real x2 = GetRectCenterX(gg_rct_Cinem5002)
local real y2 = GetRectCenterY(gg_rct_Cinem5002)
local real x3 = GetRectCenterX(gg_rct_Cinem5003)
local real y3 = GetRectCenterY(gg_rct_Cinem5003)
set marine = CreateUnit(Player(10),'h003',x1+GetRandomReal(-100.,100.),y1+GetRandomReal(-100.,100.),0.)
call UnitAddAbility(marine,CINEM_UNIT)
set scientist = CreateUnit(Player(10),'n001',x1,y1,0.)
call UnitAddAbility(marine,CINEM_UNIT)
call CamAll(gg_cam_Cin5,0.)
call TriggerSleepAction(5.)
call CinemText(marine,"Are you ready?")
call TriggerSleepAction(CINEM_DUR)
call CinemText(scientist,"Yes.")
call TriggerSleepAction(CINEM_DUR)
call IssuePointOrder(scientist,"move",x3,y3)
call TriggerSleepAction(CINEM_DUR)
call SetUnitAnimation(scientist,"attack")
call CinemText(scientist,"I hope it will work.")
call TriggerSleepAction(CINEM_DUR)
set dummy = CreateUnit(Player(10),'o007',x2,y2,0.)
call UnitAddAbility(dummy,CINEM_UNIT)
call SetUnitFlyHeight(dummy,200.,50.)
call UnitApplyTimedLife(dummy,'BTLF',4.)
call AddLightningToUnit(gen1,dummy,200.,60.,"CLPB",4.)
call TriggerSleepAction(CINEM_DUR)
set dummy = CreateUnit(Player(10),'o007',x2,y2,0.)
call UnitAddAbility(dummy,CINEM_UNIT)
call SetUnitFlyHeight(dummy,200.,50.)
call UnitApplyTimedLife(dummy,'BTLF',4.)
call AddLightningToUnit(gen2,dummy,200.,60.,"CLPB",4.)
call TriggerSleepAction(CINEM_DUR)
set dummy = CreateUnit(Player(10),'o007',x2,y2,0.)
call UnitAddAbility(dummy,CINEM_UNIT)
call SetUnitFlyHeight(dummy,200.,50.)
call UnitApplyTimedLife(dummy,'BTLF',4.)
call AddLightningToUnit(gen3,dummy,200.,60.,"CLPB",4.)
call TriggerSleepAction(CINEM_DUR)
call CinemText(scientist,"It seems fine.")
call TriggerSleepAction(CINEM_DUR)
call CinemText(scientist,"Let's run it.")
call SetUnitAnimation(scientist,"attack")
call TriggerSleepAction(CINEM_DUR)
set dummy = CreateUnit(Player(10),'o007',x2,y2,0.)
call UnitAddAbility(dummy,CINEM_UNIT)
call SetUnitFlyHeight(dummy,200.,25.)
call UnitApplyTimedLife(dummy,'BTLF',15.)
call AddLightningToUnit(gen1,dummy,200.,60.,"CLPB",15.)
call AddLightningToUnit(gen2,dummy,200.,60.,"CLPB",15.)
call AddLightningToUnit(gen3,dummy,200.,60.,"CLPB",15.)
call TriggerSleepAction(CINEM_DUR)
call CinemText(scientist,"Oh no.")
call TriggerSleepAction(CINEM_DUR)
call AddLightningToUnit(gen1,scientist,60.,20.,"CLPB",1.)
call AddLightningToUnit(gen2,scientist,60.,20.,"CLPB",1.)
call AddLightningToUnit(gen3,scientist,60.,20.,"CLPB",1.)
call TriggerSleepAction(CINEM_DUR)
call CinemText(scientist,"Aaaaaah!")
call KillUnit(scientist)
call TriggerSleepAction(CINEM_DUR)
call CinemText(marine,"Shit...")
call TriggerSleepAction(CINEM_DUR)
call AddLightningToUnit(gen1,gen4,60.,0.,"CLPB",0.5)
call AddLightningToUnit(gen2,gen4,60.,0.,"CLPB",0.5)
call AddLightningToUnit(gen3,gen4,60.,0.,"CLPB",0.5)
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Human\\Thunderclap\\ThunderClapCaster.mdl",x2,y2))
set creeps = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),'u006',x2,y2,0.)
call UnitAddAbility(creeps,CINEM_UNIT)
call KillUnit(dummy)
call TriggerSleepAction(CINEM_DUR)
call CinemText(marine,"What the fuck!")
call TriggerSleepAction(CINEM_DUR)
call SetUnitOwner(creeps,Player(11),false)
call IssueTargetOrder(creeps,"attack",marine)
call TriggerSleepAction(5.)
call CinematicEnd()
set scientist = null
set marine = null
set creeps = null
set gen1 = null
set gen2 = null
set gen3 = null
set gen4 = null
set dummy = null
endfunction
function StartCinematic5 takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterTimerEvent(t, 0.01,false)
call TriggerAddAction(t, function RunCinematic)
endfunction
endlibrary
//TESH.scrollpos=6
//TESH.alwaysfold=0
library Cinematic6 needs CinematicSystem
private function RunCinematic takes nothing returns nothing
local unit marine = null
local unit child = null
local unit creeps = null
local real x1 = GetRectCenterX(gg_rct_Cinem6001)
local real y1 = GetRectCenterY(gg_rct_Cinem6001)
local real x2 = GetRectCenterX(gg_rct_Cinem6002)
local real y2 = GetRectCenterY(gg_rct_Cinem6002)
set marine = CreateUnit(Player(10),'h003',x1+GetRandomReal(-50.,50.),y1+GetRandomReal(-50.,50.),0.)
call UnitAddAbility(marine,CINEM_UNIT)
set child = CreateUnit(Player(10),'n00T',x1+GetRandomReal(-50.,50.),y1+GetRandomReal(-50.,50.),0.)
call UnitAddAbility(child,CINEM_UNIT)
call CamAll(gg_cam_Cin6,0.)
call TriggerSleepAction(5.)
call CinemText(child,"sigh")
call TriggerSleepAction(CINEM_DUR)
call CinemText(marine,"why are you crying?")
call TriggerSleepAction(CINEM_DUR)
call CinemText(child,"snif")
call TriggerSleepAction(CINEM_DUR)
call CinemText(marine,"Mmmm. Come on.")
call TriggerSleepAction(CINEM_DUR)
call CinemText(marine,"Where are your parents?")
call TriggerSleepAction(CINEM_DUR)
call CinemText(child,"The big lady ate them")
call TriggerSleepAction(CINEM_DUR)
call CinemText(marine,"The big lady?")
call TriggerSleepAction(CINEM_DUR)
set creeps = CreateUnit(Player(10),'u01B',x2,y2,0.)
call UnitAddAbility(creeps,CINEM_UNIT)
call CamAll(gg_cam_Cin6B,0.)
call TriggerSleepAction(CINEM_DUR)
call CinemText(marine,"Oh my god!")
call TriggerSleepAction(CINEM_DUR)
call SetUnitOwner(creeps,Player(11),false)
call IssueTargetOrder(creeps,"attack",marine)
call TriggerSleepAction(5.)
call CinematicEnd()
set child = null
set marine = null
set creeps = null
endfunction
function StartCinematic6 takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterTimerEvent(t, 0.01,false)
call TriggerAddAction(t, function RunCinematic)
endfunction
endlibrary
//TESH.scrollpos=24
//TESH.alwaysfold=0
library Cinematic7 needs CinematicSystem
private function RunCinematic takes nothing returns nothing
local unit car = null
local unit marine1 = null
local unit marine2 = null
local unit marine3 = null
local unit marine4 = null
local unit marine5 = null
local unit creeps = null
local real x1 = GetRectCenterX(gg_rct_Cinem7001)
local real y1 = GetRectCenterY(gg_rct_Cinem7001)
local real x2 = GetRectCenterX(gg_rct_Cinem7002)
local real y2 = GetRectCenterY(gg_rct_Cinem7002)
call CamAll(gg_cam_Cin7,0.)
set car = CreateUnit(Player(10),'n011',x1+GetRandomReal(-100.,100),y1+GetRandomReal(-100.,100),0.)
set marine1 = CreateUnit(Player(10),'h00U',x1+GetRandomReal(-100.,100),y1+GetRandomReal(-100.,100),0.)
set marine2 = CreateUnit(Player(10),'h00U',x1+GetRandomReal(-100.,100),y1+GetRandomReal(-100.,100),0.)
set marine3 = CreateUnit(Player(10),'h00U',x1+GetRandomReal(-100.,100),y1+GetRandomReal(-100.,100),0.)
set marine4 = CreateUnit(Player(10),'h00V',x1+GetRandomReal(-100.,100),y1+GetRandomReal(-100.,100),0.)
set marine5 = CreateUnit(Player(10),'h004',x1+GetRandomReal(-100.,100),y1+GetRandomReal(-100.,100),0.)
call UnitAddAbility(car,CINEM_UNIT)
call UnitAddAbility(marine1,CINEM_UNIT)
call UnitAddAbility(marine2,CINEM_UNIT)
call UnitAddAbility(marine3,CINEM_UNIT)
call UnitAddAbility(marine4,CINEM_UNIT)
call UnitAddAbility(marine5,CINEM_UNIT)
call TriggerSleepAction(3.)
call CinemText(car,"Control! We need assistance!")
call TriggerSleepAction(CINEM_DUR)
call CinemText(marine1,"Go!Go!Go!")
call TriggerSleepAction(CINEM_DUR)
call CinemText(marine4,"They are too close!")
set creeps = CreateUnit(Player(11),'u001',x2,y2,0.)
call UnitAddAbility(creeps,CINEM_UNIT)
call IssuePointOrder(creeps,"attack",x1,y1)
call TriggerSleepAction(0.1)
set creeps = CreateUnit(Player(11),'u010',x2,y2,0.)
call UnitAddAbility(creeps,CINEM_UNIT)
call IssuePointOrder(creeps,"attack",x1,y1)
call TriggerSleepAction(0.1)
set creeps = CreateUnit(Player(11),'u010',x2,y2,0.)
call UnitAddAbility(creeps,CINEM_UNIT)
call IssuePointOrder(creeps,"attack",x1,y1)
call TriggerSleepAction(0.1)
set creeps = CreateUnit(Player(11),'u010',x2,y2,0.)
call UnitAddAbility(creeps,CINEM_UNIT)
call IssuePointOrder(creeps,"attack",x1,y1)
call TriggerSleepAction(0.1)
set creeps = CreateUnit(Player(11),'u001',x2,y2,0.)
call UnitAddAbility(creeps,CINEM_UNIT)
call IssuePointOrder(creeps,"attack",x1,y1)
call TriggerSleepAction(0.1)
set creeps = CreateUnit(Player(11),'u00Z',x2,y2,0.)
call UnitAddAbility(creeps,CINEM_UNIT)
call IssuePointOrder(creeps,"attack",x1,y1)
call TriggerSleepAction(0.1)
set creeps = CreateUnit(Player(11),'u00Z',x2,y2,0.)
call UnitAddAbility(creeps,CINEM_UNIT)
call IssuePointOrder(creeps,"attack",x1,y1)
call TriggerSleepAction(0.1)
set creeps = CreateUnit(Player(11),'u00Z',x2,y2,0.)
call UnitAddAbility(creeps,CINEM_UNIT)
call IssuePointOrder(creeps,"attack",x1,y1)
call TriggerSleepAction(0.1)
set creeps = CreateUnit(Player(11),'u005',x2,y2,0.)
call UnitAddAbility(creeps,CINEM_UNIT)
call IssuePointOrder(creeps,"attack",x1,y1)
call TriggerSleepAction(0.1)
set creeps = CreateUnit(Player(11),'u003',x2,y2,0.)
call UnitAddAbility(creeps,CINEM_UNIT)
call IssuePointOrder(creeps,"attack",x1,y1)
call TriggerSleepAction(0.1)
set creeps = CreateUnit(Player(11),'u00E',x2,y2,0.)
call UnitAddAbility(creeps,CINEM_UNIT)
call IssuePointOrder(creeps,"attack",x1,y1)
call TriggerSleepAction(0.1)
set creeps = CreateUnit(Player(11),'u00F',x2,y2,0.)
call UnitAddAbility(creeps,CINEM_UNIT)
call IssuePointOrder(creeps,"attack",x1,y1)
call TriggerSleepAction(0.1)
call CinemText(marine4,"For the deads!")
call TriggerSleepAction(CINEM_DUR)
call CamAll(gg_cam_Cin7B,10.)
call IssuePointOrder(car,"attack",x2,y2)
call IssuePointOrder(marine1,"attack",x2,y2)
call IssuePointOrder(marine2,"attack",x2,y2)
call IssuePointOrder(marine3,"attack",x2,y2)
call IssuePointOrder(marine4,"attack",x2,y2)
call IssuePointOrder(marine5,"attack",x2,y2)
call CinemText(marine3,"They will rape us")
call TriggerSleepAction(CINEM_DUR)
call TriggerSleepAction(10.)
call CinematicEnd()
set marine1 = null
set marine2 = null
set marine3 = null
set marine4 = null
set marine5 = null
set car = null
set creeps = null
endfunction
function StartCinematic7 takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterTimerEvent(t, 0.01,false)
call TriggerAddAction(t, function RunCinematic)
endfunction
endlibrary
//TESH.scrollpos=17
//TESH.alwaysfold=0
library Cinematic8 needs CinematicSystem
private function RunCinematic takes nothing returns nothing
local unit marine = null
local unit scientist = null
local real x1 = GetRectCenterX(gg_rct_Cinem8001)
local real y1 = GetRectCenterY(gg_rct_Cinem8001)
set marine = CreateUnit(Player(10),'h003',x1+GetRandomReal(-50.,50.),y1+GetRandomReal(-50.,50.),0.)
call UnitAddAbility(marine,CINEM_UNIT)
set scientist = CreateUnit(Player(10),'n001',x1+GetRandomReal(-50.,50.),y1+GetRandomReal(-50.,50.),0.)
call UnitAddAbility(scientist,CINEM_UNIT)
call CamAll(gg_cam_Cin8,0.)
call TriggerSleepAction(5.)
call CinemText(scientist,"Operation has begun")
call TriggerSleepAction(CINEM_DUR)
call CinemText(marine,"Yes sir")
call TriggerSleepAction(CINEM_DUR)
call CinemText(scientist,"Start the procedure")
call TriggerSleepAction(CINEM_DUR)
call CinemText(marine,"It will be done, sir")
call TriggerSleepAction(CINEM_DUR)
call CinemText(scientist,"What's your opinion, Captain?")
call TriggerSleepAction(CINEM_DUR)
call CinemText(marine,"I don't know sir")
call TriggerSleepAction(CINEM_DUR)
call CinemText(scientist,"Of course...")
call TriggerSleepAction(CINEM_DUR)
call CinemText(scientist,"Your job to is to observe")
call TriggerSleepAction(CINEM_DUR)
call CinemText(scientist,"Complete report in 24 hours")
call TriggerSleepAction(CINEM_DUR)
call CinemText(scientist,"Then we will clean up the area")
call TriggerSleepAction(CINEM_DUR)
call CinemText(marine,"Aye aye, sir.")
call TriggerSleepAction(CINEM_DUR)
call CinematicEnd()
set scientist = null
set marine = null
endfunction
function StartCinematic8 takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterTimerEvent(t, 0.01,false)
call TriggerAddAction(t, function RunCinematic)
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library Cinematic9 needs CinematicSystem
private function RunCinematic takes nothing returns nothing
local unit marine = null
local unit frank = null
local real x1 = GetRectCenterX(gg_rct_Cinem9001)
local real y1 = GetRectCenterY(gg_rct_Cinem9001)
local real x2 = 0.
local real y2 = 0.
local unit creeps = null
local integer i = 0
set marine = CreateUnit(Player(10),'h003',x1+GetRandomReal(-50.,50.),y1+GetRandomReal(-50.,50.),GetRandomReal(0.,360.))
call UnitAddAbility(marine,CINEM_UNIT)
set marine = CreateUnit(Player(10),'h003',x1+GetRandomReal(-50.,50.),y1+GetRandomReal(-50.,50.),GetRandomReal(0.,360.))
call UnitAddAbility(marine,CINEM_UNIT)
set marine = CreateUnit(Player(10),'h003',x1+GetRandomReal(-50.,50.),y1+GetRandomReal(-50.,50.),GetRandomReal(0.,360.))
call UnitAddAbility(marine,CINEM_UNIT)
set marine = CreateUnit(Player(10),'h003',x1+GetRandomReal(-50.,50.),y1+GetRandomReal(-50.,50.),GetRandomReal(0.,360.))
set frank = CreateUnit(Player(10),'u011',x1,y1,GetRandomReal(0.,360.))
call UnitAddAbility(frank,CINEM_UNIT)
call CamAll(gg_cam_Cin9,0.)
call TriggerSleepAction(5.)
call CinemText(marine,"Doctor Frank")
call TriggerSleepAction(CINEM_DUR)
call CinemText(marine,"You are under arrest")
call TriggerSleepAction(CINEM_DUR)
call CinemText(marine,"Please follow us")
call TriggerSleepAction(CINEM_DUR)
call CinemText(frank,"You are a fool")
call TriggerSleepAction(CINEM_DUR)
call CinemText(marine,"Gentleman, come now.")
call TriggerSleepAction(CINEM_DUR)
call CinemText(frank,"This will never end.")
call TriggerSleepAction(CINEM_DUR)
call CinemText(marine,"Okay, take him")
call TriggerSleepAction(CINEM_DUR)
call CinemText(frank,"Idiot")
call TriggerSleepAction(CINEM_DUR)
call CinemText(frank,"Let me show you...")
call TriggerSleepAction(CINEM_DUR)
loop
exitwhen i > 29
set x2 = x1+200.*Cos(i*12.*bj_DEGTORAD)
set y2 = y1+200.*Sin(i*12.*bj_DEGTORAD)
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\NightElf\\Blink\\BlinkTarget.mdl",x2,y2))
set creeps = CreateUnit(Player(10),'u001',x2,y2,GetRandomReal(0.,360.))
call UnitAddAbility(creeps,CINEM_UNIT)
call TriggerSleepAction(0.25)
set i = i + 1
endloop
call CinemText(marine,"Fuck!")
call TriggerSleepAction(CINEM_DUR)
call TriggerSleepAction(5.)
call CinematicEnd()
set frank = null
set marine = null
set creeps = null
endfunction
function StartCinematic9 takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterTimerEvent(t, 0.01,false)
call TriggerAddAction(t, function RunCinematic)
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library Cinematic10 needs CinematicSystem, TextDisplay
private function RunCinematic takes nothing returns nothing
local integer i = 0
local integer j = 0
call CamAll(gg_cam_Cin10,0.)
call TriggerSleepAction(5.)
call DisplayAllNoSpeaker("06.00 PM")
call TriggerSleepAction(CINEM_DUR)
call DisplayAllNoSpeaker("Intervention Squad Briefing ")
call TriggerSleepAction(CINEM_DUR)
call DisplayAllNoSpeaker("1-Deploy into the sector 601")
call TriggerSleepAction(CINEM_DUR)
call DisplayAllNoSpeaker("2-Look for explanations about the blackout")
call TriggerSleepAction(CINEM_DUR)
call DisplayAllNoSpeaker("3- Eliminate all threats")
call TriggerSleepAction(CINEM_DUR)
call DisplayAllNoSpeaker("4-Provide assistance to the staff of the Restricted Complex 601")
call TriggerSleepAction(CINEM_DUR)
call DisplayAllNoSpeaker("This file and all its content are classified")
call TriggerSleepAction(CINEM_DUR)
call DisplayAllNoSpeaker("Information will be uploaded into your internal CPU")
call TriggerSleepAction(CINEM_DUR)
loop
exitwhen j > MAXPLAYER
set i = 0
loop
exitwhen i > 20
call DisplayTextToPlayer(Player(j),0.,0.," ")
set i = i + 1
endloop
set j = j + 1
endloop
call CinematicEnd()
endfunction
function StartCinematic10 takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterTimerEvent(t, 0.01,false)
call TriggerAddAction(t, function RunCinematic)
endfunction
endlibrary
//TESH.scrollpos=24
//TESH.alwaysfold=0
library CinematicSystem needs StartGame, GroupUtils,TextDisplay,AbilityPreload
globals
constant integer CINEM_UNIT = 'A0CI'
constant real CINEM_DUR = 2.
constant integer BLOOD_FX = 'A03L'
constant string CINEM_MASK = "ReplaceableTextures\\CameraMasks\\Black_mask.blp"
constant string SKY = "Environment\\Sky\\FelwoodSky\\FelwoodSky.mdx"
private constant string LIGHT_TERRAIN = "Environment\\DNC\\DNCDalaran\\DNCDalaranTerrain\\DNCDalaranTerrain.mdx"
private constant string LIGHT_UNIT = "Environment\\DNC\\DNCDalaran\\DNCDalaranUnit\\DNCDalaranUnit.mdx"
endglobals
function LockAll takes unit target returns nothing
local integer i = 0
loop
exitwhen i > MAXPLAYER
call SetCameraTargetControllerNoZForPlayer(Player(i),target,0,0,true)
set i = i + 1
endloop
endfunction
function CamAll takes camerasetup cam, real time returns nothing
local integer i = 0
loop
exitwhen i > MAXPLAYER
call CameraSetupApplyForPlayer(true,cam,Player(i),time )
set i = i + 1
endloop
endfunction
function CinemText takes unit speaker, string text returns nothing
call RadioSound()
call TextTagMessage(text, speaker, 0.,10., 20., 90., 9, 5.,CINEM_DUR)
endfunction
private function RemoveCinematicUnits takes nothing returns boolean
if GetUnitAbilityLevel(GetFilterUnit(),CINEM_UNIT)>=1 then
call KillUnit(GetFilterUnit())
endif
return true
endfunction
function CinematicEnd takes nothing returns nothing
local integer i = 0
call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUT, 0.,CINEM_MASK,0,0,0,0)
loop
exitwhen i > MAXPLAYER
call SetPlayerAllianceBJ( Player(i), ALLIANCE_SHARED_VISION, false, Player(10) )
call SetPlayerAllianceBJ( Player(10), ALLIANCE_SHARED_VISION, false, Player(i) )
call ResetToGameCameraForPlayer(Player(i),0)
set i = i + 1
endloop
call FogEnable(true)
call FogMaskEnable(true)
call GroupEnumUnitsInRect(ENUM_GROUP,bj_mapInitialPlayableArea,Filter(function RemoveCinematicUnits))
call CinematicModeBJ(false,bj_FORCE_ALL_PLAYERS)
call SetMusicVolume(100)
call InitializeGame()
set ChapterIntermission = false
endfunction
private function init takes nothing returns nothing
call AbilityPreload(CINEM_UNIT)
call AbilityPreload(BLOOD_FX)
call CinematicModeBJ(true,bj_FORCE_ALL_PLAYERS)
call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUT, 0.,CINEM_MASK,0,0,0,0)
call SetSkyModel(SKY)
call SetDayNightModels(LIGHT_TERRAIN,LIGHT_UNIT)
endfunction
endlibrary
//TESH.scrollpos=13
//TESH.alwaysfold=0
library AbilityPreload
//===========================================================================
// Information:
//==============
//
// Preloading removes the noticeable delay the first time an ability
// is loaded in a game. If an ability was not already on a pre-placed unit
// or a unit that was created during initialization, preloading is needed
// to prevent a delay.
//
//===========================================================================
// AbilityPreload API:
//=====================
//
// AbilityPreload(abilityid) :
// Call this before any time has elapsed to preload a specific
// ability. If debug mode is enabled, you will see an error message
// if you call this after initialization, or if you try to preload
// an ability that does not exist. Will inline to a UnitAddAbility
// call if debug mode is disabled.
//
// AbilityRangePreload(start, end) :
// Same as AbilityPreload, but preloads a range of abilities.
// It will iterates between the two rawcode values and preload
// every ability along the way. It will not show an error message
// for non-existent abilities.
//
//===========================================================================
// Configuration:
//================
globals
private constant integer PreloadUnitRawcode = 'e004'
endglobals
//===========================================================================
globals
private unit PreloadUnit
endglobals
function AbilityPreload takes integer abilityid returns nothing
static if DEBUG_MODE then
if GetUnitTypeId(PreloadUnit) == 0 then
call BJDebugMsg("AbilityPreload error: Can't preload an ability after initialization")
return
endif
endif
call UnitAddAbility(PreloadUnit, abilityid)
static if DEBUG_MODE then
if GetUnitAbilityLevel(PreloadUnit, abilityid) == 0 then
call BJDebugMsg("AbilityPreload error: Attempted to preload a non-existent ability")
endif
endif
endfunction
function AbilityRangePreload takes integer start, integer end returns nothing
local integer i = 1
static if DEBUG_MODE then
if GetUnitTypeId(PreloadUnit) == 0 then
call BJDebugMsg("AbilityPreload error: Can't preload an ability after initialization")
return
endif
endif
if start > end then
set i = -1
endif
loop
exitwhen start > end
call UnitAddAbility(PreloadUnit, start)
set start = start + i
endloop
endfunction
//===========================================================================
private struct Init extends array
private static method onInit takes nothing returns nothing
set PreloadUnit = CreateUnit(Player(15), PreloadUnitRawcode, 0., 0., 0.)
call UnitApplyTimedLife(PreloadUnit, 0, .001)
call ShowUnit(PreloadUnit, false)
call UnitAddAbility(PreloadUnit, 'Aloc')
endmethod
endstruct
endlibrary
//TESH.scrollpos=252
//TESH.alwaysfold=0
library AutoIndex
//===========================================================================
// Information:
//==============
//
// AutoIndex is a very simple script to utilize. Just call GetUnitId(unit)
// to get get the unique value assigned to a particular unit. The GetUnitId
// function is extremely fast because it inlines directly to a GetUnitUserData
// call. AutoIndex automatically assigns an ID to each unit as it enters the
// map, and instantly frees that ID as the unit leaves the map. Detection of
// leaving units is accomplished in constant time without a periodic scan.
//
// AutoIndex uses UnitUserData by default. If something else in your map
// would conflict with that, you can set the UseUnitUserData configuration
// constant to false, and a hashtable will be used instead. Note that hash-
// tables are about 60% slower.
//
// If you turn on debug mode, AutoIndex will be able to display several
// helpful error messages. The following issues will be detected:
// -Passing a removed or decayed unit to GetUnitId
// -Code outside of AutoIndex has overwritten a unit's UserData value.
// -GetUnitId was used on a filtered unit (a unit you don't want indexed).
//
// AutoIndex provides events upon indexing or deindexing units. This
// effectively allows you to notice when units enter or leave the game. Also
// included are the AutoData, AutoCreate, and AutoDestroy modules, which allow
// you to fully utilize AutoIndex's enter/leave detection capabilities in
// conjunction with your structs.
//
//===========================================================================
// How to install AutoIndex:
//===========================
//
// 1.) Copy and paste this script into your map.
// 2.) Save it to allow the ObjectMerger macro to generate the "Leave Detect"
// ability for you. Close and re-open the map. After that, disable the macro
// to prevent the delay while saving.
//
//===========================================================================
// How to use AutoIndex:
//=======================
//
// So you can get a unique integer for each unit, but how do you use that to
// attach data to a unit? GetUnitId will always return a number in the range of
// 1-8190. This means it can be used as an array index, as demonstrated below:
/*
globals
integer array IntegerData
real array RealData
SomeStruct array SomeStructData
englobals
function Example takes nothing returns nothing
local unit u = CreateUnit(Player(0), 'hpea', 0., 0., 0.)
local integer id = GetUnitId(u)
//You now have a unique index for the unit, so you can
//attach or retrieve data about the unit using arrays.
set IntegerData[id] = 5
set RealData[id] = 25.0
set SomeStructData[id] = SomeStruct.create()
//If you have access to the same unit in another function, you can
//retrieve the data by using GetUnitId() and reading the arrays.
endfunction
*/
// The UnitFilter function in the configuration section is provided so that
// you can make AutoIndex completely ignore certain unit-types. Ignored units
// won't be indexed or fire indexed/deindexed events. You may want to filter out
// dummy casters or system-private units, especially ones that use UnitUserData
// internally. xe dummy units are automatically filtered.
//
//===========================================================================
// How to use OnUnitIndexed / OnUnitDeindexed:
//=============================================
//
// AutoIndex will fire the OnUnitIndexed event when a unit enters the map,
// and the OnUnitDeindexed event when a unit leaves the map. Functions used
// as events must take a unit and return nothing. An example is given below:
/*
function UnitEntersMap takes unit u returns nothing
call BJDebugMsg(GetUnitName(u)+" with ID "+I2S(GetUnitId(u))+" entered the map.")
endfunction //Using GetUnitId() during Indexed events works fine...
function UnitLeavesMap takes unit u returns nothing
call BJDebugMsg(GetUnitName(u)+" with ID "+I2S(GetUnitId(u))+" left the map.")
endfunction //So does using GetUnitId() during Deindexed events.
function Init takes nothing returns nothing
call OnUnitIndexed(UnitEntersMap)
call OnUnitDeindexed(UnitLeavesMap)
endfunction
*/
// If you call OnUnitIndexed during map initialization, every existing
// unit will be considered as entering the map. This saves you from the need
// to manually enumerate preplaced units (or units created by initialization
// code that ran before OnUnitIndexed was called).
//
// OnUnitDeindexed runs while a unit still exists, which means you can
// still do things such as destroy special effects attached to the unit.
// The unit will cease to exist immediately after the event is over.
//
//===========================================================================
// AutoIndex API:
//================
//
// GetUnitId(unit) -> integer
// This function returns a unique ID in the range of 1-8190 for the
// specified unit. Returns 0 if a null unit was passed. This function
// inlines directly to GetUnitUserData or LoadInteger if debug mode
// is disabled. If debug mode is enabled, this function will print
// an error message when passed a decayed or filtered unit.
//
// IsUnitIndexed(unit) -> boolean
// This function returns a boolean indicating whether the specified
// unit has been indexed. The only time this will return false is
// for units you have filtered using the UnitFilter function, or
// for xe dummy units. You can use this function to easily detect
// dummy units and avoid performing certain actions on them.
//
// OnUnitIndexed(IndexFunc)
// This function accepts an IndexFunc, which must take a unit and
// return nothing. The IndexFunc will be fired instantly whenever
// a unit enters the map. You may use GetUnitId on the unit. When
// you call this function during map initialization, every existing
// unit will be considered as entering the map.
//
// OnUnitDeindexed(IndexFunc)
// Same as above, but runs whenever a unit is leaving the map. When
// this event runs, the unit still exists, but it will cease to exist
// as soon as the event ends. You may use GetUnitId on the unit.
//
//===========================================================================
// How to use AutoData:
//======================
//
// The AutoData module allows you to associate one or more instances
// of the implementing struct with units, as well as iterate through all
// of the instances associated with each unit.
//
// This association is accomplished through the "me" instance member,
// which the module will place in the implementing struct. Whichever unit
// you assign to "me" becomes the owner of that instance. You may change
// ownership by reassigning "me" to another unit at any time, or you may
// make the instance unowned by assigning "me" to null.
//
// AutoData implements the static method operator [] in your struct
// to allow you to access instances from their owning units. For example,
// you may type: local StructName s = StructName[u]. If u has been set
// to own an instance of StructName, s will be set to that instance.
//
// So, what happens if you assign the same owning unit to multiple
// instances? You may use 2D array syntax to access instances assigned to
// the same unit: local StructName s = StructName[u][n], where u is the
// owning unit, and n is the index beginning with 0 for each unit. You
// can access the size of a unit's instance list (i.e. the number of
// instances belonging to the unit) by using the .size instance member.
/*
struct Example
implement AutoData
static method create takes unit u returns Example
local Example this = allocate()
set me = u //Assigning the "me" member from AutoData.
return this
endmethod
endstruct
function Test takes nothing returns nothing
local unit u = CreateUnit(Player(0), 'hpea', 0., 0., 0.)
local Example e1 = Example.create(u)
local Example e2 = Example.create(u)
local Example e3 = Example.create(u)
local Example e
call BJDebugMsg(I2S(Example[u].size)) //Prints 3 because u owns e1, e2, and e3.
set e = Example[u][GetRandomInt(0, Example[u].size - 1)] //Random instance belonging to u.
set e = Example[u] //This is the fastest way to iterate the instances belonging
loop //to a specific unit, starting with the first instance.
exitwhen e == 0 //e will be assigned to 0 when no instances remain.
call BJDebugMsg(I2S(e)) //Prints the values of e1, e2, e3.
set e = e[e.index + 1] //"e.index" refers to the e's position in u's instance list.
endloop //Thus, index + 1 is next, and index - 1 is previous.
endfunction //This trick allows you to avoid a local counter.
*/
// AutoData restrictions:
// -You may not implement AutoData in any struct which has already
// declared static or non-static method operator [].
// -AutoData will conflict with anything named "me", "size", or
// "index" in the implementing struct.
// -AutoData may not be implemented in structs that extend array.
// -You may not declare your own destroy method. (This restriction
// can be dropped as soon as JassHelper supports module onDestroy).
//
// AutoData information:
// -You do not need to null the "me" member when destroying an
// instance. That is done for you automatically during destroy().
// (But if you use deallocate(), you must null "me" manually.)
// -StructName[u] and StructName[u][0] refer to the same instance,
// which is the first instance that was associated with unit u.
// -StructName[u][StructName[u].size - 1] refers to the instance that
// was most recently associated with unit u.
// -Instances keep their relative order in the list when one is removed.
//
//===========================================================================
// How to use AutoCreate:
//=======================
//
// The AutoCreate module allows you to automatically create instances
// of the implementing struct for units as they enter the game. AutoCreate
// automatically implements AutoData into your struct. Any time an instance
// is automatically created for a unit, that instance's "me" member will be
// assigned to the entering unit.
//
// AutoCreate restrictions:
// -All of the same restrictions as AutoData.
// -If your struct's allocate() method takes parameters (i.e. the parent
// type's create method takes parameters), you must declare a create
// method and pass those extra parameters to allocate yourself.
//
// AutoCreate information:
// -You may optionally declare the createFilter method, which specifies
// which units should recieve an instance as they enter the game. If
// you do not declare it, all entering units will recieve an instance.
// -You may optionally declare the onCreate method, which will run when
// AutoCreate automatically creates an instance. (This is just a stand-
// in until JassHelper supports the onCreate method.)
// -You may declare your own create method, but it must take a single
// unit parameter (the entering unit) if you do so.
/*
struct Example
private static method createFilter takes unit u returns boolean
return GetUnitTypeId(u) == 'hfoo' //Created only for Footmen.
endmethod
private method onCreate takes nothing returns nothing
call BJDebugMsg(GetUnitName(me)+" entered the game!")
endmethod
implement AutoCreate
endstruct
*/
//===========================================================================
// How to use AutoDestroy:
//=========================
//
// The AutoDestroy module allows you to automatically destroy instances
// of the implementing struct when their "me" unit leaves the game. AutoDestroy
// automatically implements AutoData into your struct. You must assign a unit
// to the "me" member of an instance for this module to have any effect.
//
// AutoDestroy restrictions:
// -All of the same restrictions as AutoData.
//
// AutoDestroy information:
// -If you also implement AutoCreate in the same struct, remember that it
// assigns the "me" unit automatically. That means you can have fully
// automatic creation and destruction.
/*
struct Example
static method create takes unit u returns Example
local Example this = allocate()
set me = u //You should assign a unit to "me",
return this //otherwise AutoDestroy does nothing.
endmethod //Not necessary if using AutoCreate.
private method onDestroy takes nothing returns nothing
call BJDebugMsg(GetUnitName(me)+" left the game!")
endmethod
implement AutoDestroy
endstruct
*/
//===========================================================================
// Configuration:
//================
// external ObjectMerger w3a Adef lvdt anam "Leave Detect" aart "" arac 0
//Save your map with this Object Merger call enabled, then close and reopen your
//map. Disable it by removing the exclamation to remove the delay while saving.
globals
private constant integer LeaveDetectAbilityID = 'lvdt'
//This rawcode must match the parameter after "Adef" in the
//ObjectMerger macro above. You may change both if you want.
private constant boolean UseUnitUserData = true
//If this is set to true, UnitUserData will be used. You should only set
//this to false if something else in your map already uses UnitUserData.
//A hashtable will be used instead, but it is about 60% slower.
private constant boolean SafeMode = true
//This is set to true by default so that GetUnitId() will ALWAYS work.
//If if this is set to false, GetUnitId() may fail to work in a very
//rare circumstance: creating a unit that has a default-on autocast
//ability, and using GetUnitId() on that unit as it enters the game,
//within a trigger that detects any order. Set this to false for a
//performance boost only if you think you can avoid this issue.
private constant boolean AutoDataFastMode = false
//If this is set to true, AutoData will utilize one hashtable per time
//it is implemented. If this is set to false, all AutoDatas will share
//a single hashtable, but iterating through the instances belonging to
//a unit will become about 12.5% slower. Your map will break if you
//use more than 255 hashtables simultaneously. Only set this to false
//if you suspect you will run out of hashtable instances.
endglobals
private function UnitFilter takes unit u returns boolean
return true
endfunction
//Make this function return false for any unit-types you want to ignore.
//Ignored units won't be indexed or fire OnUnitIndexed/OnUnitDeindexed
//events. The unit parameter "u" to refers to the unit being filtered.
//Do not filter out xe dummy units; they are automatically filtered.
//===========================================================================
// AutoData / AutoCreate / AutoDestroy modules:
//==============================================
function interface AutoCreator takes unit u returns nothing
function interface AutoDestroyer takes unit u returns nothing
globals
hashtable AutoData = null //If AutoDataFastMode is disabled, this hashtable will be
endglobals //initialized and shared between all AutoData implementations.
module AutoData
private static hashtable ht
private static thistype array data
private static integer array listsize
private static key typeid //Good thing keys exist to identify each implementing struct.
private unit meunit
private integer id
readonly integer index //The user can avoid using a local counter because this is accessable.
static method operator [] takes unit u returns thistype
return data[GetUnitId(u)]
endmethod //This is as fast as retrieving an instance from a unit gets.
method operator [] takes integer index returns thistype
static if AutoDataFastMode then //If fast mode is enabled...
return LoadInteger(ht, id, index)
else //Each instance has its own hashtable to associate unit and index.
return LoadInteger(AutoData, id, index*8190+typeid)
endif //Otherwise, simulate a 3D array associating unit, struct-type ID, and index.
endmethod //Somehow, this version is 12.5% slower just because of the math.
private method setIndex takes integer index, thistype data returns nothing
static if AutoDataFastMode then //Too bad you can't have a module-private operator []=.
call SaveInteger(ht, id, index, data)
else
call SaveInteger(AutoData, id, index*8190+typeid, data)
endif
endmethod
private method remove takes nothing returns nothing
if meunit == null then //If the struct doesn't have an owner...
return //Nothing needs to be done.
endif
loop
exitwhen index == listsize[id] //The last value gets overwritten by 0.
call setIndex(index, this[index + 1]) //Shift each element down by one.
set this[index].index = index //Update the shifted instance's index.
set index = index + 1
endloop
set listsize[id] = listsize[id] - 1
set data[id] = this[0] //Ensure thistype[u] returns the same value as thistype[u][0].
set meunit = null
endmethod
private method add takes unit u returns nothing
if meunit != null then //If the struct has an owner...
call remove() //remove it first.
endif
set meunit = u
set id = GetUnitId(u) //Cache GetUnitId for slight performance boost.
if data[id] == 0 then //If this is the first instance for this unit...
set data[id] = this //Update the value that thistype[u] returns.
endif
set index = listsize[id] //Remember the index for removal.
call setIndex(index, this) //Add to the array.
set listsize[id] = index + 1
endmethod
method operator me takes nothing returns unit
return meunit
endmethod
method operator me= takes unit u returns nothing
if u != null then //If assigning "me" a non-null value...
call add(u) //Add this instance to that unit's array.
else //If assigning "me" a null value...
call remove() //Remove this instance from that unit's array.
endif
endmethod
method operator size takes nothing returns integer
return listsize[id]
endmethod
method destroy takes nothing returns nothing
call deallocate()
call remove() //This makes removal automatic when an instance is destroyed.
endmethod
private static method onInit takes nothing returns nothing
static if AutoDataFastMode then //If fast mode is enabled...
set ht = InitHashtable() //Initialize one hashtable per instance.
else //If fast mode is disabled...
if AutoData == null then //If the hashtable hasn't been initialized yet...
set AutoData = InitHashtable() //Initialize the shared hashtable.
endif
endif
endmethod
endmodule
module AutoCreate
implement AutoData //AutoData is necessary for AutoCreate.
private static method creator takes unit u returns nothing
local thistype this
local boolean b = true //Assume that the instance will be created.
static if thistype.createFilter.exists then //If createFilter exists...
set b = createFilter(u) //evaluate it and update b.
endif
if b then //If the instance should be created...
static if thistype.create.exists then //If the create method exists...
set this = create(u) //Create the instance, passing the entering unit.
else //If the create method doesn't exist...
set this = allocate() //Just allocate the instance.
endif
set me = u //Assign the instance's owner as the entering unit.
static if thistype.onCreate.exists then //If onCreate exists...
call onCreate() //Call it, because JassHelper should do this anyway.
endif
endif
endmethod
private static method onInit takes nothing returns nothing
call AutoIndex.addAutoCreate(thistype.creator)
endmethod //During module initialization, pass the creator function to AutoIndex.
endmodule
module AutoDestroy
implement AutoData //AutoData is necessary for AutoDestroy.
static method destroyer takes unit u returns nothing
loop
exitwhen thistype[u] == 0
call thistype[u].destroy()
endloop
endmethod //Destroy each instance owned by the unit until none are left.
private static method onInit takes nothing returns nothing
call AutoIndex.addAutoDestroy(thistype.destroyer)
endmethod //During module initialization, pass the destroyer function to AutoIndex.
endmodule
//===========================================================================
// AutoIndex struct:
//===================
function interface IndexFunc takes unit u returns nothing
hook RemoveUnit AutoIndex.hook_RemoveUnit
hook ReplaceUnitBJ AutoIndex.hook_ReplaceUnitBJ
debug hook SetUnitUserData AutoIndex.hook_SetUnitUserData
private keyword getIndex
private keyword getIndexDebug
private keyword isUnitIndexed
private keyword onUnitIndexed
private keyword onUnitDeindexed
struct AutoIndex
private static trigger enter = CreateTrigger()
private static trigger order = CreateTrigger()
private static trigger creepdeath = CreateTrigger()
private static group preplaced = CreateGroup()
private static timer allowdecay = CreateTimer()
private static hashtable ht
private static boolean array dead
private static boolean array summoned
private static boolean array animated
private static boolean array nodecay
private static boolean array removing
private static IndexFunc array indexfuncs
private static integer indexfuncs_n = -1
private static IndexFunc array deindexfuncs
private static integer deindexfuncs_n = -1
private static IndexFunc indexfunc
private static AutoCreator array creators
private static integer creators_n = -1
private static AutoDestroyer array destroyers
private static integer destroyers_n = -1
private static unit array allowdecayunit
private static integer allowdecay_n = -1
private static boolean duringinit = true
private static boolean array altered
private static unit array idunit
//===========================================================================
static method getIndex takes unit u returns integer
static if UseUnitUserData then
return GetUnitUserData(u)
else
return LoadInteger(ht, 0, GetHandleId(u))
endif
endmethod //Resolves to an inlinable one-liner after the static if.
static method getIndexDebug takes unit u returns integer
if u == null then
return 0
elseif GetUnitTypeId(u) == 0 then
call BJDebugMsg("AutoIndex error: Removed or decayed unit passed to GetUnitId.")
elseif idunit[getIndex(u)] != u and GetIssuedOrderId() != 852056 then
call BJDebugMsg("AutoIndex error: "+GetUnitName(u)+" is a filtered unit.")
endif
return getIndex(u)
endmethod //If debug mode is enabled, use the getIndex method that shows errors.
private static method setIndex takes unit u, integer index returns nothing
static if UseUnitUserData then
call SetUnitUserData(u, index)
else
call SaveInteger(ht, 0, GetHandleId(u), index)
endif
endmethod //Resolves to an inlinable one-liner after the static if.
static method isUnitIndexed takes unit u returns boolean
return u != null and idunit[getIndex(u)] == u
endmethod
static method isUnitAnimateDead takes unit u returns boolean
return animated[getIndex(u)]
endmethod //Don't use this; use IsUnitAnimateDead from AutoEvents instead.
//===========================================================================
private static method onUnitIndexed_sub takes nothing returns nothing
call indexfunc.evaluate(GetEnumUnit())
endmethod
static method onUnitIndexed takes IndexFunc func returns nothing
set indexfuncs_n = indexfuncs_n + 1
set indexfuncs[indexfuncs_n] = func
if duringinit then //During initialization, evaluate the indexfunc for every preplaced unit.
set indexfunc = func
call ForGroup(preplaced, function AutoIndex.onUnitIndexed_sub)
endif
endmethod
static method onUnitDeindexed takes IndexFunc func returns nothing
set deindexfuncs_n = deindexfuncs_n + 1
set deindexfuncs[deindexfuncs_n] = func
endmethod
static method addAutoCreate takes AutoCreator func returns nothing
set creators_n = creators_n + 1
set creators[creators_n] = func
endmethod
static method addAutoDestroy takes AutoDestroyer func returns nothing
set destroyers_n = destroyers_n + 1
set destroyers[destroyers_n] = func
endmethod
//===========================================================================
private static method hook_RemoveUnit takes unit whichUnit returns nothing
set removing[getIndex(whichUnit)] = true
endmethod //Intercepts whenever RemoveUnit is called and sets a flag.
private static method hook_ReplaceUnitBJ takes unit whichUnit, integer newUnitId, integer unitStateMethod returns nothing
set removing[getIndex(whichUnit)] = true
endmethod //Intercepts whenever ReplaceUnitBJ is called and sets a flag.
private static method hook_SetUnitUserData takes unit whichUnit, integer data returns nothing
static if UseUnitUserData then
if idunit[getIndex(whichUnit)] == whichUnit then
if getIndex(whichUnit) == data then
call BJDebugMsg("AutoIndex error: Code outside AutoIndex attempted to alter "+GetUnitName(whichUnit)+"'s index.")
else
call BJDebugMsg("AutoIndex error: Code outside AutoIndex altered "+GetUnitName(whichUnit)+"'s index.")
if idunit[data] != null then
call BJDebugMsg("AutoIndex error: "+GetUnitName(whichUnit)+" and "+GetUnitName(idunit[data])+" now have the same index.")
endif
set altered[data] = true
endif
endif
endif //In debug mode, intercepts whenever SetUnitUserData is used on an indexed unit.
endmethod //Displays an error message if outside code tries to alter a unit's index.
//===========================================================================
private static method allowDecay takes nothing returns nothing
local integer n = allowdecay_n
loop
exitwhen n < 0
set nodecay[getIndex(allowdecayunit[n])] = false
set allowdecayunit[n] = null
set n = n - 1
endloop
set allowdecay_n = -1
endmethod //Iterate through all the units in the stack and allow them to decay again.
private static method detectStatus takes nothing returns boolean
local unit u = GetTriggerUnit()
local integer index = getIndex(u)
local integer n
if idunit[index] == u then //Ignore non-indexed units.
if not IsUnitType(u, UNIT_TYPE_DEAD) then
if dead[index] then //The unit was dead, but now it's alive.
set dead[index] = false //The unit has been resurrected.
//! runtextmacro optional RunAutoEvent("Resurrect")
//If AutoEvents is in the map, run the resurrection events.
if IsUnitType(u, UNIT_TYPE_SUMMONED) and not summoned[index] then
set summoned[index] = true //If the unit gained the summoned flag,
set animated[index] = true //it's been raised with Animate Dead.
//! runtextmacro optional RunAutoEvent("AnimateDead")
//If AutoEvents is in the map, run the Animate Dead events.
endif
endif
else
if not removing[index] and not dead[index] and not animated[index] then
set dead[index] = true //The unit was alive, but now it's dead.
set nodecay[index] = true //A dead unit can't decay for at least 0. seconds.
set allowdecay_n = allowdecay_n + 1 //Add the unit to a stack. After the timer
set allowdecayunit[allowdecay_n] = u //expires, allow the unit to decay again.
call TimerStart(allowdecay, 0., false, function AutoIndex.allowDecay)
//! runtextmacro optional RunAutoEvent("Death")
//If AutoEvents is in the map, run the Death events.
elseif removing[index] or (dead[index] and not nodecay[index]) or (not dead[index] and animated[index]) then
//If .nodecay was false and the unit is dead and was previously dead, the unit decayed.
//If .animated was true and the unit is dead, the unit died and exploded.
//If .removing was true, the unit is being removed or replaced.
set n = deindexfuncs_n
loop //Run the OnUnitDeindexed events.
exitwhen n < 0
call deindexfuncs[n].evaluate(u)
set n = n - 1
endloop
set n = destroyers_n
loop //Destroy AutoDestroy structs for the leaving unit.
exitwhen n < 0
call destroyers[n].evaluate(u)
set n = n - 1
endloop
call AutoIndex(index).destroy() //Free the index by destroying the AutoIndex struct.
set idunit[index] = null //Null this unit reference to prevent a leak.
endif
endif
endif
set u = null
return false
endmethod
//===========================================================================
private static method unitEntersMap takes unit u returns nothing
local integer index
local integer n = 0
if getIndex(u) != 0 then
return //Don't index a unit that already has an ID.
endif
static if LIBRARY_xebasic then
if GetUnitTypeId(u) == XE_DUMMY_UNITID then
return //Don't index xe dummy units.
endif
endif
if not UnitFilter(u) then
return //Don't index units that fail the unit filter.
endif
set index = create()
call setIndex(u, index) //Assign an index to the entering unit.
call UnitAddAbility(u, LeaveDetectAbilityID) //Add the leave detect ability to the entering unit.
call UnitMakeAbilityPermanent(u, true, LeaveDetectAbilityID) //Prevent it from disappearing on morph.
set dead[index] = IsUnitType(u, UNIT_TYPE_DEAD) //Reset all of the flags for the entering unit.
set summoned[index] = IsUnitType(u, UNIT_TYPE_SUMMONED) //Each of these flags are necessary to detect
set animated[index] = false //when a unit leaves the map.
set nodecay[index] = false
set removing[index] = false
debug set altered[index] = false //In debug mode, this flag tracks wheter a unit's index was altered.
set idunit[index] = u //Attach the unit that is supposed to have this index to the index.
if duringinit then //If a unit enters the map during initialization...
call GroupAddUnit(preplaced, u) //Add the unit to the preplaced units group. This ensures that
endif //all units are noticed by OnUnitIndexed during initialization.
loop //Create AutoCreate structs for the entering unit.
exitwhen n > creators_n
call creators[n].evaluate(u)
set n = n + 1
endloop
set n = 0
loop //Run the OnUnitIndexed events.
exitwhen n > indexfuncs_n
call indexfuncs[n].evaluate(u)
set n = n + 1
endloop
endmethod
private static method onIssuedOrder takes nothing returns boolean
static if SafeMode then //If SafeMode is enabled, perform this extra check.
if getIndex(GetTriggerUnit()) == 0 then //If the unit doesn't already have
call unitEntersMap(GetTriggerUnit()) //an index, then assign it one.
endif
endif
return GetIssuedOrderId() == 852056 //If the order is Undefend, allow detectStatus to run.
endmethod
private static method initEnteringUnit takes nothing returns boolean
call unitEntersMap(GetFilterUnit())
return false
endmethod
//===========================================================================
private static method afterInit takes nothing returns nothing
set duringinit = false //Initialization is over; set a flag.
call DestroyTimer(GetExpiredTimer()) //Destroy the timer.
call GroupClear(preplaced) //The preplaced units group is
call DestroyGroup(preplaced) //no longer needed, so clean it.
set preplaced = null
endmethod
private static method onInit takes nothing returns nothing
local region maparea = CreateRegion()
local rect bounds = GetWorldBounds()
local group g = CreateGroup()
local integer i = 15
static if not UseUnitUserData then
set ht = InitHashtable() //Only create a hashtable if it will be used.
endif
loop
exitwhen i < 0
call SetPlayerAbilityAvailable(Player(i), LeaveDetectAbilityID, false)
//Make the LeaveDetect ability unavailable so that it doesn't show up on the command card of every unit.
call TriggerRegisterPlayerUnitEvent(order, Player(i), EVENT_PLAYER_UNIT_ISSUED_ORDER, null)
//Register the "EVENT_PLAYER_UNIT_ISSUED_ORDER" event for each player.
call GroupEnumUnitsOfPlayer(g, Player(i), function AutoIndex.initEnteringUnit)
//Enum every non-filtered unit on the map during initialization and assign it a unique
//index. By using GroupEnumUnitsOfPlayer, even units with Locust can be detected.
set i = i - 1
endloop
call TriggerAddCondition(order, And(function AutoIndex.onIssuedOrder, function AutoIndex.detectStatus))
//The detectStatus method will fire every time a non-filtered unit recieves an undefend order.
//And() is used here to avoid using a trigger action, which starts a new thread and is slower.
call TriggerRegisterPlayerUnitEvent(creepdeath, Player(12), EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(creepdeath, function AutoIndex.detectStatus)
//The detectStatus method must also fire when a neutral hostile creep dies, in case it was
//sleeping. Sleeping creeps don't fire undefend orders on non-damaging deaths.
call RegionAddRect(maparea, bounds) //GetWorldBounds() includes the shaded boundry areas.
call TriggerRegisterEnterRegion(enter, maparea, function AutoIndex.initEnteringUnit)
//The filter function of an EnterRegion trigger runs instantly when a unit is created.
call TimerStart(CreateTimer(), 0., false, function AutoIndex.afterInit)
//After any time elapses, perform after-initialization actions.
call GroupClear(g)
call DestroyGroup(g)
call RemoveRect(bounds)
set g = null
set bounds = null
endmethod
endstruct
//===========================================================================
// User functions:
//=================
function GetUnitId takes unit u returns integer
static if DEBUG_MODE then //If debug mode is enabled...
return AutoIndex.getIndexDebug(u) //call the debug version of GetUnitId.
else //If debug mode is disabled...
return AutoIndex.getIndex(u) //call the normal, inlinable version.
endif
endfunction
function IsUnitIndexed takes unit u returns boolean
return AutoIndex.isUnitIndexed(u)
endfunction
function OnUnitIndexed takes IndexFunc func returns nothing
call AutoIndex.onUnitIndexed(func)
endfunction
function OnUnitDeindexed takes IndexFunc func returns nothing
call AutoIndex.onUnitDeindexed(func)
endfunction
endlibrary
//TESH.scrollpos=3
//TESH.alwaysfold=0
library BoundSentinel initializer init
//*************************************************
//* BoundSentinel
//* ---------------
//* Author: Vexorian
//*
//* Don't leave your units unsupervised, naughty
//* them may try to get out of the map bounds and
//* crash your game.
//*
//* To implement, just get a vJass compiler and
//* copy this library/trigger to your map.
//*
//*************************************************
//==================================================
globals
// High enough so the unit is no longer visible, low enough so the
// game doesn't crash...
//
// I think you need 0.0 or soemthing negative prior to patch 1.22
//
private constant real EXTRA = 300.0
endglobals
//=========================================================================================
globals
private real maxx
private real maxy
private real minx
private real miny
endglobals
//=======================================================================
private function dis takes nothing returns nothing
local unit u=GetTriggerUnit()
local real x=GetUnitX(u)
local real y=GetUnitY(u)
if(x>maxx) then
set x=maxx
elseif(x<minx) then
set x=minx
endif
if(y>maxy) then
set y=maxy
elseif(y<miny) then
set y=miny
endif
call SetUnitX(u,x)
call SetUnitY(u,y)
set u=null
endfunction
private function init takes nothing returns nothing
local trigger t=CreateTrigger()
local region r=CreateRegion()
local rect rc
set minx=GetCameraBoundMinX() - EXTRA
set miny=GetCameraBoundMinY() - EXTRA
set maxx=GetCameraBoundMaxX() + EXTRA
set maxy=GetCameraBoundMaxY() + EXTRA
set rc=Rect(minx,miny,maxx,maxy)
call RegionAddRect(r, rc)
call RemoveRect(rc)
call TriggerRegisterLeaveRegion(t,r, null)
call TriggerAddAction(t, function dis)
//this is not necessary but I'll do it anyway:
set t=null
set r=null
set rc=null
endfunction
endlibrary
//TESH.scrollpos=12
//TESH.alwaysfold=0
library BuffSystem initializer init needs AbilityPreload, SpellEvent,SoundUtils
globals
constant integer DUMMY_POISON = 'o003'
constant integer SPELL_FRACT = 'A083'
constant integer BUFF_FRACT = 'B00S'
constant string ORDER_FRACT = "slow"
constant integer SPELL_POISON = 'A084'
constant integer BUFF_POISON1 = 'B00Q'
constant integer BUFF_POISON2 = 'B00R'
constant integer SPELL_RESIDUAL_NANITES = 'A03J'
constant integer BUFF_RESIDUAL_NANITES = 'B031'
constant string ORDER_RESIDUAL_NANITES = "faeriefire"
private constant integer ID = 11
integer SOUND_FRAC
endglobals
function UnitAddBuffResidualNanites takes unit caster, unit victim returns nothing
local unit dummy = CreateUnit(GetOwningPlayer(caster),DUMMY,GetUnitX(victim),GetUnitY(victim),0.)
if IsUnitAlly(caster,GetOwningPlayer(victim))== true then
call SetUnitOwner(dummy,Player(ID),false)
endif
call UnitAddAbility(dummy,SPELL_RESIDUAL_NANITES)
call IssueTargetOrder(dummy,ORDER_RESIDUAL_NANITES,victim)
call UnitApplyTimedLife(dummy,'BTLF',1.)
set dummy = null
endfunction
function UnitAddBuffPoison takes unit victim returns nothing
local unit dummy = CreateUnit(Player(ID),DUMMY_POISON,GetUnitX(victim),GetUnitY(victim),0.)
call UnitAddAbility(dummy,SPELL_POISON)
call IssueTargetOrder(dummy,"attack",victim)
call UnitApplyTimedLife(dummy,'BTLF',5.)
set dummy = null
endfunction
function UnitAddBuffFract takes unit victim returns nothing
local unit dummy = CreateUnit(Player(ID),DUMMY,GetUnitX(victim),GetUnitY(victim),0.)
call UnitAddAbility(dummy,SPELL_FRACT)
call IssueTargetOrder(dummy,ORDER_FRACT,victim)
call UnitApplyTimedLife(dummy,'BTLF',1.)
call RunSoundForPlayer(SOUND_FRAC,GetOwningPlayer(victim))
call UnitDamageTarget(dummy,victim, 100.,false,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
set dummy = null
endfunction
private function init takes nothing returns nothing
set SOUND_FRAC = DefineSound("Sound\\Units\\Combat\\MetalLightChopWood2.wav",569, false, false)
call AbilityPreload(SPELL_FRACT)
call AbilityPreload(SPELL_POISON)
call AbilityPreload(SPELL_RESIDUAL_NANITES)
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library CheckPointValidity
function CheckPointValidity takes real coordonate, real min, real max returns real
if coordonate>max then
return max
elseif coordonate<min then
return min
else
return coordonate
endif
endfunction
endlibrary
//TESH.scrollpos=30
//TESH.alwaysfold=0
library GroupFunction initializer init uses GroupUtils,Push
globals
private unit DamageSource
private real Radius
private real X
private real Y
private real Amount
private integer Distance
private integer Speed
private real Imp
private boolean CasterDamaged
private boolean WithPush
private unit TmpTarget
private rect TmpRect
private attacktype DamageType
constant attacktype DMG_UNKNOWN = ATTACK_TYPE_CHAOS
constant attacktype DMG_PHYSIC = ATTACK_TYPE_NORMAL
constant attacktype DMG_PIERCE = ATTACK_TYPE_PIERCE
constant attacktype DMG_ENERGETIC = ATTACK_TYPE_MAGIC
constant attacktype DMG_EXPLOSIVE = ATTACK_TYPE_HERO
endglobals
private function FilterAllItems takes nothing returns boolean
call UnitDamageTarget(DamageSource,GetFilterItem(),Amount,false,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
return true
endfunction
private function FilterAllDestructables takes nothing returns boolean
if GetDestructableTypeId(GetEnumDestructable())=='YTft' then
call SetDestructableAnimation(GetEnumDestructable(), "stand hit")
endif
call UnitDamageTarget(DamageSource,GetFilterDestructable(),Amount,false,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
return true
endfunction
private function FilterAndActionEnnemyUnits takes nothing returns boolean
set TmpTarget = GetFilterUnit()
if IsUnitEnemy(TmpTarget,GetOwningPlayer(DamageSource))==true and not (IsUnitType(TmpTarget,UNIT_TYPE_DEAD)) then
if Amount > 0. then
call UnitDamageTarget(DamageSource,TmpTarget,Amount,false,false,DamageType,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
endif
if WithPush == true and not (IsUnitType(TmpTarget,UNIT_TYPE_STRUCTURE)) then
call Push(X,Y,TmpTarget,Distance,Speed,Imp)
endif
endif
return false
endfunction
private function FilterAndActionAllUnits takes nothing returns boolean
set TmpTarget = GetFilterUnit()
if not (IsUnitType(TmpTarget,UNIT_TYPE_DEAD)) then
if TmpTarget!=DamageSource or (TmpTarget==DamageSource and CasterDamaged == true) then
call UnitDamageTarget(DamageSource,TmpTarget,Amount,false,false,DamageType,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
endif
if WithPush == true and not (IsUnitType(TmpTarget,UNIT_TYPE_STRUCTURE)) then
call Push(X,Y,TmpTarget,Distance,Speed,Imp)
endif
endif
return false
endfunction
function UnitDamageEnemies takes unit damagesource, real radius, real x, real y, real amount,attacktype dmgtype,boolean withpush,integer distance,integer speed,real imp returns nothing
set DamageSource = damagesource
set Radius = radius
set X = x
set Y = y
set Amount = amount
set WithPush = withpush
set DamageType = dmgtype
if WithPush==true then
set Distance = distance
set Speed = speed
set Imp = imp
else
set Distance = 0
set Speed = 0
set Imp = 0
endif
call GroupEnumUnitsInRange(ENUM_GROUP,x,y,radius,Filter(function FilterAndActionEnnemyUnits))
endfunction
function UnitDamageAll takes unit damagesource,boolean casterdamaged, real radius, real x, real y, real amount,attacktype dmgtype,boolean withpush,integer distance,integer speed,real imp returns nothing
set DamageSource = damagesource
set CasterDamaged = casterdamaged
set Radius = radius
set X = x
set Y = y
set Amount = amount
set DamageType = dmgtype
set WithPush = withpush
if WithPush==true then
set Distance = distance
set Speed = speed
set Imp = imp
else
set Distance = 0
set Speed = 0
set Imp = 0
endif
if Amount > 0. then
call SetRect(TmpRect,X-Radius,Y-Radius,X+Radius,Y+Radius)
call EnumItemsInRect(TmpRect,Filter(function FilterAllItems),null)
call EnumDestructablesInRect(TmpRect,Filter(function FilterAllDestructables),null)
endif
call GroupEnumUnitsInRange(ENUM_GROUP,x,y,radius,Filter(function FilterAndActionAllUnits))
endfunction
private function init takes nothing returns nothing
set DamageSource = null
set Radius = 0.
set X = 0.
set Y = 0.
set Amount = 0.
set Distance = 0
set Speed = 0
set Imp = 0.
set CasterDamaged = false
set WithPush = false
set TmpTarget = null
set TmpRect = Rect(0.,0.,0.,0.)
endfunction
endlibrary
//TESH.scrollpos=33
//TESH.alwaysfold=0
library GroupUtils initializer Init requires optional xebasic
//******************************************************************************
//* BY: Rising_Dusk
//*
//* This library is a combination of several features relevant to groups. First
//* and foremost, it contains a group stack that you can access dynamic groups
//* from. It also provides means to refresh groups and clear any shadow
//* references within them. The included boolexprs are there for backwards
//* compatibility with maps that happen to use them. Since the 1.24c patch,
//* null boolexprs used in GroupEnumUnits* calls no longer leak, so there is no
//* performance gain to using the BOOLEXPR_TRUE constant.
//*
//* Instead of creating/destroying groups, we have moved on to recycling them.
//* NewGroup pulls a group from the stack and ReleaseGroup adds it back. Always
//* remember to call ReleaseGroup on a group when you are done using it. If you
//* fail to do so enough times, the stack will overflow and no longer work.
//*
//* GroupRefresh cleans a group of any shadow references which may be clogging
//* its hashtable. If you remove a unit from the game who is a member of a unit
//* group, it will 'effectively' remove the unit from the group, but leave a
//* shadow in its place. Calling GroupRefresh on a group will clean up any
//* shadow references that may exist within it. It is only worth doing this on
//* groups that you plan to have around for awhile.
//*
//* Constants that can be used from the library:
//* [group] ENUM_GROUP As you might expect, this group is good for
//* when you need a group just for enumeration.
//* [boolexpr] BOOLEXPR_TRUE This is a true boolexpr, which is important
//* because a 'null' boolexpr in enumeration
//* calls results in a leak. Use this instead.
//* [boolexpr] BOOLEXPR_FALSE This exists mostly for completeness.
//*
//* This library also includes a simple implementation of a group enumeration
//* call that factors collision of units in a given area of effect. This is
//* particularly useful because GroupEnumUnitsInRange doesn't factor collision.
//*
//* In your map, you can just replace all instances of GroupEnumUnitsInRange
//* with GroupEnumUnitsInArea with identical arguments and your spells will
//* consider all units colliding with the area of effect. After calling this
//* function as you would normally call GroupEnumUnitsInRange, you are free to
//* do anything with the group that you would normally do.
//*
//* If you don't use xebasic in your map, you may edit the MAX_COLLISION_SIZE
//* variable below and the library will use that as the added radius to check.
//* If you use xebasic, however, the script will automatically use xe's
//* collision size variable.
//*
//* You are also able to use GroupUnitsInArea. This function returns all units
//* within the area, no matter what they are, which can be convenient for those
//* instances where you actually want that.
//*
//* Example usage:
//* local group MyGroup = NewGroup()
//* call GroupRefresh(MyGroup)
//* call ReleaseGroup(MyGroup)
//* call GroupEnumUnitsInArea(ENUM_GROUP, x, y, 350., BOOLEXPR_TRUE)
//* call GroupUnitsInArea(ENUM_GROUP, x, y, 350.)
//*
globals
//If you don't have xebasic in your map, this value will be used instead.
//This value corresponds to the max collision size of a unit in your map.
private constant real MAX_COLLISION_SIZE = 197.
//If you are insane and don't care about any of the protection involved in
//this library, but want this script to be really fast, set this to true.
private constant boolean LESS_SAFETY = false
endglobals
globals
//* Constants that are available to the user
group ENUM_GROUP = CreateGroup()
boolexpr BOOLEXPR_TRUE = null
boolexpr BOOLEXPR_FALSE = null
endglobals
globals
//* Hashtable for debug purposes
private hashtable ht = InitHashtable()
//* Temporary references for GroupRefresh
private boolean Flag = false
private group Refr = null
//* Arrays and counter for the group stack
private group array Groups
private integer Count = 0
//* Variables for use with the GroupUnitsInArea function
private real X = 0.
private real Y = 0.
private real R = 0.
private hashtable H = InitHashtable()
endglobals
private function HookDestroyGroup takes group g returns nothing
if g == ENUM_GROUP then
call BJDebugMsg(SCOPE_PREFIX+"Warning: ENUM_GROUP destroyed")
endif
endfunction
debug hook DestroyGroup HookDestroyGroup
private function AddEx takes nothing returns nothing
if Flag then
call GroupClear(Refr)
set Flag = false
endif
call GroupAddUnit(Refr, GetEnumUnit())
endfunction
function GroupRefresh takes group g returns nothing
set Flag = true
set Refr = g
call ForGroup(Refr, function AddEx)
if Flag then
call GroupClear(g)
endif
endfunction
function NewGroup takes nothing returns group
if Count == 0 then
set Groups[0] = CreateGroup()
else
set Count = Count - 1
endif
static if not LESS_SAFETY then
call SaveInteger(ht, 0, GetHandleId(Groups[Count]), 1)
endif
return Groups[Count]
endfunction
function ReleaseGroup takes group g returns boolean
local integer id = GetHandleId(g)
static if LESS_SAFETY then
if g == null then
debug call BJDebugMsg(SCOPE_PREFIX+"Error: Null groups cannot be released")
return false
elseif Count == 8191 then
debug call BJDebugMsg(SCOPE_PREFIX+"Error: Max groups achieved, destroying group")
call DestroyGroup(g)
return false
endif
else
if g == null then
debug call BJDebugMsg(SCOPE_PREFIX+"Error: Null groups cannot be released")
return false
elseif not HaveSavedInteger(ht, 0, id) then
debug call BJDebugMsg(SCOPE_PREFIX+"Error: Group not part of stack")
return false
elseif LoadInteger(ht, 0, id) == 2 then
debug call BJDebugMsg(SCOPE_PREFIX+"Error: Groups cannot be multiply released")
return false
elseif Count == 8191 then
debug call BJDebugMsg(SCOPE_PREFIX+"Error: Max groups achieved, destroying group")
call DestroyGroup(g)
return false
endif
call SaveInteger(ht, 0, id, 2)
endif
call GroupClear(g)
set Groups[Count] = g
set Count = Count + 1
return true
endfunction
private function Filter takes nothing returns boolean
return IsUnitInRangeXY(GetFilterUnit(), X, Y, R)
endfunction
private function HookDestroyBoolExpr takes boolexpr b returns nothing
local integer bid = GetHandleId(b)
if HaveSavedHandle(H, 0, bid) then
//Clear the saved boolexpr
call DestroyBoolExpr(LoadBooleanExprHandle(H, 0, bid))
call RemoveSavedHandle(H, 0, bid)
endif
endfunction
hook DestroyBoolExpr HookDestroyBoolExpr
private constant function GetRadius takes real radius returns real
static if LIBRARY_xebasic then
return radius+XE_MAX_COLLISION_SIZE
else
return radius+MAX_COLLISION_SIZE
endif
endfunction
function GroupEnumUnitsInArea takes group whichGroup, real x, real y, real radius, boolexpr filter returns nothing
local real prevX = X
local real prevY = Y
local real prevR = R
local integer bid = 0
//Set variables to new values
set X = x
set Y = y
set R = radius
if filter == null then
//Adjusts for null boolexprs passed to the function
set filter = Condition(function Filter)
else
//Check for a saved boolexpr
set bid = GetHandleId(filter)
if HaveSavedHandle(H, 0, bid) then
//Set the filter to use to the saved one
set filter = LoadBooleanExprHandle(H, 0, bid)
else
//Create a new And() boolexpr for this filter
set filter = And(Condition(function Filter), filter)
call SaveBooleanExprHandle(H, 0, bid, filter)
endif
endif
//Enumerate, if they want to use the boolexpr, this lets them
call GroupEnumUnitsInRange(whichGroup, x, y, GetRadius(radius), filter)
//Give back original settings so nested enumerations work
set X = prevX
set Y = prevY
set R = prevR
endfunction
function GroupUnitsInArea takes group whichGroup, real x, real y, real radius returns nothing
local real prevX = X
local real prevY = Y
local real prevR = R
//Set variables to new values
set X = x
set Y = y
set R = radius
//Enumerate
call GroupEnumUnitsInRange(whichGroup, x, y, GetRadius(radius), Condition(function Filter))
//Give back original settings so nested enumerations work
set X = prevX
set Y = prevY
set R = prevR
endfunction
private function True takes nothing returns boolean
return true
endfunction
private function False takes nothing returns boolean
return false
endfunction
private function Init takes nothing returns nothing
set BOOLEXPR_TRUE = Condition(function True)
set BOOLEXPR_FALSE = Condition(function False)
endfunction
endlibrary
//TESH.scrollpos=15
//TESH.alwaysfold=0
library IndieSummons initializer Init requires AutoIndex, TimerUtils, Table
//**************************************************************************************************
//*
//* Independant Summons (Code + config)
//* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
//* You just need to copy this trigger, notice that these functions do nothing without the other
//* part which has the header functions and you'll also need to call them.
//*
//**************************************************************************************************
// 2010-01-18 (Original system by Vexorian, modified by MoCo):
// - vjassification of system
// - now works with latest patches
//==================================================================================================
// Independant Summons Configuration:
//
globals
private Table SummonIdTab
private unit array Summons[1]
private unit array Masters[1]
private integer N = 0
private constant integer MAX_N = 64
endglobals
private constant function IndieSummon_maxdelay takes nothing returns real
return 4. //* The max delay betwen orders issued to the summon
endfunction
private constant function IndieSummon_mindelay takes nothing returns real
return 2.00 //* The min delay betwen orders issued to the summon
endfunction
private constant function IndieSummon_maxdistance takes nothing returns real
return 1500.0 //* If the distance betwen the summon and the master is greater than this value,
// The summon will move to the position of the master instead of attack move
endfunction
private constant function IndieSummon_cometomaxdist takes nothing returns real
return 400.0 //* Max distance for issued orders to approach the master
endfunction
private constant function IndieSummon_cometomindist takes nothing returns real
return 200.0 //* Min distance for issued orders to approach the master
endfunction
//==================================================================================================
private function SetSummonId takes unit summon returns integer
set N = N + 1
set SummonIdTab[GetUnitId(summon)] = N
if N > MAX_N then
set N = 0
endif
return SummonIdTab[GetUnitId(summon)]
endfunction
private function GetSummonId takes unit summon returns integer
return SummonIdTab[GetUnitId(summon)]
endfunction
private function IndieSummon_GetMaster takes unit summon returns unit
local integer id = GetSummonId(summon)
return Masters[id]
return null
endfunction
private function IndieSummon_StopAI takes unit summon returns nothing
local integer id = GetSummonId(summon)
set Masters[id] = null
endfunction
private function IndieSummon_Order takes unit summon, unit master returns nothing
local integer o=GetUnitCurrentOrder(summon)
local real tx=GetUnitX(master)
local real ty=GetUnitY(master)
local real angle
local real dist
set dist=Pow(tx-GetUnitX(summon),2) + Pow(ty-GetUnitY(summon),2)
if (dist > (IndieSummon_maxdistance()*IndieSummon_maxdistance()) ) and (o == 0 or o == OrderId("attack") or o == OrderId("move") or o == OrderId("stop") or o==851971) then
call IssuePointOrder(summon, "move", tx,ty)
elseif dist >= (IndieSummon_cometomindist()*IndieSummon_cometomindist()) and (o == 0 or o == 851971) then
set angle = GetRandomReal( GetUnitFacing(master)-80, GetUnitFacing(master)+80)
if (ModuloInteger(GetUnitPointValue(summon),2)==0) then
set angle=angle * bj_DEGTORAD
else
set angle=- angle * bj_DEGTORAD
endif
set dist = GetRandomReal(IndieSummon_cometomindist(), IndieSummon_cometomaxdist() )
set tx=tx+dist*Cos(angle)
set ty=ty+dist*Sin(angle)
if not IssuePointOrder(summon, "attack", tx, ty ) then
call IssuePointOrder(summon, "move", tx, ty )
endif
endif
set summon=null
set master=null
endfunction
private function IndieSummon_AntiSmart_Timer takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer id = GetTimerData(t)
local unit s = Summons[id]
local unit m = Masters[id]
if (GetUnitCurrentOrder(s)!=851971) then
call DestroyTimer(t)
else
call IndieSummon_Order( s, m )
call TimerStart(t,0.1,false,function IndieSummon_AntiSmart_Timer)
endif
set t = null
set s = null
set m = null
endfunction
private function IndieSummon_AntiSmart takes nothing returns nothing
local timer t
local integer id = GetSummonId(GetTriggerUnit())
if (GetIssuedOrderId() == 851971) then
set t=CreateTimer()
call SetTimerData(t, id)
call TimerStart(t,0,false,function IndieSummon_AntiSmart_Timer)
set t=null
endif
endfunction
private function IndieSummon_loop takes integer id returns nothing
local unit summon = Summons[id]
local unit master // = Masters[id]
local trigger smart=CreateTrigger()
local integer n = 0
local triggeraction ac = TriggerAddAction( smart, function IndieSummon_AntiSmart)
call TriggerRegisterUnitEvent( smart, summon, EVENT_UNIT_ISSUED_TARGET_ORDER )
call TriggerRegisterUnitEvent( smart, summon, EVENT_UNIT_ISSUED_POINT_ORDER )
loop //second coundition: modified by jk2pach to detect units with AI disabled
exitwhen (GetWidgetLife(summon)<=0) or (GetPlayerController(GetOwningPlayer(summon)) == MAP_CONTROL_USER and GetUnitAbilityLevel(summon,AI_ENABLED)<=0)
set master = Masters[id]
if (master==null) then
exitwhen true
else
call IndieSummon_Order( summon, master)
call PolledWait( GetRandomReal( IndieSummon_mindelay(), IndieSummon_maxdelay() ))
endif
endloop
set Masters[id] = null
call TriggerRemoveAction(smart,ac)
if smart != null then
call DestroyTrigger(smart)
endif
set ac=null
set summon=null
set master=null
set smart=null
endfunction
function IndieSummon_SetMaster takes unit summon, unit master returns nothing
local integer id
set id = SetSummonId(summon)
set Masters[id] = master
set Summons[id] = summon
call IndieSummon_loop.execute(id)
endfunction
//===========================================================================
private function Init takes nothing returns nothing
set SummonIdTab = Table.create()
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library IsGameLoaded
globals
private boolean B = false
endglobals
function IsGameLoaded takes nothing returns boolean
return B
endfunction
private function Actions takes nothing returns nothing
set B = true
endfunction
// because of how jasshelper handle inits actually
private module init
private static method onInit takes nothing returns nothing
local trigger trig = CreateTrigger()
call TriggerRegisterGameEvent(trig,EVENT_GAME_LOADED)
call TriggerAddAction(trig,function Actions)
endmethod
endmodule
private struct s_dummy
implement init
endstruct
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library IsUnitTypeId uses IsGameLoaded
globals
private constant player DummyPlayer = Player(13)
endglobals
globals
private unit U
private hashtable Hasht = InitHashtable()
endglobals
function IsUnitTypeId takes integer unitid returns boolean
if IsGameLoaded() then
// IsUnitIdType is bugged , IsUnitHeroId only check if the first letter of the id is an uppercase and not if the id is a valid hero id, so i've figured only this way
// or you can use a third party tool instead, like GMSI, but imho it's overskilled here
if HaveSavedBoolean(Hasht,unitid,0) then
return LoadBoolean(Hasht,unitid,0)
endif
set U = CreateUnit(DummyPlayer,unitid,0.,0.,0.)
if U != null then
call RemoveUnit(U)
set U = null
call SaveBoolean(Hasht,unitid,0,true)
return true
else
call SaveBoolean(Hasht,unitid,0,false)
return false
endif
else
return UnitId2String(unitid) != null // always returns null when the game was saved and loaded, and yes it's a bug
endif
endfunction
endlibrary
//TESH.scrollpos=20
//TESH.alwaysfold=0
library laser needs TimerUtils
private struct str
unit u1
unit u2
lightning e
integer i
integer dur
endstruct
private function Action takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
local real x1 = GetUnitX(dat.u1)
local real y1 = GetUnitY(dat.u1)
local real z1 = GetUnitFlyHeight(dat.u1)
local real x2 = GetUnitX(dat.u2)
local real y2 = GetUnitY(dat.u2)
local real z2 = GetUnitFlyHeight(dat.u2)
if dat.i < dat.dur and not (IsUnitType(dat.u1,UNIT_TYPE_DEAD)) and not (IsUnitType(dat.u1,UNIT_TYPE_DEAD)) and dat.u1!=null and dat.u2!=null then
set dat.i = dat.i + 1
call MoveLightningEx(dat.e,true,x1, y1, z1, x2, y2, z2)
else
call DestroyLightning(dat.e)
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
function Eclair takes unit u1,unit u2, string s, real dur returns nothing
local timer t = NewTimer()
local str dat = str.create()
local real x1 = GetUnitX(u1)
local real y1 = GetUnitY(u1)
local real z1 = GetUnitFlyHeight(u1)
local real x2 = GetUnitX(u2)
local real y2 = GetUnitY(u2)
local real z2 = GetUnitFlyHeight(u2)
set dat.u1 = u1
set dat.u2 = u2
set dat.e = AddLightningEx(s, true, x1, y1, z1, x2, y2, z2)
set dat.i = 0
set dat.dur = R2I(dur/TIMEOUT)
call SetTimerData(t, dat)
call TimerStart (t, TIMEOUT, true, function Action )
set u1 = null
set u2 = null
set s = null
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library PowerupSentinel initializer onInit
//* ============================================================================
//* PowerupSentinel by Vexorian
//* ------------
//* Placing this library in your map will automatically fix all rune/tome
//* memory leaks in your map.
//*
//* Powerup items don't get removed automatically by the game, they instead
//* just leave a small item in the map, this causes memory leaks but - worse -
//* it also makes areas of your map where a lot of tomes have been used lag.
//*
//* ===========================================================================
private function Clean takes nothing returns boolean
if GetWidgetLife(GetManipulatedItem()) == 0 then // no you don't need 0.405, you could also use IsItemPowerUp instead
call RemoveItem(GetManipulatedItem())
endif
return false
endfunction
private function onInit takes nothing returns nothing
local trigger trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_DROP_ITEM)
call TriggerAddCondition(trig,function Clean)
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library RegisterAnyUnitEvent
function RegisterAnyUnitEvent takes playerunitevent E, code condition returns trigger
local trigger t = CreateTrigger()
local integer i = 0
loop
call TriggerRegisterPlayerUnitEvent(t, Player(i), E, null)
set i = i + 1
exitwhen i == bj_MAX_PLAYER_SLOTS
endloop
if condition != null then
call TriggerAddCondition(t, Condition(condition))
endif
return t
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library SoundUtils requires Stack, TimerUtils
//******************************************************************************
//* BY: Rising_Dusk
//*
//* Sounds are a very picky datatype in WC3. They have many quirks that one must
//* account for in order to use them, and simply using the internal WE Sound
//* Editor isn't enough because the sounds it makes can't be played multiple
//* times at once. 3-D sounds are also very tricky because there are different
//* WC3 sound options that a user can have activated where certain sounds will
//* or will not work. This library attempts to streamline the handling of sounds
//* so that it is less likely to confuse you or cause problems.
//*
//* The .mp3 format can be used for 3-D sounds, but there is one problem that
//* must be noted. If your computer supports the "Dolby Surround" sound option
//* in WC3 and you have it selected, then .mp3 files will work for 3-D sounds.
//* If you don't, however, they may not work depending on what you do have
//* selected and what is available for your computer. The .wav format works on
//* all possible settings, making them excellent for general use. This library
//* can interface with sounds of either type.
//*
//* Known issues with sounds that this library resolves:
//* - A given sound variable can only be played once at a time. In order to
//* play a sound type multiple times at once, you need multiple variables.
//* - A sound cannot be played at the same instant that it is created.
//*
//* The DefineSound function defines a sound type based on some basic parameters
//* the user provides. DefineSoundEx is available if the user wants control over
//* all possible parameters, though they won't have an impact most of the time.
//* The duration parameter for DefineSound and DefineSoundEx is in milliseconds,
//* which is consistent with Blizzard's natives. To get the duration of a given
//* sound, open up the WE's Sound Editor, navigate to your sound, and select
//* "Add as Sound." In doing so, it will show its duration in seconds. Multiply
//* that number by 1000 and use it as the duration argument.
//*
//* This library returns a sound variable with RunSound that you can change the
//* settings of using the standard JASS sound API. The library assigns default
//* values to the parameters for 2-D and 3-D sounds, that way they will run
//* without any further help.
//*
//* The library automatically allocates, runs, and recycles a sound when you
//* call RunSound. This library will not automatically recycle looping sounds,
//* so you will need to call ReleaseSound on the looping sound when you want it
//* to end.
//*
//******************************************************************************
//*
//* > function DefineSound takes string fileName, integer duration, ...
//* boolean looping, boolean is3D returns integer
//*
//* This function defines a sound type with a short list of parameters. The
//* returned integer serves as a SOUND_TYPE for running this type of sound at
//* any other point in a map.
//*
//* > function DefineSoundEx takes string fileName, integer duration, ...
//* boolean looping, boolean is3D, boolean stopwhenoutofrange, ...
//* integer fadeInRate, integer fadeOutRate, string eaxSetting ...
//* returns integer
//*
//* This function serves an identical purpose to DefineSound, but gives the user
//* full control over the entire list of parameters. Similar to DefineSound, the
//* returned integer serves as a SOUND_TYPE for running this type of sound.
//*
//* > function RunSound takes integer soundRef returns sound
//*
//* This function runs a sound with the parameters held within the soundRef
//* integer argument. The soundRef argument is the returned value of DefineSound
//* or DefineSoundEx.
//*
//* > function RunSoundOnUnit takes integer soundRef, unit whichUnit returns sound
//*
//* The same as RunSound, just this function runs a sound of a given type on a
//* specified unit.
//*
//* > function RunSoundAtPoint takes integer soundRef, real x, real y, real z returns sound
//*
//* The same as RunSound, just this function runs a sound of a given type at a
//* specified point in 3D space.
//*
//* > function RunSoundForPlayer takes integer soundRef, player p returns sound
//*
//* The same as RunSound, just this function runs a sound of a given type only
//* for the specified player.
//*
//* > function ReleaseSound takes sound s returns boolean
//*
//* This function need only be called on looping sounds. If a sound is not
//* looping, it will be released and recycled on its own. This function should
//* be used on looping sounds when you want them to end.
//*
//* Example usage:
//* set SOUND_TYPE = DefineSound("Sound\\Path.wav", 300, false, true)
//* call RunSound(SOUND_TYPE)
//* call RunSoundOnUnit(SOUND_TYPE, SomeUnit)
//* call RunSoundAtPoint(SOUND_TYPE, x, y, z)
//* call RunSoundForPlayer(SOUND_TYPE, Player(5))
//* call ReleaseSound(SomeLoopingSound)
//*
globals
private hashtable ht = InitHashtable() //Attach sound types to sounds
private hashtable st = InitHashtable() //Sound hashtable
private hashtable rt = InitHashtable() //Attach soundrecyclers to sounds
private hashtable kt = InitHashtable() //Attach StopSound data
endglobals
//Struct for each sound type
private struct soundhelper
//Stack associated to each struct
Stack sta
//Sound Settings for this sound type
string fileName = ""
integer duration = 0
boolean looping = false
boolean is3D = false
boolean stopwhenoutofrange = false
integer fadeInRate = 0
integer fadeOutRate = 0
string eaxSetting = ""
static method create takes string fileName, integer duration, boolean looping, boolean is3D, boolean stopwhenoutofrange, integer fadeInRate, integer fadeOutRate, string eaxSetting returns soundhelper
local soundhelper sh = soundhelper.allocate()
//Load the parameters so the sound can be created later as necessary
set sh.fileName = fileName
set sh.duration = duration
set sh.looping = looping
set sh.is3D = is3D
set sh.stopwhenoutofrange = stopwhenoutofrange
set sh.fadeInRate = fadeInRate
set sh.fadeOutRate = fadeOutRate
set sh.eaxSetting = eaxSetting
//Create the stack for the struct
set sh.sta = Stack.create()
return sh
endmethod
endstruct
//Struct for holding data for the sound recycling
private struct soundrecycler
timer t = null
sound s = null
integer sh = 0
boolean stopped = false //Only gets used if StopSound is called on a new sound
static method create takes sound whichSound, integer soundRef returns soundrecycler
local soundrecycler sr = soundrecycler.allocate()
set sr.t = NewTimer()
set sr.s = whichSound
set sr.sh = soundRef
call SetTimerData(sr.t, integer(sr))
//Hook the value to the soundRef and whichSound
call SaveInteger(rt, soundRef, GetHandleId(whichSound), integer(sr))
return sr
endmethod
private method onDestroy takes nothing returns nothing
call RemoveSavedInteger(rt, .sh, GetHandleId(.s))
call ReleaseTimer(.t)
endmethod
endstruct
//******************************************************************************
private function HookStopSound takes sound soundHandle, boolean killWhenDone, boolean fadeOut returns nothing
local integer id = GetHandleId(soundHandle)
local integer soundRef = 0
local soundrecycler sr = 0
if HaveSavedInteger(ht, 0, id) then //Sound is from stacks
set soundRef = LoadInteger(ht, 0, id)
if HaveSavedInteger(rt, soundRef, id) then //Sound has a recycler
set sr = soundrecycler(LoadInteger(rt, soundRef, id))
set sr.stopped = true
endif
if killWhenDone then
debug call BJDebugMsg(SCOPE_PREFIX+"Warning: (StopSound) Destroying a sound in the stack")
endif
endif
endfunction
hook StopSound HookStopSound
private function HookKillSoundWhenDone takes sound soundHandle returns nothing
if HaveSavedInteger(ht, 0, GetHandleId(soundHandle)) then
call BJDebugMsg(SCOPE_PREFIX+"Warning: (KillSoundWhenDone) Destroying a sound in the stack")
endif
endfunction
debug hook KillSoundWhenDone HookKillSoundWhenDone
//******************************************************************************
function DefineSoundEx takes string fileName, integer duration, boolean looping, boolean is3D, boolean stopwhenoutofrange, integer fadeInRate, integer fadeOutRate, string eaxSetting returns integer
return integer(soundhelper.create(fileName, duration, looping, is3D, stopwhenoutofrange, fadeInRate, fadeOutRate, eaxSetting))
endfunction
function DefineSound takes string fileName, integer duration, boolean looping, boolean is3D returns integer
return DefineSoundEx(fileName, duration, looping, is3D, true, 10, 10, "CombatSoundsEAX")
endfunction
function ReleaseSound takes sound s returns boolean
local integer id = GetHandleId(s)
local integer soundRef = 0
local soundhelper sh = 0
local soundrecycler sr = 0
if s == null then
debug call BJDebugMsg(SCOPE_PREFIX+"Error: Cannot recycle a null sound")
return false
elseif not HaveSavedInteger(ht, 0, id) then
debug call BJDebugMsg(SCOPE_PREFIX+"Error: Cannot recycle a sound not allocated by RunSound")
return false
endif
set soundRef = LoadInteger(ht, 0, id)
set sh = soundhelper(soundRef)
call StopSound(s, false, true) //Stop the sound
call sh.sta.push(id) //Return it to the stack
call SaveSoundHandle(st, soundRef, id, s) //Save it to hashtable
if not sh.looping then
//soundrecycler only exists for non-looping sounds
set sr = soundrecycler(LoadInteger(rt, soundRef, id))
call sr.destroy() //Destroy recycler helper
endif
return true
endfunction
private function Recycle takes nothing returns nothing
local soundrecycler sr = soundrecycler(GetTimerData(GetExpiredTimer()))
local soundhelper sh = soundhelper(sr.sh)
local integer id = GetHandleId(sr.s)
call StopSound(sr.s, false, true) //Stop the sound
call sh.sta.push(id) //Return it to the stack
call SaveSoundHandle(st, integer(sh), id, sr.s) //Save it to hashtable
call sr.destroy() //Destroy recycler helper
endfunction
private function Run takes nothing returns nothing
local soundrecycler sr = soundrecycler(GetTimerData(GetExpiredTimer()))
local soundhelper sh = soundhelper(sr.sh)
if not sr.stopped then
call StartSound(sr.s) //Play sound here
endif
if not sh.looping and not sr.stopped then
call TimerStart(sr.t, sh.duration*0.001, false, function Recycle)
else
call sr.destroy()
endif
endfunction
function RunSound takes integer soundRef returns sound
local sound s = null
local integer i = 0
local soundhelper sh = soundhelper(soundRef)
local soundrecycler sr = 0
if soundRef <= 0 then
debug call BJDebugMsg(SCOPE_PREFIX+"Error: Cannot run sound of undefined type")
return null
endif
//Check if the stack is empty
if sh.sta.peek() == Stack.EMPTY then
//Create a new sound for the stack
set s = CreateSound(sh.fileName, sh.looping, sh.is3D, sh.stopwhenoutofrange, sh.fadeInRate, sh.fadeOutRate, sh.eaxSetting)
//Attach the type to the sound for future reference
call SaveInteger(ht, 0, GetHandleId(s), integer(sh))
call SetSoundDuration(s, sh.duration)
//Stuff that must be performed immediately upon creation of sounds
call SetSoundChannel(s, 5)
call SetSoundVolume(s, 127)
call SetSoundPitch(s, 1.)
if sh.is3D then
//These are settings necessary for 3-D sounds to function properly
//You can change them at will outside of this function
call SetSoundDistances(s, 600., 10000.)
call SetSoundDistanceCutoff(s, 3000.)
call SetSoundConeAngles(s, 0., 0., 127)
call SetSoundConeOrientation(s, 0., 0., 0.)
endif
//Start sound after a delay because it was created here
set sr = soundrecycler.create(s, soundRef)
call TimerStart(sr.t, 0.001, false, function Run)
else
//Allocate a sound from the stack
set i = sh.sta.pop()
if not HaveSavedHandle(st, soundRef, i) then
debug call BJDebugMsg(SCOPE_PREFIX+"Error: No sound in given stack member")
return null
endif
set s = LoadSoundHandle(st, soundRef, i)
call RemoveSavedInteger(st, soundRef, i)
call SetSoundVolume(s, 127) //Start volume at max
//Start it here since it wasn't created here
call StartSound(s)
//Recycle the sound in a timer callback after it's finished if nonlooping
if not sh.looping then
set sr = soundrecycler.create(s, soundRef)
call TimerStart(sr.t, sh.duration*0.001, false, function Recycle)
endif
endif
return s
endfunction
function RunSoundOnUnit takes integer soundRef, unit whichUnit returns sound
local sound s = RunSound(soundRef)
call AttachSoundToUnit(s, whichUnit)
return s
endfunction
function RunSoundAtPoint takes integer soundRef, real x, real y, real z returns sound
local sound s = RunSound(soundRef)
call SetSoundPosition(s, x, y, z)
return s
endfunction
function RunSoundForPlayer takes integer soundRef, player p returns sound
local sound s = RunSound(soundRef)
if GetLocalPlayer() != p then
call SetSoundVolume(s, 0)
else
call SetSoundVolume(s, 127)
endif
return s
endfunction
endlibrary
//TESH.scrollpos=38
//TESH.alwaysfold=0
library SpellEvent requires AutoIndex,UnitListModule
private function interface FunctionInterface takes nothing returns nothing
globals
private keyword s_spell
s_spell SpellEvent = 0
key SPELL_CHANNEL
key SPELL_CAST
key SPELL_EFFECT
key SPELL_FINISH // if the unit had succesfully finished the spell
key SPELL_ENDCAST // if the unit abort the spell before the end
endglobals
globals
private hashtable HashT
private timer Tim
private integer Index = 0
private FunctionInterface Func = 0
private s_spell array S
endglobals
private module m_init
static method onInit takes nothing returns nothing
local trigger trig
//! runtextmacro t_CreateSpellsTriggers("OnChannel","CHANNEL")
//! runtextmacro t_CreateSpellsTriggers("OnCast","CAST")
//! runtextmacro t_CreateSpellsTriggers("OnEffect","EFFECT")
//! runtextmacro t_CreateSpellsTriggers("OnFinish","FINISH")
//! runtextmacro t_CreateSpellsTriggers("OnEndCast","ENDCAST")
set Tim = CreateTimer()
set HashT = InitHashtable()
endmethod
endmodule
function RegisterSpellEvent takes integer whichEvent, integer whichSpell, FunctionInterface whichFunc returns nothing
call SaveInteger(HashT,whichEvent,whichSpell,integer(whichFunc))
endfunction
function RegisterSpellChannelResponse takes integer spellId, FunctionInterface whichFunc returns nothing
call SaveInteger(HashT,SPELL_CHANNEL,spellId,integer(whichFunc))
endfunction
function RegisterSpellCastResponse takes integer spellId, FunctionInterface whichFunc returns nothing
call SaveInteger(HashT,SPELL_CAST,spellId,integer(whichFunc))
endfunction
function RegisterSpellEffectResponse takes integer spellId, FunctionInterface whichFunc returns nothing
call SaveInteger(HashT,SPELL_EFFECT,spellId,integer(whichFunc))
endfunction
function RegisterSpellFinishResponse takes integer spellId, FunctionInterface whichFunc returns nothing
call SaveInteger(HashT,SPELL_FINISH,spellId,integer(whichFunc))
endfunction
function RegisterSpellEndCastResponse takes integer spellId, FunctionInterface whichFunc returns nothing
call SaveInteger(HashT,SPELL_ENDCAST,spellId,integer(whichFunc))
endfunction
private struct s_spell
integer AbilityId = 0
unit CastingUnit = null
unit TargetUnit = null
item TargetItem = null
destructable TargetDestructable = null
real TargetX = 0.
real TargetY = 0.
boolean IsTargetPoint = false
boolean IsTargetUnit = false
boolean IsTargetItem = false
boolean IsTargetDestructable = false
boolean IsNoTarget = false
integer TargetUnitTypeId = 0
integer TargetDestructableTypeId = 0
integer TargetItemTypeId = 0
boolean CastFinished = false
private method destroy takes nothing returns nothing
call .unitListRemove.evaluate()
set .CastFinished = false
endmethod
implement UnitList
private static method create takes nothing returns thistype
local thistype this = .allocate()
set .CastingUnit = GetSpellAbilityUnit()
set .TargetUnit = GetSpellTargetUnit()
set .AbilityId = GetSpellAbilityId()
if .TargetUnit != null then
set .IsTargetUnit = true
set .TargetUnitTypeId = GetUnitTypeId(.TargetUnit)
set .TargetX = GetUnitX(.TargetUnit)
set .TargetY = GetUnitY(.TargetUnit)
else
set .TargetDestructable = GetSpellTargetDestructable()
if .TargetDestructable != null then
set .IsTargetDestructable = true
set .TargetDestructableTypeId = GetDestructableTypeId(.TargetDestructable)
set .TargetX = GetDestructableX(.TargetDestructable)
set .TargetY = GetDestructableY(.TargetDestructable)
else
set .TargetItem = GetSpellTargetItem()
if .TargetItem != null then
set .IsTargetItem = true
set .TargetItemTypeId = GetItemTypeId(.TargetItem)
set .TargetX = GetItemX(.TargetItem)
set .TargetY = GetItemY(.TargetItem)
else
set .IsNoTarget = true
set .TargetX = GetSpellTargetX()
set .TargetY = GetSpellTargetY()
endif
endif
endif
call .unitListAdd(.CastingUnit)
return this
endmethod
private static method DestroyInstances takes nothing returns nothing
loop
exitwhen Index == 0
set Index = Index-1
call S[Index].destroy()
endloop
endmethod
private static method OnChannel takes nothing returns boolean
set SpellEvent = s_spell.create()
//! runtextmacro t_FindSpellFunctionInterface("CHANNEL")
return false
endmethod
private static method OnCast takes nothing returns boolean
//! runtextmacro t_FindWhichSpell()
//! runtextmacro t_FindSpellFunctionInterface("CAST")
return false
endmethod
private static method OnEffect takes nothing returns boolean
//! runtextmacro t_FindWhichSpell()
//! runtextmacro t_FindSpellFunctionInterface("EFFECT")
return false
endmethod
private static method OnFinish takes nothing returns boolean
//! runtextmacro t_FindWhichSpell()
set SpellEvent.CastFinished = true
//! runtextmacro t_FindSpellFunctionInterface("FINISH")
return false
endmethod
private static method OnEndCast takes nothing returns boolean
//! runtextmacro t_FindWhichSpell()
//! runtextmacro t_FindSpellFunctionInterface("ENDCAST")
set S[Index] = SpellEvent
set Index = Index+1
call TimerStart(Tim,0.,false,function thistype.DestroyInstances)
return false
endmethod
implement m_init
endstruct
//! textmacro t_FindWhichSpell
set SpellEvent = s_spell.unitFirst(GetSpellAbilityUnit())
loop
exitwhen SpellEvent.AbilityId == GetSpellAbilityId()
set SpellEvent = SpellEvent.unitNext
endloop
//! endtextmacro
//! textmacro t_CreateSpellsTriggers takes NAME , EVENT
set trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_SPELL_$EVENT$)
call TriggerAddCondition(trig,function s_spell.$NAME$)
//! endtextmacro
//! textmacro t_FindSpellFunctionInterface takes EVENT
set Func = FunctionInterface(LoadInteger(HashT,SPELL_$EVENT$,SpellEvent.AbilityId))
if Func != 0 then
call Func.execute()
endif
//! endtextmacro
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library Stack
//*****************************************************************
//* STACK
//*
//* written by: Anitarf
//*
//* This is an efficient implementation of a stack in vJass. Since
//* it is based on a linked list, I decided to add common list
//* methods to the data structure so it can function both as
//* a stack and a simple linked list.
//*
//* As a linked list, it has less functionality than Ammorth's
//* LinkedList, but is considerably faster. Note only that most of
//* the list methods have O(n) time complexity so they may not be
//* suitable for operations on very large lists, however due to
//* their simplicity the list would need to be really large for
//* this to become a problem.
//*
//* All stack methods are of course O(1) and as fast as possible.
//* If you just need a stack, this is definitely the best choice.
//*
//* set s=Stack.create() - Instanceates a new Stack object.
//* call s.destroy() - Destroys the Stack.
//*
//* Stack syntax:
//* call s.push(123) - Pushes the value 123 on the stack.
//* A stack may contain multiple
//* instances of the same value.
//* set i=s.peek() - Reads the top value of the stack
//* and stores it to the variable i.
//* set i=s.pop() - Removes the top value from the stack
//* and stores it to the variable i.
//* s.peek()==Stack.EMPTY - Checks if the stack is empty.
//*
//* List syntax:
//* call s.add(123) - Adds the value 123 to the list.
//* A list may contain multiple
//* instances of the same value.
//* s.size - The total number of values on the list.
//* s.contains(123) - Checks if the value 123 is on the list.
//* set n=s.count(123) - Stores the number of times the value
//* 123 is on the list to the variable n.
//* call s.remove(123) - Removes one instance of the value 123
//* from the list. Returns false if
//* the value was not found on the list.
//* call s.purge(123) - Removes all instances of the value 123
//* from the list. Returns the number of
//* values that were removed.
//* set i=s.first - Reads the first value from the list
//* and stores it to the variable i.
//* set i=s.random - Reads a random value from the list
//* and stores it to the variable i.
//* set s2=s.copy() - Makes a copy of the list and stores
//* it to the variable s2.
//* call s.enum(Func,b) - Calls function Func for all values
//* on the list. The function must follow
//* the Enum function interface.
//* b is a boolean value, if it is true
//* then the values will be enumerated
//* top to bottom, if false then bottom
//* to top.
//*****************************************************************
public function interface Enum takes integer value returns nothing
struct Stack
// Use a totally random number here, the more improbable someone uses it, the better.
// This is the value that is returned by .pop and .peek methods and .first and .random operators when called on an empty stack.
public static constant integer EMPTY=0x28829022
// End of calibration.
readonly integer size = 0
private integer top = 0
private static integer free = 1
private static integer array next
private static integer array value
method push takes integer i returns nothing
// Get an index from the list of free indexes.
local integer n=Stack.free
set Stack.free=Stack.next[n]
// Extend the list of free indexes if needed.
if Stack.free==0 then
set Stack.free=n+1
endif
// Store the value to the index.
set Stack.value[n]=i
// Add index to the top of the stack.
set Stack.next[n]=.top
set .top=n
set .size=.size+1
endmethod
method pop takes nothing returns integer
// Get the top index of stack.
local integer n=.top
// Safety check in case a user pops an empty stack.
if n==0 then
debug call BJDebugMsg("stack warning: .pop called on an empty stack!")
return Stack.EMPTY
endif
// Remove the top index from stack.
set .top=Stack.next[n]
set .size=.size-1
// Add the index to the list of free indexes.
set Stack.next[n]=Stack.free
set Stack.free=n
// Return the value.
return Stack.value[n]
endmethod
method peek takes nothing returns integer
// Read the value of the top index.
return Stack.value[.top]
endmethod
method add takes integer value returns nothing
call .push(value)
endmethod
method contains takes integer value returns boolean
// Get the first index of the list.
local integer i=.top
// Search through the list.
loop
// Stop the search when the end of the list is reached.
exitwhen i==0
// Stop the search if the value is found.
if Stack.value[i]==value then
return true
endif
// Get the next index of the list.
set i=Stack.next[i]
endloop
return false
endmethod
method count takes integer value returns integer
local integer count=0
// Get the first index of the list.
local integer i=.top
// Search through the list.
loop
// Stop the search when the end of the list is reached.
exitwhen i==0
// Increase the count if the value is found.
if Stack.value[i]==value then
set count=count+1
endif
// Get the next index of the list.
set i=Stack.next[i]
endloop
return count
endmethod
method operator first takes nothing returns integer
return .peek()
endmethod
method operator random takes nothing returns integer
local integer r=GetRandomInt(1,.size)
// Get the first index of the list.
local integer i=.top
// Loop through the list.
loop
// Stop the loop after a random amount of repeats.
set r=r-1
exitwhen r==0 or i==0
// Get the next index of the list.
set i=Stack.next[i]
endloop
return Stack.value[i]
endmethod
method remove takes integer value returns boolean
// Get the first index of the list.
local integer i1=.top
local integer i2
// Check if the first index holds the value.
if Stack.value[i1]==value then
call .pop()
return true
endif
// Search through the rest of the list.
loop
set i2=Stack.next[i1]
// Stop the search when the end of the list is reached.
exitwhen i2==0
// Check if the next index holds the value.
if Stack.value[i2]==value then
// Remove the index from the stack.
set Stack.next[i1]=Stack.next[i2]
// Add the removed index to the list of free indexes.
set Stack.next[i2]=Stack.free
set Stack.free=i2
set .size=.size-1
return true
endif
set i1=i2
endloop
return false
endmethod
method purge takes integer value returns integer
local integer count=0
local integer i1
local integer i2
// If the first index holds the value, pop it.
loop
// If the list is empty, return.
if .top==0 then
return count
endif
// Repeat until the first index doesn't hold the value.
exitwhen Stack.value[.top]!=value
call .pop()
set count=count+1
endloop
// Get the first index of the list.
set i1=.top
// Search through the rest of the list.
loop
set i2=Stack.next[i1]
// Stop the search when the end of the list is reached.
exitwhen i2==0
// Check if the next index holds the value.
if Stack.value[i2]==value then
// Remove the index from the stack.
set Stack.next[i1]=Stack.next[i2]
// Add the removed index to the list of free indexes.
set Stack.next[i2]=Stack.free
set Stack.free=i2
set .size=.size-1
set count=count+1
else
set i1=i2
endif
endloop
return count
endmethod
method enum takes Enum f, boolean top2bottom returns nothing
local integer array value
// Get the first index of the list.
local integer i1=.top
local integer i2=0
// Populate the array.
loop
exitwhen i1==0
set value[i2]=Stack.value[i1]
set i2=i2+1
set i1=Stack.next[i1]
endloop
// Call the Enum function for each value in the array.
set i1=i2-1
loop
exitwhen i2==0
set i2=i2-1
// Enumerate in which direction?
if top2bottom then
call f.evaluate(value[i1-i2])
else
call f.evaluate(value[i2])
endif
endloop
endmethod
method copy takes nothing returns Stack
local Stack that=Stack.create()
// Get the first index of the list.
local integer i1=.top
local integer i2
// Add a dummy index to the top of the new list.
call that.push(0)
set i2=that.top
loop
exitwhen i1==0
// Get an index from the list of free indexes and add it at the end of the list.
set Stack.next[i2]=Stack.free
set i2=Stack.next[i2]
set Stack.free=Stack.next[i2]
// Extend the list of free indexes if needed.
if Stack.free==0 then
set Stack.free=i2+1
endif
// Copy the value to the new index.
set Stack.value[i2]=Stack.value[i1]
set i1=Stack.next[i1]
endloop
// End the new list correctly.
set Stack.next[i2]=0
// Remove the dummy index.
call that.pop()
// Copy the size value to the new list.
set that.size=this.size
return that
endmethod
method onDestroy takes nothing returns nothing
local integer n
// Remove all remaining indexes from the stack.
loop
// Get the top index.
set n=.top
exitwhen n==0
// Remove it from the stack.
set .top=Stack.next[n]
// Add it to the list of free indexes.
set Stack.next[n]=Stack.free
set Stack.free=n
endloop
endmethod
static method onInit takes nothing returns nothing
// Store the EMPTY value to index 0 to make .peek inline friendly.
set Stack.value[0]=Stack.EMPTY
endmethod
endstruct
endlibrary
//TESH.scrollpos=37
//TESH.alwaysfold=0
library Push needs TimerUtils, UnitPhysic
globals
private constant string FX_WATER = "Objects\\Spawnmodels\\Naga\\NagaDeath\\NagaDeath.mdl"
private constant string FX_GROUND = "dust.mdx"
endglobals
private struct structure
unit target
real angle
integer distance
real speed
integer i
real imp
integer deltaZ
endstruct
private function Update takes nothing returns nothing
local timer t = GetExpiredTimer()
local structure dat = GetTimerData(t)
local real x1 = GetUnitX(dat.target)
local real y1 = GetUnitY(dat.target)
local real x2 = x1 + dat.speed*Cos(dat.angle)
local real y2 = y1 + dat.speed*Sin(dat.angle)
local real z1 = GetUnitFlyHeight(dat.target)
local real z2 = 0.
if dat.i < dat.distance then
set dat.i = dat.i + 1
set dat.deltaZ = GetTerrainCliffLevel(x1,y1)-GetTerrainCliffLevel(x2,y2)
if dat.deltaZ >= 0 then
call SetUnitPosition(dat.target, x2, y2)
endif
if dat.imp > 0. then
if (dat.i < (dat.distance * 0.5)) then
set z2 = z1 + (dat.distance * dat.imp)
else
set z2 = z1 - (dat.distance * dat.imp)
endif
endif
else
if IsTerrainDeepWater(x1,y1) or IsTerrainShallowWater(x1,y1)==true then
call DestroyEffect(AddSpecialEffect(FX_WATER, x1,y1))
else
call DestroyEffect(AddSpecialEffect(FX_GROUND,x1,y1 ))
endif
call SetUnitPathing(dat.target,true)
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
function Push takes real x, real y, unit target, integer distance, integer speed, real imp returns nothing
local timer t = NewTimer()
local structure dat = structure.create()
local real weight = GetUnitWeight(target)
call SetUnitPathing( target, false)
set dat.target = target
set dat.angle = Atan2(GetUnitY(target) - y, GetUnitX(target) - x)
set dat.distance = R2I(distance/speed)
set dat.speed = speed*weight
set dat.i = 0
set dat.imp = imp*weight
call SetTimerData(t, dat)
call TimerStart (t, TIMEOUT, true, function Update )
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library Table
//***************************************************************
//* Table object 3.0
//* ------------
//*
//* set t=Table.create() - instanceates a new table object
//* call t.destroy() - destroys it
//* t[1234567] - Get value for key 1234567
//* (zero if not assigned previously)
//* set t[12341]=32 - Assigning it.
//* call t.flush(12341) - Flushes the stored value, so it
//* doesn't use any more memory
//* t.exists(32) - Was key 32 assigned? Notice
//* that flush() unassigns values.
//* call t.reset() - Flushes the whole contents of the
//* Table.
//*
//* call t.destroy() - Does reset() and also recycles the id.
//*
//* If you use HandleTable instead of Table, it is the same
//* but it uses handles as keys, the same with StringTable.
//*
//* You can use Table on structs' onInit if the struct is
//* placed in a library that requires Table or outside a library.
//*
//* You can also do 2D array syntax if you want to touch
//* mission keys directly, however, since this is shared space
//* you may want to prefix your mission keys accordingly:
//*
//* set Table["thisstring"][ 7 ] = 2
//* set Table["thisstring"][ 5 ] = Table["thisstring"][7]
//*
//***************************************************************
//=============================================================
globals
private constant integer MAX_INSTANCES=8100 //400000
//Feel free to change max instances if necessary, it will only affect allocation
//speed which shouldn't matter that much.
//=========================================================
private hashtable ht
endglobals
private struct GTable[MAX_INSTANCES]
method reset takes nothing returns nothing
call FlushChildHashtable(ht, integer(this) )
endmethod
private method onDestroy takes nothing returns nothing
call this.reset()
endmethod
//=============================================================
// initialize it all.
//
private static method onInit takes nothing returns nothing
set ht = InitHashtable()
endmethod
endstruct
//Hey: Don't instanciate other people's textmacros that you are not supposed to, thanks.
//! textmacro Table__make takes name, type, key
struct $name$ extends GTable
method operator [] takes $type$ key returns integer
return LoadInteger(ht, integer(this), $key$)
endmethod
method operator []= takes $type$ key, integer value returns nothing
call SaveInteger(ht, integer(this) ,$key$, value)
endmethod
method flush takes $type$ key returns nothing
call RemoveSavedInteger(ht, integer(this), $key$)
endmethod
method exists takes $type$ key returns boolean
return HaveSavedInteger( ht, integer(this) ,$key$)
endmethod
static method flush2D takes string firstkey returns nothing
call $name$(- StringHash(firstkey)).reset()
endmethod
static method operator [] takes string firstkey returns $name$
return $name$(- StringHash(firstkey) )
endmethod
endstruct
//! endtextmacro
//! runtextmacro Table__make("Table","integer","key" )
//! runtextmacro Table__make("StringTable","string", "StringHash(key)" )
//! runtextmacro Table__make("HandleTable","handle","GetHandleId(key)" )
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library TerrainPathability initializer Init
//******************************************************************************
//* BY: Rising_Dusk
//*
//* This script can be used to detect the type of pathing at a specific point.
//* It is valuable to do it this way because the IsTerrainPathable is very
//* counterintuitive and returns in odd ways and aren't always as you would
//* expect. This library, however, facilitates detecting those things reliably
//* and easily.
//*
//******************************************************************************
//*
//* > function IsTerrainDeepWater takes real x, real y returns boolean
//* > function IsTerrainShallowWater takes real x, real y returns boolean
//* > function IsTerrainLand takes real x, real y returns boolean
//* > function IsTerrainPlatform takes real x, real y returns boolean
//* > function IsTerrainWalkable takes real x, real y returns boolean
//*
//* These functions return true if the given point is of the type specified
//* in the function's name and false if it is not. For the IsTerrainWalkable
//* function, the MAX_RANGE constant below is the maximum deviation range from
//* the supplied coordinates that will still return true.
//*
//* The IsTerrainPlatform works for any preplaced walkable destructable. It will
//* return true over bridges, destructable ramps, elevators, and invisible
//* platforms. Walkable destructables created at runtime do not create the same
//* pathing hole as preplaced ones do, so this will return false for them. All
//* other functions except IsTerrainWalkable return false for platforms, because
//* the platform itself erases their pathing when the map is saved.
//*
//* After calling IsTerrainWalkable(x, y), the following two global variables
//* gain meaning. They return the X and Y coordinates of the nearest walkable
//* point to the specified coordinates. These will only deviate from the
//* IsTerrainWalkable function arguments if the function returned false.
//*
//* Variables that can be used from the library:
//* [real] TerrainPathability_X
//* [real] TerrainPathability_Y
//*
globals
private constant real MAX_RANGE = 10.
private constant integer DUMMY_ITEM_ID = 'wolg'
endglobals
globals
private item Item = null
private rect Find = null
private item array Hid
private integer HidMax = 0
public real X = 0.
public real Y = 0.
endglobals
function IsTerrainDeepWater takes real x, real y returns boolean
return not IsTerrainPathable(x, y, PATHING_TYPE_FLOATABILITY) and IsTerrainPathable(x, y, PATHING_TYPE_WALKABILITY)
endfunction
function IsTerrainShallowWater takes real x, real y returns boolean
return not IsTerrainPathable(x, y, PATHING_TYPE_FLOATABILITY) and not IsTerrainPathable(x, y, PATHING_TYPE_WALKABILITY) and IsTerrainPathable(x, y, PATHING_TYPE_BUILDABILITY)
endfunction
function IsTerrainLand takes real x, real y returns boolean
return IsTerrainPathable(x, y, PATHING_TYPE_FLOATABILITY)
endfunction
function IsTerrainPlatform takes real x, real y returns boolean
return not IsTerrainPathable(x, y, PATHING_TYPE_FLOATABILITY) and not IsTerrainPathable(x, y, PATHING_TYPE_WALKABILITY) and not IsTerrainPathable(x, y, PATHING_TYPE_BUILDABILITY)
endfunction
private function HideItem takes nothing returns nothing
if IsItemVisible(GetEnumItem()) then
set Hid[HidMax] = GetEnumItem()
call SetItemVisible(Hid[HidMax], false)
set HidMax = HidMax + 1
endif
endfunction
function IsTerrainWalkable takes real x, real y returns boolean
//Hide any items in the area to avoid conflicts with our item
call MoveRectTo(Find, x, y)
call EnumItemsInRect(Find ,null, function HideItem)
//Try to move the test item and get its coords
call SetItemPosition(Item, x, y) //Unhides the item
set X = GetItemX(Item)
set Y = GetItemY(Item)
static if LIBRARY_IsTerrainWalkable then
//This is for compatibility with the IsTerrainWalkable library
set IsTerrainWalkable_X = X
set IsTerrainWalkable_Y = Y
endif
call SetItemVisible(Item, false)//Hide it again
//Unhide any items hidden at the start
loop
exitwhen HidMax <= 0
set HidMax = HidMax - 1
call SetItemVisible(Hid[HidMax], true)
set Hid[HidMax] = null
endloop
//Return walkability
return (X-x)*(X-x)+(Y-y)*(Y-y) <= MAX_RANGE*MAX_RANGE and not IsTerrainPathable(x, y, PATHING_TYPE_WALKABILITY)
endfunction
private function Init takes nothing returns nothing
set Find = Rect(0., 0., 128., 128.)
set Item = CreateItem(DUMMY_ITEM_ID, 0, 0)
call SetItemVisible(Item, false)
endfunction
endlibrary
//TESH.scrollpos=116
//TESH.alwaysfold=0
library TextDisplay initializer init needs SoundUtils
globals
integer SOUND_ERROR
integer SOUND_RADIO
integer SOUND_BIP
integer SOUND_NEWHERO
integer SOUND_FLY
integer SOUND_BOMBFALL
integer SOUND_WILLEXPLODE
integer SOUND_GRENADE
integer SOUND_FLASH
integer SOUND_BOSS
integer SOUND_LOAD
integer SOUND_ROCKET
integer SOUND_EXPLOSION
endglobals
function MusicQuest takes nothing returns nothing
call PlayMusic(gg_snd_Orc1)
endfunction
function MusicOff takes nothing returns nothing
call StopMusic(true)
call MusicQuest()
endfunction
function MusicChapter takes nothing returns nothing
call MusicOff()
call PlayMusic(gg_snd_PursuitTheme)
endfunction
function BossSound takes nothing returns nothing
call RunSound(SOUND_BOSS)
endfunction
function FlashSound takes real x, real y returns nothing
call RunSoundAtPoint(SOUND_FLASH,x,y,0.)
endfunction
function RocketSound takes real x, real y returns nothing
call RunSoundAtPoint(SOUND_ROCKET,x,y,0.)
endfunction
function ExplosionSound takes real x, real y returns nothing
call RunSoundAtPoint(SOUND_EXPLOSION,x,y,0.)
endfunction
function LoadSound takes real x, real y returns nothing
call RunSoundAtPoint(SOUND_LOAD,x,y,0.)
endfunction
function GrenadeSound takes real x, real y returns nothing
call RunSoundAtPoint(SOUND_GRENADE,x,y,0.)
endfunction
function ErrorSound takes player whichPlayer returns nothing
call RunSoundForPlayer(SOUND_ERROR,whichPlayer)
endfunction
function BipSound takes nothing returns nothing
call RunSound(SOUND_BIP)
endfunction
function FlySound takes nothing returns nothing
call RunSound(SOUND_FLY)
endfunction
function BombFallSound takes nothing returns nothing
call RunSound(SOUND_BOMBFALL)
endfunction
function WillExplodeSound takes nothing returns nothing
call RunSound(SOUND_WILLEXPLODE)
endfunction
function RadioSound takes nothing returns nothing
call RunSound(SOUND_RADIO)
endfunction
function DisplayAllNoSpeaker takes string text returns nothing
local integer i = 0
call RadioSound()
loop
exitwhen i > MAXPLAYER
call DisplayTextToPlayer(Player(i),0.,0.,text)
set i = i + 1
endloop
endfunction
function StoryDisplay takes string speaker, string text returns nothing
local integer i = 0
call RadioSound()
loop
exitwhen i > MAXPLAYER
if PlayerStory[i]==true then
call DisplayTextToPlayer(Player(i),0.,0.,"|c00AFAAFF"+speaker+"|r"+" : "+text)
endif
set i = i + 1
endloop
endfunction
function DisplayAll takes string speaker, string text returns nothing
local integer i = 0
call RadioSound()
loop
exitwhen i > MAXPLAYER
call DisplayTextToPlayer(Player(i),0.,0.,"|c00AFAAFF"+speaker+"|r"+" : "+text)
set i = i + 1
endloop
endfunction
function TextTagMessage takes string text, unit u, real xOffset, real zOffset, real speed, real angle, real size, real transparency, real lifespan returns nothing
local texttag tag = CreateTextTag()
set speed = speed * 0.071 / 128
set angle = angle * bj_DEGTORAD
if IsUnitType(u,UNIT_TYPE_HERO)==true then
call SetTextTagText(tag, "|cffff4500"+GetPlayerName(GetOwningPlayer(u)) +"|r "+ text, size * 0.0023)
else
call SetTextTagText(tag, "|cffff4500" +GetUnitName(u)+"|r "+ text, size * 0.0023)
endif
call SetTextTagPos(tag, GetUnitX(u) - 10 + xOffset, GetUnitY(u), zOffset) // on enlève 10 au x pour centrer à peu prés le tag sur l'unité
call SetTextTagVelocity(tag, speed * Cos(angle), speed * Sin(angle))
call SetTextTagColor(tag, 255, 255, 255, R2I((100.0-transparency) * 2.55))
call SetTextTagFadepoint(tag, lifespan - 0.25) // pour que le texte disparaisse en fondu
call SetTextTagLifespan(tag, lifespan) // la durée de vie du texte, fondu compris
call SetTextTagPermanent(tag, false)
set tag = null
endfunction
private function init takes nothing returns nothing
set SOUND_ERROR = DefineSound("Sound\\Interface\\Error.wav",614, false, false)
set SOUND_BOSS = DefineSound("Sound\\Music\\mp3Music\\Tension.mp3",19540, false, false)
set SOUND_NEWHERO = DefineSound("Radio.wav",1000, false, false)
set SOUND_RADIO = DefineSound("Radio.wav",1000, false, false)
set SOUND_BIP = DefineSound("c4_beep1.wav",500, false, false)
set SOUND_FLY = DefineSound("Fly.mp3",4000, false, false)
set SOUND_WILLEXPLODE = DefineSound("WillExplode.mp3",3000, false, false)
set SOUND_GRENADE = DefineSound("ct_fireinhole.wav",3000, false, true)
set SOUND_BOMBFALL = DefineSound("BombFall.mp3",4000, false, true)
set SOUND_ROCKET = DefineSound("Abilities\\Spells\\Other\\TinkerRocket\\TinkerMissileLaunch1.wav",2000, false, true)
set SOUND_EXPLOSION = DefineSound("Sound\\Buildings\\Death\\BuildingDeathLargeHuman.wav",4000, false, true)
set SOUND_FLASH = DefineSound("abilities\\Weapons\\ZigguratMissile\\ZigguratMissileLaunch1.wav",401, false, true)
set SOUND_LOAD = DefineSound("abilities\\Spells\\Other\\LoadUnload\\Loading.wav",740,false,true)
endfunction
endlibrary
//TESH.scrollpos=30
//TESH.alwaysfold=0
library TimerUtils initializer init
//*********************************************************************
//* TimerUtils (red+blue+orange flavors for 1.24b+)
//* ----------
//*
//* To implement it , create a custom text trigger called TimerUtils
//* and paste the contents of this script there.
//*
//* To copy from a map to another, copy the trigger holding this
//* library to your map.
//*
//* (requires vJass) More scripts: htt://www.wc3c.net
//*
//* For your timer needs:
//* * Attaching
//* * Recycling (with double-free protection)
//*
//* set t=NewTimer() : Get a timer (alternative to CreateTimer)
//* ReleaseTimer(t) : Relese a timer (alt to DestroyTimer)
//* SetTimerData(t,2) : Attach value 2 to timer
//* GetTimerData(t) : Get the timer's value.
//* You can assume a timer's value is 0
//* after NewTimer.
//*
//* Multi-flavor:
//* Set USE_HASH_TABLE to true if you don't want to complicate your life.
//*
//* If you like speed and giberish try learning about the other flavors.
//*
//********************************************************************
//================================================================
globals
//How to tweak timer utils:
// USE_HASH_TABLE = true (new blue)
// * SAFEST
// * SLOWEST (though hash tables are kind of fast)
//
// USE_HASH_TABLE = false, USE_FLEXIBLE_OFFSET = true (orange)
// * kinda safe (except there is a limit in the number of timers)
// * ALMOST FAST
//
// USE_HASH_TABLE = false, USE_FLEXIBLE_OFFSET = false (red)
// * THE FASTEST (though is only faster than the previous method
// after using the optimizer on the map)
// * THE LEAST SAFE ( you may have to tweak OFSSET manually for it to
// work)
//
private constant boolean USE_HASH_TABLE = true
private constant boolean USE_FLEXIBLE_OFFSET = false
private constant integer OFFSET = 0x100000
private integer VOFFSET = OFFSET
//Timers to preload at map init:
private constant integer QUANTITY = 512
//Changing this to something big will allow you to keep recycling
// timers even when there are already AN INCREDIBLE AMOUNT of timers in
// the stack. But it will make things far slower so that's probably a bad idea...
private constant integer ARRAY_SIZE = 8190
endglobals
//==================================================================================================
globals
private integer array data[ARRAY_SIZE]
private hashtable ht
endglobals
//It is dependent on jasshelper's recent inlining optimization in order to perform correctly.
function SetTimerData takes timer t, integer value returns nothing
static if(USE_HASH_TABLE) then
// new blue
call SaveInteger(ht,0,GetHandleId(t), value)
elseif (USE_FLEXIBLE_OFFSET) then
// orange
static if (DEBUG_MODE) then
if(GetHandleId(t)-VOFFSET<0) then
call BJDebugMsg("SetTimerData: Wrong handle id, only use SetTimerData on timers created by NewTimer")
endif
endif
set data[GetHandleId(t)-VOFFSET]=value
else
// new red
static if (DEBUG_MODE) then
if(GetHandleId(t)-OFFSET<0) then
call BJDebugMsg("SetTimerData: Wrong handle id, only use SetTimerData on timers created by NewTimer")
endif
endif
set data[GetHandleId(t)-OFFSET]=value
endif
endfunction
function GetTimerData takes timer t returns integer
static if(USE_HASH_TABLE) then
// new blue
return LoadInteger(ht,0,GetHandleId(t) )
elseif (USE_FLEXIBLE_OFFSET) then
// orange
static if (DEBUG_MODE) then
if(GetHandleId(t)-VOFFSET<0) then
call BJDebugMsg("SetTimerData: Wrong handle id, only use SetTimerData on timers created by NewTimer")
endif
endif
return data[GetHandleId(t)-VOFFSET]
else
// new red
static if (DEBUG_MODE) then
if(GetHandleId(t)-OFFSET<0) then
call BJDebugMsg("SetTimerData: Wrong handle id, only use SetTimerData on timers created by NewTimer")
endif
endif
return data[GetHandleId(t)-OFFSET]
endif
endfunction
//==========================================================================================
globals
private timer array tT[ARRAY_SIZE]
private integer tN = 0
private constant integer HELD=0x28829022
//use a totally random number here, the more improbable someone uses it, the better.
endglobals
//==========================================================================================
function NewTimer takes nothing returns timer
if (tN==0) then
//If this happens then the QUANTITY rule has already been broken, try to fix the
// issue, else fail.
debug call BJDebugMsg("NewTimer: Warning, Exceeding TimerUtils_QUANTITY, make sure all timers are getting recycled correctly")
static if( not USE_HASH_TABLE) then
debug call BJDebugMsg("In case of errors, please increase it accordingly, or set TimerUtils_USE_HASH_TABLE to true")
set tT[0]=CreateTimer()
static if( USE_FLEXIBLE_OFFSET) then
if (GetHandleId(tT[0])-VOFFSET<0) or (GetHandleId(tT[0])-VOFFSET>=ARRAY_SIZE) then
//all right, couldn't fix it
call BJDebugMsg("NewTimer: Unable to allocate a timer, you should probably set TimerUtils_USE_HASH_TABLE to true or fix timer leaks.")
return null
endif
else
if (GetHandleId(tT[0])-OFFSET<0) or (GetHandleId(tT[0])-OFFSET>=ARRAY_SIZE) then
//all right, couldn't fix it
call BJDebugMsg("NewTimer: Unable to allocate a timer, you should probably set TimerUtils_USE_HASH_TABLE to true or fix timer leaks.")
return null
endif
endif
endif
else
set tN=tN-1
endif
call SetTimerData(tT[tN],0)
return tT[tN]
endfunction
//==========================================================================================
function ReleaseTimer takes timer t returns nothing
if(t==null) then
debug call BJDebugMsg("Warning: attempt to release a null timer")
return
endif
if (tN==ARRAY_SIZE) then
debug call BJDebugMsg("Warning: Timer stack is full, destroying timer!!")
//stack is full, the map already has much more troubles than the chance of bug
call DestroyTimer(t)
else
call PauseTimer(t)
if(GetTimerData(t)==HELD) then
debug call BJDebugMsg("Warning: ReleaseTimer: Double free!")
return
endif
call SetTimerData(t,HELD)
set tT[tN]=t
set tN=tN+1
endif
endfunction
private function init takes nothing returns nothing
local integer i=0
local integer o=-1
local boolean oops = false
static if( USE_HASH_TABLE ) then
set ht = InitHashtable()
loop
exitwhen(i==QUANTITY)
set tT[i]=CreateTimer()
call SetTimerData(tT[i], HELD)
set i=i+1
endloop
set tN = QUANTITY
else
loop
set i=0
loop
exitwhen (i==QUANTITY)
set tT[i] = CreateTimer()
if(i==0) then
set VOFFSET = GetHandleId(tT[i])
static if(USE_FLEXIBLE_OFFSET) then
set o=VOFFSET
else
set o=OFFSET
endif
endif
if (GetHandleId(tT[i])-o>=ARRAY_SIZE) then
exitwhen true
endif
if (GetHandleId(tT[i])-o>=0) then
set i=i+1
endif
endloop
set tN = i
exitwhen(tN == QUANTITY)
set oops = true
exitwhen not USE_FLEXIBLE_OFFSET
debug call BJDebugMsg("TimerUtils_init: Failed a initialization attempt, will try again")
endloop
if(oops) then
static if ( USE_FLEXIBLE_OFFSET) then
debug call BJDebugMsg("The problem has been fixed.")
//If this message doesn't appear then there is so much
//handle id fragmentation that it was impossible to preload
//so many timers and the thread crashed! Therefore this
//debug message is useful.
elseif(DEBUG_MODE) then
call BJDebugMsg("There were problems and the new timer limit is "+I2S(i))
call BJDebugMsg("This is a rare ocurrence, if the timer limit is too low:")
call BJDebugMsg("a) Change USE_FLEXIBLE_OFFSET to true (reduces performance a little)")
call BJDebugMsg("b) or try changing OFFSET to "+I2S(VOFFSET) )
endif
endif
endif
endfunction
endlibrary
//TESH.scrollpos=177
//TESH.alwaysfold=0
library UnitListModule requires AutoIndex
//===========================================================================
// Information:
//==============
//
// This library provides the UnitList module, which allows you to easily
// create a linked list of struct instances associated with a particular unit.
// There is no faster method to associate a list of structs with a unit or to
// iterate through that list than the method this module uses. Whenever a unit
// leaves the game, all of the struct instances associated with that unit will
// be automatically destroyed. Aside from the fact that this module offers the
// best-possible peformance for this type of task, it is also able to greatly
// simplify the code of any system or spell that needs to associate multiple
// struct instances with a single unit.
//
//===========================================================================
// How to use the UnitList module:
//=================================
//
// Using the UnitList module is pretty simple. First, implement it in your
// struct (preferably at the top to avoid unnecessary TriggerEvaluate calls).
// In the struct's create method, you must call unitListAdd(u). The unit passed
// to this method will become the "owner" of that instance. (An instance may not
// be in more than one unit's list.) In the onDestroy method, you must also call
// unitListRemove(). An example is shown below:
//
/*
struct Example
implement UnitList
static method create takes unit u returns Example
local Example this = allocate()
call unitListAdd(u) //This instance has been added to this unit's list.
return this
endmethod
method onDestroy takes nothing returns nothing
call unitListRemove() //This instance has been removed from the unit's list.
endmethod
endstruct
*/
// The requirement to call unitListAdd() and unitListRemove() will be done
// away with once JassHelper supports module onDestroy and module onCreate, but
// for now, it is not too much of a burden.
//
// Once this is done, your struct will gain all of the methods detailed
// in the API section. Below is an example of how to iterate through the list
// of structs associated with a specific unit:
/*
function IterationExample takes unit u returns nothing
local Example e = Example.unitFirst(u)
loop
exitwhen e == 0
//Do something with e here.
call BJDebugMsg(GetUnitName(e.me))
//"me" refers to the unit that "owns" each struct instance.
set e = e.unitNext
endloop
//Use .unitLast(u) and .unitPrev instead to iterate backwards.
endmethod
*/
//
//===========================================================================
// UnitList module API:
//======================
//
// (static) unitCount(u) -> integer
// This method returns the number of structs of thistype associated with
// the specified unit.
//
// (static) unitFirst(u) -> thistype
// This method returns the first instance of thistype in the list of the
// specified unit.
//
// (static) unitLast(u) -> thistype
// This method returns the last instance of thistype in the list of the
// specified unit.
//
// unitNext -> thistype
// This member contains the next instance of thistype in the list of the
// "owner" this instance.
//
// unitPrev -> thistype
// This member contains the previous instance of thistype in the list of
// the "owner" this instance.
//
// unitListAdd(u)
// This method adds this instance to the list of structs of thistype for
// the specified unit. The unit passed to this method will become the
// "owner" of this struct instance. You may call it again to change the
// "owner".
//
// unitListRemove()
// This method removes this instance from the list of structs of thistype
// for the "owner" of this instance. This should usually be called in the
// onDestroy method of the implementing struct.
//
// (static) unitListDestroy(u)
// This method destroys all instances of thistype in the list of the spec-
// ified unit. This is called automatically on units as they leave the game.
//
// me -> unit
// This member contains the "owner" of this instance, as assigned by the
// unitListAdd(u) method. Contains null if no unit owns the instance.
//
//===========================================================================
module UnitList
private static boolean array destroying
private static integer array count
private static thistype array first
private static thistype array last
readonly thistype unitNext
readonly thistype unitPrev
readonly unit me
static method unitCount takes unit u returns integer
return count[GetUnitId(u)]
endmethod
static method unitFirst takes unit u returns thistype
return first[GetUnitId(u)]
endmethod
static method unitLast takes unit u returns thistype
return last[GetUnitId(u)]
endmethod
method unitListRemove takes nothing returns nothing
local integer id = GetUnitId(me)
if me == null then
return
endif
set me = null
if first[id] == this then
set first[id] = unitNext
endif
if last[id] == this then
set last[id] = unitPrev
endif
set unitPrev.unitNext = unitNext
set unitNext.unitPrev = unitPrev
set count[id] = count[id] - 1
endmethod
method unitListAdd takes unit u returns nothing
local integer id = GetUnitId(u)
if destroying[id] then
return
endif
if me != null then
call unitListRemove()
endif
set me = u
if first[id] == 0 then
set first[id] = this
else
set last[id].unitNext = this
set unitPrev = last[id]
endif
set last[id] = this
set count[id] = count[id] + 1
endmethod
static method unitListDestroy takes unit u returns nothing
local integer id = GetUnitId(u)
local thistype this = last[id]
set destroying[id] = true
loop
exitwhen this == 0
call destroy()
set this = unitPrev
endloop
set destroying[id] = false
endmethod
private static method onInit takes nothing returns nothing
call UnitListModule_AddUnitList(thistype.unitListDestroy)
endmethod
endmodule
//===========================================================================
function interface UnitListDestroyer takes unit u returns nothing
globals
public UnitListDestroyer array destroyers
public integer destroyers_n = -1
endglobals
public function AddUnitList takes UnitListDestroyer destroyer returns nothing
set destroyers_n = destroyers_n + 1
set destroyers[destroyers_n] = destroyer
endfunction
//! textmacro DestroyUnitLists
set n = UnitListModule_destroyers_n
loop
exitwhen n < 0
call UnitListModule_destroyers[n].evaluate(u)
set n = n - 1
endloop
//! endtextmacro
endlibrary
//TESH.scrollpos=93
//TESH.alwaysfold=0
library Ranks initializer init needs TextDisplay,LeaderBoard
globals
string array RankName [25]
string array RankBoardName [25]
string array RankPlayer [12]
string array RankBoardPlayer [12]
integer array CurrentPlayerRank [12]
integer array RankReq [25]
integer XpAverageCoeff = 0
integer XpAveragePoints = 0
integer XpMax = 0
integer XpAverage = 0
integer RankMax = 25
private constant integer RANK_UPGRADE = 'R003'
private constant real XP_TKMALUS = 0.15
boolean array TeamKiller [12]
endglobals
private function SetRankVariables takes nothing returns nothing
local integer i = 0
set RankName[1] = "Recruit"
set RankBoardName[1]= "Rec"
set RankReq[1] = 0
set RankName[2] = "Private"
set RankBoardName[2]= "Pvt"
set RankReq[2] = 500
set RankName[3] = "Private 2nd Class"
set RankBoardName[3]= "Pvt2c"
set RankReq[3] = 1000
set RankName[4] = "Private 1st Class"
set RankBoardName[4]= "Pvt1c"
set RankReq[4] = 2000
set RankName[5] = "Corporal"
set RankBoardName[5]= "Cpl"
set RankReq[5] = 5000
set RankName[6] = "Sergeant"
set RankBoardName[6]= "Sgt"
set RankReq[6] = 10000
set RankName[7] = "Staff Sergeant"
set RankBoardName[7]= "SSgt"
set RankReq[7] = 15000
set RankName[8] = "Sergeant 1st Class"
set RankBoardName[8]= "Sgt1c"
set RankReq[8] = 20000
set RankName[9] = "First Sergeant"
set RankBoardName[9]= "1st Sgt"
set RankReq[9] = 30000
set RankName[10] = "Master Sergeant"
set RankBoardName[10]= "MsSgt"
set RankReq[10] = 40000
set RankName[11] = "Sergeant Major"
set RankBoardName[11]= "SgtMaj"
set RankReq[11] = 50000
set RankName[12] = "Command Sergeant Major"
set RankBoardName[12]= "ComSgtMaj"
set RankReq[12] = 60000
set RankName[13] = "2nd Lieutenant"
set RankBoardName[13]= "2ndLt"
set RankReq[13] = 80000
set RankName[14] = "1st Lieutenant"
set RankBoardName[14]= "1stLt"
set RankReq[14] = 100000
set RankName[15] = "Captain"
set RankBoardName[15]= "Capt"
set RankReq[15] = 130000
set RankName[16] = "Major"
set RankBoardName[16]= "Major"
set RankReq[16] = 160000
set RankName[17] = "Lieutenant-Colonel"
set RankBoardName[17]= "LtCol"
set RankReq[17] = 200000
set RankName[18] = "Colonel"
set RankBoardName[18]= "Col"
set RankReq[18] = 250000
set RankName[19] = "Brigadier-General"
set RankReq[19] = 300000
set RankBoardName[19]= "BrigGen"
set RankName[20] = "Major-General"
set RankReq[20] = 400000
set RankBoardName[20]= "MajGen"
set RankName[21] = "Lieutenant-General"
set RankReq[21] = 500000
set RankBoardName[21]= "LtGen"
set RankName[22] = "General"
set RankReq[22] = 600000
set RankBoardName[22]= "Gen"
set RankMax = 22
set XpMax = RankReq[RankMax]
set i = 0
loop
exitwhen i > MAXPLAYER
set Xp[i]=0
set CurrentGameXp[i]=0
set CurrentPlayerRank[i]=1
set RankPlayer[i]="Recruit"
set RankBoardPlayer[i]="Rec"
set i = i + 1
endloop
endfunction
function CheckRank takes integer whichPlayerId returns nothing
local integer i = 1
set i = CurrentPlayerRank[whichPlayerId]
loop
exitwhen i > RankMax
if Xp[whichPlayerId]>= RankReq[i] and Xp[whichPlayerId]<RankReq[i+1] then
if CurrentPlayerRank[whichPlayerId] < i then
set CurrentPlayerRank[whichPlayerId] = i
if i >= 2 then
call DisplayAll(PlayerColor[whichPlayerId]+GetPlayerName(Player(whichPlayerId)),"has been awarded for its Bravery and has been promoted to "+RankName[i])
endif
call SetPlayerTechResearched(Player(whichPlayerId),RANK_UPGRADE,i)
set RankPlayer[whichPlayerId]=RankName[i]
set RankBoardPlayer[whichPlayerId]=RankBoardName[i]
call BoardUpdateRank(Player(whichPlayerId))
endif
call BoardUpdateXp(Player(whichPlayerId))
return
endif
set i = i + 1
endloop
endfunction
function CheckRankLoad takes integer whichPlayerId returns nothing
local integer i = 1
set i = CurrentPlayerRank[whichPlayerId]
loop
exitwhen i > RankMax
if Xp[whichPlayerId]>= RankReq[i] and Xp[whichPlayerId]<RankReq[i+1] then
if CurrentPlayerRank[whichPlayerId] < i then
set CurrentPlayerRank[whichPlayerId] = i
call SetPlayerTechResearched(Player(whichPlayerId),RANK_UPGRADE,i)
set RankPlayer[whichPlayerId]=RankName[i]
set RankBoardPlayer[whichPlayerId]=RankBoardName[i]
if BoardOk == true then
call BoardUpdateRank(Player(whichPlayerId))
endif
if CurrentPlayerRank[whichPlayerId] >= 6 then
set PlayerStory[whichPlayerId]=false
endif
endif
call BoardUpdateXp(Player(whichPlayerId))
return
endif
set i = i + 1
endloop
endfunction
function CheckRankAll takes nothing returns nothing
local integer i = 0
loop
exitwhen i > MAXPLAYER
if GetPlayerSlotState(Player(i))==PLAYER_SLOT_STATE_PLAYING then
call CheckRank(i)
endif
set i = i + 1
endloop
endfunction
function RankAllQuest takes integer whichQuest,integer whichAmount returns nothing
local integer i = 0
if XpAvailable == true then
loop
exitwhen i > MAXPLAYER
if GetPlayerSlotState(Player(i))==PLAYER_SLOT_STATE_PLAYING then
set Xp[i] = Xp[i] + whichAmount
set CurrentGameXp[i] = CurrentGameXp[i] + whichAmount
if TeamKiller[i]==true then
set CurrentGameXp[i] = CurrentGameXp[i] - R2I((XP_TKMALUS*whichAmount))
endif
call DisplayTextToPlayer(Player(i),0.,0.,QuestTitre[whichQuest]+" : "+I2S(whichAmount)+" XP to all Players")
call BoardUpdateXp(Player(i))
endif
set i = i + 1
endloop
endif
call CheckRankAll()
endfunction
function RankAll takes integer whichAmount returns nothing
local integer i = 0
if XpAvailable == true then
loop
exitwhen i > MAXPLAYER
if GetPlayerSlotState(Player(i))==PLAYER_SLOT_STATE_PLAYING then
set Xp[i] = Xp[i] + whichAmount
if TeamKiller[i]==true then
set CurrentGameXp[i] = CurrentGameXp[i] - R2I((XP_TKMALUS*whichAmount))
endif
set CurrentGameXp[i] = CurrentGameXp[i] + whichAmount
call BoardUpdateXp(Player(i))
endif
set i = i + 1
endloop
endif
call CheckRankAll()
endfunction
private function init takes nothing returns nothing
local integer i = 0
call SetRankVariables()
loop
exitwhen i > MAXPLAYER
set TeamKiller[i]=false
set i = i + 1
endloop
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library MedalSystem
//Disabled in order to prevent noob hackers to generate codes
endlibrary
//TESH.scrollpos=292
//TESH.alwaysfold=0
library HeroSelection initializer init needs TimerUtils, SoundUtils,LearnSkill TextDisplay, AbilityPreload, HeroDeath, LeaderBoard
globals
//About the hero picked by unit
unit array Hero [10] //A played Hero (array is for player)
//About the class of heroes
integer array HeroId[40] //Id of hero types
integer HeroMax //Maximum number of hero
string array HeroName [40] //Name of hero type
string array PickedHeroName [40] //name displayed in the -team command
string array PickedHeroBoardName [40]
string array HeroBoardName [40] //Name of hero type
integer array HeroStockMax [40] //Hero left stock
integer array HeroStockLeft [40] //Hero starting stock
integer array HeroRank [40] //rank required
integer array HeroCoeff [40]
boolean array HeroPicked [40]
boolean array HeroRepicked [40]
real array HeroMs [12]
unit array Tavern [4]
private constant integer INVENTORY = 'AInv'
private constant real WAIT = 0.5
private constant real PICK_DURATION = 120
private constant string MASK = "ReplaceableTextures\\CameraMasks\\Scope_Mask.blp"
private constant integer FORCED_ID = 'H00I'
private constant integer FORCED_INDEX = 0
private key HERO_INDEX
private key KILLCOEFF_INDEX
private hashtable HashT
private trigger TrigRandom
private trigger TrigRepick
private real StartX
private real StartY
private real StartRaptorX
private real StartRaptorY
endglobals
//! textmacro t__BuyHero_Init takes HERO_TYPE , HERO_INDEX, KILLCOEFF
call SaveInteger(HashT,$HERO_TYPE$,HERO_INDEX,$HERO_INDEX$)
call SaveInteger(HashT,$HERO_TYPE$,KILLCOEFF_INDEX,$KILLCOEFF$)
//! endtextmacro
private function SetHeroVariables takes nothing returns nothing
local integer i = 0
set HeroName[i]= "Security Officer"
set HeroBoardName[i]= "SO"
set HeroId[i]= 'H00I'
set HeroStockMax[i]= 10
set HeroRank[i] = 1
//! runtextmacro t__BuyHero_Init("'H00I'","0","10")
set i = i + 1
set HeroName[i] = "Biologist"
set HeroBoardName[i] = "Bi"
set HeroId[i] = 'H00D'
set HeroStockMax[i] = 2
set HeroRank[i] = 1
//! runtextmacro t__BuyHero_Init("'H00D'","1","5")
set i = i + 1
set HeroName[i] = "Firebat"
set HeroBoardName[i] = "FB"
set HeroId[i] = 'H00J'
set HeroStockMax[i] = 2
set HeroRank[i] = 2
//! runtextmacro t__BuyHero_Init("'H00J'","2","15")
set i = i + 1
set HeroName[i] = "Armored Soldier"
set HeroBoardName[i] = "AS"
set HeroId[i] = 'H01B'
set HeroStockMax[i] = 1
set HeroRank[i] = 2
//! runtextmacro t__BuyHero_Init("'H01B'","3","5")
set i = i + 1
set HeroName[i] = "Mechanist"
set HeroBoardName[i] = "MC"
set HeroId[i] = 'H00H'
set HeroStockMax[i] = 1
set HeroRank[i] = 3
//! runtextmacro t__BuyHero_Init("'H00H'","4","10")
set i = i + 1
set HeroName[i] = "Polyvalent Sniper"
set HeroBoardName[i] = "PS"
set HeroId[i] = 'H00X'
set HeroStockMax[i] = 1
set HeroRank[i] = 3
//! runtextmacro t__BuyHero_Init("'H00X'","5","10")
set i = i + 1
set HeroName[i] = "Force Recon"
set HeroBoardName[i] = "FR"
set HeroId[i] = 'H00K'
set HeroStockMax[i] = 1
set HeroRank[i] = 4
//! runtextmacro t__BuyHero_Init("'H00K'","6","10")
set i = i + 1
set HeroName[i] = "Shock Troop"
set HeroBoardName[i] = "ST"
set HeroId[i] = 'H01O'
set HeroStockMax[i] = 1
set HeroRank[i] = 4
//! runtextmacro t__BuyHero_Init("'H01O'","7","15")
set i = i + 1
set HeroName[i] = "Heavy Soldier"
set HeroBoardName[i] = "HS"
set HeroId[i] = 'H000'
set HeroStockMax[i] = 1
set HeroRank[i] = 5
//! runtextmacro t__BuyHero_Init("'H000'","8","10")
set i = i + 1
set HeroName[i] = "Marine Leader"
set HeroBoardName[i] = "ML"
set HeroId[i] = 'H00Z'
set HeroStockMax[i] = 1
set HeroRank[i] = 5
//! runtextmacro t__BuyHero_Init("'H00Z'","9","10")
set i = i + 1
set HeroName[i] = "Cleaning Force"
set HeroBoardName[i] = "CF"
set HeroId[i] = 'H00L'
set HeroStockMax[i] = 1
set HeroRank[i] = 6
//! runtextmacro t__BuyHero_Init("'H00L'","10","15")
set i = i + 1
set HeroName[i] = "Cyborg"
set HeroBoardName[i] = "CY"
set HeroId[i] = 'H010'
set HeroStockMax[i] = 1
set HeroRank[i] = 6
//! runtextmacro t__BuyHero_Init("'H010'","11","15")
set i = i + 1
set HeroName[i] = "Physicist"
set HeroBoardName[i] = "PH"
set HeroId[i] = 'H00E'
set HeroStockMax[i] = 1
set HeroRank[i] = 7
//! runtextmacro t__BuyHero_Init("'H00E'","12","10")
set i = i + 1
set HeroName[i] = "Elimination Force"
set HeroBoardName[i] = "EF"
set HeroId[i] = 'H01D'
set HeroStockMax[i] = 1
set HeroRank[i] = 7
//! runtextmacro t__BuyHero_Init("'H01D'","13","10")
set i = i + 1
set HeroName[i] = "Tactical Controller"
set HeroBoardName[i] = "TC"
set HeroId[i] = 'H00R'
set HeroStockMax[i] = 1
set HeroRank[i] = 8
//! runtextmacro t__BuyHero_Init("'H00R'","14","10")
set i = i + 1
set HeroName[i] = "Demolition Expert"
set HeroBoardName[i] = "DE"
set HeroId[i] = 'H00M'
set HeroStockMax[i] = 1
set HeroRank[i] = 9
//! runtextmacro t__BuyHero_Init("'H00M'","15","15")
set i = i + 1
set HeroName[i] = "Experimental Soldier"
set HeroBoardName[i] = "ES"
set HeroId[i] = 'H01S'
set HeroStockMax[i] = 1
set HeroRank[i] = 9
//! runtextmacro t__BuyHero_Init("'H01S'","16","15")
set i = i + 1
set HeroName[i] = "Response Force"
set HeroBoardName[i] = "RF"
set HeroId[i] = 'H011'
set HeroStockMax[i] = 1
set HeroRank[i] = 10
//! runtextmacro t__BuyHero_Init("'H011'","17","15")
set i = i + 1
set HeroName[i] = "Lightning Sniper"
set HeroBoardName[i] = "LS"
set HeroId[i] = 'H01P'
set HeroStockMax[i] = 1
set HeroRank[i] = 10
//! runtextmacro t__BuyHero_Init("'H01P'","18","15")
set i = i + 1
set HeroName[i] = "Commander"
set HeroBoardName[i] = "CO"
set HeroId[i] = 'H013'
set HeroStockMax[i] = 1
set HeroRank[i] = 11
//! runtextmacro t__BuyHero_Init("'H013'","19","15")
set i = i + 1
set HeroName[i] = "Special Agent"
set HeroBoardName[i] = "SA"
set HeroId[i] = 'H01T'
set HeroStockMax[i] = 1
set HeroRank[i] = 11
//! runtextmacro t__BuyHero_Init("'H01T'","20","15")
set i = i + 1
set HeroName[i] = "Assault Force"
set HeroBoardName[i] = "AF"
set HeroId[i] = 'H016'
set HeroStockMax[i] = 1
set HeroRank[i] = 12
//! runtextmacro t__BuyHero_Init("'H016'","21","12")
set i = i + 1
set HeroName[i] = "Intervention Pilot"
set HeroBoardName[i] = "IP"
set HeroId[i] = 'H01L'
set HeroStockMax[i] = 1
set HeroRank[i] = 12
//! runtextmacro t__BuyHero_Init("'H01L'","22","10")
set i = i + 1
set HeroName[i] = "Classified Operator"
set HeroBoardName[i] = "CR"
set HeroId[i] = 'H017'
set HeroStockMax[i] = 1
set HeroRank[i] = 13
//! runtextmacro t__BuyHero_Init("'H017'","23","10")
set i = i + 1
set HeroName[i] = "Elite Troop"
set HeroBoardName[i] = "ET"
set HeroId[i] = 'H01Y'
set HeroStockMax[i] = 1
set HeroRank[i] = 13
//! runtextmacro t__BuyHero_Init("'H01Y'","24","15")
set i = i + 1
set HeroName[i] = "Combat Engineer"
set HeroBoardName[i] = "CE"
set HeroId[i] = 'H01C'
set HeroStockMax[i] = 1
set HeroRank[i] = 14
//! runtextmacro t__BuyHero_Init("'H01C'","25","20")
set i = i + 1
set HeroName[i] = "Drone Master"
set HeroBoardName[i] = "DM"
set HeroId[i] = 'H01Z'
set HeroStockMax[i] = 1
set HeroRank[i] = 14
//! runtextmacro t__BuyHero_Init("'H01Z'","26","15")
set i = i + 1
set HeroName[i] = "Orbital Troop"
set HeroBoardName[i] = "OT"
set HeroId[i] = 'H020'
set HeroStockMax[i] = 1
set HeroRank[i] = 15
//! runtextmacro t__BuyHero_Init("'H020'","27","15")
set i = i + 1
set HeroName[i] = "Squad Leader"
set HeroBoardName[i] = "SL"
set HeroId[i] = 'H022'
set HeroStockMax[i] = 1
set HeroRank[i] = 15
//! runtextmacro t__BuyHero_Init("'H022'","28","15")
set i = i + 1
set HeroName[i] = "Chemical Tester"
set HeroBoardName[i] = "CT"
set HeroId[i] = 'H023'
set HeroStockMax[i] = 1
set HeroRank[i] = 15
//! runtextmacro t__BuyHero_Init("'H023'","29","10")
set i = i + 1
set HeroName[i] = "Cerberus"
set HeroBoardName[i] = "CU"
set HeroId[i] = 'H024'
set HeroStockMax[i] = 1
set HeroRank[i] = 16
//! runtextmacro t__BuyHero_Init("'H024'","30","15")
set i = i + 1
set HeroName[i] = "Biological Soldier"
set HeroBoardName[i] = "BS"
set HeroId[i] = 'H025'
set HeroStockMax[i] = 1
set HeroRank[i] = 16
//! runtextmacro t__BuyHero_Init("'H025'","31","10")
set i = i + 1
set HeroName[i] = "Unmanned Aerial Vehicle"
set HeroBoardName[i] = "UV"
set HeroId[i] = 'H029'
set HeroStockMax[i] = 1
set HeroRank[i] = 17
//! runtextmacro t__BuyHero_Init("'H029'","32","5")
set i = i + 1
set HeroName[i] = "Psy Ops"
set HeroBoardName[i] = "PO"
set HeroId[i] = 'H002'
set HeroStockMax[i] = 1
set HeroRank[i] = 17
//! runtextmacro t__BuyHero_Init("'H002'","33","10")
set i = i + 1
set HeroName[i] = "Nanite Controler"
set HeroBoardName[i] = "NC"
set HeroId[i] = 'H005'
set HeroStockMax[i] = 1
set HeroRank[i] = 18
//! runtextmacro t__BuyHero_Init("'H005'","34","10")
set i = i + 1
set HeroName[i] = "Time Manipulator"
set HeroBoardName[i] = "TM"
set HeroId[i] = 'H008'
set HeroStockMax[i] = 1
set HeroRank[i] = 18
//! runtextmacro t__BuyHero_Init("'H008'","35","10")
set i = i + 1
set HeroName[i] = "General"
set HeroBoardName[i] = "GN"
set HeroId[i] = 'H02A'
set HeroStockMax[i] = 1
set HeroRank[i] = 19
//! runtextmacro t__BuyHero_Init("'H02A'","36","20")
set HeroMax = 35
endfunction
private function UpdateHero takes player owner, integer heroId, integer heroIndex returns nothing
local integer ownerId = GetPlayerId(owner)
set HeroStockLeft[heroIndex] = HeroStockLeft[heroIndex] - 1
set HeroCoeff[ownerId]=LoadInteger(HashT,heroId,KILLCOEFF_INDEX)
set HeroPicked[ownerId]=true
set PickedHeroName[ownerId] = HeroName[heroIndex]
set PickedHeroBoardName[ownerId] = HeroBoardName[heroIndex]
if BoardOk == true then
call BoardUpdateRank(owner)
endif
call SelectUnitForPlayerSingle( Hero[ownerId], Player(ownerId) )
if heroId == 'H02B' then
if GetLocalPlayer() == owner then
call PanCameraToTimed(StartRaptorX,StartRaptorY,0.)
endif
call SetUnitPosition(Hero[ownerId],StartRaptorX,StartRaptorY)
else
if GetLocalPlayer() == owner then
call PanCameraToTimed(StartX,StartY,0.)
endif
call SetUnitPosition(Hero[ownerId],StartX,StartY)
endif
call RunSound(SOUND_NEWHERO)
call DisplayAll(PlayerColor[ownerId]+GetPlayerName(owner)," is accredited as "+HeroName[heroIndex])
call LearnSkill(Hero[ownerId])
endfunction
private function HeroIsPicked takes nothing returns boolean
local unit sold = GetSoldUnit()
local integer heroId = GetUnitTypeId(sold)
local player owner = GetOwningPlayer(sold)
local integer ownerId = GetPlayerId(owner)
local integer heroIndex = LoadInteger(HashT,heroId,HERO_INDEX)
call RemoveUnit(Hero[ownerId])
set Hero[ownerId] = sold
if GetUnitAbilityLevel(Hero[ownerId],INVENTORY)>=1 then
call UnitAddItemById(Hero[ownerId],'I033')
call UnitAddItemById(Hero[ownerId],'I01T')
call UnitAddItemById(Hero[ownerId],'I035')
endif
call UpdateHero(owner,heroId,heroIndex)
set sold = null
return false
endfunction
private function FindRandomHeroIndex takes integer ownerId returns integer
local integer random = FORCED_INDEX
local boolean picked = false
loop
exitwhen picked == true
set random = GetRandomInt(0,HeroMax)
if HeroStockLeft[random]>=1 and HeroRank[random]<=CurrentPlayerRank[ownerId] then
set picked = true
return random
endif
endloop
return random
endfunction
private function HeroIsRandomed takes nothing returns boolean
local player owner = GetTriggerPlayer()
local integer ownerId = GetPlayerId(owner)
local integer heroIndex = FindRandomHeroIndex(ownerId)
if HeroPicked[ownerId]==false then
call RemoveUnit(Hero[ownerId])
set Hero[ownerId] = CreateUnit(owner,HeroId[heroIndex],StartX,StartY,0.)
if GetUnitAbilityLevel(Hero[ownerId],INVENTORY)>=1 then
call UnitAddItemById(Hero[ownerId],'I033')
call UnitAddItemById(Hero[ownerId],'I01T')
call UnitAddItemById(Hero[ownerId],'I035')
call SetItemCharges(UnitAddItemById(Hero[ownerId],'I01C'),7)//Random ammo bonus
endif
call UpdateHero(owner,HeroId[heroIndex],heroIndex)
if heroIndex < 11 then
call RemoveUnitFromStock(Tavern[0],HeroId[heroIndex])
call AddUnitToStock(Tavern[1],HeroId[heroIndex],HeroStockLeft[heroIndex],HeroStockMax[heroIndex])
elseif heroIndex >= 11 and heroIndex < 22 then
call RemoveUnitFromStock(Tavern[1],HeroId[heroIndex])
call AddUnitToStock(Tavern[1],HeroId[heroIndex],HeroStockLeft[heroIndex],HeroStockMax[heroIndex])
elseif heroIndex >= 22 and heroIndex < 33 then
call RemoveUnitFromStock(Tavern[2],HeroId[heroIndex])
call AddUnitToStock(Tavern[2],HeroId[heroIndex],HeroStockLeft[heroIndex],HeroStockMax[heroIndex])
elseif heroIndex >= 33 then
call RemoveUnitFromStock(Tavern[3],HeroId[heroIndex])
call AddUnitToStock(Tavern[3],HeroId[heroIndex],HeroStockLeft[heroIndex],HeroStockMax[heroIndex])
endif
else
call ErrorSound(owner)
call DisplayTextToPlayer(owner,0.,0.,"You have already a hero")
endif
return false
endfunction
private function HeroIsRepicked takes nothing returns boolean
local player owner = GetTriggerPlayer()
local integer ownerId = GetPlayerId(owner)
local integer heroIndex = FindRandomHeroIndex(ownerId)
if HeroPicked[ownerId]==false then
call ErrorSound(owner)
call DisplayTextToPlayer(owner,0.,0.,"You have not already picked a hero")
else
if HeroRepicked[ownerId]==false then
call RemoveUnit(Hero[ownerId])
set Hero[ownerId] = CreateUnit(owner,HeroId[heroIndex],StartX,StartY,0.)
if GetUnitAbilityLevel(Hero[ownerId],INVENTORY)>=1 then
call UnitAddItemById(Hero[ownerId],'I033')
endif
call UpdateHero(owner,HeroId[heroIndex],heroIndex)
if heroIndex < 11 then
call RemoveUnitFromStock(Tavern[0],HeroId[heroIndex])
call AddUnitToStock(Tavern[1],HeroId[heroIndex],HeroStockLeft[heroIndex],HeroStockMax[heroIndex])
elseif heroIndex >= 11 and heroIndex < 22 then
call RemoveUnitFromStock(Tavern[1],HeroId[heroIndex])
call AddUnitToStock(Tavern[1],HeroId[heroIndex],HeroStockLeft[heroIndex],HeroStockMax[heroIndex])
elseif heroIndex >= 22 and heroIndex < 33 then
call RemoveUnitFromStock(Tavern[2],HeroId[heroIndex])
call AddUnitToStock(Tavern[2],HeroId[heroIndex],HeroStockLeft[heroIndex],HeroStockMax[heroIndex])
elseif heroIndex >= 33 then
call RemoveUnitFromStock(Tavern[3],HeroId[heroIndex])
call AddUnitToStock(Tavern[3],HeroId[heroIndex],HeroStockLeft[heroIndex],HeroStockMax[heroIndex])
endif
else
call ErrorSound(owner)
call DisplayTextToPlayer(owner,0.,0.,"You have already repicked a hero")
endif
endif
return false
endfunction
private function ForcePick takes integer ownerId returns nothing
local player owner = Player(ownerId)
if HeroPicked[ownerId]==false then
call RemoveUnit(Hero[ownerId])
set Hero[ownerId] = CreateUnit(owner,FORCED_ID,StartX,StartY,0.)
if GetUnitAbilityLevel(Hero[ownerId],INVENTORY)>=1 then
call UnitAddItemById(Hero[ownerId],'I033')
call UnitAddItemById(Hero[ownerId],'I01T')
call UnitAddItemById(Hero[ownerId],'I035')
endif
call UpdateHero(owner,FORCED_ID,FORCED_INDEX)
endif
endfunction
private function ForceBuy takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer i = 0
call DisableTrigger(TrigRandom)
call DestroyTrigger(TrigRandom)
set TrigRandom = null
call DisableTrigger(TrigRepick)
call DestroyTrigger(TrigRepick)
set TrigRepick = null
loop
exitwhen i > MAXPLAYER
if GetPlayerSlotState(Player(i))==PLAYER_SLOT_STATE_PLAYING then
call ForcePick(i)
endif
set i = i + 1
endloop
set i = 0
loop
exitwhen i > 2
call KillUnit(Tavern[i])
set i = i + 1
endloop
call ReleaseTimer(t)
endfunction
private function Cooldown takes nothing returns nothing
local integer i = 0
local timer t = NewTimer()
call DisplayAll("Game", "You have "+I2S(R2I(PICK_DURATION))+ " seconds to pick your hero" )
call TimerStart (t, PICK_DURATION, false, function ForceBuy )
endfunction
function InitializeHeroStock takes nothing returns nothing
local integer i = 0
loop
exitwhen i > HeroMax
if i < 11 then
call AddUnitToStock(Tavern[0],HeroId[i],HeroStockLeft[i],HeroStockMax[i])
elseif i >= 11 and i < 22 then
call AddUnitToStock(Tavern[1],HeroId[i],HeroStockLeft[i],HeroStockMax[i])
elseif i >= 22 and i < 33 then
call AddUnitToStock(Tavern[2],HeroId[i],HeroStockLeft[i],HeroStockMax[i])
elseif i >= 33 then
call AddUnitToStock(Tavern[3],HeroId[i],HeroStockLeft[i],HeroStockMax[i])
endif
set i = i + 1
endloop
call Cooldown()
endfunction
function AddTavern takes nothing returns nothing
local integer i = 0
local trigger t = CreateTrigger()
local real x1 = GetRectCenterX(gg_rct_Tavern)
local real y1 = GetRectCenterY(gg_rct_Tavern)
local real x2 = 0.
local real y2 = 0.
loop
exitwhen i > 3
set x2 = x1+300.*Cos(i*90.*bj_DEGTORAD)
set y2 = y1+300.*Sin(i*90.*bj_DEGTORAD)
set Tavern[i] = CreateUnit(Player(10),'o023',x2,y2,315.)
call TriggerRegisterUnitEvent(t,Tavern[i], EVENT_UNIT_SELL )
set i = i + 1
endloop
call TriggerAddCondition(t, Condition(function HeroIsPicked))
endfunction
private function init takes nothing returns nothing
local integer i = 0
set HashT = InitHashtable()
set StartX = GetRectCenterX(gg_rct_HeroStart)
set StartY = GetRectCenterY(gg_rct_HeroStart)
set StartRaptorX = GetRectCenterX(gg_rct_RaptorStart)
set StartRaptorY = GetRectCenterY(gg_rct_RaptorStart)
call SetHeroVariables()
loop
exitwhen i > HeroMax
set HeroStockLeft[i] = HeroStockMax[i]
call RemoveUnit(CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),HeroId[i],0.,0.,0.))
set i = i + 1
endloop
set TrigRandom = CreateTrigger()
set TrigRepick = CreateTrigger()
set i = 0
loop
exitwhen i > MAXPLAYER
set HeroCoeff[i]=10
call TriggerRegisterPlayerChatEvent(TrigRandom, Player(i),"-random",true)
call TriggerRegisterPlayerChatEvent(TrigRepick, Player(i),"-repick",true)
set i = i + 1
endloop
call TriggerAddCondition(TrigRandom, Condition(function HeroIsRandomed))
call TriggerAddCondition(TrigRepick, Condition(function HeroIsRepicked))
endfunction
endlibrary
//TESH.scrollpos=378
//TESH.alwaysfold=0
library AmmoSystem initializer init needs RegisterAnyUnitEvent,Push,AbilityPreload, TimerUtils, AutoIndex, SoundUtils, TextDisplay, SpellEvent
globals
private constant integer PRIMARY_AMMOSTART = 30
private constant integer SPELL_FF = 'A0JG'
private constant integer SPELL_DG = 'A0KX'
private constant integer FF_ID = 1
private constant integer DG_ID = 2
private unit array DummySecWeapon [12]
private constant integer AMMOMAX_FF = 8
private constant integer AMMOMAX_DG = 7
private constant integer DUMMY_SECONDARYWEAPON = 'o03I'
private constant real RELOADTIME_FF = 4.
private constant real RELOADTIME_DG = 5.
private integer SOUND_RELOAD
private integer SOUND_DG
private integer SOUND_FF
private constant string BONE_WEAPON = "weapon"
private constant string PRIMARY_ANIM = "spell first"
private constant string SECONDAR_ANIM = "spell second"
private constant string FX_RELOAD = "Abilities\\Spells\\Other\\TalkToMe\\TalkToMe.mdl"
private key UNIT_AMMOMAX
private key UNIT_RELOADTIME
private key UNIT_PUSH //0 nothing, 1 push
private key UNIT_SECWEAPON //0 nothing, 1 five seven, 2 deagle
private hashtable HashT
private constant integer AMMO_ID = 'I01C'
private constant integer SPELL_RELOADAMMO = 'A00L'
private constant integer SPELL_DROPAMMO = 'A02A'
private constant integer SPELL_SAWED_OFF_SHOTGUN = 'A0GB'
endglobals
//! textmacro t__Ammo_Init takes UNIT_TYPE ,UNIT_AMMO,UNIT_RELOAD,UNIT_KNB,UNIT_GUN
call SaveInteger(HashT,$UNIT_TYPE$,UNIT_AMMOMAX,$UNIT_AMMO$)
call SaveInteger(HashT,$UNIT_TYPE$,UNIT_RELOADTIME,$UNIT_RELOAD$)
call SaveInteger(HashT,$UNIT_TYPE$,UNIT_PUSH,$UNIT_KNB$)
call SaveInteger(HashT,$UNIT_TYPE$,UNIT_SECWEAPON,$UNIT_GUN$)
//! endtextmacro
private function SetAmmoVariables takes nothing returns nothing
local integer i = 0
set SOUND_RELOAD = DefineSound("abilities\\Spells\\Human\\HolyBolt\\HolyBolt.wav",1000, false, true)
set SOUND_FF = DefineSound("FiveSeven.wav",1000, false, true)
set SOUND_DG = DefineSound("Deagle.wav",1000, false, true)
//! runtextmacro t__Ammo_Init("'H00I'","30","4","0","1")
//! runtextmacro t__Ammo_Init("'H00D'","8","4","1","2")
//! runtextmacro t__Ammo_Init("'H00M'","50","4","0","1")
//! runtextmacro t__Ammo_Init("'H00J'","100","5","0","1")
//! runtextmacro t__Ammo_Init("'H00E'","8","4","0","1")
//! runtextmacro t__Ammo_Init("'H00L'","200","6","0","1")
//! runtextmacro t__Ammo_Init("'H000'","30","4","0","1")
//! runtextmacro t__Ammo_Init("'H00H'","30","2","0","1")
//! runtextmacro t__Ammo_Init("'H00R'","50","4","0","1")
//! runtextmacro t__Ammo_Init("'H00K'","5","5","0","1")
//! runtextmacro t__Ammo_Init("'h003'","30","2","0","0")
//! runtextmacro t__Ammo_Init("'h00P'","8","4","1","0")
//! runtextmacro t__Ammo_Init("'H017'","8","4","0","1")
//! runtextmacro t__Ammo_Init("'h004'","100","5","0","0")
//! runtextmacro t__Ammo_Init("'h009'","50","4","0","0")
//! runtextmacro t__Ammo_Init("'H01S'","30","4","0","1")
//! runtextmacro t__Ammo_Init("'H01T'","10","2","0","1")
//! runtextmacro t__Ammo_Init("'H01P'","5","5","0","1")
//! runtextmacro t__Ammo_Init("'h009'","30","2","0","0")
//! runtextmacro t__Ammo_Init("'h00F'","30","2","0","0")
//! runtextmacro t__Ammo_Init("'h00O'","30","4","0","0")
//! runtextmacro t__Ammo_Init("'h00U'","30","4","0","0")
//! runtextmacro t__Ammo_Init("'h00V'","400","6","0","0")
//! runtextmacro t__Ammo_Init("'h00W'","30","4","0","0")
//! runtextmacro t__Ammo_Init("'H00X'","15","6","0","1")
//! runtextmacro t__Ammo_Init("'H00Z'","30","4","0","1")
//! runtextmacro t__Ammo_Init("'H010'","200","6","0","1")
//! runtextmacro t__Ammo_Init("'H011'","30","4","0","1")
//! runtextmacro t__Ammo_Init("'H013'","15","8","0","1")
//! runtextmacro t__Ammo_Init("'H016'","50","4","0","1")
//! runtextmacro t__Ammo_Init("'H01L'","30","2","0","1")
//! runtextmacro t__Ammo_Init("'H01O'","30","4","0","1")
//! runtextmacro t__Ammo_Init("'H01B'","8","4","0","1")
//! runtextmacro t__Ammo_Init("'H01D'","30","4","0","1")
//! runtextmacro t__Ammo_Init("'H01C'","30","2","0","1")
//! runtextmacro t__Ammo_Init("'H01Y'","30","4","0","1")
//! runtextmacro t__Ammo_Init("'H01Z'","8","4","0","1")
//! runtextmacro t__Ammo_Init("'H020'","50","4","0","1")
//! runtextmacro t__Ammo_Init("'H022'","30","2","0","1")
//! runtextmacro t__Ammo_Init("'H023'","8","4","1","2")
//! runtextmacro t__Ammo_Init("'H024'","200","6","0","1")
//! runtextmacro t__Ammo_Init("'H025'","100","5","0","1")
//! runtextmacro t__Ammo_Init("'H002'","30","4","0","1")
//! runtextmacro t__Ammo_Init("'H005'","8","4","1","2")
//! runtextmacro t__Ammo_Init("'H008'","8","4","0","2")
//! runtextmacro t__Ammo_Init("'H02A'","30","4","0","1")
//! runtextmacro t__Ammo_Init("'H00N'","30","4","0","0")
//! runtextmacro t__Ammo_Init("'H02D'","50","4","0","0")
//! runtextmacro t__Ammo_Init("'H02E'","10","5","0","0")
endfunction
private function SetGold takes player owner, integer amount returns nothing
call SetPlayerState(owner,PLAYER_STATE_RESOURCE_GOLD, amount)
endfunction
private function SetLumber takes player owner, integer amount returns nothing
call SetPlayerState(owner,PLAYER_STATE_RESOURCE_LUMBER, amount)
endfunction
private struct str
unit marine = null
player owner = null
integer ownerId = 0
timer primWeaponReloadTimer = null
timer secWeaponReloadTimer = null
effect reloadFx = null
integer id = 0
integer primAmmoMax = 0
integer primAmmoCurrent = 0
integer secAmmoMax = 0
integer secAmmoCurrent = 0
real primReloadTime = 0.
real secReloadTime = 0.
boolean primReload = false
boolean secReload = false
boolean withPush = false
integer secWeaponId = 0
implement AutoData
private static method createFilter takes unit u returns boolean
return LoadInteger(HashT,GetUnitTypeId(u),UNIT_AMMOMAX)>=1 and GetOwningPlayer(u)!=Player(PLAYER_NEUTRAL_PASSIVE)
endmethod
private method onCreate takes nothing returns nothing
set .reloadFx = null
set .marine = me
set .owner = GetOwningPlayer(me)
set .ownerId = GetPlayerId(.owner)
set .id = GetUnitTypeId(me)
set .primWeaponReloadTimer = null
set .primAmmoMax = LoadInteger(HashT,.id,UNIT_AMMOMAX)
set .primAmmoCurrent = .primAmmoMax
set .primReloadTime = I2R(LoadInteger(HashT,.id,UNIT_RELOADTIME))
set .secWeaponId = LoadInteger(HashT,.id,UNIT_SECWEAPON)
if IsUnitType(.marine,UNIT_TYPE_HERO) then
call SetGold(.owner,.primAmmoMax)
call SetLumber(.owner,PRIMARY_AMMOSTART)
endif
if .secWeaponId > 0 then
if .secWeaponId == FF_ID then
call UnitAddAbility(.marine,SPELL_FF)
set .secAmmoMax = AMMOMAX_FF
set .secReloadTime = RELOADTIME_FF
elseif .secWeaponId == DG_ID then
call UnitAddAbility(.marine,SPELL_DG)
set .secAmmoMax = AMMOMAX_DG
set .secReloadTime = RELOADTIME_DG
endif
set DummySecWeapon[.ownerId] = CreateUnit(.owner,DUMMY_SECONDARYWEAPON,0.,0.,0.)
else
set .secAmmoMax = 0
endif
set .secAmmoCurrent = .secAmmoMax
set .primReload = false
if LoadInteger(HashT,.id,UNIT_PUSH)==1 then
set .withPush = true
else
set .withPush = false
endif
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
if .reloadFx != null or .primReload == true then
call DestroyEffect(.reloadFx)
set .reloadFx = null
endif
set .marine = null
if .primWeaponReloadTimer != null or .primReload == true then
call ReleaseTimer(.primWeaponReloadTimer)
endif
set .primWeaponReloadTimer = null
if .secWeaponReloadTimer != null or .secReload == true then
call ReleaseTimer(.secWeaponReloadTimer)
endif
set .secWeaponReloadTimer = null
set .primReload = false
set .secReload = false
endmethod
implement AutoDestroy
endstruct
function GetAmmoNeeded takes unit marine returns integer
return AMMO_ID
endfunction
function UpgradeMaxWeapon takes unit marine, integer amount returns nothing
local str dat = str[marine]
set dat.primAmmoMax = dat.primAmmoMax + amount
endfunction
function UpgradeReloadWeapon takes unit marine, real time returns nothing
local str dat = str[marine]
set dat.primReloadTime = dat.primReloadTime - time
endfunction
private function ReloadSecondaryWeapon takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
set dat.secAmmoCurrent = dat.secAmmoMax
call ReleaseTimer(t)
set dat.secReload = false
set dat.secWeaponReloadTimer = null
set DummySecWeapon[dat.ownerId] = CreateUnit(dat.owner,DUMMY_SECONDARYWEAPON,0.,0.,0.)
endfunction
private function ReloadPrimaryWeapon takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
set dat.primAmmoCurrent = dat.primAmmoMax
call DestroyEffect(dat.reloadFx)
set dat.reloadFx = null
if IsUnitType(dat.marine,UNIT_TYPE_HERO) then
call SetGold(dat.owner,dat.primAmmoMax)
else
call SetUnitState(dat.marine,UNIT_STATE_MANA,dat.primAmmoMax)
endif
call ReleaseTimer(t)
set dat.primReload = false
set dat.primWeaponReloadTimer = null
endfunction
function ForceReload takes unit marine returns nothing
local str dat = str[marine]
if dat.primReload == false then
set dat.primAmmoCurrent = 0
set dat.reloadFx = AddSpecialEffectTarget(FX_RELOAD,marine, "overhead")
call RunSoundOnUnit(SOUND_RELOAD,marine)
call TextTagMessage("Reloading", dat.marine, 0., 50., 64., 90., 9, 5., 2.00 )
set dat.primWeaponReloadTimer = NewTimer()
call SetUnitAnimation(SpellEvent.CastingUnit, "Spell Second" )
if IsUnitType(marine,UNIT_TYPE_HERO) then
call SetLumber(dat.owner,GetPlayerState(dat.owner,PLAYER_STATE_RESOURCE_LUMBER)-1)
call SetGold(dat.owner,dat.primAmmoCurrent)
if GetPlayerState(dat.owner,PLAYER_STATE_RESOURCE_LUMBER)<=0 then
call DisplayTextToPlayer(dat.owner,0.,0.,GetUnitName(marine)+" will be out of ammo")
endif
endif
set dat.primReload = true
call SetTimerData(dat.primWeaponReloadTimer,dat)
call TimerStart(dat.primWeaponReloadTimer,dat.primReloadTime,false,function ReloadPrimaryWeapon)
endif
if IsUnitType(marine,UNIT_TYPE_HERO) and dat.secAmmoCurrent == 0 and GetPlayerState(dat.owner,PLAYER_STATE_RESOURCE_LUMBER) >= 1 and dat.secReload == false then
call SetLumber(dat.owner,GetPlayerState(dat.owner,PLAYER_STATE_RESOURCE_LUMBER)-1)
set dat.secReload = true
if GetPlayerState(dat.owner,PLAYER_STATE_RESOURCE_LUMBER)<=0 then
call DisplayTextToPlayer(dat.owner,0.,0.,GetUnitName(marine)+" will be out of ammo")
endif
set dat.secWeaponReloadTimer = NewTimer()
call SetTimerData(dat.secWeaponReloadTimer,dat)
call TimerStart(dat.secWeaponReloadTimer,dat.secReloadTime,false,function ReloadSecondaryWeapon)
endif
endfunction
private function UseSecondaryWeapon takes nothing returns nothing
local unit marine = SpellEvent.CastingUnit
local str dat = str[marine]
if SpellEvent.AbilityId == SPELL_FF then
call RunSoundOnUnit(SOUND_FF,marine)
elseif SpellEvent.AbilityId == SPELL_DG then
call RunSoundOnUnit(SOUND_DG,marine)
endif
set dat.secAmmoCurrent = dat.secAmmoCurrent - 1
if dat.secAmmoCurrent == 0 then
call KillUnit(DummySecWeapon[dat.ownerId])
if GetPlayerState(dat.owner,PLAYER_STATE_RESOURCE_LUMBER) >= 1 then
call RunSoundOnUnit(SOUND_RELOAD,marine)
call TextTagMessage("Reloading Sec. Weapon", marine, 0., 50., 64., 90., 9, 5., 2.00 )
call SetLumber(dat.owner,GetPlayerState(dat.owner,PLAYER_STATE_RESOURCE_LUMBER)-1)
set dat.secReload = true
if GetPlayerState(dat.owner,PLAYER_STATE_RESOURCE_LUMBER)<=0 then
call DisplayTextToPlayer(dat.owner,0.,0.,GetUnitName(marine)+" will be out of ammo")
endif
set dat.secWeaponReloadTimer = NewTimer()
call SetTimerData(dat.secWeaponReloadTimer,dat)
call TimerStart(dat.secWeaponReloadTimer,dat.secReloadTime,false,function ReloadSecondaryWeapon)
endif
endif
set marine = null
endfunction
private function ReloadAmmo takes nothing returns nothing
local unit marine = SpellEvent.CastingUnit
local str dat = str[marine]
if dat.primReload == false then
if GetPlayerState(dat.owner,PLAYER_STATE_RESOURCE_LUMBER)<=0 then
call ErrorSound(dat.owner)
call DisplayTextToPlayer(dat.owner,0.,0.,GetUnitName(marine)+" is out of ammo. Feed the inventory with any magazine to reload the weapon.")
else
if IsUnitType(dat.marine,UNIT_TYPE_HERO) then
call SetGold(dat.owner,0)
else
call SetUnitState(dat.marine,UNIT_STATE_MANA,0)
endif
call ForceReload(marine)
endif
else
call ErrorSound(dat.owner)
call DisplayTextToPlayer(dat.owner,0.,0.,"You are already reloading")
endif
set marine = null
endfunction
private function UsePrimaryWeapon takes nothing returns boolean
local unit marine = GetAttacker()
local str dat = str[marine]
local unit target = GetTriggerUnit()
if str[marine]!= 0 then
if dat.primAmmoCurrent == 0 then
call IssueImmediateOrder(marine,"stop")
else
set dat.primAmmoCurrent = dat.primAmmoCurrent - 1
if IsUnitType(dat.marine,UNIT_TYPE_HERO) then
call SetGold(dat.owner,dat.primAmmoCurrent)
else
call SetUnitState(dat.marine,UNIT_STATE_MANA,dat.primAmmoCurrent)
endif
if dat.withPush == true then
if not (IsUnitType(target,UNIT_TYPE_STRUCTURE)) then
if GetUnitAbilityLevel(marine,SPELL_SAWED_OFF_SHOTGUN)>=1 then
call Push(GetUnitX(marine),GetUnitY(marine),GetTriggerUnit(),150,20,0.)
else
call Push(GetUnitX(marine),GetUnitY(marine),GetTriggerUnit(),100,10,0.)
endif
endif
endif
endif
endif
set target = null
set marine = null
return false
endfunction
private function DropAmmo takes nothing returns nothing
local unit marine = SpellEvent.CastingUnit
local str dat = str[marine]
if GetPlayerState(dat.owner,PLAYER_STATE_RESOURCE_LUMBER)<=0 then
call ErrorSound(dat.owner)
call DisplayTextToPlayer(dat.owner,0.,0.,GetUnitName(marine)+" is out of ammo.")
else
call SetLumber(dat.owner,GetPlayerState(dat.owner,PLAYER_STATE_RESOURCE_LUMBER)-1)
if GetPlayerState(dat.owner,PLAYER_STATE_RESOURCE_LUMBER)<=0 then
call DisplayTextToPlayer(dat.owner,0.,0.,GetUnitName(marine)+" will be out of ammo")
endif
call UnitAddItemById(marine,AMMO_ID)
endif
set marine = null
endfunction
private function UsePrimaryAmmo takes unit marine, item ammo returns nothing
local str dat = str[marine]
call SetLumber(dat.owner,GetPlayerState(dat.owner,PLAYER_STATE_RESOURCE_LUMBER)+1)
call TextTagMessage("+"+I2S(dat.primAmmoMax),dat.marine, 0., 50., 64., 90., 9, 5., 2.00 )
if GetPlayerState(dat.owner,PLAYER_STATE_RESOURCE_LUMBER)<=0 then
call DisplayTextToPlayer(dat.owner,0.,0.,GetUnitName(marine)+" will be out of ammo")
endif
endfunction
private function UnitUsesAmmo takes nothing returns boolean
local unit marine = GetTriggerUnit()
local item ammo = GetManipulatedItem()
if GetItemTypeId(ammo)==AMMO_ID then
call UsePrimaryAmmo(marine,ammo)
endif
set ammo = null
set marine = null
return false
endfunction
private function NpcOutOfAmmo takes nothing returns boolean
local unit marine = GetTriggerUnit()
local str dat = str[marine]
if str[marine]!= 0 then
call ForceReload(marine)
endif
set marine = null
return false
endfunction
private struct s_npc
trigger trig
private static method createFilter takes unit u returns boolean
return LoadInteger(HashT,GetUnitTypeId(u),UNIT_AMMOMAX)>=1 and not (IsUnitType(u,UNIT_TYPE_HERO))
endmethod
private method onCreate takes nothing returns nothing
set .trig = CreateTrigger()
call TriggerRegisterUnitStateEvent(.trig,me,UNIT_STATE_MANA,EQUAL,0.)
call TriggerAddCondition(.trig,Condition(function NpcOutOfAmmo))
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
call DisableTrigger(.trig)
call DestroyTrigger(.trig)
set .trig = null
endmethod
implement AutoDestroy
endstruct
private function HerOutOfAmmo takes nothing returns boolean
local player owner = GetTriggerPlayer()
local integer ownerId = GetPlayerId(owner)
local str dat = str[Hero[ownerId]]
if str[Hero[ownerId]]!= 0 then
if GetPlayerState(dat.owner,PLAYER_STATE_RESOURCE_LUMBER) <= 0 then
call DisplayTextToPlayer(dat.owner,0.,0.,GetUnitName(dat.marine)+" is out of ammo")
else
call ForceReload(dat.marine)
endif
endif
return false
endfunction
private function init takes nothing returns nothing
local trigger t = CreateTrigger()
local integer i = 0
set HashT = InitHashtable()
call AbilityPreload(SPELL_FF)
call SetAmmoVariables()
call RegisterSpellCastResponse(SPELL_RELOADAMMO,ReloadAmmo)
call RegisterSpellCastResponse(SPELL_DROPAMMO,DropAmmo)
call RegisterSpellCastResponse(SPELL_FF,UseSecondaryWeapon)
call RegisterSpellCastResponse(SPELL_DG,UseSecondaryWeapon)
call RegisterAnyUnitEvent(EVENT_PLAYER_UNIT_ATTACKED,function UsePrimaryWeapon)
call RegisterAnyUnitEvent(EVENT_PLAYER_UNIT_USE_ITEM,function UnitUsesAmmo)
loop
exitwhen i > MAXPLAYER
if GetPlayerSlotState(Player(i))==PLAYER_SLOT_STATE_PLAYING and GetPlayerController(Player(i)) == MAP_CONTROL_USER then
call TriggerRegisterPlayerStateEvent(t,Player(i),PLAYER_STATE_RESOURCE_GOLD,EQUAL,0.)
endif
set i = i + 1
endloop
call TriggerAddCondition(t,Condition(function HerOutOfAmmo))
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library HeroDeath initializer init needs AutoIndex, GameEndFailed,TimerUtils, TextDisplay,LeaderBoard,MedalSystem,AmmoSystem
globals
private constant real REMOVE_X = -12000.
private constant real REMOVE_Y = 14000.
private constant integer BUFF_ATD = 'A085'
private constant integer AuraAtd = 'A085'
private constant integer BuffAtd = 'B00T'
constant integer HERO_CORPSE = 'o00A'
private constant string FX = "Abilities\\Spells\\Orc\\Reincarnation\\ReincarnationTarget.mdl"
private constant real DURATION = 120.
private constant string DEADC = "|cff808080"
private constant string CYBORG_INFO = "AW-Little Brother created with what still lives in me"
private constant integer CYBORG_SPELL = 'A09W'
private constant integer CYBORG_UNIT = 'n00X'
private boolean array HeroIsDefinitelyDead [12]
boolean HeroDead = false
integer HeroAlive = 0
endglobals
function EraseUnit takes unit whichUnit returns nothing
call SetUnitPosition(whichUnit,REMOVE_X,REMOVE_Y)
call KillUnit(whichUnit)
endfunction
private function SharedVision takes integer whichPlayerId returns nothing
local integer i = 0
loop
exitwhen i > MAXPLAYER
call SetPlayerAllianceBJ( Player(i), ALLIANCE_SHARED_VISION, true, Player(whichPlayerId) )
call SetPlayerAllianceBJ( Player(whichPlayerId), ALLIANCE_SHARED_VISION, true, Player(i) )
set i = i + 1
endloop
call SetPlayerDead(Player(whichPlayerId))
endfunction
private function KillAllUnitsOfPlayer takes nothing returns boolean
if not (GetUnitTypeId(GetFilterUnit())==CYBORG_UNIT) then
call KillUnit(GetFilterUnit())
endif
return true
endfunction
private struct s_Corpse
unit hero = null
boolean rescuable = false
effect fx = null
player owner = null
integer ownerId = 0
private static method createFilter takes unit u returns boolean
return GetUnitTypeId(u)==HERO_CORPSE
endmethod
private method onCreate takes nothing returns nothing
set .hero = null
set .owner = GetOwningPlayer(me)
set .ownerId = GetPlayerId(.owner)
set .rescuable = false
set .fx = null
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
set .rescuable = false
set .hero = null
set .fx = null
endmethod
implement AutoDestroy
endstruct
private struct s_Hero
boolean rescuable = false
boolean duty = false
player owner = null
integer ownerId = 0
private static method createFilter takes unit u returns boolean
return IsUnitType(u,UNIT_TYPE_HERO)==true
endmethod
private method onCreate takes nothing returns nothing
set .rescuable = false
set .duty = false
set .owner = GetOwningPlayer(me)
set .ownerId = GetPlayerId(.owner)
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
set .rescuable = false
set .duty = false
endmethod
implement AutoDestroy
endstruct
function IsHeroDefinitelyDead takes integer ownerId returns boolean
return HeroIsDefinitelyDead[ownerId]==true and IsUnitType(Hero[ownerId],UNIT_TYPE_DEAD)
endfunction
function GetAmountOfAlivePlayer takes nothing returns nothing
local integer i = 0
set HeroAlive = 0
loop
exitwhen i > MAXPLAYER
if not (IsUnitType(Hero[i],UNIT_TYPE_DEAD)) and Hero[i]!=null and IsHeroDefinitelyDead(i)==false then
set HeroAlive = HeroAlive + 1
endif
set i = i + 1
endloop
if HeroAlive <=0 then
call GameEndFailed()
endif
endfunction
private function RemoveAllItem takes unit hero returns nothing
local integer i = 0
local real x = GetUnitX(hero)
local real y = GetUnitY(hero)
local item whichItem = null
local integer whichItemId = 0
local integer whichItemCharge = 0
loop
exitwhen i > 5
set whichItem = UnitItemInSlot(hero,i)
if not (whichItem==null) then
set whichItemId = GetItemTypeId(whichItem)
set whichItemCharge = GetItemCharges(whichItem)
call RemoveItem(whichItem)
set whichItem = CreateItem(whichItemId,x,y)
if whichItemCharge>=1 then
call SetItemCharges(whichItem,whichItemCharge)
endif
endif
set whichItem = null
set i = i + 1
endloop
set whichItem = null
endfunction
private function ReviveLinkedHero takes unit hero, real x, real y returns nothing
local s_Hero dat = s_Hero[hero]
call ReviveHero(hero,GetUnitX(hero),GetUnitY(hero),false)
set dat.rescuable = false
endfunction
function CheckCorpseStatus takes integer casterOwnerId, unit corpse returns nothing
local s_Corpse dat = s_Corpse[corpse]
if GetUnitAbilityLevel(corpse,BUFF_ATD)>=1 then
call TextTagMessage(PlayerColor[dat.ownerId]+GetPlayerName(dat.owner)+"Thanks", dat.hero, 0., 50., 64., 90., 9, 5., 4.00 )
call DisplayAll(PlayerColor[dat.ownerId]+GetPlayerName(dat.owner)," is now saved.")
set dat.rescuable = false
call ReviveLinkedHero(dat.hero,GetUnitX(corpse),GetUnitY(corpse))
call UnitRemoveAbility(corpse,BUFF_ATD)
call DestroyEffect(dat.fx)
if GetPlayerState(dat.owner,PLAYER_STATE_RESOURCE_LUMBER)>=1 then
call ForceReload(dat.hero)
else
call ErrorSound(dat.owner)
call DisplayTextToPlayer(dat.owner,0.,0.,"You are out of ammo")
endif
call KillUnit(corpse)
endif
endfunction
private function RemoveHero takes unit hero returns nothing
local s_Hero dat = s_Hero[hero]
call SharedVision(GetPlayerId(GetOwningPlayer(hero)))
call EraseUnit(hero)
endfunction
private function SetHeroNonRescuable takes unit corpse returns nothing
local s_Corpse dat = s_Corpse[corpse]
if GetPlayerSlotState(GetOwningPlayer(dat.hero))==PLAYER_SLOT_STATE_PLAYING then
call SharedVision(GetPlayerId(GetOwningPlayer(dat.hero)))
call TextTagMessage(PlayerColor[dat.ownerId]+GetPlayerName(dat.owner)+"It's a honor to die at your side!",dat.hero, 0., 50., 64., 90., 9, 5., 4.00 )
call DisplayAll(PlayerColor[dat.ownerId]+GetPlayerName(dat.owner)," cannot be saved now. We've lost a man.")
if GetUnitAbilityLevel(dat.hero,CYBORG_SPELL)>=1 then//Create Cyborg Brother
call CreateUnit(GetOwningPlayer(dat.hero),CYBORG_UNIT,GetUnitX(corpse),GetUnitY(corpse),0.)
call DisplayAll(PlayerColor[GetPlayerId(GetOwningPlayer(dat.hero))]+GetPlayerName(GetOwningPlayer(dat.hero)),CYBORG_INFO)
endif
set HeroDead = true
endif
set HeroIsDefinitelyDead[dat.ownerId]=true
call RemoveHero(dat.hero)
call RemoveAllItem(dat.hero)
call DestroyEffect(dat.fx)
call KillUnit(corpse)
call GroupEnumUnitsOfPlayer(ENUM_GROUP,GetOwningPlayer(dat.hero),Filter(function KillAllUnitsOfPlayer))
call GetAmountOfAlivePlayer()
endfunction
private struct str
unit hero
unit corpse
integer i
player owner
integer ownerId
endstruct
private function UpdateHeroStatus takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
if dat.i < DURATION and dat.hero != null and GetUnitAbilityLevel(dat.corpse,BUFF_ATD)>=1 and GetPlayerSlotState(dat.owner)==PLAYER_SLOT_STATE_PLAYING then
set dat.i = dat.i + 1
call TextTagMessage("No longer rescuable in: "+I2S(R2I(DURATION-dat.i)), dat.hero, 0., 50., 64., 90., 9, 5., 4.00 )
else
if dat.hero != null and GetUnitAbilityLevel(dat.corpse,BUFF_ATD)>=1 then
call SetHeroNonRescuable(dat.corpse)
endif
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function StartCooldown takes unit hero, unit corpse returns nothing
local str dat = str.create()
local timer t = NewTimer()
set dat.hero = hero
set dat.corpse = corpse
set dat.owner = GetOwningPlayer(hero)
set dat.ownerId = GetPlayerId(dat.owner)
set dat.i = 0
call SetTimerData(t,dat)
call TimerStart(t,1.,true,function UpdateHeroStatus)
endfunction
private function SetCorpseOnDeadHero takes unit corpse,unit hero returns nothing
local s_Corpse dat = s_Corpse[corpse]
set dat.hero = hero
set dat.rescuable = true
set dat.fx = AddSpecialEffect(FX,GetUnitX(corpse),GetUnitY(corpse))
endfunction
private function CheckHeroDeath takes unit hero returns nothing
local s_Hero dat = s_Hero[hero]
local unit corpse = null
if dat.rescuable == false and GetPlayerSlotState(GetOwningPlayer(hero))==PLAYER_SLOT_STATE_PLAYING and GetPlayerController(GetOwningPlayer(hero)) == MAP_CONTROL_USER then
set dat.rescuable = true
set corpse = CreateUnit(GetOwningPlayer(hero),HERO_CORPSE,GetUnitX(hero),GetUnitY(hero),GetUnitFacing(hero))
call SetUnitTimeScale(corpse,0.05)
call SetUnitAnimation(corpse,"decay")
call TextTagMessage(PlayerColor[dat.ownerId]+GetPlayerName(dat.owner)+"I am dying", hero, 0., 50., 64., 90., 9, 5., 4.00 )
call SetCorpseOnDeadHero(corpse,hero)
call UnitAddAbility(corpse,BUFF_ATD)
if GetUnitAbilityLevel(hero,BUFF_POISON1)>=1 then
call UnitRemoveAbility(hero,BUFF_POISON1)
endif
if GetUnitAbilityLevel(hero,BUFF_POISON2)>=1 then
call UnitRemoveAbility(hero,BUFF_POISON2)
endif
if GetUnitAbilityLevel(hero,BUFF_FRACT)>=1 then
call UnitRemoveAbility(hero,BUFF_FRACT)
endif
call StartCooldown(hero,corpse)
elseif not(GetPlayerSlotState(GetOwningPlayer(hero))==PLAYER_SLOT_STATE_PLAYING) then
call EraseUnit(hero)
endif
set corpse = null
endfunction
private function HeroDeath takes nothing returns boolean
local unit victim = GetTriggerUnit()
local unit killer = GetKillingUnit()
local player victimOwner = GetOwningPlayer(victim)
local player killerOwner = GetOwningPlayer(killer)
local integer victimOwnerId = GetPlayerId(victimOwner)
local integer killerOwnerId = GetPlayerId(killerOwner)
if IsUnitType(victim, UNIT_TYPE_HERO) == true then
call CheckHeroDeath(victim)
call GetAmountOfAlivePlayer()
endif
if victimOwnerId < 11 and killerOwnerId < 10 and IsUnitType(victim, UNIT_TYPE_HERO) and killerOwner !=null and victimOwner!=null then
if killerOwner != victimOwner then
call DisplayAll(PlayerColor[victimOwnerId]+GetPlayerName(victimOwner)," has been killed by "+PlayerColor[killerOwnerId]+GetPlayerName(killerOwner))
call DisplayAll(PlayerColor[killerOwnerId]+GetPlayerName(killerOwner)," has now an experience malus of 15%.")
set TeamKiller[killerOwnerId]=true
else
call DisplayAll(PlayerColor[victimOwnerId]+GetPlayerName(victimOwner)," has killed himself")
endif
endif
set victim = null
set killer = null
return false
endfunction
public function init takes nothing returns nothing
local trigger t = CreateTrigger()
local integer i = 0
set HeroDead = false
loop
exitwhen i > MAXPLAYER+1
call TriggerRegisterPlayerUnitEvent(t,Player(i),EVENT_PLAYER_UNIT_DEATH,null)
set HeroIsDefinitelyDead[i]=false
set i = i + 1
endloop
call TriggerAddCondition(t, Condition(function HeroDeath))
set HeroAlive = 1
endfunction
endlibrary
//TESH.scrollpos=10
//TESH.alwaysfold=0
scope DamageStat initializer init
globals
private constant integer CHANCE_POISON = 10// /100
private constant integer CHANCE_FRAC = 1 // /100
private constant integer PARASITE1 = 'u00V'
private constant integer PARASITE2 = 'u00W'
private constant integer NBCCS_ARMOR = 'A0K6' //For biological soldier
private constant integer TOXINE_EXPERTISE = 'A0K3' //For biological soldier
integer array HeroHit [12]
endglobals
private function UnitTakeDamage takes nothing returns boolean
local unit attacker = GetAttacker()
local integer attackerId = GetUnitTypeId(attacker)
local unit victim = GetTriggerUnit()
local player victimOwner = GetOwningPlayer(victim)
local integer victimOwnerId = GetPlayerId(victimOwner)
local player attackerOwner = GetOwningPlayer(attacker)
local integer attackerOwnerId = GetPlayerId(attackerOwner)
if not (IsUnitType(victim,UNIT_TYPE_GIANT)) and not (IsUnitType(victim,UNIT_TYPE_TAUREN)) and not (IsUnitType(victim,UNIT_TYPE_MECHANICAL)) and not (IsUnitType(victim,UNIT_TYPE_STRUCTURE)) then
if (attackerOwnerId == 11 or attackerOwnerId == 13 or attackerOwnerId == 14) and not (IsUnitType(attacker,UNIT_TYPE_TAUREN)) then
if victim == Hero[victimOwnerId] then
set HeroHit[victimOwnerId]=HeroHit[victimOwnerId]+1
call BoardUpdateHit(victimOwner)
endif
if GetUnitAbilityLevel(victim,NBCCS_ARMOR)<=0 and GetUnitAbilityLevel(victim,TOXINE_EXPERTISE)<=0 then
if attackerId == PARASITE1 or attackerId == PARASITE2 then
call UnitAddBuffPoison(victim)
endif
if GetRandomInt(0,100)<CHANCE_POISON and GetUnitAbilityLevel(victim,BUFF_POISON1)<=0 and GetUnitAbilityLevel(victim,BUFF_POISON2)<=0 then
call UnitAddBuffPoison(victim)
endif
if GetRandomInt(0,100)<CHANCE_FRAC and GetUnitAbilityLevel(victim,BUFF_FRACT)<=0 then
call UnitAddBuffFract(victim)
endif
endif
endif
endif
set attacker = null
set victim = null
return false
endfunction
public function init takes nothing returns nothing
local integer i = 0
loop
exitwhen i > MAXPLAYER
set HeroHit[i]=0
set i = i + 1
endloop
call RegisterAnyUnitEvent(EVENT_PLAYER_UNIT_ATTACKED,function UnitTakeDamage)
endfunction
endscope
//TESH.scrollpos=19
//TESH.alwaysfold=0
library Reinforcements initializer init needs TimerUtils, TextDisplay, HeroDeath
globals
private constant integer DRONE_ID = 'n00G'
private constant real LIFESPAN = 60.
private constant string INFO1 = "Reinforcements incoming."
private constant string INFO2 = "Reinforcements have landed."
private constant integer SPEED = 25
private constant real SPAWN_DISTANCE = 4000.
private constant real SPAWN_Z = 500.
private constant real WAIT = 3.
private rect array LZRect [6]
private integer LZMax
endglobals
private struct s_delay
unit drone
endstruct
private function Wait takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_delay dat = GetTimerData(t)
local integer i = 0
local real x = GetUnitX(dat.drone)
local real y = GetUnitY(dat.drone)
local integer count = 0
call SetUnitFlyHeight(dat.drone,SPAWN_Z,300.)
call UnitAddAbility(dat.drone,LASTQUESTUNIT_SPELL)
call IssuePointOrder(dat.drone,LASTQUESTUNIT_ORDER,GetRectCenterX(gg_rct_LastQuest),GetRectCenterY(gg_rct_LastQuest))
loop
exitwhen i > MAXPLAYER
if GetPlayerSlotState(Player(i))==PLAYER_SLOT_STATE_PLAYING and IsHeroDefinitelyDead(i)==true then
call UnitRemoveAbility(CreateUnit(Player(i),AlliedId[GetRandomInt(0,AlliedIdMax)],x,y,0.),AI_ON)
set count = count + 1
endif
set i = i + 1
endloop
if count >= 1 then
call DisplayAll("Control",INFO2)
call PingMinimapEx(x,y,10., 0, 0, 255, false)
endif
call ReleaseTimer(t)
call dat.destroy()
endfunction
private function DelayControl takes unit drone returns nothing
local timer t = NewTimer()
local s_delay dat = s_delay.create()
set dat.drone = drone
call SetTimerData(t, dat)
call TimerStart (t, WAIT, false, function Wait)
endfunction
private struct s_drop
unit drone
real angle
integer distance
integer i
endstruct
private function Update takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_drop dat = GetTimerData(t)
local real newX = GetUnitX(dat.drone) + SPEED*Cos(dat.angle)
local real newY = GetUnitY(dat.drone) + SPEED*Sin(dat.angle)
if dat.i < dat.distance then
set dat.i = dat.i + 1
call SetUnitPosition(dat.drone, newX, newY)
else
call SetUnitFlyHeight(dat.drone,100.,300.)
call DelayControl(dat.drone)
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function StartReinforcements takes nothing returns nothing
local timer t = NewTimer()
local s_drop dat = s_drop.create()
local real x1 = GetRandomReal(MapXMin,MapXMax)
local real y1 = GetRandomReal(MapYMin,MapYMax)
local integer id = GetRandomInt(0,LZMax)
local real x2 = GetRectCenterX(LZRect[id])
local real y2 = GetRectCenterY(LZRect[id])
set dat.angle = Atan2((y2 -y1), (x2 - x1))
set dat.distance =R2I(SquareRoot((x2-x2)*(x2-x1)+(y2-y1)*(y2-y1))/SPEED)
set dat.i = 0
set dat.drone = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),DRONE_ID,x1,y1, dat.angle*bj_RADTODEG )
call SetUnitFlyHeight(dat.drone,SPAWN_Z,0.)
call SetTimerData(t, dat)
call TimerStart (t, TIMEOUT, true, function Update)
endfunction
function SpawnReinforcements takes nothing returns nothing
local integer i = 0
local integer count = 0
loop
exitwhen i > MAXPLAYER
if GetPlayerSlotState(Player(i))==PLAYER_SLOT_STATE_PLAYING and IsHeroDefinitelyDead(i)==true then
set count = count + 1
endif
set i = i + 1
endloop
if count >= 1 then
call DisplayAll("Control",INFO1)
call StartReinforcements()
endif
endfunction
private function init takes nothing returns nothing
set LZRect[0]=gg_rct_LZ1
set LZRect[1]=gg_rct_LZ2
set LZRect[2]=gg_rct_LZ3
set LZRect[3]=gg_rct_LZ4
set LZRect[4]=gg_rct_LZ5
set LZMax = 4
endfunction
endlibrary
//TESH.scrollpos=55
//TESH.alwaysfold=0
library LearnSkill needs Assistance,DownloadTargetAcquisitionUpgrade,Barrage,GreaterMagazineST,Endurance,SecurityTraining,ServiceIntelligence,GreaterMagazineSA,Mercenary,SteyrScoutFeaturesMk2,EliteTraining,GreaterMagazineOT,AdvancedInfantry,MachineryExpertise,RobotDrone,SurvivalSkills,WrathOfZeus,SteyrScoutFeaturesMk2,HeavenWrath,MultitaskDriver,SteyrScoutFeatures,ScoutTraining,FireMastery,EyeOfTheEagle,Experience,WarUpgrade,SurgicalStrike,GWDrones,AWDrones,OpenFire,CyborgSkills,BodyTurret,Prototype,TeslaEnhancing,BioChemicalWeapon,Marksmanship,MachinegunDomination,BurstMode,CEBuildingMax,DefensiveBuildings,OffensiveBuildings,PlasmaField,PlasmaTechnology, Resistance,Biology,BiologicalWeaponTraining,ToxineExpertise
function LearnSkill takes unit hero returns nothing
local integer heroId = GetUnitTypeId(hero)
if heroId == 'H016' then//AF
call PlasmaField(hero)
call PlasmaTechnology(hero)
elseif heroId == 'H01B' then//AS
call Resistance(hero)
elseif heroId == 'H00D' then//BI
call Biology(hero)
elseif heroId == 'H025' then//BS
call BiologicalWeaponTraining(hero)
call ToxineExpertise(hero)
elseif heroId == 'H01C' then//CE
call DefensiveBuildings(hero)
call OffensiveBuildings(hero)
call CEBuildingMax(hero)
elseif heroId == 'H00L' then//CF
call BurstMode(hero)
call MachinegunDomination(hero)
elseif heroId == 'H013' then//CO
call Marksmanship(hero)
elseif heroId == 'H023' then//CT
call BioChemicalWeapon(hero)
elseif heroId == 'H024' then//CU
call TeslaEnhancing(hero)
call Prototype(hero)
elseif heroId == 'H010' then//CY
call BodyTurret(hero)
call CyborgSkills(hero)
call OpenFire(hero)
elseif heroId == 'H01Z' then//DM
call AWDrones(hero)
call GWDrones(hero)
call SurgicalStrike(hero)
elseif heroId == 'H01S' then//ES
call WarUpgrade(hero)
elseif heroId == 'H01Y' then//ET
call Experience(hero)
call EyeOfTheEagle(hero)
elseif heroId == 'H00J' then//FB
call FireMastery(hero)
elseif heroId == 'H00K' then//FR
call ScoutTraining(hero)
call SteyrScoutFeatures(hero)
elseif heroId == 'H01L' then//IP
call MultitaskDriver(hero)
elseif heroId == 'H01P' then//LS
call HeavenWrath(hero)
call SteyrScoutFeaturesMk2(hero)
call WrathOfZeus(hero)
elseif heroId == 'H000' then//HS
call SurvivalSkills(hero)
elseif heroId == 'H00H' then//MC
call RobotDrone(hero)
call MachineryExpertise(hero)
elseif heroId == 'H00Z' then//ML
call AdvancedInfantry(hero)
elseif heroId == 'H020' then//OT
call GreaterMagazineOT(hero)
call EliteTraining(hero)
elseif heroId == 'H00X' then//PS
call SteyrScoutFeaturesMk2(hero)
elseif heroId == 'H011' then//RF
call Mercenary(hero)
//elseif heroId == 'H02B' then//RP
//call RaptorControl(hero)
elseif heroId == 'H01T' then//SA
call GreaterMagazineSA(hero)
call ServiceIntelligence(hero)
elseif heroId == 'H00I' then//SO
call SecurityTraining(hero)
elseif heroId == 'H01O' then//ST
call Endurance(hero)
call GreaterMagazineST(hero)
elseif heroId == 'H00R' then//TC
call Barrage(hero)
elseif heroId == 'H029' then//UV
call DownloadTargetAcquisitionUpgrade(hero)
call Assistance(hero)
endif
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library AdvancedItemHandlingSystem initializer Init needs RegisterAnyUnitEvent
// The_Witcher's
//
// <<advanced item system>>
//
// this system improves the warcraft III item engine
//
// if a unit gets an item which it already has it stacks
// in addition this works even if the inventory is full!!!
//
// if you double-right-click an item with charges it splits up
// and if you move a item onto an equal item and they are stackable they stack
// no Setup Part! don't touch anything
private struct data
unit u
item ite
integer index
real x
real y
endstruct
globals
private data array DATAS
private integer total = 0
private hashtable h = InitHashtable()
private timer tim = CreateTimer()
private trigger trg = CreateTrigger( )
endglobals
private function IsInventoryFull takes unit u returns boolean
local integer i = 0
loop
exitwhen i == 6
if UnitItemInSlot(u, i) == null then
return false
endif
set i = i + 1
endloop
return true
endfunction
private function ItemWalk takes nothing returns boolean
local integer i = 0
local unit u = GetTriggerUnit()
local item ite = GetOrderTargetItem()
local data dat
if IsInventoryFull(u) and GetItemCharges(ite)!= 0 then
loop
exitwhen i > 5
if GetItemTypeId(ite) == GetItemTypeId(UnitItemInSlot(u, i)) and UnitHasItem(u,ite)== false then
call IssuePointOrder( u, "move", GetItemX(ite),GetItemY(ite) )
if LoadInteger(h,GetHandleId(u),0) == 0 then
set dat = data.create()
set DATAS[total] = dat
set dat.index = total
set total = total + 1
set dat.u = u
set dat.ite = ite
set dat.x = GetItemX(ite)
set dat.y = GetItemY(ite)
call SaveInteger(h,GetHandleId(u),0,dat)
else
set dat = LoadInteger(h,GetHandleId(u),0)
set dat.u = u
set dat.ite = ite
set dat.x = GetItemX(ite)
set dat.y = GetItemY(ite)
endif
set i = 100
endif
set i = i + 1
endloop
set dat = LoadInteger(h,GetHandleId(u),0)
if i < 10 and dat != 0 then
set total = total - 1
set DATAS[dat.index] = DATAS[total]
set DATAS[dat.index].index = dat.index
call FlushChildHashtable(h,GetHandleId(dat.u))
call dat.destroy()
endif
endif
set u = null
set ite = null
return false
endfunction
private function ItemStack takes nothing returns boolean
local integer i = 0
local integer id
local item k
local item m = GetManipulatedItem()
local unit u = GetTriggerUnit()
local integer ite = GetItemTypeId(m)
local integer c = GetItemCharges(m)
local integer it
if GetItemCharges(GetManipulatedItem()) > 0 then
loop
exitwhen i > 6
set it = GetItemTypeId(UnitItemInSlot(u, i - 1))
set k = UnitItemInSlot(u, i - 1)
if ( ( it == ite ) and( m != k ) ) then
call SetItemCharges( k, GetItemCharges(k) + c )
call RemoveItem( m )
set i = 10
endif
set i = i + 1
endloop
endif
set k = null
set m = null
set u = null
return false
endfunction
private function ItemTake takes nothing returns nothing
local real dx
local real dy
local item it
local integer i
local integer ii = 0
local data dat
loop
exitwhen ii >= total
set dat = DATAS[ii]
set dx = GetItemX(dat.ite) - GetUnitX(dat.u)
set dy = GetItemY(dat.ite) - GetUnitY(dat.u)
if ( SquareRoot(dx * dx + dy * dy) < 100.00 ) and IsItemOwned(dat.ite) == false then
set i = 0
loop
exitwhen i > 5
set it = UnitItemInSlot(dat.u,i)
if GetItemTypeId(dat.ite) == GetItemTypeId(it) then
set i = 5
endif
set i = i + 1
endloop
call SetItemCharges( it, GetItemCharges(it) + GetItemCharges(dat.ite) )
call RemoveItem( dat.ite )
set total = total - 1
set DATAS[ii] = DATAS[total]
set DATAS[ii].index = ii
call FlushChildHashtable(h,GetHandleId(dat.u))
call dat.destroy()
call IssueImmediateOrder(dat.u,"stop")
endif
set ii = ii + 1
endloop
set it = null
endfunction
private function ItemWalkAbort1 takes nothing returns boolean
local data dat = LoadInteger(h,GetHandleId(GetTriggerUnit()),0)
if dat != 0 and( GetOrderPointX() != dat.x or GetOrderPointY() != dat.y )then
set total = total - 1
set DATAS[dat.index] = DATAS[total]
set DATAS[dat.index].index = dat.index
call FlushChildHashtable(h,GetHandleId(dat.u))
call dat.destroy()
endif
return false
endfunction
private function ItemWalkAbort2 takes nothing returns boolean
local data dat = LoadInteger(h,GetHandleId(GetTriggerUnit()),0)
if dat != 0 then
set total = total - 1
set DATAS[dat.index] = DATAS[total]
set DATAS[dat.index].index = dat.index
call FlushChildHashtable(h,GetHandleId(dat.u))
call dat.destroy()
endif
return false
endfunction
private function ItemSplit takes nothing returns boolean
local integer i = GetItemCharges(GetOrderTargetItem())
if GetIssuedOrderId() > 852001 and GetIssuedOrderId() < 852008 then
if GetOrderTargetItem() == UnitItemInSlot(GetOrderedUnit(), GetIssuedOrderId()-852002) then
if i > 1 then
set i = i/2
call SetItemCharges(GetOrderTargetItem(), GetItemCharges(GetOrderTargetItem()) - i)
call DisableTrigger(trg)
call UnitAddItemByIdSwapped(GetItemTypeId(GetOrderTargetItem()), GetTriggerUnit())
call EnableTrigger(trg)
call SetItemCharges(bj_lastCreatedItem, i)
endif
else
if i > 0 and GetItemTypeId(GetOrderTargetItem()) == GetItemTypeId(UnitItemInSlot(GetOrderedUnit(), GetIssuedOrderId()-852002)) then
call SetItemCharges(GetOrderTargetItem(), GetItemCharges(GetOrderTargetItem()) + GetItemCharges(UnitItemInSlot(GetOrderedUnit(), GetIssuedOrderId()-852002)))
call RemoveItem(UnitItemInSlot(GetOrderedUnit(), GetIssuedOrderId()-852002))
endif
endif
endif
return false
endfunction
private function Init takes nothing returns nothing
call TimerStart( tim, 0.05, true, function ItemTake )
call RegisterAnyUnitEvent(EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER,function ItemWalkAbort1)
call RegisterAnyUnitEvent(EVENT_PLAYER_UNIT_ISSUED_ORDER,function ItemWalkAbort2)
call RegisterAnyUnitEvent(EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER,function ItemWalk)
call RegisterAnyUnitEvent(EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER,function ItemSplit)
call RegisterAnyUnitEvent(EVENT_PLAYER_UNIT_PICKUP_ITEM,function ItemStack)
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope ClassItemPick initializer init
private function ItemCheck takes nothing returns boolean
local unit marine = GetTriggerUnit()
local item whichItem = GetManipulatedItem()
local player owner = GetOwningPlayer(marine)
local integer marineId = GetUnitTypeId(marine)
local integer whichItemId = GetItemTypeId(whichItem)
local boolean drop = false
if GetItemType(whichItem)==ITEM_TYPE_PERMANENT then
if whichItemId == 'I002' and marineId != 'H00J' then //Exoarmor
set drop = true
elseif whichItemId == 'I008' and marineId != 'H00K' then //Improved google
set drop = true
elseif whichItemId == 'I00A' and marineId != 'H00H' then //Repair Tool
set drop = true
elseif whichItemId == 'I00D' and marineId != 'H01D' then //Improved Laser Device
set drop = true
elseif whichItemId == 'I007' and marineId != 'H010' then //Leg Upgrade
set drop = true
elseif whichItemId == 'I005' then //Pump system
if not (marineId == 'H017' or marineId == 'H00E') then
set drop = true
endif
elseif whichItemId == 'I006' then //Reinforced Suit
if not (marineId == 'H01B' or marineId == 'H000') then
set drop = true
endif
elseif whichItemId == 'I003' and marineId != 'H00D' then //sawed off shotgun
set drop = true
elseif whichItemId == 'I001' and marineId != 'H00I' then //secure perimeter
set drop = true
elseif whichItemId == 'I000' then //Sniper Scope
if not (marineId == 'H01P' or marineId == 'H00X') then
set drop = true
endif
endif
if drop == true then
call ErrorSound(owner)
call DisplayTextToPlayer(owner,0.,0.,"You are not allowed to use this item")
call RemoveItem(whichItem)
call CreateItem(whichItemId,GetUnitX(marine),GetUnitY(marine))
endif
endif
set marine = null
set whichItem = null
return false
endfunction
public function init takes nothing returns nothing
call RegisterAnyUnitEvent(EVENT_PLAYER_UNIT_PICKUP_ITEM,function ItemCheck)
endfunction
endscope
//TESH.scrollpos=145
//TESH.alwaysfold=0
library EquipementBox initializer init needs AutoIndex, AmmoSystem
globals
constant integer BOX_ID = 'o01L'
private constant integer SPAWNMIN = 1
private constant integer SPAWNMAX = 3
private constant integer CHANCE_CLASSITEM = 5
private constant real AOE = 75.
private integer array ItemId [30]
private integer array ClassItemId [30]
private integer array ChargedId [30]
private integer ChargedMax
private integer ClassMax
private integer ItemMax
endglobals
private function SetItemVariables takes nothing returns nothing
local integer i = 0
set ChargedId[i] = 'I004' //Concussion grenade
set i = i + 1
set ChargedId[i] = 'I00F' //Directionnal Mine
set i = i + 1
set ChargedId[i] = 'I038' //Electro magnetic pulse
set i = i + 1
set ChargedId[i] = 'I033'//bandage pack
set i = i + 1
set ChargedId[i] = 'I00E'//Chain Explosive
set i = i + 1
set ChargedId[i] = 'I01T'//Emergency battery
set i = i + 1
set ChargedId[i] = 'I00V' //Flash grenade
set i = i + 1
set ChargedId[i] = 'I00U'//Fragmentation Grenade
set i = i + 1
set ChargedId[i] = 'I036'//Instant immunity
set i = i + 1
set ChargedId[i] = 'I03A'//Mental prep manual
set i = i + 1
set ChargedId[i] = 'I00G'//Mine
set i = i + 1
set ChargedId[i] = 'I01S'//Morphine Pill
set i = i + 1
set ChargedId[i] = 'I037'//Polarizator
set i = i + 1
set ChargedId[i] = 'I00O'//Remote bomb
set i = i + 1
set ChargedId[i] = 'I034'//Static Discharge
set i = i + 1
set ChargedId[i] = 'I039'//Survival manual
set i = i + 1
set ChargedId[i] = 'I03B'//Survival training skills
set i = i + 1
set ChargedId[i] = 'I035'//Vaccin
set ChargedMax = i
set i = 0
set ItemId[i] = 'I00P'//Satchel
set i = i + 1
set ItemId[i] = 'I01N'//Ernegy drink injector
set i = i + 1
set ItemId[i] = 'I00U'//Armored plate mkI
set i = i + 1
set ItemId[i] = 'I02V'// Head Mounted Dsiplay
set i = i + 1
set ItemId[i] = 'I00B'// Energy Cell
set i = i + 1
set ItemId[i] = 'I02O'//Improved Stocks
set i = i + 1
set ItemId[i] = 'I02C'//athletic training
set i = i + 1
set ItemId[i] = 'I027'//deflection suit
set i = i + 1
set ItemId[i] = 'I01X'//First Aid Kit
set i = i + 1
set ItemId[i] = 'I009'//Solar Energy
set i = i + 1
set ItemId[i] = 'I02K'//Kevlar Suit
set i = i + 1
set ItemId[i] = 'I00Y'//Dynamo
set i = i + 1
set ItemId[i] = 'I016'//NanoRobot Drip
set i = i + 1
set ItemId[i] = 'I013'//Gazoline Motor
set i = i + 1
set ItemId[i] = 'I02G'//Spaulder Mark I
set ItemMax = i
set i = 0
set ClassItemId[i] ='I002'//FB - Exo Armor
set i = i + 1
set ClassItemId[i] ='I008'//FR - Improved Google
set i = i + 1
set ClassItemId[i] ='I00A'//MC - Improved Repair Tool
set i = i + 1
set ClassItemId[i] ='I007'//CY - Leg Upgrade
set i = i + 1
set ClassItemId[i] ='I005'//PH-CO Pump System
set i = i + 1
set ClassItemId[i] ='I006'//AS-HS - Reinforced Suit
set i = i + 1
set ClassItemId[i] ='I003'//BI - Sawed Off Shotgun
set i = i + 1
set ClassItemId[i] ='I001'//SO - Secure Perimeter
set i = i + 1
set ClassItemId[i] ='I000'//PS-LS - Sniper Scope
set i = i + 1
set ClassItemId[i] ='I00D'//EF - Improved Laser Device
set ClassMax = i
endfunction
private function UnitDeath takes nothing returns boolean
local unit victim = GetTriggerUnit()
local integer Amount = GetRandomInt(SPAWNMIN,SPAWNMAX)
local real x = GetUnitX(victim)
local real y = GetUnitY(victim)
local integer i = 0
local integer neededId = 0
loop
exitwhen i > Amount
if GetRandomInt(0,100)<=50 then
call CreateItem(ItemId[GetRandomInt(0,ItemMax)],x+GetRandomReal(-AOE,AOE),y+GetRandomReal(-AOE,AOE))
else
call CreateItem(ChargedId[GetRandomInt(0,ChargedMax)],x+GetRandomReal(-AOE,AOE),y+GetRandomReal(-AOE,AOE))
endif
set i = i + 1
endloop
set i = 0
loop
exitwhen i > MAXPLAYER
if GetPlayerSlotState(Player(i))==PLAYER_SLOT_STATE_PLAYING and GetPlayerController(Player(i)) == MAP_CONTROL_USER then
set neededId = GetAmmoNeeded(Hero[i])
call SetItemCharges(CreateItem(neededId,x+GetRandomReal(-AOE,AOE),y+GetRandomReal(-AOE,AOE)),GetRandomInt(1,5))
endif
set i = i + 1
endloop
if GetRandomInt(0,100)<=CHANCE_CLASSITEM then
call CreateItem(ClassItemId[GetRandomInt(0,ClassMax)],x+GetRandomReal(-AOE,AOE),y+GetRandomReal(-AOE,AOE))
endif
set victim = null
return false
endfunction
private struct str
trigger trig
private static method createFilter takes unit u returns boolean
return GetUnitTypeId(u)==BOX_ID
endmethod
private method onCreate takes nothing returns nothing
set .trig = CreateTrigger()
call TriggerRegisterUnitEvent(.trig,me,EVENT_UNIT_DEATH)
call TriggerAddCondition(.trig,Condition(function UnitDeath))
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
call DisableTrigger(.trig)
call DestroyTrigger(.trig)
set .trig = null
endmethod
implement AutoDestroy
endstruct
private function init takes nothing returns nothing
local integer i = 0
call SetItemVariables()
loop
exitwhen i > ItemMax
call RemoveItem(CreateItem(ItemId[i],0.,0.))
set i = i + 1
endloop
endfunction
endlibrary
//TESH.scrollpos=16
//TESH.alwaysfold=0
library ItemSpawn needs TimerUtils, TextDisplay, CheckPointValidity
globals
private constant real TIMEOUT_FLY = 10.
private constant integer DRONE_ID = 'n01K'
private constant integer SPELL ='A05C'
private constant integer SPEED = 50
private constant real IMP = 1.
private constant real SPAWN_DISTANCE = 4000.
private constant real SPAWN_Z = 400.
endglobals
private function Drop takes real x, real y returns nothing
local unit dummy = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),BOX_ID,x,y,0.)
call SetUnitFlyHeight(dummy, SPAWN_Z, 0.)
call SetUnitFlyHeight(dummy, 0.,400.)
set dummy = null
endfunction
private struct s_drop
unit drone
real angle
integer distance
integer firepoint
integer i
real targetX
real targetY
integer boxPerFly
integer dropCount
integer dropInterval
endstruct
private function UpdateDrop takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_drop dat = GetTimerData(t)
local real newX = GetUnitX(dat.drone) + SPEED*Cos(dat.angle)
local real newY = GetUnitY(dat.drone) + SPEED*Sin(dat.angle)
local real z = GetUnitFlyHeight(dat.drone)
local real newz = 0.
if dat.i < dat.distance then
set dat.i = dat.i + 1
call SetUnitPosition(dat.drone, newX, newY)
if dat.i == dat.firepoint and dat.dropCount< dat.boxPerFly then
set dat.firepoint = dat.firepoint + dat.dropInterval
set dat.dropCount = dat.dropCount + 1
call Drop(newX,newY)
endif
else
call RemoveUnit(dat.drone)
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function EquipementDropMission takes integer boxPerFly returns nothing
local timer t = NewTimer()
local s_drop dat = s_drop.create()
local real x1 = GetRandomReal(MapXMin,MapXMax)
local real y1 = GetRandomReal(MapYMin,MapYMax)
local real x2 = GetRandomReal(MapXMin,MapXMax)
local real y2 = GetRandomReal(MapYMin,MapYMax)
local real angle = Atan2((y2 -y1), (x2 - x1))
call FlySound()
set dat.targetX = x2
set dat.targetY = y2
set dat.angle = angle
set dat.distance =R2I(SquareRoot((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))/SPEED)
set dat.dropInterval =R2I(dat.distance/boxPerFly)
set dat.firepoint = dat.dropInterval
set dat.i = 0
set dat.dropCount = 0
set dat.boxPerFly = boxPerFly
set dat.drone = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),DRONE_ID,x1,y1, dat.angle*bj_RADTODEG )
call SetUnitFlyHeight(dat.drone,SPAWN_Z,0.)
call SetTimerData(t, dat)
call TimerStart (t, TIMEOUT, true, function UpdateDrop)
endfunction
private struct s_delay
integer i
integer boxPerFly
integer flyAmount
endstruct
private function UpdateDelay takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_delay dat = GetTimerData(t)
if dat.i < dat.flyAmount then
set dat.i = dat.i + 1
call EquipementDropMission(dat.boxPerFly)
else
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
function StartItemSpawn takes integer flyAmount, integer boxPerFly returns nothing
local timer t = NewTimer()
local s_delay dat = s_delay.create()
set dat.i = 0
call DisplayAll("Pilot", " Equipment drops commencing")
set dat.flyAmount = flyAmount
set dat.boxPerFly = boxPerFly
call SetTimerData(t,dat)
call TimerStart(t,TIMEOUT_FLY,true,function UpdateDelay)
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library RecipeSYS initializer Init needs Table
// ¤ v0.6d ¤
// ( *'*-._.-*'*-._.-*'*-._.-*'* )
// ) RecipeSYS (
// ( Created by Artificial )
// )*'*-._.-*'*-._.-*'*-._.-*'*(
// ¤ ¤
//
// How to use the RecipeSYS
// ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨
// ---- Adding recipes
// Adding recipes is rather easy. You just call a function
// and give it some arguments. The function you call is
// recipe.create, and is called like this:
//
// call recipe.create(i1, i2, i3, i4, i5, i6, result, sfx, attPoint, charges, chargeType)
//
// i1 - i6 are the raw codes* of the items required for the
// recipe to combine. result is the raw code of the item they
// will combine to. sfx is the path of the special effect you
// want to use (give "" for default), and attPoint the attachment
// point of it ("" for default). The boolean charges is whether
// the result should have some other amount of charges than the
// default one. If it is true, chargeType determines what amount
// of charges the result will get when combined (-1 => amount of
// charges left in the ingredient with most charges, 0 => sum of
// charges left in the ingredients, anything else => the number
// given as the argument).
//
// * You can find out the rawcodes by going to the object
// editor and pressing ctrl + D. The first 4 characters
// are the rawcode of the item. When calling the function,
// remember to put the rawcode between ' and ' in case
// you want it to work.
//
// If you want the recipe to require less than 6 items, just give
// zeros as ingredient arguments.
//
// --- AddRecipe Wrappers
// You can also add recipes using some of the wrapper
// functions: AddRecipe, AddRecipeEx, AddRecipeWithCharges,
// and AddRecipeWithChargesEx.
//
// AddRecipe takes i1, i2, i3, i4, i5, i6, result
// AddRecipeEx takes i1, i2, i3, i4, i5, i6, result, sfx, attPoint
// AddRecipeWithCharges takes i1, i2, i3, i4, i5, i6, result, chargeType
// AddRecipeWithChargesEx takes i1, i2, i3, i4, i5, i6, result, chargeType, sfx, attPoint
//
// ---- Removing Recipes
// There are two ways of removing recipes: destroyin a specific
// recipe and removing recipes by the result (removes all recipes
// with that item as result).
// Removing a specific recipe is done by calling the .destroy method
// for that recipe, and removing by result is done by using the
// RemoveRecipeByResult function, eg. like this:
//
// call RemoveRecipeByResult('belv')
//
// ---- Disassembling Items
// Disassembling an item that is a result of some recipe would cause
// the item to be replaced with the ingredients of the recipe.
// Example of usage:
//
// call DisassembleItem(GetManipulatedItem(), GetTriggerUnit())
//
// The first argument is the item to be disassembled and the second
// one is the unit to give the ingredients to. In case you don't want
// to give the items to an unit, give null as the unit argument.
// You also have the DisassembleItemByRecipe function, which takes
// one argument more: the recipe whose ingredients you want the item
// to be disassembled to.
//
// There are a few restrictions with the disassembling:
// - If the item being disassemled isn't created by the system,
// and used on an item that is the result of several recipes
// the system will just give the items that are required for one
// of the recipes.
// - When used on an recipe added via the charged recipe thingy
// the ingredient items won't recieve the amount of items they
// had when the result was made, but the default amount of charges.
//
// Note: If you are using the function with the 'A unit Loses an item'
// event you'll need to add a little wait before the function
// call in case you want the items to be created at the position
// where the item was dropped. And the wait is also needed when
// the item being disassembled is the result of a recipe that has
// only the same type of items as ingredients (or at least I think so).
//
// ---- Disabling and Re-Enabling Recipes
// Instead of removing a recipe to disable it and then adding the
// recipe again you can also disable and enable the recipe.
// This is done by setting the enabled member of the recipe to false
// (or to true if enabling). You can also use the EnableRecipeByResult
// function:
//
// call EnableRecipeByResult('fgdg', false)
//
// That would disable the recipes that have the item 'fgdg' as result.
// The enabling of the recipe would happen with the same function, but
// with true as the boolean argument.
//
// ---- Disabling/Re-enabling the System
// If you need to disable/enable the system for some time, you can use these lines:
//
// call DisableTrigger(RecipeSYS_TRIGGER)
// call EnableTrigger(RecipeSYS_TRIGGER)
//
// Note, that this only disables the combining of items by the system itself,
// if you're using a combining trigger of your own, you'll need to disable that
// trigger.
//
// ---- Manual Checking For Recipes
// In case you'd want to use some other event than the 'A unit Acquires an
// item', you can set AUTO_COMBINE to false, and create a trigger that has
// the event you want (eg. 'A unit Starts the effect of an ability'), and
// then call the CheckForRecipes function from there. The arguments it takes
// are the item that should be checked if it belongs to a recipe and the unit
// the result should be created to (if any is created).
// The function returns a boolean depending on whether it combined the item
// to something or not. And if it combined something, you can refer to the
// created item with bj_lastCreatedItem (Last created item in GUI).
//
// Strengths of RecipeSYS
// ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨
// - Supports having several items of the same type as
// ingredients in the same recipe.
// - Supports having the same item type as an ingredient in
// several recipes.
// - Allows to specify the special effect and it's attachment
// point (each recipe can have its own ones, if you wish so).
// - All you need to do is add the recipes.
// - You can remove recipes.
// - You can add recipes with results that have charges.
// - The amount of charges can be predefined, the sum of charges
// left in the ingredients, or the amount of charges in the
// ingredient with most charges.
// - You can disable and enable single recipes or the whole sytem.
// - You can disassemble items.
// - You can disable the automatic combining of items, and create
// a trigger that combines items manually (so you can have any
// event you want).
//
// Weaknesses of RecipeSYS
// ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨
// - Don't know if it's optimized as much as it could nor if it's
// the best recipe system out there. ^_^
// - The item disassembling has some restrictions, and doesn't work
// flawlessy with the 'A unit Loses an item' event (see the Test2
// trigger in the demo map or the instructions of the function for
// additional information).
// - The max amount of item types you can use in recipes as
// ingredients is 8190 / AMOUNT_ING and as results 8190 / AMOUNT_RES.
//
// How to import RecipeSYS
// ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨
// Two easy steps:
// - Copy this trigger to your map.
// - Copy the trigger 'Table' to your map.
// Alternatively:
// - Create a trigger named 'RecipeSYS' in your map.
// - Convert it to Jass (Custom Script) and replace all
// of the code in there with the code in this trigger.
// - Create a trigger named 'Table' in your map.
// - Convert it to Jass (Custom Script) and replace all
// of the code in there with the code in the trigger 'Table'.
globals
// ¤ ¤
// ( *'*-._.-*'*-._.-*'*-._.-*'* )
// ) RecipeSYS configuration (
// ( *'*-._.-*'*-._.-*'*-._.-*'* )
// ¤ ¤
private constant boolean AUTO_COMBINE = true
//Whether you want the system to automatically combine
//the ingredients of a recipe to the result when a unit
//has all of them.
private constant string SFX_PATH = "Abilities\\Spells\\Items\\TomeOfRetraining\\TomeOfRetrainingCaster.mdl"
//The path of the default effect.
private constant string SFX_POINT = "origin"
//The default attachment point.
private constant integer AMOUNT_ING = 10
//The amount of recipes an item can be an ingredient in.
private constant integer AMOUNT_RES = 10
//The amount of recipes an item can be a result in.
// ¤ ¤
// ( *'*-._.-*'*-._.-*'*-._.-*'* )
// )DO NOT EDIT PAST THIS POINT(
// ( *'*-._.-*'*-._.-*'*-._.-*'* )
// )Well, you can if you really(
// ( want to, but only if you )
// )know what you're doing. And(
// ( it's not needed, anyways. )
// )*'*-._.-*'*-._.-*'*-._.-*'*(
// ¤ ¤
public constant trigger TRIGGER = CreateTrigger()
private Table ING_TABLE
private Table RES_TABLE
private HandleTable COMBINE_TABLE
endglobals
private type ingIn extends recipe array [AMOUNT_ING]
private type resIn extends recipe array [AMOUNT_RES]
struct recipe
integer array items [6]
integer result
integer chargeType
string sfx
string point
boolean resultHasCharges
boolean enabled
static method create takes integer i1, integer i2, integer i3, integer i4, integer i5, integer i6, integer result, string sfx, string attPoint, boolean charges, integer chargetype returns recipe
local recipe i = recipe.allocate()
local ingIn ing
local resIn res
local boolean array b
local integer j = 0
local integer k
local integer l = 0
set i.items[0] = i1
set i.items[1] = i2
set i.items[2] = i3
set i.items[3] = i4
set i.items[4] = i5
set i.items[5] = i6
set i.result = result
set i.enabled = true
set i.resultHasCharges = charges
set i.chargeType = chargetype
//To prevent linking the recipe to the item type twice.
set b[0] = true
set b[1] = i2 != i1
set b[2] = i3 != i2 and i3 != i1
set b[3] = i4 != i3 and i4 != i2 and i4 != i1
set b[4] = i5 != i4 and i5 != i3 and i5 != i2 and i5 != i1
set b[5] = i6 != i5 and i6 != i4 and i6 != i3 and i6 != i2 and i6 != i1
//Set the SFX things (default or specified).
if sfx == "" then
set i.sfx = SFX_PATH
else
set i.sfx = sfx
endif
if attPoint == "" then
set i.point = SFX_POINT
else
set i.point = attPoint
endif
//Linking the recipe to the item types.
loop
if i.items[j] != 0 and b[j] then
set k = ING_TABLE[i.items[j]]
if k != 0 then
//Item type is in another recipe aswell.
set ing = ingIn(k)
set k = 0
//Seek for an open slot.
loop
exitwhen ing[k] == 0
set k = k + 1
if k == ingIn.size then
debug call BJDebugMsg("|cffff0202RecipeSYS Error:|r AMOUNT_ING is too small!")
return 0
endif
endloop
else
//First appearance for the item type.
set ing = ingIn.create()
set k = 0
endif
set ing[k] = i
set ING_TABLE[i.items[j]] = integer(ing)
endif
set j = j + 1
exitwhen j == 6
endloop
set k = RES_TABLE[i.result]
if k != 0 then
//Item type is in some other recipe, too.
set res = resIn(k)
set k = 0
loop
exitwhen res[k] == 0
set k = k + 1
if k == resIn.size then
debug call BJDebugMsg("|cffff0202RecipeSYS Error:|r AMOUNT_RES too small!")
return 0
endif
endloop
else
//First time being in a recipe for the item type.
set res = resIn.create()
endif
set res[k] = i
set RES_TABLE[i.result] = integer(res)
return i
endmethod
private method ClearRecipeFromIngredient takes integer it returns nothing
local integer i = 0
local integer j
local ingIn ing = ingIn(ING_TABLE[it])
if it == 0 or integer(ing[0]) == 0 then
return
endif
//Finding the right array slot and setting it's value to 0.
loop
exitwhen i == ingIn.size
if ing[i] == this then
set j = i + 1
//Finding the last used array slot.
loop
exitwhen j == ingIn.size or ing[j] == 0
set j = j + 1
endloop
set j = j - 1
set ing[i] = ing[j]
set ing[j] = 0
exitwhen true
endif
set i = i + 1
endloop
//Free the array and flush if the slots are empty.
if integer(ing[0]) == 0 then
call ING_TABLE.flush(it)
call ing.destroy()
endif
endmethod
private method ClearRecipeFromResult takes integer it returns nothing
local integer i = 0
local integer j
local resIn res = resIn(RES_TABLE[it])
if it == 0 then
return
endif
//Finding the right array slot and setting it's value to 0.
loop
exitwhen i == resIn.size
if res[i] == this then
set j = i + 1
//Finding the last used array slot.
loop
exitwhen j == resIn.size or res[j] == 0
set j = j + 1
endloop
set j = j - 1
set res[i] = res[j]
set res[j] = 0
exitwhen true
endif
set i = i + 1
endloop
//Free the array slots and flush if it's empty.
if res[0] == 0 then
call RES_TABLE.flush(it)
call res.destroy()
endif
endmethod
method onDestroy takes nothing returns nothing
local integer i = 0
loop
call .ClearRecipeFromIngredient(.items[i])
set i = i + 1
exitwhen i == 6
endloop
call .ClearRecipeFromResult(.result)
set .result = 0
endmethod
endstruct
//****************************************************
//** Recipes Without Charges **
//****************************************************
function AddRecipe takes integer item1, integer item2, integer item3, integer item4, integer item5, integer item6, integer result returns recipe
return recipe.create(item1, item2, item3, item4, item5, item6, result, "", "", false, 0)
endfunction
function AddRecipeEx takes integer item1, integer item2, integer item3, integer item4, integer item5, integer item6, integer result, string sfx, string attachmentPoint returns recipe
return recipe.create(item1, item2, item3, item4, item5, item6, result, sfx, attachmentPoint, false, 0)
endfunction
//****************************************************
//** Recipes With Charges **
//****************************************************
function AddRecipeWithCharges takes integer item1, integer item2, integer item3, integer item4, integer item5, integer item6, integer result, integer chargeType returns recipe
return recipe.create(item1, item2, item3, item4, item5, item6, result, "", "", true, chargeType)
endfunction
function AddRecipeWithChargesEx takes integer item1, integer item2, integer item3, integer item4, integer item5, integer item6, integer result, integer chargeType, string sfx, string attachmentPoint returns recipe
return recipe.create(item1, item2, item3, item4, item5, item6, result, sfx, attachmentPoint, true, chargeType)
endfunction
//****************************************************
//** Removing Recipes **
//****************************************************
function RemoveRecipeByResult takes integer result returns nothing
local resIn res = resIn(RES_TABLE[result])
loop
exitwhen integer(res[0]) == 0
call res[0].destroy()
endloop
endfunction
//****************************************************
//** Disabling and enabling recipes **
//****************************************************
function EnableRecipeByResult takes integer result, boolean enable returns nothing
local resIn res = resIn(RES_TABLE[result])
local integer i = 0
loop
exitwhen integer(res[i]) == 0
set res[i].enabled = enable
set i = i + 1
endloop
endfunction
//****************************************************
//** Disassembling Combined Items **
//****************************************************
function DisassembleItemByRecipe takes item whichItem, unit whichUnit, recipe re returns nothing
local integer i = 0
local real x = GetItemX(whichItem)
local real y = GetItemY(whichItem)
local boolean b = IsTriggerEnabled(GetTriggeringTrigger())
local boolean c = IsTriggerEnabled(TRIGGER)
if re.result == GetItemTypeId(whichItem) then
if b then
//Avoid clashing with some events.
call DisableTrigger(GetTriggeringTrigger())
endif
call COMBINE_TABLE.flush(whichItem)
call RemoveItem(whichItem)
//Should the items be created for a unit or at ground?
if whichUnit == null then
loop
call CreateItem(re.items[i], x, y)
set i = i + 1
exitwhen i == 6
endloop
else
if c then
//Preventing infinite loop.
call DisableTrigger(TRIGGER)
endif
loop
call UnitAddItemById(whichUnit, re.items[i])
set i = i + 1
exitwhen i == 6
endloop
if c then
call EnableTrigger(TRIGGER)
endif
endif
if b then
call EnableTrigger(GetTriggeringTrigger())
endif
endif
endfunction
function DisassembleItem takes item whichItem, unit whichUnit returns nothing
local integer id = GetItemTypeId(whichItem)
local resIn r = resIn(RES_TABLE[id])
local recipe re = recipe(COMBINE_TABLE[whichItem])
if integer(re) == 0 or re.result != id then //The last one just in case the recipe has been destroyed.
if integer(r[0]) == 0 then
return
endif
set re = r[0]
endif
call DisassembleItemByRecipe(whichItem, whichUnit, re)
endfunction
//****************************************************
//** Combining **
//****************************************************
private function Combine takes recipe rec, unit u returns boolean
local integer array itemsReq
local integer itemInSlot
local integer topCharges = 0
local integer sumCharges = 0
local integer i = 0
local integer j = 0
local item resu
local item array itemsToCombine
//Setting the items.
loop
set itemsReq[i] = rec.items[i]
set i = i + 1
exitwhen i == 6
endloop
set i = 0
//Finding the items.
loop
set itemInSlot = GetItemTypeId(UnitItemInSlot(u, i))
loop
if itemsReq[j] == itemInSlot and itemInSlot != 0 then
set itemsToCombine[j] = UnitItemInSlot(u, i)
set itemsReq[j] = 0
exitwhen true
endif
set j = j + 1
exitwhen j == 6
endloop
set j = 0
set i = i + 1
exitwhen i == 6
endloop
set i = 0
set j = 0
//Checking if all items were found.
loop
if itemsReq[i] != 0 then
loop
set itemsToCombine[j] = null
set j = j + 1
exitwhen j == 6
endloop
return false
endif
set i = i + 1
exitwhen i == 6
endloop
set i = 0
//Remove the old items.
loop
//Set the different charge amounts in case the result has charges.
set j = GetItemCharges(itemsToCombine[i])
set sumCharges = sumCharges + j
if j > topCharges then
set topCharges = j
endif
call COMBINE_TABLE.flush(itemsToCombine[i])
call RemoveItem(itemsToCombine[i])
set itemsToCombine[i] = null
set i = i + 1
exitwhen i == 6
endloop
//Create the result.
set resu = UnitAddItemById(u, rec.result)
call DestroyEffect(AddSpecialEffectTarget(rec.sfx, u, rec.point))
//Set charges if it should have any.
if rec.resultHasCharges then
if rec.chargeType == 0 then
call SetItemCharges(resu, sumCharges)
elseif rec.chargeType == -1 then
call SetItemCharges(resu, topCharges)
else
call SetItemCharges(resu, rec.chargeType)
endif
endif
//Set the data if wanted.
set COMBINE_TABLE[resu] = integer(rec)
set bj_lastCreatedItem = resu
set resu = null
return true
endfunction
//****************************************************
//** Recipe Finding **
//****************************************************
function CheckForRecipes takes item check, unit u returns boolean
local ingIn r = ingIn(ING_TABLE[GetItemTypeId(check)])
local integer i = 0
loop
exitwhen integer(r[i]) == 0
if r[i].enabled then
if Combine(r[i], u) then
return true
endif
endif
set i = i + 1
endloop
return false
endfunction
private function Check takes nothing returns boolean
return CheckForRecipes(GetManipulatedItem(), GetTriggerUnit())
endfunction
//=====================================================================
private function SafeFilt takes nothing returns boolean
return true
endfunction
//=====================================================================
private function Init takes nothing returns nothing
local integer index = 0
if AUTO_COMBINE then
loop
call TriggerRegisterPlayerUnitEvent(TRIGGER, Player(index), EVENT_PLAYER_UNIT_PICKUP_ITEM, Filter(function SafeFilt))
set index = index + 1
exitwhen index == bj_MAX_PLAYER_SLOTS
endloop
call TriggerAddCondition(TRIGGER, Condition(function Check))
endif
set ING_TABLE = Table.create()
set RES_TABLE = Table.create()
set COMBINE_TABLE = HandleTable.create()
endfunction
endlibrary
//TESH.scrollpos=57
//TESH.alwaysfold=0
scope RecipeSets initializer init
private function init takes nothing returns nothing
call AddRecipe('I01U','I01U',0,0,0,0,'I019') //2X armored plate mk 1 = armored plate mk II
call AddRecipe('I019','I019',0,0,0,0,'I01Y') //2x armored plate mk II = Mail Armor
call AddRecipe('I01Y','I01Y',0,0,0,0,'I01A') //2x Mail Armor = Stab vest
//Health Points
call AddRecipe('I01N','I01N',0,0,0,0,'I01M')//2 Energy Drink Injector = Epinephrine Pomp
call AddRecipe('I01M','I01N',0,0,0,0,'I01E')//2 Epinephrine Pomp = Autoinjector
call AddRecipe('I01E','I01N',0,0,0,0,'I01P')//2 Autoinjector = Cybernetic Roots
call AddRecipe('I01P','I01N',0,0,0,0,'I01W')//2 Cybernetic Roots = Snyapse Electronic Link
call AddRecipe('I01W','I01N',0,0,0,0,'I01V')//2 Snyapse Electronic Link = Nanobacterium Generator
call AddRecipe('I01V','I01N',0,0,0,0,'I01Q')//2 Nanobacterium Generator = Managed Fusion Generator
//Energy Points
call AddRecipe('I00B','I00B',0,0,0,0,'I01J')//2 Energy Cell = Condensator
call AddRecipe('I01J','I00B',0,0,0,0,'I01I')//2 Condensator = Accumulator
call AddRecipe('I01I','I00B',0,0,0,0,'I01H')//2 Condensator = ElectroStatic Pack
call AddRecipe('I01H','I00B',0,0,0,0,'I01F')//2 ElectroStatic Pack = High Capacty Energy Cell
call AddRecipe('I01F','I00B',0,0,0,0,'I01K')//2 High Capacty Energy Cell = Microgravity Internal Combustor
call AddRecipe('I01K','I00B',0,0,0,0,'I01L')//2 Microgravity Internal Combustor = Micro-Gamma Track
//Damage
call AddRecipe('I02O','I02O',0,0,0,0,'I02Q')// 2 Improved Stocks = advanced Rifling
call AddRecipe('I02Q','I02O',0,0,0,0,'I02R')// 2 advanced Rifling = Polygonal Rifling
call AddRecipe('I02R','I02O',0,0,0,0,'I02S')// 2 Polygonal Rifling = Integrated Sight
call AddRecipe('I02S','I02O',0,0,0,0,'I02N')// 2 Integrated Sight = Predicated Impact Point
call AddRecipe('I02N','I02O',0,0,0,0,'I02P')// 2 Predicated Impact Point = Illuminated Reticle
call AddRecipe('I02P','I02O',0,0,0,0,'I02T')// 2 Illuminated Reticle = Infantry HUD
//CS
call AddRecipe('I02V','I02V',0,0,0,0,'I02X')//2 Head Mounted Dsiplay = bundle Adjustement Tool
call AddRecipe('I02X','I02V',0,0,0,0,'I030')//2 bundle Adjustement Tool = Haptic Technology
call AddRecipe('I030','I02V',0,0,0,0,'I02U')//2 Haptic Technology = Augmented Reality System
call AddRecipe('I02U','I02V',0,0,0,0,'I02Y')//2 Augmented Reality System = Fiduciary Marker Tracer
call AddRecipe('I02Y','I02V',0,0,0,0,'I032')//2 Fiduciary Marker Tracer = Virtual Retinal Display
call AddRecipe('I032','I02V',0,0,0,0,'I02W')//2 Virtual Retinal Display = Iterative Reconstruction
call AddRecipe('I02W','I02V',0,0,0,0,'I02Z')//2 Iterative Reconstruction= Structure From Motion Recorder
call AddRecipe('I02Z','I02V',0,0,0,0,'I031')//2 Structure From Motion Recorder= Volumetric Retinal Display
//Movespeed
call AddRecipe('I02C','I02C',0,0,0,0,'I02D') //2 athletic training = marathon training
call AddRecipe('I02D','I02D',0,0,0,0,'I02E') //2 marathon training = kevlar test shooes
call AddRecipe('I02E','I02E',0,0,0,0,'I02B') //2 kevlar test shooes = soap shoes
//attack rate
call AddRecipe('I027','I027',0,0,0,0,'I028') //2 deflection suit = reflection suit
call AddRecipe('I028','I028',0,0,0,0,'I029') //2 reflection suit = eletro Static Deflection suit
call AddRecipe('I029','I029',0,0,0,0,'I02A') //2 eletro Static Deflection suit = castigliano suit
//Health Point regeneration
call AddRecipe('I01X','I01X',0,0,0,0,'I024') //2 First Aid Kit = Medical Corps Link
call AddRecipe('I024','I024',0,0,0,0,'I025') //2 Medical Corps Link = Telecommunication
call AddRecipe('I025','I025',0,0,0,0,'I026') //2 Telecommunication = Permanent Link
//Mana Point regeneration
call AddRecipe('I009','I009',0,0,0,0,'I022') //2 Solar Energy = Thermodynamic
call AddRecipe('I022','I022',0,0,0,0,'I023') //2 Thermodynamic = Hydrogene Combustion
call AddRecipe('I023','I023',0,0,0,0,'I021') //2 Hydrogene Combustion = Vacuum Energy
//Dodge
call AddRecipe('I02K','I02K',0,0,0,0,'I02L') //2 Kevlar Suit = Vectran Suit
call AddRecipe('I02L','I02L',0,0,0,0,'I02J') //2 Vectran suit = Spider Silk Suit
call AddRecipe('I02J','I02J',0,0,0,0,'I02M') //2 Spider Silk Suit = Ultra High Molecular Weight Polyethylene
//Electronic
call AddRecipe('I00Y','I00Y',0,0,0,0,'I00Z') //2 Dynamo = Static Convertor
call AddRecipe('I00Z','I00Z',0,0,0,0,'I010') //2 Static Convertor = Ionic Battery
//Endurance
call AddRecipe('I016','I016',0,0,0,0,'I018') //2 NanoRobot Drip = Metabolism Convertor
call AddRecipe('I018','I018',0,0,0,0,'I017') //2 Metabolism Convertor = Direct Injector
//Motorization
call AddRecipe('I013','I013',0,0,0,0,'I014') //2 Gazoline Motor = Ion Motor
call AddRecipe('I014','I014',0,0,0,0,'I015') //2 Ion Motor = Hydrogene Battery
//Defense
call AddRecipe('I02G','I02G',0,0,0,0,'I02H') //2 Spaulder Mark I = Spauler Mark II
call AddRecipe('I02H','I02H',0,0,0,0,'I02I') //2 Spaulder Mark II = Interceptor Body Armor
call AddRecipe('I02I','I02I',0,0,0,0,'I02F') //2 Interceptor Body Armor = Molecular Tactic Vest
endfunction
endscope
//TESH.scrollpos=195
//TESH.alwaysfold=0
library qsys initializer init needs LeaderBoard,GroupUtils,HeroDeath,QuestVariables,ItemSpawn,TextDisplay,Ranks,SoundUtils,SpawnSystem,AlliedSpawnSystem,IsUnitTypeId,SpellEvent
globals
private constant real TIMEOUT_LAST_QUESTUPDATE = 30.
integer ChapterDone = 0
boolean QuestTargetHero
integer GameMode
real array GameRate [7]
string array GameName [7]
constant integer ALLIED_AI = 10
boolean ChapterIntermission = false
private constant string ICONE = "ReplaceableTextures\\CommandButtons\\BTNAmbush.blp"
private constant string C1 = " mission added"
private constant string C2 = " mission completed"
private constant string C3 = " mission failed"
boolean QuestPingAllowed = false
private constant integer FLY_AMOUNT = 1
private constant integer BOX_AMOUNT = 4
constant real QUEST_WAIT = 10.
constant real CHAPTER_WAIT = 60.
constant integer QUESTUNIT = 'A02K'
constant integer LASTQUESTUNIT_SPELL = 'A02M'
constant string LASTQUESTUNIT_ORDER = "blink"
integer SOUND_QUESTNEW
integer SOUND_QUESTFAIL
integer SOUND_QUESTLOG
integer SOUND_QUESTSUCCESS
constant integer QUESTMAX = 0 //max stack of quests
quest array Quest [90] //Quests
string array QuestStory [90] // ini sotry of the quest
string array QuestTitre [90] // title of the quest
string array QuestEta [90] //ETA of the quest
integer array QuestRank [90] //Rank earned
boolean array QuestBoolean [90] //Boolean for a quest
trigger array QuestTrig [90][30]//maximum 8 triggers/quest
integer array QuestSpawn [90][10] //set the specific spawn points for quests: up to QUESTSPAWNMAX+1 points
integer array QuestUniverse [90]//universe of creeps spawned during a quest
integer array CreepsUniverseId [25][10] //id of the creeps spawned per universe
integer array CreepsUniverseSpecial[25][2]
integer array CreepsUniverseRush[25]
integer array CreepsUniverseAir[25]
integer array CreepsUniverseCoeff [25][10] //to compare the number of units spawned
constant integer CreepsUniverseMaxId = 10 // maximum id per universe
integer array QuestBoss [25][2] //boss spawned at the end of a quest
real array QuestCreepsSpawnRate [90] //time used for the spawn rate of creeps (ex: 15 seconds)
integer array QuestAssautMax [90]
integer CurrentQuestId
unit Building
unit Boss
timer FailTimer
integer CreepsRequiredKill = 0
integer CreepsKill = 0
integer VillagerKill = 0
integer CreepsSubKill = 0
integer VillagerAlive = 0
integer VillagerAll = 0
group VillagerGroup
rect CurrentRect
integer CurrentLastWayPoint
integer CurrentWayPoint
integer CurrentWayPointArrivedUnit
integer CurrentLastWayPointArrivedUnit
rect array ConvoyRect [15]
integer array ConvoySpawn [15][4]
private constant real WAIT_BEFORE_ORDER_MOVE = 5.
constant string MOVE_ORDER = "impale"
constant integer MOVE_SPELL = 'A00N'
private constant real RATIO = 0.75
endglobals
function PingQuest takes real x, real y, real dur1, real dur2 returns nothing
if QuestPingAllowed == false then
call PingMinimap(x,y,dur1)
else
call PingMinimap(x,y,dur2)
endif
endfunction
function CountUnitOfConvoyInRect takes nothing returns nothing
if RectContainsUnit(CurrentRect,GetEnumUnit()) then
set CurrentWayPointArrivedUnit = CurrentWayPointArrivedUnit + 1
endif
endfunction
function MoveAll takes nothing returns nothing
local unit convoyUnit = GetEnumUnit()
local real x = GetRandomReal(GetRectMinX(CurrentRect),GetRectMaxX(CurrentRect))
local real y = GetRandomReal(GetRectMinY(CurrentRect),GetRectMaxY(CurrentRect))
if IsUnitInGroup(convoyUnit,VillagerGroup) and not (RectContainsUnit(CurrentRect,convoyUnit)) then
call IssuePointOrder(convoyUnit,MOVE_ORDER,x,y)
endif
set convoyUnit = null
endfunction
function OrderConvoyToMove takes nothing returns nothing
call ReleaseTimer(GetExpiredTimer())
call PingQuest(GetRectCenterX(CurrentRect),GetRectCenterY(CurrentRect),15.,30.)
call ForGroup(VillagerGroup,function MoveAll)
endfunction
private function ForceToMove takes nothing returns boolean
local unit convoyUnit = GetTriggerUnit()
local real x = GetRandomReal(GetRectMinX(CurrentRect),GetRectMaxX(CurrentRect))
local real y = GetRandomReal(GetRectMinY(CurrentRect),GetRectMaxY(CurrentRect))
if IsUnitInGroup(convoyUnit,VillagerGroup) and QuestBoolean[CurrentQuestId] and not (OrderId2String(GetIssuedOrderId())==MOVE_ORDER) then
call IssuePointOrder(convoyUnit,MOVE_ORDER,x,y)
endif
set convoyUnit = null
return false
endfunction
function CountAliveAllied takes nothing returns nothing
if not (IsUnitType(GetEnumUnit(),UNIT_TYPE_DEAD)) then
set VillagerAlive = VillagerAlive + 1
endif
endfunction
function CountAllAllied takes nothing returns nothing
set VillagerAll = VillagerAll + 1
endfunction
private function UpdateCreeps takes nothing returns nothing
local integer i = 0
call CreepsResetSpawn()
loop
exitwhen i > 4
if ConvoySpawn[CurrentWayPoint][i]!= null then
set SpawnTrue[ConvoySpawn[CurrentWayPoint][i]] = true
endif
set i = i + 1
endloop
endfunction
function WaitBeforeMoveOrder takes nothing returns nothing
local timer t = NewTimer()
call UpdateCreeps()
call TimerStart (t, WAIT_BEFORE_ORDER_MOVE, false, function OrderConvoyToMove )
endfunction
private function CheckCurrentWayPoint takes nothing returns nothing
if QuestBoolean[CurrentQuestId] then
if CurrentWayPoint >= CurrentLastWayPoint and RectContainsUnit(CurrentRect,SpellEvent.CastingUnit)then
call ForGroup(VillagerGroup,function MoveAll)
elseif CurrentWayPoint < CurrentLastWayPoint and RectContainsUnit(CurrentRect,SpellEvent.CastingUnit) then
set CurrentWayPointArrivedUnit = 0
set VillagerAlive = 0
call ForGroup(VillagerGroup,function CountUnitOfConvoyInRect)
call ForGroup(VillagerGroup,function CountAliveAllied)
if CurrentWayPointArrivedUnit > RATIO*VillagerAlive then
set CurrentWayPoint = CurrentWayPoint + 1
set CurrentRect = ConvoyRect[CurrentWayPoint]
call WaitBeforeMoveOrder()
else
call ForGroup(VillagerGroup,function MoveAll)
endif
endif
endif
endfunction
function QuestSetTimeToEvening takes nothing returns nothing
call SetFloatGameState(GAME_STATE_TIME_OF_DAY, 20.)
endfunction
function QuestSetTimeToMorning takes nothing returns nothing
call SetFloatGameState(GAME_STATE_TIME_OF_DAY, 7.)
endfunction
function QuestSetTimeToNight takes nothing returns nothing
call SetFloatGameState(GAME_STATE_TIME_OF_DAY, 0.)
endfunction
function DestroyQuestTrigger takes integer id, integer triggerId returns nothing
call DisableTrigger(QuestTrig[id][triggerId])
call DestroyTrigger(QuestTrig[id][triggerId])
set QuestTrig[id][triggerId] = null
endfunction
private function SpawnQuestBoss takes integer id returns nothing
local integer random = GetRandomInt(0,1)
local integer currentUniverse = QuestUniverse[id]
local real x = GetRandomReal(MapXMin,MapXMax)
local real y = GetRandomReal(MapYMin,MapYMax)
if QuestPingAllowed == true then
call PingMinimapEx(x, y,3., 204, 0, 0, false)
endif
call SpawnCreeps(QuestBoss[currentUniverse][random],11,x,y)
endfunction
private function RemoveLastQuestUnit takes nothing returns boolean
if GetUnitAbilityLevel(GetTriggerUnit(),LASTQUESTUNIT_SPELL)>=1 then
call EraseUnit(GetTriggerUnit())
endif
return false
endfunction
private function OrderLastQuestUnitAgain takes nothing returns nothing
if not SpellEvent.CastFinished then
call IssuePointOrder(SpellEvent.CastingUnit,LASTQUESTUNIT_ORDER,GetRectCenterX(gg_rct_LastQuest),GetRectCenterY(gg_rct_LastQuest))
endif
endfunction
private function UpdateLastQuestUnitDestination takes nothing returns boolean
if GetUnitAbilityLevel(GetFilterUnit(),LASTQUESTUNIT_SPELL)>=1 then
if GetUnitAbilityLevel(GetFilterUnit(),GARN)<=0 then
call UnitAddAbility(GetFilterUnit(),GARN)
endif
call IssuePointOrder(GetFilterUnit(),LASTQUESTUNIT_ORDER,GetRectCenterX(gg_rct_LastQuest),GetRectCenterY(gg_rct_LastQuest))
endif
return true
endfunction
private function SetLastQuestUnitDestination takes nothing returns boolean
local unit target = GetFilterUnit()
if GetUnitAbilityLevel(target,MOVE_SPELL)>=1 and IsUnitInGroup(target,VillagerGroup)==false then
call UnitRemoveAbility(target,MOVE_SPELL)
endif
if GetUnitAbilityLevel(target,QUESTUNIT)>=1 then
call UnitRemoveAbility(target,QUESTUNIT)
call UnitAddAbility(target,LASTQUESTUNIT_SPELL)
call IssuePointOrder(target,LASTQUESTUNIT_ORDER,GetRectCenterX(gg_rct_LastQuest),GetRectCenterY(gg_rct_LastQuest))
endif
set target = null
return true
endfunction
function ChapterRank takes string chapterName, integer amount returns nothing
call DisplayAll(chapterName,"completed."+I2S(amount)+" Xp to all players.")
call RankAll(R2I(amount*GameRate[GameMode]))
call RunSound(SOUND_QUESTSUCCESS)
endfunction
private function PeriodicLastQuestUpdate takes nothing returns boolean
call GroupEnumUnitsOfPlayer(ENUM_GROUP,Player(ALLIED_AI),Filter(function UpdateLastQuestUnitDestination))
return false
endfunction
function EndQuest takes integer id,boolean success returns nothing
call GetAmountOfAlivePlayer()
call QuestSetCompleted( Quest[id], true )
call QuestSetDescription(Quest[id], QuestStory[id]+" "+QuestEta[id])
call SetBoardTitle("Waiting for Control orders...")
call DestroyQuest(Quest[id])
set QuestBoolean[id]=false
if success==true then
call DisplayAll(QuestTitre[id],C2)
call RankAllQuest(id,R2I(QuestRank[id]*GameRate[GameMode]))
call RunSound(SOUND_QUESTSUCCESS)
else
call DisplayAll(QuestTitre[id],C3)
call RunSound(SOUND_QUESTFAIL)
endif
call SpawnQuestBoss(id)
call GroupEnumUnitsOfPlayer(ENUM_GROUP,Player(ALLIED_AI),Filter(function SetLastQuestUnitDestination))
endfunction
function UpdateQuestMbOnly takes integer id returns nothing
call QuestSetDescription(Quest[id], QuestStory[id]+" : "+QuestEta[id])
call SetBoardTitle("Q"+I2S(id)+"-"+QuestTitre[id]+" "+QuestEta[id])
endfunction
function UpdateQuest takes integer id returns nothing
call RunSound(SOUND_QUESTLOG)
call QuestSetDescription(Quest[id], QuestStory[id]+" : "+QuestEta[id])
call SetBoardTitle("Q"+I2S(id)+" - "+QuestTitre[id]+" "+QuestEta[id])
call DisplayAll(QuestTitre[id],QuestEta[id])
endfunction
private function SetQuestSpawn takes integer id returns nothing
local integer i = 0
local integer j = 0
local integer currentUniverse = QuestUniverse[id]
call CreepsResetCreepsId()
call CreepsResetSpawn()
call CreepsChangeTimerRate(QuestCreepsSpawnRate[id])
call CreepsAddSpecialId(CreepsUniverseSpecial[currentUniverse][0])
call CreepsAddSpecialId(CreepsUniverseSpecial[currentUniverse][1])
call CreepsAddRushId(CreepsUniverseRush[currentUniverse])
call CreepsAddAirId(CreepsUniverseAir[currentUniverse])
loop
exitwhen i > CreepsUniverseMaxId-1
if IsUnitTypeId(CreepsUniverseId[currentUniverse][i])==true then
set j = 0
loop
exitwhen j > CreepsUniverseCoeff[currentUniverse][i]
call CreepsAddCreepsId(CreepsUniverseId[currentUniverse][i])
set j = j + 1
endloop
endif
set i = i + 1
endloop
set i = 1
loop
exitwhen i > 10
if QuestSpawn[id][i]!= null and QuestSpawn[id][i]!= 0 then
set SpawnTrue[QuestSpawn[id][i]] = true
endif
set i = i + 1
endloop
if GameMode != 4 and GameMode != 5 then
call CreepsSpawnFirstWave()
endif
endfunction
private function StartQuest takes integer id returns nothing
local integer k = 0
call GetAmountOfAlivePlayer()
call RunSound(SOUND_QUESTNEW)
call AlliedSetAssautMax(QuestAssautMax[id])
set Quest[id] = CreateQuest()
set QuestTitre[id]= "|c00AAAAFF"+QuestTitre[id]+"|r"
call QuestSetTitle(Quest[id], QuestTitre[id])
call QuestSetDescription(Quest[id], QuestStory[id])
call QuestSetIconPath(Quest[id], ICONE)
call QuestSetRequired(Quest[id], true)
call QuestSetDiscovered(Quest[id], true)
call QuestSetCompleted(Quest[id], false)
call QuestSetEnabled(Quest[id],true)
call FlashQuestDialogButton()
call DisplayAll(QuestTitre[id],C1)
call SetBoardTitle("Q"+I2S(id)+" - "+QuestTitre[id]+" "+QuestEta[id])
set QuestBoolean[id]=true
call DisplayAll("Control",QuestStory[id])
set PlayerAmount = 0
set XpAveragePoints = 0
loop
exitwhen k > MAXPLAYER
if GetPlayerSlotState(Player(k))==PLAYER_SLOT_STATE_PLAYING and GetPlayerController(Player(k)) == MAP_CONTROL_USER and IsHeroDefinitelyDead(k)==false then
set PlayerAmount = PlayerAmount + 1
set XpAveragePoints = XpAveragePoints + Xp[k]
endif
set k = k + 1
endloop
if PlayerAmount == 0 then
set PlayerAmount = 1
endif
set XpAverage = R2I(XpAveragePoints / PlayerAmount)
if PlayerAmount <= 1 then
if XpAvailable == true then
if ChapterDone <=1 then
set XpAvailable = false
call DisplayAll("Game", "Not enough players. Experience is disabled")
else
set XpAvailable = true
endif
endif
endif
set XpAverageCoeff = R2I((100*XpAverage)/XpMax)
call SetQuestSpawn(id)
endfunction
private struct str
integer id
endstruct
private function Wait takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
call StartQuest(dat.id)
call ReleaseTimer(t)
call dat.destroy()
endfunction
function IniQuest takes integer id returns nothing
local str dat = str.create()
local timer t = NewTimer()
set dat.id = id
set CreepsKill = 0
set CreepsSubKill = 0
set VillagerKill = 0
set VillagerAlive = 0
set VillagerAll = 0
set CurrentQuestId = id
set CurrentLastWayPointArrivedUnit = 0
set CurrentWayPointArrivedUnit = 0
call SetTimerData(t, dat)
call TimerStart (t, QUEST_WAIT, false, function Wait )
endfunction
private function init takes nothing returns nothing
local trigger t1 = CreateTrigger()
local trigger t2 = CreateTrigger()
local trigger t3 = CreateTrigger()
set GameMode = 0
set QuestTargetHero = false
set ChapterDone = 0
set ChapterIntermission = false
call QuestVariables()
call AbilityPreload(QUESTUNIT)
call AbilityPreload(LASTQUESTUNIT_SPELL)
call RegisterSpellEndCastResponse(LASTQUESTUNIT_SPELL, OrderLastQuestUnitAgain)
call AbilityPreload(MOVE_SPELL)
call RegisterSpellFinishResponse(MOVE_SPELL, CheckCurrentWayPoint)
call TriggerRegisterEnterRectSimple(t1, gg_rct_LastQuest)
call TriggerAddCondition(t1, Condition(function RemoveLastQuestUnit))
call TriggerRegisterTimerEvent(t2, TIMEOUT_LAST_QUESTUPDATE,true)
call TriggerAddCondition(t2, Condition(function PeriodicLastQuestUpdate))
set t3 = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(t3,Player(ALLIEDID), EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER,null )
call TriggerRegisterPlayerUnitEvent(t3,Player(ALLIEDID), EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER,null )
call TriggerRegisterPlayerUnitEvent(t3,Player(ALLIEDID), EVENT_PLAYER_UNIT_ISSUED_ORDER,null )
call TriggerAddCondition(t3, Condition( function ForceToMove) )
endfunction
endlibrary
//TESH.scrollpos=92
//TESH.alwaysfold=0
library SideQuestSystem initializer init needs TextDisplay,Ranks,SoundUtils
globals
private constant string ICONE = "ReplaceableTextures\\CommandButtons\\BTNAmbush.blp"
private constant string C2 = "secondary mission completed"
private constant string C3 = " mission failed"
boolean array SideQuestCompleted [10]
integer SideQuestDone = 0
quest array SideQuest [10]
string array SideQuestStory [10]
string array SideQuestTitre [10]
string array SideQuestEta [10]
string array SideQuestEndText [10]
integer array SideQuestRank [10]
boolean array SideQuestBoolean [10]
private constant integer SIDEQUESTMAX = 7
endglobals
private function SideQuestVariables takes nothing returns nothing
local integer i = 0
//SQ1
set i = i + 1
set SideQuestTitre[i] = "Caves"
set SideQuestStory[i] = "It is possible the caves on this area are linked to the Restricted Complex 601. We have to seal them with satchels"
set SideQuestEndText[i] = "All caves have been sealed."
set SideQuestRank[i] = 100
//SQ2
set i = i + 1
set SideQuestTitre[i] = "Zombie Samples"
set SideQuestStory[i] = "We need to identify the different mutations of zombies. Biologists must take samples of each zombie species."
set SideQuestEndText[i] = "All species of zombies identified through samples"
set SideQuestRank[i] = 100
//SQ3
set i = i + 1
set SideQuestTitre[i] = "Primary Defensive Structures"
set SideQuestStory[i] = "The external turrets of the Restricted Complex 601 are offline. Mechanist are able to reset them."
set SideQuestEndText[i] = "All Primary Defensive Structures are online."
set SideQuestRank[i] = 100
//SQ4
set i = i + 1
set SideQuestTitre[i] = "Primary Radar Structures"
set SideQuestStory[i] = "The radars of the Restricted Complex 601 are offline. Force Recon are able to reset them."
set SideQuestEndText[i] = "All Primary Radar Structures are online. We should get more information about this area now."
set SideQuestRank[i] = 100
//SQ5
set i = i + 1
set SideQuestTitre[i] = "Emergency Teleportation Beacons"
set SideQuestStory[i] = "The RC601 used to have some teleportation beacons. If they are activated, Marine Leader will be able to use them."
set SideQuestEndText[i] = "All Emergency Teleportation Beacons have been activated. Nice job."
set SideQuestRank[i] = 100
//SQ6
set i = i + 1
set SideQuestTitre[i] = "Secondary Generator"
set SideQuestStory[i] = "Secondary Generator are working through a plasma energy. When they are all activated, they pulse energy for any combat armor for the soldiers of the Restricted Complex."
set SideQuestEndText[i] = "All Secondary Generators have been activated. Nice job."
set SideQuestRank[i] = 100
//SQ7
set i = i + 1
set SideQuestTitre[i] = "Parasite Spore"
set SideQuestStory[i] = "It seems parasite spores have birth over the Restricted Complex 601. We need to kill them."
set SideQuestEndText[i] = "All parasites spores destroyed"
set SideQuestRank[i] = 100
endfunction
function EndSideQuest takes integer id returns nothing
call QuestSetCompleted( SideQuest[id], true )
call QuestSetDescription(SideQuest[id], SideQuestStory[id]+" "+SideQuestEta[id])
call DestroyQuest(SideQuest[id])
call DisplayAll(SideQuestTitre[id],C2)
call DisplayAll("Control",SideQuestEndText[id])
call RankAllQuest(id,R2I(SideQuestRank[id]*GameRate[GameMode]))
set SideQuestCompleted[id]=true
set SideQuestDone = SideQuestDone + 1
call RunSound(SOUND_QUESTSUCCESS)
endfunction
function UpdateSideQuest takes integer id returns nothing
call RunSound(SOUND_QUESTLOG)
call QuestSetDescription(SideQuest[id], SideQuestStory[id]+" : "+SideQuestEta[id])
call DisplayAll(SideQuestTitre[id],SideQuestEta[id])
endfunction
private function StartSideQuest takes integer id returns nothing
set SideQuest[id] = CreateQuest()
set SideQuestTitre[id]= "|c00AAAAFF"+SideQuestTitre[id]+"|r"
call QuestSetTitle(SideQuest[id], SideQuestTitre[id])
call QuestSetDescription(SideQuest[id], SideQuestStory[id])
call QuestSetIconPath(SideQuest[id], ICONE)
call QuestSetRequired(SideQuest[id], true)
call QuestSetDiscovered(SideQuest[id], true)
call QuestSetCompleted(SideQuest[id], false)
call QuestSetEnabled(SideQuest[id],true)
set SideQuestBoolean[id]=true
endfunction
private function CheckHeroType takes nothing returns boolean
local unit hero = GetTriggerUnit()
local integer heroId = GetUnitTypeId(hero)
local player owner = GetOwningPlayer(hero)
if GetPlayerSlotState(owner)==PLAYER_SLOT_STATE_PLAYING and GetPlayerController(owner) == MAP_CONTROL_USER then
if heroId == 'H00D' and SideQuestBoolean[2]==false then
call StartSideQuest(2)//biologist, zombie samples
endif
if (heroId == 'H00H' or heroId == 'H01C' or heroId == 'H02A') and SideQuestBoolean[3]==false then
call StartSideQuest(3)//mech CE or GN, def towers
endif
if (heroId == 'H00K' or heroId == 'H02A') and SideQuestBoolean[4]==false then
call StartSideQuest(4)//force recon or GN, radars
endif
if heroId == 'H00Z' and SideQuestBoolean[5]==false then
call StartSideQuest(5)//marine leader, teleporters
endif
if (heroId == 'H016' or heroId == 'H01P') and SideQuestBoolean[6]==false then
call StartSideQuest(6)//assaut force or lightning sniper, generators
endif
endif
set hero = null
set owner = null
return false
endfunction
private function init takes nothing returns nothing
local trigger t = CreateTrigger()
local integer i = 1
set SideQuestDone = 0
call SideQuestVariables()
loop
exitwhen i > SIDEQUESTMAX
set SideQuestBoolean[i]=false
set SideQuestCompleted[i]=false
set i = i + 1
endloop
call StartSideQuest(1)//Cave
call StartSideQuest(7)//Parasite Spore
call TriggerRegisterEnterRectSimple(t, bj_mapInitialPlayableArea)
call TriggerAddCondition(t, Condition(function CheckHeroType))
endfunction
endlibrary
//TESH.scrollpos=866
//TESH.alwaysfold=0
library QuestVariables needs SoundUtils
function QuestVariables takes nothing returns nothing
local integer i = 0
set i = 0
//1: zombies light
set i = i + 1
set CreepsUniverseId[i][0] ='u001'//zombie man 1
set CreepsUniverseId[i][1] ='u003' //zombie woman 1
set CreepsUniverseId[i][2] ='u005' //zombie man 2
set CreepsUniverseId[i][4] ='u009' //ghoul
set CreepsUniverseCoeff[i][0] = 4
set CreepsUniverseCoeff[i][1] = 1
set CreepsUniverseCoeff[i][2] = 4
set CreepsUniverseCoeff[i][3] = 1
set CreepsUniverseRush[i] = 'u004' //Flesh Mass
set CreepsUniverseAir[i] = 'u00J' //Dead raven
set CreepsUniverseSpecial[i][0]= 'u00K'//mutation Omicron
set CreepsUniverseSpecial[i][1]= 'u006'//abomination
set QuestBoss[i][0] = 'u002'//Sadrhadamant
set QuestBoss[i][1] = 'u00A'//BladesOfPain
//2: zombies medium
set i = i + 1
set CreepsUniverseId[i][0] ='u006' //Abomination
set CreepsUniverseId[i][1] ='u00E' //Decomposition
set CreepsUniverseId[i][2] ='u00C' //Putrefaction
set CreepsUniverseId[i][3] ='u00F' //Excrecence
set CreepsUniverseCoeff[i][0] = 1
set CreepsUniverseCoeff[i][1] = 4
set CreepsUniverseCoeff[i][2] = 4
set CreepsUniverseCoeff[i][3] = 2
set CreepsUniverseRush[i] = 'u007' //Mutation Gamma
set CreepsUniverseAir[i] = 'u008' //Gargoyle
set CreepsUniverseSpecial[i][0]= 'u008'//gargoyle
set CreepsUniverseSpecial[i][1]= 'u00K'//Mutation Omicron
set QuestBoss[i][0] = 'u00S'//Tinus
set QuestBoss[i][1] = 'u00A'//BladesOfPain
//3: zombies heavy
set i = i + 1
set CreepsUniverseId[i][0] ='u006' //Abomination
set CreepsUniverseId[i][1] ='u00E' //Decomposition
set CreepsUniverseId[i][2] ='u01Y' //Avenger
set CreepsUniverseId[i][3] ='u00T' //Excrecence
set CreepsUniverseCoeff[i][0] = 1
set CreepsUniverseCoeff[i][1] = 4
set CreepsUniverseCoeff[i][2] = 1
set CreepsUniverseCoeff[i][3] = 2
set CreepsUniverseRush[i] = 'u00B' //Mutation Iota
set CreepsUniverseAir[i] = 'u008' //Gargoyle
set CreepsUniverseSpecial[i][0]= 'u00H'//bug
set CreepsUniverseSpecial[i][1]= 'u00K'//Mutation Omicron
set QuestBoss[i][0] = 'u00S'//Tinus
set QuestBoss[i][1] = 'u00U'//IronInferno
//4: gargoyles only
set i = i + 1
set CreepsUniverseId[i][0] ='u008' //gargoyle
set CreepsUniverseId[i][1] ='u008' //gargoyle
set CreepsUniverseCoeff[i][0] = 2
set CreepsUniverseCoeff[i][1] = 2
set CreepsUniverseRush[i] = 'u008' //gargoyle
set CreepsUniverseSpecial[i][0]= 'u008'//gargoyle
set CreepsUniverseSpecial[i][1]= 'u008'//gargoyle
set CreepsUniverseAir[i] = 'u00J' //Dead raven
set QuestBoss[i][0] = 'u00U'//IronInferno
set QuestBoss[i][1] = 'u00U'//IronInferno
//5: omicron only
set i = i + 1
set CreepsUniverseId[i][0] ='u00K'//mutation Omicron
set CreepsUniverseId[i][1] ='u00K' //mutation Omicron
set CreepsUniverseCoeff[i][0] = 2
set CreepsUniverseCoeff[i][1] = 2
set CreepsUniverseRush[i] = 'u00J' //Dead raven
set CreepsUniverseAir[i] = 'u00J' //Dead raven
set CreepsUniverseSpecial[i][0]= 'u00J'//Dead raven
set CreepsUniverseSpecial[i][1]= 'u00J'//Dead raven
set QuestBoss[i][0] = 'u002'//Sadrhadamant
set QuestBoss[i][1] = 'u00A'//BladesOfPain
//6: air only
set i = i + 1
set CreepsUniverseId[i][0] ='u008' //gargoyle
set CreepsUniverseId[i][1] ='u00J' //Dead raven
set CreepsUniverseCoeff[i][0] = 2
set CreepsUniverseCoeff[i][1] = 2
set CreepsUniverseRush[i] = 'u008' //gargoyle
set CreepsUniverseSpecial[i][0]= 'u008'//gargoyle
set CreepsUniverseSpecial[i][1]= 'u00J'//Dead raven
set CreepsUniverseAir[i] = 'u00J' //Dead raven
set QuestBoss[i][0] = 'u00U'//IronInferno
set QuestBoss[i][1] = 'u00U'//IronInferno
set SOUND_QUESTNEW = DefineSound("Radio.wav",1000, false, false)
set SOUND_QUESTFAIL = DefineSound("Radio.wav",1000, false, false)
set SOUND_QUESTLOG = DefineSound("Radio.wav",1000, false, false)
set SOUND_QUESTSUCCESS = DefineSound("Radio.wav",1000, false, false)
set GameRate[0]= 1.00 //default
set GameRate[1]= 1.00 //normal
set GameRate[2]= 1.40 //nightmare
set GameRate[3]= 1.00 //survival
set GameRate[4]= 1.00 //last stand
set GameRate[5]= 1.00 //siege
set GameRate[6]= 1.00 //assaut
set GameName[1] = "Normal"
set GameName[2] = "Nightmare"
set GameName[3] = "Survival"
set GameName[4] = "Last stand"
set GameName[5] = "Siege"
set GameName[6] = "Assaut"
set SpecialCreepsChance[1]=1
set SpecialCreepsChance[2]=1.2
set SpecialCreepsChance[3]=1.5
set SpecialCreepsChance[4]=1.5
set SpecialCreepsChance[5]=1.5
set SpecialCreepsChance[6]=1.2
set i = 0
//Q1
set i = i + 1
set QuestTitre[i] = "A strange night"
set QuestStory[i] = "Something weird is going on. No idea what it is. Move to the village on South West and try to understand what is going on."
set QuestRank[i] = 50
set QuestSpawn[i][1] = 1
set QuestSpawn[i][2] = 2
set QuestSpawn[i][3] = 7
set QuestSpawn[i][4] = 13
set QuestSpawn[i][5] = 14
set QuestSpawn[i][6] = 29
set QuestUniverse[i] = 1 //Zombie Light
set QuestCreepsSpawnRate[i] = 15.
set QuestAssautMax[i] = 3
//Q2
set i = i + 1
set QuestTitre[i] = "Hold them alive"
set QuestStory[i] = "Okay, let's escort those civilians to the extraction points. Tango group will join with other civilians. Wait for them on the East of the village."
set QuestRank[i] = 50
set QuestSpawn[i][1] = 14
set QuestSpawn[i][2] = 29
set QuestSpawn[i][3] = 30
set QuestSpawn[i][4] = 31
set QuestSpawn[i][5] = 32
set QuestUniverse[i] = 1 //Zombie Light
set QuestCreepsSpawnRate[i] = 15.
set QuestAssautMax[i] = 8
//Q3
set i = i + 1
set QuestTitre[i] = "Blood Samples"
set QuestStory[i] = "We need to find some samples of blood to help the scientist to fight the infection before it contaminate the other civilians. Look on the ground if you can find some of those samples."
set QuestRank[i] = 50
set QuestSpawn[i][1] = 2
set QuestSpawn[i][2] = 6
set QuestSpawn[i][3] = 8
set QuestSpawn[i][4] = 10
set QuestSpawn[i][5] = 14
set QuestSpawn[i][6] = 19
set QuestUniverse[i] = 1 //Zombie Light
set QuestCreepsSpawnRate[i] = 45.
set QuestAssautMax[i] = 4
//Q4
set i = i + 1
set QuestTitre[i] = "We own the night"
set QuestStory[i] = "We have detected a large hord of those...Ahem. Things. We need to defend the main generator of the external outpost. Move to the center of the region."
set QuestRank[i] = 50
set QuestSpawn[i][1] = 4
set QuestSpawn[i][2] = 6
set QuestSpawn[i][3] = 9
set QuestSpawn[i][4] = 14
set QuestSpawn[i][5] = 17
set QuestUniverse[i] = 1 //Zombie Light
set QuestCreepsSpawnRate[i] = 15.
set QuestAssautMax[i] = 4
//Q5
set i = i + 1
set QuestTitre[i] = "Teleporter"
set QuestStory[i] = "Protect the old teleporter until all engineers have entered the Restricted Complex 601. Engineers will be air dropped on the external outpost. The Old Teleporter is north of it, on the north west of the Swamps."
set QuestRank[i] = 50
set QuestSpawn[i][1] = 3
set QuestSpawn[i][2] = 4
set QuestSpawn[i][3] = 9
set QuestSpawn[i][4] = 10
set QuestSpawn[i][5] = 14
set QuestSpawn[i][6] = 17
set QuestUniverse[i] = 1 //Zombie Light
set QuestCreepsSpawnRate[i] = 45.
set QuestAssautMax[i] = 4
//Q6
set i = i + 1
set QuestTitre[i] = "A Project"
set QuestStory[i] = "Wait a second!"
set QuestRank[i] = 50
set QuestSpawn[i][1] = 3
set QuestSpawn[i][2] = 4
set QuestSpawn[i][3] = 9
set QuestSpawn[i][4] = 10
set QuestSpawn[i][5] = 14
set QuestSpawn[i][6] = 17
set QuestUniverse[i] = 1 //Zombie Light
set QuestCreepsSpawnRate[i] = 45.
set QuestAssautMax[i] = 4
//Q7
set i = i + 1
set QuestTitre[i] = "Villagers will own us"
set QuestStory[i] = "We fail to protect the villagers. They turned into those horrible creatures. Try to survive! We recommand to bunker on the External Outpost."
set QuestRank[i] = 50
set QuestSpawn[i][1] = 4
set QuestSpawn[i][2] = 6
set QuestSpawn[i][3] = 9
set QuestSpawn[i][4] = 14
set QuestSpawn[i][5] = 17
set QuestUniverse[i] = 2 //Zombie medium
set QuestCreepsSpawnRate[i] = 15.
set QuestAssautMax[i] = 4
//Q8
set i = i + 1
set QuestTitre[i] = "Are they sleeping?"
set QuestStory[i] = "There is a barrack where troops are supposed to be. We have to catch them. Barracks are extreme North of this region. If they are still alive, escort them to the Mechanoids Facilities, South East. "
set QuestRank[i] = 50
set QuestSpawn[i][1] = 4
set QuestSpawn[i][2] = 10
set QuestSpawn[i][3] = 11
set QuestSpawn[i][4] = 16
set QuestSpawn[i][5] = 17
set QuestSpawn[i][6] = 18
set QuestUniverse[i] = 2 //Zombie Medium
set QuestCreepsSpawnRate[i] = 45.
set QuestAssautMax[i] = 4
//Q9
set i = i + 1
set QuestTitre[i] = "Rats are leaving the sinking ship"
set QuestStory[i] = "Lets escort the GW-Worker Squadron to the ship facilities. They are on North East."
set QuestRank[i] = 50
set QuestSpawn[i][1] = 15
set QuestSpawn[i][2] = 22
set QuestSpawn[i][3] = 21
set QuestSpawn[i][4] = 33
set QuestUniverse[i] = 2 //Zombie Medium
set QuestCreepsSpawnRate[i] = 45.
set QuestAssautMax[i] = 4
//Q10
set i = i + 1
set QuestTitre[i] = "Dance of the Frogs"
set QuestStory[i] = "We require to scout the swamps since something strang is happening there. Swamps are North West, near the External outpost. Join the pilots of the frogs into the Mechanoids Facilites"
set QuestRank[i] = 50
set QuestSpawn[i][1] = 2
set QuestSpawn[i][2] = 4
set QuestSpawn[i][3] = 8
set QuestSpawn[i][4] = 14
set QuestSpawn[i][5] = 19
set QuestSpawn[i][6] = 22
set QuestUniverse[i] = 2 //Zombie Medium
set QuestCreepsSpawnRate[i] = 45.
set QuestAssautMax[i] = 4
//Q11
set i = i + 1
set QuestTitre[i] = "They need time"
set QuestStory[i] = "Defend the ship facilities until ships are ready to move."
set QuestRank[i] = 50
set QuestSpawn[i][1] = 11
set QuestSpawn[i][2] = 12
set QuestSpawn[i][3] = 15
set QuestSpawn[i][4] = 16
set QuestSpawn[i][5] = 23
set QuestUniverse[i] = 2 //Zombie Medium
set QuestCreepsSpawnRate[i] = 15.
set QuestAssautMax[i] = 4
//Q12
set i = i + 1
set QuestTitre[i] = "Battle of the Swamps"
set QuestStory[i] = "We will set up an observatory tower to scout the swamps. Protect it at all cost. An engineer will start the construction as soon as possible."
set QuestRank[i] = 50
set QuestSpawn[i][1] = 2
set QuestSpawn[i][2] = 4
set QuestSpawn[i][3] = 8
set QuestSpawn[i][4] = 14
set QuestSpawn[i][5] = 19
set QuestSpawn[i][6] = 22
set QuestUniverse[i] = 2 //Zombie Medium
set QuestCreepsSpawnRate[i] = 45.
set QuestAssautMax[i] = 4
//Q13
set i = i + 1
set QuestTitre[i] = "Water is contaminated"
set QuestStory[i] = "That will be harder than we expected. Protect the engineers at all cost!"
set QuestRank[i] = 50
set QuestSpawn[i][1] = 11
set QuestSpawn[i][2] = 12
set QuestSpawn[i][3] = 15
set QuestSpawn[i][4] = 16
set QuestSpawn[i][5] = 23
set QuestUniverse[i] = 2 //Zombie Medium
set QuestCreepsSpawnRate[i] = 15.
set QuestAssautMax[i] = 4
//Q14
set i = i + 1
set QuestTitre[i] = "Falling in water"
set QuestStory[i] = "Its the worst case we could have: we are not able to prevent any wave from the Restricted Complex 601. Try to defend the Doctor Terry, men!"
set QuestRank[i] = 50
set QuestSpawn[i][1] = 2
set QuestSpawn[i][2] = 4
set QuestSpawn[i][3] = 8
set QuestSpawn[i][4] = 14
set QuestSpawn[i][5] = 19
set QuestSpawn[i][6] = 22
set QuestUniverse[i] = 2 //Zombie Medium
set QuestCreepsSpawnRate[i] = 15.
set QuestAssautMax[i] = 4
//Q15
set i = i + 1
set QuestTitre[i] = "An other project"
set QuestStory[i] = "Oh my god. Something extremely big just get out of the Restricted Complex 601. It seems equiped with human technology."
set QuestRank[i] = 50
set QuestSpawn[i][1] = 8
set QuestSpawn[i][2] = 7
set QuestSpawn[i][3] = 21
set QuestSpawn[i][4] = 22
set QuestSpawn[i][5] = 24
set QuestUniverse[i] = 2 //Zombie Medium
set QuestCreepsSpawnRate[i] = 45.
set QuestAssautMax[i] = 4
//Q16
set i = i + 1
set QuestTitre[i] = "Harry"
set QuestStory[i] = "The Major Harry seems to be closed to escape from the Restricted Complex 601. Join him in front of the main entry. It is extreme North West of the area."
set QuestRank[i] = 50
set QuestSpawn[i][1] = 1
set QuestSpawn[i][2] = 7
set QuestSpawn[i][3] = 12
set QuestSpawn[i][4] = 15
set QuestSpawn[i][5] = 22
set QuestUniverse[i] = 3 //Zombie heavy
set QuestCreepsSpawnRate[i] = 45.
set QuestAssautMax[i] = 4
//Q17
set i = i + 1
set QuestTitre[i] = "Beacons"
set QuestStory[i] = "Okay, Gentlemen. Let's set up those beacons to the concerned area. We dropped them on Airfield, South East. We need to do this mapping of the ground."
set QuestRank[i] = 50
set QuestSpawn[i][1] = 7
set QuestSpawn[i][2] = 8
set QuestSpawn[i][3] = 10
set QuestSpawn[i][4] = 12
set QuestSpawn[i][5] = 22
set QuestUniverse[i] = 3 //Zombie heavy
set QuestCreepsSpawnRate[i] = 45.
set QuestAssautMax[i] = 4
//Q18
set i = i + 1
set QuestTitre[i] = "Equipement Pieces"
set QuestStory[i] = "We need to try to repair those planes. Find the equipement pieces. No idea where the planes drop them..."
set QuestRank[i] = 50
set QuestSpawn[i][1] = 7
set QuestSpawn[i][2] = 8
set QuestSpawn[i][3] = 10
set QuestSpawn[i][4] = 12
set QuestSpawn[i][5] = 24
set QuestUniverse[i] = 3 //Zombie heavy
set QuestCreepsSpawnRate[i] = 45.
set QuestAssautMax[i] = 4
//Q19
set i = i + 1
set QuestTitre[i] = "Airfield is surrounded"
set QuestStory[i] = "Okay, lets try to make those planes fly. We need to contain this ugly things until planes take off."
set QuestRank[i] = 50
set QuestSpawn[i][1] = 5
set QuestSpawn[i][2] = 25
set QuestSpawn[i][3] = 26
set QuestSpawn[i][4] = 27
set QuestSpawn[i][5] = 28
set QuestUniverse[i] = 3 //Zombie heavy
set QuestCreepsSpawnRate[i] = 15.
set QuestAssautMax[i] = 4
//Q20
set i = i + 1
set QuestTitre[i] = "Chopper Repair"
set QuestStory[i] = "You know what is fun with this chopper? It need some repair. Protect our technicians while they try to make from this old thing something able to fly and fire."
set QuestRank[i] = 50
set QuestSpawn[i][1] = 5
set QuestSpawn[i][2] = 25
set QuestSpawn[i][3] = 26
set QuestSpawn[i][4] = 27
set QuestSpawn[i][5] = 28
set QuestUniverse[i] = 3 //Zombie heavy
set QuestCreepsSpawnRate[i] = 15.
set QuestAssautMax[i] = 4
//Q21
set i = i + 1
set QuestTitre[i] = "Air Strike"
set QuestStory[i] = "Shut the fuck up one second! Pilots were not able to target precisely the creeps. Now we get a hudge wave of flying deads coming to the Airfield. Kill them all and protect the generator at all cost!"
set QuestRank[i] = 50
set QuestSpawn[i][1] = 5
set QuestSpawn[i][2] = 25
set QuestSpawn[i][3] = 26
set QuestSpawn[i][4] = 27
set QuestSpawn[i][5] = 28
set QuestUniverse[i] = 4 //Gargoyles only
set QuestCreepsSpawnRate[i] = 15.
set QuestAssautMax[i] = 4
//Q22
set i = i + 1
set QuestTitre[i] = "The Hord"
set QuestStory[i] = "Nice. It is when we do not have air support than the biggest babies come out of the RC-601 directly to the Airfield. Protect the generator at all cost!"
set QuestRank[i] = 50
set QuestSpawn[i][1] = 5
set QuestSpawn[i][2] = 25
set QuestSpawn[i][3] = 26
set QuestSpawn[i][4] = 27
set QuestSpawn[i][5] = 28
set QuestUniverse[i] = 3 //Zombie heavy
set QuestCreepsSpawnRate[i] = 15.
set QuestAssautMax[i] = 4
//Q23
set i = i + 1
set QuestTitre[i] = "Project Nexus"
set QuestStory[i] = "You have less than one minute to join the External Outpost. Defend the impulsion generator!"
set QuestRank[i] = 50
set QuestSpawn[i][1] = 5
set QuestSpawn[i][2] = 25
set QuestSpawn[i][3] = 26
set QuestSpawn[i][4] = 27
set QuestSpawn[i][5] = 28
set QuestUniverse[i] = 3 //Zombie heavy
set QuestCreepsSpawnRate[i] = 15.
set QuestAssautMax[i] = 4
//Q24
set i = i + 1
set QuestTitre[i] = "Vortex Assault"
set QuestStory[i] = "A strange object has appeared on what is supposed to be over the Restricted Complex 601 Physic Labs. It seems it has the ability to transfer Gamma mutations from the RC. Destroy it. We might have 6 minutes before having a serious probleme."
set QuestRank[i] = 50
set QuestSpawn[i][1] = 2
set QuestSpawn[i][2] = 22
set QuestSpawn[i][3] = 32
set QuestSpawn[i][4] = 33
set QuestUniverse[i] = 1 //Zombie light
set QuestCreepsSpawnRate[i] = 45.
set QuestAssautMax[i] = 4
//Q25
set i = i + 1
set QuestTitre[i] = "Spores Replication"
set QuestStory[i] = "Parasite Spores have been detected arround the whole sector. Destroy them before their number is too high. We might have 6 minutes before having a serious probleme."
set QuestRank[i] = 50
set QuestSpawn[i][1] = 11
set QuestSpawn[i][2] = 12
set QuestSpawn[i][3] = 15
set QuestSpawn[i][4] = 16
set QuestSpawn[i][5] = 23
set QuestUniverse[i] = 2 //Zombie Medium
set QuestCreepsSpawnRate[i] = 45.
set QuestAssautMax[i] = 4
//Q26
set i = i + 1
set QuestTitre[i] = "The ground is burning"
set QuestStory[i] = "Okay, Gentlemen. We have there a new threat. Codename Lich. Destroy them before they have burnt the whole sector. We might have 6 minutes before having a serious probleme."
set QuestRank[i] = 50
set QuestSpawn[i][1] = 11
set QuestSpawn[i][2] = 12
set QuestSpawn[i][3] = 15
set QuestSpawn[i][4] = 16
set QuestSpawn[i][5] = 23
set QuestUniverse[i] = 2 //Zombie Medium
set QuestCreepsSpawnRate[i] = 45.
set QuestAssautMax[i] = 4
//Q27
set i = i + 1
set QuestTitre[i] = "Cocoons"
set QuestStory[i] = "Damned. Some spiders eggs have muted into giant one. Destroy them all. I do NOT want to take the entire week to hunt spiders. We might have 6 minutes before having a serious probleme."
set QuestRank[i] = 50
set QuestSpawn[i][1] = 11
set QuestSpawn[i][2] = 12
set QuestSpawn[i][3] = 15
set QuestSpawn[i][4] = 16
set QuestSpawn[i][5] = 23
set QuestUniverse[i] = 2 //Zombie Medium
set QuestCreepsSpawnRate[i] = 45.
set QuestAssautMax[i] = 4
//Q28
set i = i + 1
set QuestTitre[i] = "Wave I"
set QuestStory[i] = "Survivor Mode: try to stay alive"
set QuestRank[i] = 50
set QuestSpawn[i][1] = 8
set QuestSpawn[i][2] = 12
set QuestSpawn[i][3] = 20
set QuestSpawn[i][4] = 24
set QuestSpawn[i][5] = 34
set QuestSpawn[i][6] = 35
set QuestSpawn[i][7] = 36
set QuestSpawn[i][8] = 37
set QuestUniverse[i] = 1 //Zombie light
set QuestCreepsSpawnRate[i] = 5.
set QuestAssautMax[i] = 0
//Q29
set i = i + 1
set QuestTitre[i] = "Wave II"
set QuestStory[i] = "Survivor Mode: try to stay alive"
set QuestRank[i] = 50
set QuestSpawn[i][1] = 8
set QuestSpawn[i][2] = 12
set QuestSpawn[i][3] = 20
set QuestSpawn[i][4] = 24
set QuestSpawn[i][5] = 34
set QuestSpawn[i][6] = 35
set QuestSpawn[i][7] = 36
set QuestSpawn[i][8] = 37
set QuestUniverse[i] = 2 //Zombie medium
set QuestCreepsSpawnRate[i] = 5.
set QuestAssautMax[i] = 0
//Q30
set i = i + 1
set QuestTitre[i] = "Wave III"
set QuestStory[i] = "Survivor Mode: try to stay alive"
set QuestRank[i] = 50
set QuestSpawn[i][1] = 8
set QuestSpawn[i][2] = 12
set QuestSpawn[i][3] = 20
set QuestSpawn[i][4] = 24
set QuestSpawn[i][5] = 34
set QuestSpawn[i][6] = 35
set QuestSpawn[i][7] = 36
set QuestSpawn[i][8] = 37
set QuestUniverse[i] = 3 //Zombie heavy
set QuestCreepsSpawnRate[i] = 5.
set QuestAssautMax[i] = 0
//Q31
set i = i + 1
set QuestTitre[i] = "Wave IV"
set QuestStory[i] = "Survivor Mode: try to stay alive"
set QuestRank[i] = 50
set QuestSpawn[i][1] = 8
set QuestSpawn[i][2] = 12
set QuestSpawn[i][3] = 20
set QuestSpawn[i][4] = 24
set QuestSpawn[i][5] = 34
set QuestSpawn[i][6] = 35
set QuestSpawn[i][7] = 36
set QuestSpawn[i][8] = 37
set QuestUniverse[i] = 3 //Zombie heavy
set QuestCreepsSpawnRate[i] = 5.
set QuestAssautMax[i] = 0
//Q32
set i = i + 1
set QuestTitre[i] = "The worst pilot"
set QuestStory[i] = "The fighter of the Captain Barney has been shoot by something. Move to the fields on South West and assist the civilans already there to heal him."
set QuestRank[i] = 50
set QuestSpawn[i][1] = 1
set QuestSpawn[i][2] = 2
set QuestSpawn[i][3] = 7
set QuestSpawn[i][4] = 13
set QuestSpawn[i][5] = 14
set QuestSpawn[i][6] = 29
set QuestUniverse[i] = 1 //Zombie Light
set QuestCreepsSpawnRate[i] = 15.
set QuestAssautMax[i] = 3
//Q33
set i = i + 1
set QuestTitre[i] = "Wave V"
set QuestStory[i] = "Survivor Mode: try to stay alive"
set QuestRank[i] = 50
set QuestSpawn[i][1] = 8
set QuestSpawn[i][2] = 12
set QuestSpawn[i][3] = 20
set QuestSpawn[i][4] = 24
set QuestSpawn[i][5] = 34
set QuestSpawn[i][6] = 35
set QuestSpawn[i][7] = 36
set QuestSpawn[i][8] = 37
set QuestUniverse[i] = 6 //Air only
set QuestCreepsSpawnRate[i] = 5.
set QuestAssautMax[i] = 0
//Q34
set i = i + 1
set QuestTitre[i] = "We need the mechs"
set QuestStory[i] = "We have to defend the mechanoids facilities. They are on South East."
set QuestRank[i] = 50
set QuestSpawn[i][1] = 15
set QuestSpawn[i][2] = 22
set QuestSpawn[i][3] = 21
set QuestSpawn[i][4] = 33
set QuestUniverse[i] = 2 //Zombie Medium
set QuestCreepsSpawnRate[i] = 15.
set QuestAssautMax[i] = 4
//Q35
set i = i + 1
set QuestTitre[i] = "Scout"
set QuestStory[i] = "The convoy of GW-Frog has arrived on the same place you landed. Escort it to the mechanoid facilities."
set QuestRank[i] = 50
set QuestSpawn[i][1] = 1
set QuestSpawn[i][2] = 13
set QuestSpawn[i][3] = 30
set QuestSpawn[i][4] = 38
set QuestUniverse[i] = 1 //Zombie Light
set QuestCreepsSpawnRate[i] = 45.
set QuestAssautMax[i] = 2
//Q36
set i = i + 1
set QuestTitre[i] = "Failed Airdrop"
set QuestStory[i] = "We have tried to send scientists by the air way. It's a disaster, all the troops seems to be hurt and not grouped. Find them and escort them to the External Outpost. They must bee south west of the area."
set QuestRank[i] = 50
set QuestSpawn[i][1] = 1
set QuestSpawn[i][2] = 7
set QuestSpawn[i][3] = 30
set QuestSpawn[i][4] = 32
set QuestUniverse[i] = 1 //Zombie Light
set QuestCreepsSpawnRate[i] = 45.
set QuestAssautMax[i] = 2
//Q37
set i = i + 1
set QuestTitre[i] = "Corned Beef"
set QuestStory[i] = "There is a GW-Beef to escort from the Airfield (South East) to the RC601 Main Entrance (North West). We want to send a task force there."
set QuestRank[i] = 50
set QuestSpawn[i][1] = 1
set QuestSpawn[i][2] = 7
set QuestSpawn[i][3] = 12
set QuestSpawn[i][4] = 15
set QuestSpawn[i][5] = 22
set QuestUniverse[i] = 3 //Zombie heavy
set QuestCreepsSpawnRate[i] = 45.
set QuestAssautMax[i] = 4
//Q38
set i = i + 1
set QuestTitre[i] = "Warehouse"
set QuestStory[i] = "Scouts have found a warehouse, North West our position. It seems there are vehicles. Defend the Military Building there."
set QuestRank[i] = 50
set QuestSpawn[i][1] = 20
set QuestSpawn[i][2] = 30
set QuestSpawn[i][3] = 31
set QuestSpawn[i][4] = 39
set QuestUniverse[i] = 1 //Zombie Light
set QuestCreepsSpawnRate[i] = 45.
set QuestAssautMax[i] = 4
//Q39
set i = i + 1
set QuestTitre[i] = "Without Pilots"
set QuestStory[i] = "Holy shit. No pilot available. The wounded are remaining in the old factory, south of your position. Defend it at all costs!"
set QuestRank[i] = 50
set QuestSpawn[i][1] = 15
set QuestSpawn[i][2] = 22
set QuestSpawn[i][3] = 21
set QuestSpawn[i][4] = 33
set QuestUniverse[i] = 1 //Zombie Light
set QuestCreepsSpawnRate[i] = 20.
set QuestAssautMax[i] = 4
//Q40
set i = i + 1
set QuestTitre[i] = "Omicron Rush"
set QuestStory[i] = "We just found the last scientist, the Doctor Oharah. He is trapped on the South West. Protect him before those Omicron kill him."
set QuestRank[i] = 50
set QuestSpawn[i][1] = 1
set QuestSpawn[i][2] = 2
set QuestSpawn[i][3] = 29
set QuestSpawn[i][4] = 13
set QuestUniverse[i] = 5//Omicron only
set QuestCreepsSpawnRate[i] = 45.
set QuestAssautMax[i] = 4
//Q41
set i = i + 1
set QuestTitre[i] = "Containment"
set QuestStory[i] = "The Humvee supposed to evacuate the scientists you let be killed is stucked because of a hudge wave of enemies. Kill it."
set QuestRank[i] = 50
set QuestSpawn[i][1] = 40
set QuestSpawn[i][2] = 41
set QuestSpawn[i][3] = 42
set QuestSpawn[i][4] = 43
set QuestUniverse[i] = 1 //Zombie Light
set QuestCreepsSpawnRate[i] = 15.
set QuestAssautMax[i] = 4
//Q42
set i = i + 1
set QuestTitre[i] = "Siege"
set QuestStory[i] = "Defend the base."
set QuestRank[i] = 100
set QuestSpawn[i][1] = 49
set QuestSpawn[i][2] = 50
set QuestSpawn[i][3] = 51
set QuestSpawn[i][4] = 52
set QuestUniverse[i] = 1 //Zombie Light
set QuestCreepsSpawnRate[i] = 5.
set QuestAssautMax[i] = 5
//Q43
set i = i + 1
set QuestTitre[i] = "Last Stand"
set QuestStory[i] = "Defend the database which remains in the Restricted Complex 601"
set QuestRank[i] = 50
set QuestSpawn[i][1] = 49
set QuestSpawn[i][2] = 50
set QuestSpawn[i][3] = 51
set QuestSpawn[i][4] = 52
set QuestUniverse[i] = 1 //Zombie Light
set QuestCreepsSpawnRate[i] = 5.
set QuestAssautMax[i] = 5
//Q44
set i = i + 1
set QuestTitre[i] = "Street fighter"
set QuestStory[i] = "Just try to protect the last operationnal squad, if you think you are able to help the tanks. They are fightning in the streets of the town."
set QuestRank[i] = 50
set QuestSpawn[i][1] = 5
set QuestSpawn[i][2] = 16
set QuestSpawn[i][3] = 28
set QuestSpawn[i][4] = 44
set QuestSpawn[i][5] = 45
set QuestUniverse[i] = 3 //Zombie heavy
set QuestCreepsSpawnRate[i] = 15.
set QuestAssautMax[i] = 4
//Q45
set i = i + 1
set QuestTitre[i] = "Lost Reinforcements"
set QuestStory[i] = "Okay, the team is ready, but we have a probleme with reinforcements. You have to protect a crashed chopper the time they repair it."
set QuestRank[i] = 50
set QuestSpawn[i][1] = 16
set QuestSpawn[i][2] = 17
set QuestSpawn[i][3] = 18
set QuestSpawn[i][4] = 23
set QuestUniverse[i] = 3 //Zombie heavy
set QuestCreepsSpawnRate[i] = 45.
set QuestAssautMax[i] = 4
//Q46
set i = i + 1
set QuestTitre[i] = "Squad Rescue"
set QuestStory[i] = "The squad we sent into the RC has been killed. Escort the survivors to the external outpost!"
set QuestRank[i] = 50
set QuestSpawn[i][1] = 8
set QuestSpawn[i][2] = 12
set QuestSpawn[i][3] = 37
set QuestSpawn[i][4] = 40
set QuestUniverse[i] = 3 //Zombie heavy
set QuestCreepsSpawnRate[i] = 45.
set QuestAssautMax[i] = 4
//Q47
set i = i + 1
set QuestTitre[i] = "Hurricane Escort"
set QuestStory[i] = "Good job. The cleaning team has found a Hurricane in the RC601. We will clean the sector. Escort him."
set QuestRank[i] = 50
set QuestSpawn[i][1] = 8
set QuestSpawn[i][2] = 12
set QuestSpawn[i][3] = 37
set QuestSpawn[i][4] = 40
set QuestUniverse[i] = 3 //Zombie heavy
set QuestCreepsSpawnRate[i] = 15.
set QuestAssautMax[i] = 4
//Q48
set i = i + 1
set QuestTitre[i] = "Barrack Defence"
set QuestStory[i] = "Ah shit. The operation is cancelled. We need to prepare a new team to send it on the RC601. Defend the barracks the time they finish to get ready."
set QuestRank[i] = 50
set QuestSpawn[i][1] = 18
set QuestSpawn[i][2] = 23
set QuestSpawn[i][3] = 35
set QuestSpawn[i][4] = 12
set QuestUniverse[i] = 3 //Zombie heavy
set QuestCreepsSpawnRate[i] = 45.
set QuestAssautMax[i] = 4
//Q49
set i = i + 1
set QuestTitre[i] = "Entrance Guard"
set QuestStory[i] = "Okay Ladies, the GW-Beef should clean up the Restricted Complex. Wait for them and protect the entrance!"
set QuestRank[i] = 50
set QuestSpawn[i][1] = 8
set QuestSpawn[i][2] = 46
set QuestSpawn[i][3] = 47
set QuestSpawn[i][4] = 48
set QuestUniverse[i] = 3 //Zombie heavy
set QuestCreepsSpawnRate[i] = 15.
set QuestAssautMax[i] = 4
//Q50
set i = i + 1
set QuestTitre[i] = "Power Plant"
set QuestStory[i] = "A group of engineer is working on the power plant. Defend them, we need to repair it in order to make a field against the Obliterus."
set QuestRank[i] = 50
set QuestSpawn[i][1] = 6
set QuestSpawn[i][2] = 7
set QuestSpawn[i][3] = 17
set QuestSpawn[i][4] = 28
set QuestUniverse[i] = 2 //Zombie Medium
set QuestCreepsSpawnRate[i] = 45.
set QuestAssautMax[i] = 6
//Q51
set i = i + 1
set QuestTitre[i] = "Citizen Surrounded"
set QuestStory[i] = "Bravo Squad is currently defending a group of citizen from the town. Go help them!"
set QuestRank[i] = 50
set QuestSpawn[i][1] = 5
set QuestSpawn[i][2] = 16
set QuestSpawn[i][3] = 28
set QuestSpawn[i][4] = 44
set QuestSpawn[i][5] = 45
set QuestUniverse[i] = 2 //Zombie Medium
set QuestCreepsSpawnRate[i] = 45.
set QuestAssautMax[i] = 6
//Q52
set i = i + 1
set QuestTitre[i] = "Nuke Risk"
set QuestStory[i] = "Damn. Tons of flying enemies are going to the main reactor of the town. Protect it at all costs to avoid a massive explosion!"
set QuestRank[i] = 50
set QuestSpawn[i][1] = 16
set QuestSpawn[i][2] = 28
set QuestSpawn[i][3] = 44
set QuestSpawn[i][4] = 45
set QuestUniverse[i] = 6 //Air only
set QuestCreepsSpawnRate[i] = 45.
set QuestAssautMax[i] = 8
//Q53
set i = i + 1
set QuestTitre[i] = "Supply Incoming"
set QuestStory[i] = "We have set up a convoy to pick up survivors of the RC601. Escort it to the main entrance. It should arrive to the north west of the village."
set QuestRank[i] = 50
set QuestSpawn[i][1] = 2
set QuestSpawn[i][2] = 9
set QuestSpawn[i][3] = 19
set QuestSpawn[i][4] = 29
set QuestUniverse[i] = 1 //Zombie light
set QuestCreepsSpawnRate[i] = 45.
set QuestAssautMax[i] = 4
//Q54
set i = i + 1
set QuestTitre[i] = "The north hill"
set QuestStory[i] = "Defend the telecom officer on the north hill during the rescue operation."
set QuestRank[i] = 50
set QuestSpawn[i][1] = 3
set QuestSpawn[i][2] = 4
set QuestSpawn[i][3] = 8
set QuestSpawn[i][4] = 9
set QuestSpawn[i][5] = 35
set QuestUniverse[i] = 1 //Zombie light
set QuestCreepsSpawnRate[i] = 45.
set QuestAssautMax[i] = 4
//Q55
set i = i + 1
set QuestTitre[i] = "Entrance Closure"
set QuestStory[i] = "Rescue is a fail. We can only seal the RC entrance, now. Protect the 2 Pepper shaker we will airdrop during their bombing."
set QuestRank[i] = 50
set QuestSpawn[i][1] = 8
set QuestSpawn[i][2] = 9
set QuestSpawn[i][3] = 46
set QuestSpawn[i][4] = 47
set QuestUniverse[i] = 1 //Zombie light
set QuestCreepsSpawnRate[i] = 45.
set QuestAssautMax[i] = 4
//Q56
set i = i + 1
set QuestTitre[i] = "To the town"
set QuestStory[i] = "Okay, the pilot is safe. Now we have to escort the civilians to the town. They may be safe there."
set QuestRank[i] = 50
set QuestSpawn[i][1] = 1
set QuestSpawn[i][2] = 2
set QuestSpawn[i][3] = 7
set QuestSpawn[i][4] = 13
set QuestSpawn[i][5] = 14
set QuestSpawn[i][6] = 29
set QuestUniverse[i] = 1 //Zombie Light
set QuestCreepsSpawnRate[i] = 45.
set QuestAssautMax[i] = 3
//Q57
set i = i + 1
set QuestTitre[i] = "Tango"
set QuestStory[i] = "Help the Tango Squad to contain the enemies. They fight north west of the town, near the destroyed bridge."
set QuestRank[i] = 50
set QuestSpawn[i][1] = 15
set QuestSpawn[i][2] = 17
set QuestSpawn[i][3] = 23
set QuestSpawn[i][4] = 28
set QuestSpawn[i][5] = 45
set QuestUniverse[i] = 1 //Zombie Light
set QuestCreepsSpawnRate[i] = 23.
set QuestAssautMax[i] = 3
//Q58
set i = i + 1
set QuestTitre[i] = "Fall back"
set QuestStory[i] = "We failed with civilians. Regroup arround the power plant. Protect this point until things get better."
set QuestRank[i] = 50
set QuestSpawn[i][1] = 6
set QuestSpawn[i][2] = 7
set QuestSpawn[i][3] = 17
set QuestSpawn[i][4] = 28
set QuestUniverse[i] = 1 //Zombie light
set QuestCreepsSpawnRate[i] = 45.
set QuestAssautMax[i] = 4
//Q59
set i = i + 1
set QuestTitre[i] = "Assaut"
set QuestStory[i] = "There is your objective: search and destroy the base of the RC601's staff since those guys have seen too much things there."
set QuestRank[i] = 50
set QuestSpawn[i][1] = 8
set QuestSpawn[i][2] = 12
set QuestSpawn[i][3] = 20
set QuestSpawn[i][4] = 24
set QuestSpawn[i][5] = 34
set QuestSpawn[i][6] = 35
set QuestSpawn[i][7] = 36
set QuestSpawn[i][8] = 37
set QuestUniverse[i] = 1 //Zombie light
set QuestCreepsSpawnRate[i] = 45.
set QuestAssautMax[i] = 20
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library NightmareEffects
globals
private constant integer UP_CREEPS = 'R00G'
endglobals
function StartNightmareEffect takes nothing returns nothing
call SetPlayerTechResearched(Player(11),UP_CREEPS,1)
call SetWaterBaseColorBJ( 100, 25.00, 25.00, 0 )
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library GameEndFailed needs SpawnSystem,TextDisplay
function GameEndFailed takes nothing returns nothing
local integer i = 0
set ChapterIntermission = true
call CreepsDestroySystem()
call CreepsKillAllNormal()
loop
exitwhen i > MAXPLAYER
call DisplayTextToPlayer(Player(i),1.,0.5, "|c00ff0000 Squad entirely killed. Operation cancelled.|r")
set i = i + 1
endloop
set XpAvailable = false
call DisplayAll("Game", "Game is ended. Experience is disabled")
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library GameEndSuccess needs TimerUtils, SpawnSystem,TextDisplay,qsys,Ranks
private struct str
integer i
string text
endstruct
private function Wait takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
local integer i = 0
if dat.i < 35 then
set dat.i = dat.i + 1
if dat.i == 15 then
call CinematicModeBJ(true,bj_FORCE_ALL_PLAYERS)
call PauseAllUnitsBJ(true)
elseif dat.i == 20 then
loop
exitwhen i > MAXPLAYER
call DisplayTextToPlayer(Player(i),1.,0.5,dat.text)
set i = i + 1
endloop
endif
else
call ReleaseTimer(t)
call dat.destroy()
call CinematicModeBJ(false,bj_FORCE_ALL_PLAYERS)
call PauseAllUnitsBJ(false)
set XpAvailable = false
call DisplayAll("Game", "Game is ended. Experience is disabled")
endif
endfunction
function GameEndSuccess takes integer rank, string text returns nothing
local timer t = NewTimer()
local str dat = str.create()
set dat.i = 0
set ChapterDone = 3
set dat.text = text
set ChapterIntermission = true
call ChapterRank("Operation",300)
call CreepsDestroySystem()
call SetTimerData(t,dat)
call TimerStart (t, 1., true, function Wait )
endfunction
endlibrary
//TESH.scrollpos=3
//TESH.alwaysfold=0
library Chapter1 needs TimerUtils, q1,q32, TextDisplay,ItemSpawn, ParasiteSpore, Reinforcements, qsys
globals
private constant string MASK = "ReplaceableTextures\\CameraMasks\\Black_mask.blp"
endglobals
private struct str
integer i
endstruct
private function Wait takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
local integer i = 0
if dat.i < CHAPTER_WAIT+20 then
set dat.i = dat.i + 1
if dat.i == CHAPTER_WAIT+5 then
call MusicChapter()
elseif dat.i == CHAPTER_WAIT+10 then
loop
exitwhen i > MAXPLAYER
call DisplayTextToPlayer(Player(i),0.,0.,"|c00AFAAFF Chapter I : What happened?|r")
set i = i + 1
endloop
endif
else
call StartItemSpawn(6,10)
call DisplayAll("Control","Damned. We tried again to contact the Restricted Complex. But nothing happened.")
if GetRandomInt(0,100)<50 then
call StartQ1()
else
call StartQ32()
endif
set ChapterIntermission = false
call StartParasiteSpore()
call MusicOff()
call ReleaseTimer(t)
call dat.destroy()
call SpawnReinforcements()
endif
endfunction
function Chapter1 takes nothing returns nothing
local timer t = NewTimer()
local str dat = str.create()
call QuestSetTimeToEvening()
set dat.i = 0
set ChapterIntermission = true
call SetTimerData(t,dat)
call TimerStart (t, 1., true, function Wait )
endfunction
endlibrary
//TESH.scrollpos=114
//TESH.alwaysfold=0
library q1 initializer init needs qsys, TimerUtils, q2,q3,q36,q56,q53, AlliedSpawnSystem, GroupUtils
globals
private constant integer IDQ = 1
private constant integer GROUPID = 1
private constant integer REQ_BASE = 300 //Per Player
private constant integer REQ_PLAYER = 10 //Per Player
private constant integer DELTA = 100 //each delta update the quest
private constant integer AMOUNT = 14
private rect array VillagerSpawnRect [5]
private integer VillagerSpawnMax = 0
integer array VillagerId [5]
integer VillagerIdMax
endglobals
private function AlliedDeath takes nothing returns boolean
local unit allied = GetTriggerUnit()
if IsUnitInGroup(allied,VillagerGroup) then
set VillagerKill = VillagerKill + 1
call GroupRemoveUnit(VillagerGroup,allied)
set GeneralTarget = FirstOfGroup(VillagerGroup)
set VillagerAlive = 0
call ForGroup(VillagerGroup,function CountAliveAllied)
set QuestEta[IDQ] = I2S(VillagerKill) + "/"+I2S(VillagerAll)+" civilians killed"
call UpdateQuest(IDQ)
if VillagerAlive == 0 then
call ReleaseGroup(VillagerGroup)
call EndQuest(IDQ,false)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
set RandomQuest = GetRandomInt(1,6)
if RandomQuest == 1 then
call StartQ2()
elseif RandomQuest == 2 then
call StartQ3()
elseif RandomQuest == 3 then
call StartQ35()
elseif RandomQuest == 4 then
call StartQ36()
elseif RandomQuest == 5 then
call StartQ53()
elseif RandomQuest == 6 then
call StartQ56()
endif
endif
endif
set allied = null
return false
endfunction
private function EnemyDeath takes nothing returns boolean
if QuestBoolean[IDQ]==true then
set CreepsSubKill = CreepsSubKill + 1
set CreepsKill = CreepsKill + 1
set QuestEta[IDQ] = I2S(R2I(100*CreepsKill/CreepsRequiredKill)) + "% targets down"
call UpdateQuestMbOnly(IDQ)
if CreepsSubKill == DELTA then
call UpdateQuest(IDQ)
set CreepsSubKill = 0
endif
if CreepsKill >= CreepsRequiredKill then
call ReleaseGroup(VillagerGroup)
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
set RandomQuest = GetRandomInt(1,6)
if RandomQuest == 1 then
call StartQ2()
elseif RandomQuest == 2 then
call StartQ3()
elseif RandomQuest == 3 then
call StartQ35()
elseif RandomQuest == 4 then
call StartQ36()
elseif RandomQuest == 5 then
call StartQ53()
elseif RandomQuest == 6 then
call StartQ56()
endif
call SwitchPatrolToAssaut(GROUPID)
call SwitchTowerToAssaut(GROUPID)
endif
endif
return false
endfunction
private function Run takes nothing returns nothing
local integer i = 0
local unit spawned = null
local real x = 0.
local real y = 0.
local integer random = 0
call ReleaseTimer(GetExpiredTimer())
set VillagerGroup = NewGroup()
loop
exitwhen i > AMOUNT - 1
set random = GetRandomInt(0,VillagerSpawnMax)
set x = GetRectCenterX(VillagerSpawnRect[random])
set y = GetRectCenterY(VillagerSpawnRect[random])
set spawned = CreateUnit(Player(ALLIEDID),VillagerId[GetRandomInt(0,VillagerIdMax)],x,y,0.)
call GroupAddUnit(VillagerGroup,spawned)
set x = GetRandomReal(GetRectMinX(gg_rct_Village),GetRectMaxX(gg_rct_Village))
set y = GetRandomReal(GetRectMinY(gg_rct_Village),GetRectMaxY(gg_rct_Village))
call IssuePointOrder(spawned,"move",x,y)
set i = i + 1
endloop
call ForGroup(VillagerGroup,function CountAllAllied)
set GeneralTarget = FirstOfGroup(VillagerGroup)
set CreepsRequiredKill = REQ_BASE+REQ_PLAYER*PlayerAmount
call PingQuest(GetRectCenterX(gg_rct_Village),GetRectCenterY(gg_rct_Village),5.,30.)
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(11),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(13),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(14),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function EnemyDeath ) )
set QuestTrig[IDQ][1] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][1],Player(ALLIEDID),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(QuestTrig[IDQ][1], Condition( function AlliedDeath) )
set spawned = null
endfunction
function StartQ1 takes nothing returns nothing
local timer t = NewTimer()
local integer i = 0
loop
exitwhen i > 5
call AlliedAddUnitToPatrolGroup(AlliedId[GetRandomInt(0,AlliedIdLightMax)],GROUPID)
set i = i + 1
endloop
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
private function init takes nothing returns nothing
set VillagerId[0]='n000'
set VillagerId[1]='n00O'
set VillagerId[2]='n00T'
set VillagerId[3]='n00N'
set VillagerIdMax = 3
set VillagerSpawnRect[0] = gg_rct_VillageHouse1
set VillagerSpawnRect[1] = gg_rct_VillageHouse2
set VillagerSpawnRect[2] = gg_rct_VillageHouse3
set VillagerSpawnRect[3] = gg_rct_VillageHouse4
set VillagerSpawnRect[4] = gg_rct_VillageHouse5
set VillagerSpawnMax = 4
endfunction
endlibrary
//TESH.scrollpos=22
//TESH.alwaysfold=0
library q32 initializer init needs qsys, TimerUtils, q2,q3,q36,q56,q53, GroupUtils,TextDisplay,IndieSummons,GroupFunction
globals
private constant integer IDQ = 32
private constant integer REQ_BASE = 300 //Per Player
private constant integer REQ_PLAYER = 10 //Per Player
private constant integer DELTA = 100 //each delta update the quest
private constant integer AMOUNT = 14
private constant integer PILOT_ID = 'h00Y'
private unit Pilot
private unit Plane
private rect array VillagerSpawnRect [5]
private integer VillagerSpawnMax = 0
private constant integer DRONE_ID = 'n00J'
private constant integer SPEED = 30
private constant real AOE = 500.
private constant real AOE_FX = 400.
private constant real IMP = 1.
private constant real SPAWN_DISTANCE = 2000.
private constant real SPAWN_Z = 400.
private constant integer COUNT = 10
private constant string FX = "Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl"
endglobals
private function PilotDeath takes nothing returns boolean
local unit allied = GetTriggerUnit()
if allied == Pilot then
set QuestEta[IDQ] = "Barney has been killed. This is a fail..."
call UpdateQuest(IDQ)
call ReleaseGroup(VillagerGroup)
call EndQuest(IDQ,false)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call DestroyQuestTrigger(IDQ,2)
set RandomQuest = GetRandomInt(1,6)
if RandomQuest == 1 then
call StartQ2()
elseif RandomQuest == 2 then
call StartQ3()
elseif RandomQuest == 3 then
call StartQ35()
elseif RandomQuest == 4 then
call StartQ36()
elseif RandomQuest == 5 then
call StartQ53()
elseif RandomQuest == 6 then
call StartQ56()
endif
endif
set allied = null
return false
endfunction
private function AlliedDeath takes nothing returns boolean
local unit allied = GetTriggerUnit()
if IsUnitInGroup(allied,VillagerGroup) then
set VillagerKill = VillagerKill + 1
call GroupRemoveUnit(VillagerGroup,allied)
set GeneralTarget = FirstOfGroup(VillagerGroup)
set VillagerAlive = 0
call ForGroup(VillagerGroup,function CountAliveAllied)
set QuestEta[IDQ] = I2S(VillagerKill) + "/"+I2S(VillagerAll)+" civilians killed"
call UpdateQuest(IDQ)
if VillagerAlive == 0 then
call ReleaseGroup(VillagerGroup)
call EndQuest(IDQ,false)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call DestroyQuestTrigger(IDQ,2)
set RandomQuest = GetRandomInt(1,6)
if RandomQuest == 1 then
call StartQ2()
elseif RandomQuest == 2 then
call StartQ3()
elseif RandomQuest == 3 then
call StartQ35()
elseif RandomQuest == 4 then
call StartQ36()
elseif RandomQuest == 5 then
call StartQ53()
elseif RandomQuest == 6 then
call StartQ56()
endif
endif
endif
set allied = null
return false
endfunction
private function EnemyDeath takes nothing returns boolean
if QuestBoolean[IDQ]==true then
set CreepsSubKill = CreepsSubKill + 1
set CreepsKill = CreepsKill + 1
set QuestEta[IDQ] = I2S(R2I(100*CreepsKill/CreepsRequiredKill)) + "% targets down"
call UpdateQuestMbOnly(IDQ)
if CreepsSubKill == DELTA then
call UpdateQuest(IDQ)
set CreepsSubKill = 0
endif
if CreepsKill >= CreepsRequiredKill then
call ReleaseGroup(VillagerGroup)
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call DestroyQuestTrigger(IDQ,2)
set RandomQuest = GetRandomInt(1,6)
if RandomQuest == 1 then
call StartQ2()
elseif RandomQuest == 2 then
call StartQ3()
elseif RandomQuest == 3 then
call StartQ35()
elseif RandomQuest == 4 then
call StartQ36()
elseif RandomQuest == 5 then
call StartQ53()
elseif RandomQuest == 6 then
call StartQ56()
endif
endif
endif
return false
endfunction
private function Run takes nothing returns nothing
local integer i = 0
local unit spawned = null
local real x = GetRandomReal(GetRectMinX(gg_rct_Crash),GetRectMaxX(gg_rct_Crash))
local real y = GetRandomReal(GetRectMinY(gg_rct_Crash),GetRectMaxY(gg_rct_Crash))
local integer random = 0
call ReleaseTimer(GetExpiredTimer())
call SetUnitState(Plane,UNIT_STATE_LIFE,2000)
set VillagerGroup = NewGroup()
set Pilot = CreateUnit(Player(ALLIEDID),PILOT_ID,x,y,0.)
call GroupAddUnit(VillagerGroup,Pilot)
set GeneralTarget = Pilot
loop
exitwhen i > AMOUNT - 1
set random = GetRandomInt(0,VillagerSpawnMax)
set x = GetRectCenterX(VillagerSpawnRect[random])
set y = GetRectCenterY(VillagerSpawnRect[random])
set spawned = CreateUnit(Player(ALLIEDID),VillagerId[GetRandomInt(0,VillagerIdMax)],x,y,0.)
call GroupAddUnit(VillagerGroup,spawned)
set x = GetRandomReal(GetRectMinX(gg_rct_Crash),GetRectMaxX(gg_rct_Crash))
set y = GetRandomReal(GetRectMinY(gg_rct_Crash),GetRectMaxY(gg_rct_Crash))
call IssuePointOrder(spawned,"move",x,y)
set i = i + 1
endloop
set i = 0
loop
exitwhen i > 3
set x = GetRandomReal(GetRectMinX(gg_rct_VillageSpawn),GetRectMaxX(gg_rct_VillageSpawn))
set y = GetRandomReal(GetRectMinY(gg_rct_VillageSpawn),GetRectMaxY(gg_rct_VillageSpawn))
set spawned = CreateUnit(Player(ALLIEDID),'h003',x,y,0.)
call IndieSummon_SetMaster(spawned,Pilot)
call UnitAddAbility(spawned,QUESTUNIT)
set i = i + 1
endloop
set x = GetRandomReal(GetRectMinX(gg_rct_VillageSpawn),GetRectMaxX(gg_rct_VillageSpawn))
set y = GetRandomReal(GetRectMinY(gg_rct_VillageSpawn),GetRectMaxY(gg_rct_VillageSpawn))
set spawned = CreateUnit(Player(ALLIEDID),'h00P',x,y,0.)
call IndieSummon_SetMaster(spawned,Pilot)
call UnitAddAbility(spawned,QUESTUNIT)
set spawned = null
set CreepsRequiredKill = REQ_BASE+REQ_PLAYER*PlayerAmount
call ForGroup(VillagerGroup,function CountAllAllied)
call PingQuest(GetRectCenterX(gg_rct_Crash),GetRectCenterY(gg_rct_Crash),5.,30.)
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(11),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(13),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(14),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function EnemyDeath ) )
set QuestTrig[IDQ][1] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][1],Player(ALLIEDID),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(QuestTrig[IDQ][1], Condition( function AlliedDeath) )
set QuestTrig[IDQ][2] = CreateTrigger()
call TriggerRegisterUnitEvent(QuestTrig[IDQ][2],Pilot,EVENT_UNIT_DEATH)
call TriggerAddCondition(QuestTrig[IDQ][2], Condition( function PilotDeath) )
endfunction
private function AddExplosions takes unit whichUnit, real x, real y returns nothing
local integer i = 0
loop
exitwhen i > COUNT
call DestroyEffect(AddSpecialEffect(FX,x+GetRandomReal(-AOE_FX,AOE_FX),y+GetRandomReal(-AOE_FX,AOE_FX)))
set i = i + 1
endloop
call UnitDamageAll(whichUnit,false,AOE,x,y,100.,DMG_EXPLOSIVE,false,0,0,0)
endfunction
private struct str
unit drone
real angle
integer distance
integer i
endstruct
private function Update takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
local real newX = GetUnitX(dat.drone) + SPEED*Cos(dat.angle)
local real newY = GetUnitY(dat.drone) + SPEED*Sin(dat.angle)
local real z = GetUnitFlyHeight(dat.drone)
local real newz = 0.
if dat.i < dat.distance then
set dat.i = dat.i + 1
call SetUnitX(dat.drone, newX)
call SetUnitY(dat.drone, newY)
else
call AddExplosions(dat.drone,newX,newY)
call SetUnitFlyHeight(dat.drone,0.,0.)
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function StartCrash takes nothing returns nothing
local timer t = NewTimer()
local str dat = str.create()
local real x1 = -6200.
local real y1 = -13200.
local real x2 = -12200.
local real y2 = -6300.
call DisplayAll("Captain Barney","This feel baaaaad")
call FlySound()
set dat.angle = Atan2((y2 -y1), (x2 - x1))
set dat.distance =R2I(SquareRoot((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1))/SPEED)
set dat.i = 0
set dat.drone = CreateUnit(Player(ALLIEDID),DRONE_ID,x1,y1, dat.angle*bj_RADTODEG )
set Plane = dat.drone
set GeneralTarget = Plane
call SetUnitFlyHeight(dat.drone,SPAWN_Z,0.)
call SetUnitFlyHeight(dat.drone,0.,200.)
call SetTimerData(t, dat)
call TimerStart (t, TIMEOUT, true, function Update)
endfunction
function StartQ32 takes nothing returns nothing
local timer t = NewTimer()
set GeneralTarget = null
call StartCrash()
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
private function init takes nothing returns nothing
set VillagerSpawnRect[0] = gg_rct_VillageHouse1
set VillagerSpawnRect[1] = gg_rct_VillageHouse2
set VillagerSpawnRect[2] = gg_rct_VillageHouse3
set VillagerSpawnRect[3] = gg_rct_VillageHouse4
set VillagerSpawnRect[4] = gg_rct_VillageHouse5
set VillagerSpawnMax = 4
endfunction
endlibrary
//TESH.scrollpos=15
//TESH.alwaysfold=0
library q2 needs qsys,q4,q5,q7,q24,HeroDeath,AlliedSpawnSystem, GroupUtils,SpellEvent,AbilityPreload, SpawnSystem,IndieSummons, TimerUtils
globals
private constant integer IDQ = 2
private constant integer LAST_WAYPOINT = 11
private constant integer AMOUNT = 10
endglobals
private function AlliedDeath takes nothing returns boolean
local unit allied = GetTriggerUnit()
if IsUnitInGroup(allied,VillagerGroup) then
set VillagerKill = VillagerKill + 1
call GroupRemoveUnit(VillagerGroup,allied)
set GeneralTarget = FirstOfGroup(VillagerGroup)
set VillagerAlive = 0
call ForGroup(VillagerGroup,function CountAliveAllied)
set QuestEta[IDQ] = I2S(VillagerKill) + "/"+I2S(VillagerAll)+" villagers killed"
call UpdateQuest(IDQ)
set QuestRank[IDQ] = QuestRank[IDQ] - 1
if VillagerAlive == 0 then
if VillagerAll <= VillagerKill then
call ReleaseGroup(VillagerGroup)
call EndQuest(IDQ,false)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
else
call ReleaseGroup(VillagerGroup)
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
endif
set RandomQuest = GetRandomInt(1,4)
if RandomQuest == 1 then
call StartQ4()
elseif RandomQuest == 2 then
call StartQ5()
elseif RandomQuest == 3 then
call StartQ7()
elseif RandomQuest == 4 then
call StartQ24()
endif
endif
endif
set allied = null
return false
endfunction
private function ArrivedToEnd takes nothing returns boolean
local unit convoyUnit = GetTriggerUnit()
if IsUnitInGroup(convoyUnit,VillagerGroup) then
call GroupRemoveUnit(VillagerGroup,convoyUnit)
set GeneralTarget = FirstOfGroup(VillagerGroup)
call EraseUnit(convoyUnit)
set VillagerAlive = 0
set CurrentLastWayPointArrivedUnit = CurrentLastWayPointArrivedUnit + 1
call ForGroup(VillagerGroup,function CountAliveAllied)
set QuestEta[IDQ] = I2S(CurrentLastWayPointArrivedUnit) + "/"+I2S(VillagerAll)+" civilians arrived"
call UpdateQuestMbOnly(IDQ)
if VillagerAlive==0 then
call ReleaseGroup(VillagerGroup)
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
set RandomQuest = GetRandomInt(1,4)
if RandomQuest == 1 then
call StartQ4()
elseif RandomQuest == 2 then
call StartQ5()
elseif RandomQuest == 3 then
call StartQ7()
elseif RandomQuest == 4 then
call StartQ24()
endif
endif
endif
set convoyUnit = null
return false
endfunction
private function FindCivilians takes nothing returns boolean
local integer i = 0
local unit whichUnit = GetFilterUnit()
local real x
local real y
loop
exitwhen i > VillagerIdMax
if GetUnitTypeId(whichUnit)==VillagerId[i] and not (IsUnitType(whichUnit,UNIT_TYPE_DEAD)) and whichUnit != null then
call GroupAddUnit(VillagerGroup,whichUnit)
call UnitAddAbility(whichUnit,QUESTUNIT)
call UnitAddAbility(whichUnit,MOVE_SPELL)
set x = GetRandomReal(GetRectMinX(CurrentRect),GetRectMaxX(CurrentRect))
set y = GetRandomReal(GetRectMinY(CurrentRect),GetRectMaxY(CurrentRect))
call IssuePointOrder(whichUnit,MOVE_ORDER,x,y)
endif
set i = i + 1
endloop
set whichUnit = null
return true
endfunction
private function Run takes nothing returns nothing
local integer i = 0
local unit convoyUnit = null
local unit escort = null
local real x = 0.
local real y = 0.
local real angle = 0.
call ReleaseTimer(GetExpiredTimer())
set CurrentWayPoint = 1
set CurrentLastWayPoint = LAST_WAYPOINT
set CurrentRect = ConvoyRect[CurrentWayPoint]
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(ALLIEDID),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function AlliedDeath) )
set QuestTrig[IDQ][1] = CreateTrigger()
call TriggerRegisterEnterRectSimple(QuestTrig[IDQ][1], ConvoyRect[CurrentLastWayPoint])
call TriggerAddCondition(QuestTrig[IDQ][1], Condition(function ArrivedToEnd))
call PingQuest(GetRectCenterX(gg_rct_VillagerStart),GetRectCenterY(gg_rct_VillagerStart),5.,10.)
call PingQuest(GetRectCenterX(gg_rct_Village),GetRectCenterY(gg_rct_Village),5.,10.)
set VillagerGroup = NewGroup()
call GroupEnumUnitsOfPlayer(ENUM_GROUP,Player(ALLIEDID),Filter(function FindCivilians))
set i = 0
loop
exitwhen i > AMOUNT
set x = GetRandomReal(GetRectMinX(CurrentRect),GetRectMaxX(CurrentRect))
set y = GetRandomReal(GetRectMinY(CurrentRect),GetRectMaxY(CurrentRect))
set convoyUnit = CreateUnit(Player(ALLIEDID),VillagerId[GetRandomInt(0,VillagerIdMax)],GetRectCenterX(gg_rct_VillagerStart)+GetRandomReal(-50.,50),GetRectCenterY(gg_rct_VillagerStart)+GetRandomReal(-50.,50),0.)
call UnitAddAbility(convoyUnit,QUESTUNIT)
call UnitAddAbility(convoyUnit,MOVE_SPELL)
call GroupAddUnit(VillagerGroup,convoyUnit)
call IssuePointOrder(convoyUnit,MOVE_ORDER,x,y)
if GetRandomInt(0,1)==1 then
set escort = CreateUnit(Player(ALLIEDID),AlliedId[GetRandomInt(0,AlliedIdLightMax)],GetRectCenterX(gg_rct_VillagerStart)+GetRandomReal(-50.,50),GetRectCenterY(gg_rct_VillagerStart)+GetRandomReal(-50.,50),0.)
call IndieSummon_SetMaster(escort,convoyUnit)
call UnitAddAbility(escort,QUESTUNIT)
endif
set i = i + 1
endloop
set GeneralTarget = FirstOfGroup(VillagerGroup)
call ForGroup(VillagerGroup,function CountAllAllied)
set convoyUnit = null
set escort = null
endfunction
function StartQ2 takes nothing returns nothing
local timer t = NewTimer()
call IniQuest(IDQ)
set ConvoyRect[1]=gg_rct_VillagerConvoy001
set ConvoyRect[2]=gg_rct_VillagerConvoy002
set ConvoyRect[3]=gg_rct_VillagerConvoy003
set ConvoyRect[4]=gg_rct_VillagerConvoy004
set ConvoyRect[5]=gg_rct_VillagerConvoy005
set ConvoyRect[6]=gg_rct_VillagerConvoy006
set ConvoyRect[7]=gg_rct_VillagerConvoy007
set ConvoyRect[8]=gg_rct_VillagerConvoy008
set ConvoyRect[9]=gg_rct_VillagerConvoy009
set ConvoyRect[10]=gg_rct_VillagerConvoy010
set ConvoyRect[11]=gg_rct_VillagerConvoy011
set ConvoySpawn[1][0] = 1
set ConvoySpawn[1][1] = 2
set ConvoySpawn[1][2] = 14
set ConvoySpawn[2][0] = 1
set ConvoySpawn[2][1] = 2
set ConvoySpawn[2][2] = 14
set ConvoySpawn[3][0] = 6
set ConvoySpawn[3][1] = 13
set ConvoySpawn[3][2] = 14
set ConvoySpawn[4][0] = 2
set ConvoySpawn[4][1] = 6
set ConvoySpawn[4][2] = 14
set ConvoySpawn[5][0] = 6
set ConvoySpawn[5][1] = 13
set ConvoySpawn[5][2] = 14
set ConvoySpawn[6][0] = 5
set ConvoySpawn[6][1] = 6
set ConvoySpawn[6][2] = 16
set ConvoySpawn[7][0] = 5
set ConvoySpawn[7][1] = 6
set ConvoySpawn[7][2] = 16
set ConvoySpawn[8][0] = 15
set ConvoySpawn[8][1] = 16
set ConvoySpawn[8][2] = 17
set ConvoySpawn[9][0] = 15
set ConvoySpawn[9][1] = 16
set ConvoySpawn[9][2] = 17
set ConvoySpawn[10][0] = 15
set ConvoySpawn[10][1] = 16
set ConvoySpawn[10][2] = 17
set ConvoySpawn[11][0] = 15
set ConvoySpawn[11][1] = 16
set ConvoySpawn[11][2] = 17
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
endlibrary
//TESH.scrollpos=48
//TESH.alwaysfold=0
library q3 needs SpellEvent,TextDisplay,qsys,q4,,q5,q7,q24, TimerUtils, AlliedSpawnSystem, IndieSummons
globals
private constant real FAIL_DURATION = 360.
private constant integer IDQ = 3
private constant integer GROUPID = 2
private constant integer SAMPLEID = 'I011'
private constant integer SAMPLEMAX = 20 //Per Player
private constant integer SAMPLEREQ = 5 //Per Player
private constant integer DELTA = 5
endglobals
private function FilterCreepsKill takes nothing returns boolean
if GetItemTypeId(GetFilterItem())==SAMPLEID then
call RemoveItem(GetFilterItem())
endif
return true
endfunction
private function SampleFind takes nothing returns boolean
local unit hero = GetTriggerUnit()
local item sample = GetManipulatedItem()
local integer sampleId = GetItemTypeId(sample)
local player owner = GetOwningPlayer(hero)
if sampleId == SAMPLEID then
set CreepsSubKill = CreepsSubKill + 1
set CreepsKill = CreepsKill + 1
set QuestEta[IDQ] = I2S(CreepsKill) + "/"+I2S(CreepsRequiredKill)+" samples found"
call UpdateQuestMbOnly(IDQ)
if CreepsSubKill == DELTA then
call UpdateQuest(IDQ)
set CreepsSubKill = 0
endif
if CreepsKill >= CreepsRequiredKill then
call EndQuest(IDQ,true)
call EnumItemsInRect(bj_mapInitialPlayableArea,Filter(function FilterCreepsKill),null)
call DestroyQuestTrigger(IDQ,0)
set RandomQuest = GetRandomInt(1,4)
if RandomQuest == 1 then
call StartQ4()
elseif RandomQuest == 2 then
call StartQ5()
elseif RandomQuest == 3 then
call StartQ7()
elseif RandomQuest == 4 then
call StartQ24()
endif
call ReleaseTimer(FailTimer)
call SwitchPatrolToAssaut(GROUPID)
call SwitchTowerToAssaut(GROUPID)
endif
endif
set hero = null
set sample = null
return false
endfunction
private function Update takes nothing returns nothing
call ReleaseTimer(FailTimer)
if CreepsKill < CreepsRequiredKill then
call EndQuest(IDQ,false)
set RandomQuest = GetRandomInt(1,4)
if RandomQuest == 1 then
call StartQ4()
elseif RandomQuest == 2 then
call StartQ5()
elseif RandomQuest == 3 then
call StartQ7()
elseif RandomQuest == 4 then
call StartQ24()
endif
endif
call EnumItemsInRect(bj_mapInitialPlayableArea,Filter(function FilterCreepsKill),null)
call DestroyQuestTrigger(IDQ,0)
call SwitchPatrolToAssaut(GROUPID)
call SwitchTowerToAssaut(GROUPID)
endfunction
private function StartFailTimer takes nothing returns nothing
set FailTimer = NewTimer()
call TimerStart(FailTimer,FAIL_DURATION,false,function Update)
endfunction
private function Run takes nothing returns nothing
local integer i = 0
local real x = 0.
local real y = 0.
set GeneralTarget = null
call StartFailTimer()
call ReleaseTimer(GetExpiredTimer())
loop
exitwhen i > SAMPLEMAX*PlayerAmount
set x = GetRandomReal(GetRectMinX(gg_rct_SampleToFind),GetRectMaxX(gg_rct_SampleToFind))
set y = GetRandomReal(GetRectMinY(gg_rct_SampleToFind),GetRectMaxY(gg_rct_SampleToFind))
call CreateItem(SAMPLEID,x,y)
call PingQuest(x,y,0.,0.5)
set i = i + 1
endloop
set CreepsSubKill = 0
set CreepsKill= 0
set CreepsRequiredKill = SAMPLEREQ*PlayerAmount
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(QuestTrig[IDQ][0], EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function SampleFind ) )
endfunction
function StartQ3 takes nothing returns nothing
local timer t = NewTimer()
local integer i = 0
loop
exitwhen i > 3
call AlliedAddUnitToPatrolGroup(AlliedId[GetRandomInt(0,AlliedIdLightMax)],GROUPID)
call AlliedAddUnitToTowerGroup(AlliedId[GetRandomInt(0,AlliedIdLightMax)],GROUPID)
set i = i + 1
endloop
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
endlibrary
//TESH.scrollpos=18
//TESH.alwaysfold=0
library q35 initializer init needs qsys,q24,q38,q39,q40,q41,HeroDeath,AlliedSpawnSystem, GroupUtils, SpawnSystem,IndieSummons, TimerUtils
globals
private constant integer IDQ = 35
private constant integer LAST_WAYPOINT = 9
private constant integer AMOUNT = 4
private constant integer CONVOY_ID = 'n006'
private unit array Frog [4]
private rect array ScoutSpawnRect [4]
private constant integer DRONE_ID = 'n00G'
private constant integer SPEED = 40
private constant real SPAWN_Z = 500.
private constant real WALKER_Z = 50.
private constant real WAIT = 3.
endglobals
private function AlliedDeath takes nothing returns boolean
local unit allied = GetTriggerUnit()
if IsUnitInGroup(allied,VillagerGroup) then
set VillagerKill = VillagerKill + 1
call GroupRemoveUnit(VillagerGroup,allied)
set GeneralTarget = FirstOfGroup(VillagerGroup)
set VillagerAlive = 0
call ForGroup(VillagerGroup,function CountAliveAllied)
set QuestEta[IDQ] = I2S(VillagerKill) + "/"+I2S(VillagerAll)+" GW-Frog destroyed"
call UpdateQuest(IDQ)
set QuestRank[IDQ] = QuestRank[IDQ] - 5
if VillagerAlive == 0 then
if VillagerAll <= VillagerKill then
call ReleaseGroup(VillagerGroup)
call EndQuest(IDQ,false)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
else
call ReleaseGroup(VillagerGroup)
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
endif
set RandomQuest = GetRandomInt(1,5)
if RandomQuest == 1 then
call StartQ24()
elseif RandomQuest == 2 then
call StartQ38()
elseif RandomQuest == 3 then
call StartQ39()
elseif RandomQuest == 4 then
call StartQ40()
elseif RandomQuest == 5 then
call StartQ41()
endif
endif
endif
set allied = null
return false
endfunction
private function ArrivedToEnd takes nothing returns boolean
local unit convoyUnit = GetTriggerUnit()
if IsUnitInGroup(convoyUnit,VillagerGroup) then
call GroupRemoveUnit(VillagerGroup,convoyUnit)
set GeneralTarget = FirstOfGroup(VillagerGroup)
call EraseUnit(convoyUnit)
set VillagerAlive = 0
set CurrentLastWayPointArrivedUnit = CurrentLastWayPointArrivedUnit + 1
call ForGroup(VillagerGroup,function CountAliveAllied)
set QuestEta[IDQ] = I2S(CurrentLastWayPointArrivedUnit) + "/"+I2S(VillagerAll)+" GW-Frog arrived"
call UpdateQuestMbOnly(IDQ)
if VillagerAlive==0 then
call ReleaseGroup(VillagerGroup)
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
set RandomQuest = GetRandomInt(1,5)
if RandomQuest == 1 then
call StartQ24()
elseif RandomQuest == 2 then
call StartQ38()
elseif RandomQuest == 3 then
call StartQ39()
elseif RandomQuest == 4 then
call StartQ40()
elseif RandomQuest == 5 then
call StartQ41()
endif
endif
endif
set convoyUnit = null
return false
endfunction
private function FindCivilians takes nothing returns boolean
local integer i = 0
local unit whichUnit = GetFilterUnit()
loop
exitwhen i > VillagerIdMax
if GetUnitTypeId(whichUnit)==VillagerId[i] and not (IsUnitType(whichUnit,UNIT_TYPE_DEAD)) and whichUnit != null then
call UnitAddAbility(whichUnit,LASTQUESTUNIT_SPELL)
call IssuePointOrder(whichUnit,LASTQUESTUNIT_ORDER,GetRectCenterX(gg_rct_LastQuest),GetRectCenterY(gg_rct_LastQuest))
endif
set i = i + 1
endloop
set whichUnit = null
return true
endfunction
private function Run takes nothing returns nothing
local integer i = 0
local unit convoyUnit = null
local unit escort = null
local real x = 0.
local real y = 0.
local real angle = 0.
call ReleaseTimer(GetExpiredTimer())
call GroupEnumUnitsOfPlayer(ENUM_GROUP,Player(ALLIEDID),Filter(function FindCivilians))
set CurrentWayPoint = 1
set CurrentLastWayPoint = LAST_WAYPOINT
set CurrentRect = ConvoyRect[CurrentWayPoint]
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(ALLIEDID),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function AlliedDeath) )
call PingQuest(GetRectCenterX(gg_rct_ScoutStart),GetRectCenterY(gg_rct_ScoutStart),5.,10.)
set VillagerGroup = NewGroup()
set i = 0
loop
exitwhen i > AMOUNT-1
set x = GetRandomReal(GetRectMinX(CurrentRect),GetRectMaxX(CurrentRect))
set y = GetRandomReal(GetRectMinY(CurrentRect),GetRectMaxY(CurrentRect))
set convoyUnit = Frog[i]
call UnitAddAbility(convoyUnit,QUESTUNIT)
call UnitAddAbility(convoyUnit,MOVE_SPELL)
call GroupAddUnit(VillagerGroup,convoyUnit)
call IssuePointOrder(convoyUnit,MOVE_ORDER,x,y)
set escort = CreateUnit(Player(ALLIEDID),AlliedId[GetRandomInt(0,AlliedIdLightMax)],GetRectCenterX(gg_rct_VillageSpawn)+GetRandomReal(-50.,50),GetRectCenterY(gg_rct_VillageSpawn)+GetRandomReal(-50.,50),0.)
call IndieSummon_SetMaster(escort,convoyUnit)
call UnitAddAbility(escort,QUESTUNIT)
set escort = CreateUnit(Player(ALLIEDID),AlliedId[GetRandomInt(0,AlliedIdLightMax)],GetRectCenterX(gg_rct_VillageSpawn)+GetRandomReal(-50.,50),GetRectCenterY(gg_rct_VillageSpawn)+GetRandomReal(-50.,50),0.)
call IndieSummon_SetMaster(escort,convoyUnit)
call UnitAddAbility(escort,QUESTUNIT)
set i = i + 1
endloop
set GeneralTarget = FirstOfGroup(VillagerGroup)
set CurrentLastWayPointArrivedUnit = 0
set VillagerKill = 0
set VillagerAlive = 0
set VillagerAll = 0
call ForGroup(VillagerGroup,function CountAllAllied)
set QuestTrig[IDQ][1] = CreateTrigger()
call TriggerRegisterEnterRectSimple(QuestTrig[IDQ][1], ConvoyRect[CurrentLastWayPoint])
call TriggerAddCondition(QuestTrig[IDQ][1], Condition(function ArrivedToEnd))
set convoyUnit = null
set escort = null
endfunction
private struct s_delay
unit drone
unit walker
endstruct
private function Wait takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_delay dat = GetTimerData(t)
call SetUnitFlyHeight(dat.drone,SPAWN_Z,300.)
call SetUnitFlyHeight(dat.walker, 0., 0.)
call UnitRemoveAbility(dat.walker,GARN)
call SetUnitInvulnerable(dat.walker,false)
call UnitAddAbility(dat.drone,LASTQUESTUNIT_SPELL)
call IssuePointOrder(dat.drone,LASTQUESTUNIT_ORDER,GetRectCenterX(gg_rct_LastQuest),GetRectCenterY(gg_rct_LastQuest))
call ReleaseTimer(t)
call dat.destroy()
endfunction
private function DelayControl takes unit drone, unit walker returns nothing
local timer t = NewTimer()
local s_delay dat = s_delay.create()
set dat.walker = walker
set dat.drone = drone
call SetTimerData(t, dat)
call TimerStart (t, WAIT, false, function Wait)
endfunction
private struct s_drop
player owner
unit drone
unit walker
real angle
integer distance
integer i
endstruct
private function Update takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_drop dat = GetTimerData(t)
local real newX = GetUnitX(dat.drone) + SPEED*Cos(dat.angle)
local real newY = GetUnitY(dat.drone) + SPEED*Sin(dat.angle)
if dat.i < dat.distance then
set dat.i = dat.i + 1
call SetUnitPosition(dat.drone, newX, newY)
call SetUnitPosition(dat.walker, newX, newY)
else
call SetUnitFlyHeight(dat.drone,100.,300.)
call SetUnitFlyHeight(dat.walker, 0., 300.)
call DelayControl(dat.drone,dat.walker)
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function StartDrop takes real x1, real y1, real x2, real y2, integer frogId returns nothing
local timer t = NewTimer()
local s_drop dat = s_drop.create()
set dat.angle = Atan2((y2 -y1), (x2 - x1))
set dat.distance =R2I(SquareRoot((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1))/SPEED)
set dat.i = 0
set dat.drone = CreateUnit(Player(ALLIEDID),DRONE_ID,x1,y1, dat.angle*bj_RADTODEG )
call SetUnitFlyHeight(dat.drone,SPAWN_Z,0.)
set dat.walker = CreateUnit(Player(ALLIEDID),CONVOY_ID,x1,y1,0.)
call SetUnitFlyHeight(dat.walker, SPAWN_Z-WALKER_Z, 0.)
call UnitAddAbility(dat.walker,GARN)
call SetUnitPathing(dat.walker,false)
call SetUnitInvulnerable(dat.walker,true)
set Frog[frogId]=dat.walker
call SetTimerData(t, dat)
call TimerStart (t, TIMEOUT, true, function Update)
endfunction
function StartQ35 takes nothing returns nothing
local timer t = NewTimer()
local integer i = 0
local real x1 = -13700.
local real y1 = -8300.
local real x2 = 0.
local real y2 = 0.
set ConvoyRect[1]=gg_rct_ScoutConvoy001
set ConvoyRect[2]=gg_rct_ScoutConvoy002
set ConvoyRect[3]=gg_rct_ScoutConvoy003
set ConvoyRect[4]=gg_rct_ScoutConvoy004
set ConvoyRect[5]=gg_rct_ScoutConvoy005
set ConvoyRect[6]=gg_rct_ScoutConvoy006
set ConvoyRect[7]=gg_rct_ScoutConvoy007
set ConvoyRect[8]=gg_rct_ScoutConvoy008
set ConvoyRect[9]=gg_rct_ScoutConvoy009
set ConvoySpawn[1][0] = 1
set ConvoySpawn[1][1] = 13
set ConvoySpawn[1][2] = 38
set ConvoySpawn[2][0] = 13
set ConvoySpawn[2][1] = 30
set ConvoySpawn[2][2] = 38
set ConvoySpawn[3][0] = 13
set ConvoySpawn[3][1] = 22
set ConvoySpawn[3][2] = 30
set ConvoySpawn[4][0] = 13
set ConvoySpawn[4][1] = 20
set ConvoySpawn[4][2] = 22
set ConvoySpawn[5][0] = 13
set ConvoySpawn[5][1] = 20
set ConvoySpawn[5][2] = 22
set ConvoySpawn[6][0] = 20
set ConvoySpawn[6][1] = 22
set ConvoySpawn[6][2] = 39
set ConvoySpawn[7][0] = 20
set ConvoySpawn[7][1] = 25
set ConvoySpawn[7][2] = 39
set ConvoySpawn[8][0] = 20
set ConvoySpawn[8][1] = 25
set ConvoySpawn[8][2] = 39
set ConvoySpawn[9][0] = 20
set ConvoySpawn[9][1] = 25
set ConvoySpawn[9][2] = 39
loop
exitwhen i > AMOUNT-1
set x2 = GetRectCenterX(ScoutSpawnRect[i])
set y2 = GetRectCenterY(ScoutSpawnRect[i])
call StartDrop(x1,y1,x2,y2,i)
set i = i + 1
endloop
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
private function init takes nothing returns nothing
set ScoutSpawnRect[0]=gg_rct_ScoutDrop1
set ScoutSpawnRect[1]=gg_rct_ScoutDrop2
set ScoutSpawnRect[2]=gg_rct_ScoutDrop3
set ScoutSpawnRect[3]=gg_rct_ScoutDrop4
endfunction
endlibrary
//TESH.scrollpos=90
//TESH.alwaysfold=0
library q36 needs qsys, TimerUtils, q40,q41, AlliedSpawnSystem, GroupUtils, AutoIndex,HeroDeath,,IndieSummons
globals
private constant integer IDQ = 36
private constant integer AMOUNT = 6
private constant integer UNIT_ID = 'n00W'
private constant real AOE = 400.
endglobals
private struct str
boolean found
private static method createFilter takes unit u returns boolean
return GetUnitTypeId(u)==UNIT_ID
endmethod
private method onCreate takes nothing returns nothing
set .found = false
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
set .found = false
endmethod
implement AutoDestroy
endstruct
private function ArrivedToEnd takes nothing returns boolean
local unit allied = GetTriggerUnit()
if IsUnitInGroup(allied,VillagerGroup) then
set CurrentLastWayPointArrivedUnit = CurrentLastWayPointArrivedUnit + 1
call GroupRemoveUnit(VillagerGroup,allied)
set GeneralTarget = FirstOfGroup(VillagerGroup)
call EraseUnit(allied)
set VillagerAlive = 0
call ForGroup(VillagerGroup,function CountAliveAllied)
set QuestEta[IDQ] = I2S(CurrentLastWayPointArrivedUnit) + "/"+I2S(VillagerAll)+" scientists arrived"
call UpdateQuest(IDQ)
if VillagerAlive == 0 then
call ReleaseGroup(VillagerGroup)
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call DestroyQuestTrigger(IDQ,2)
set RandomQuest = GetRandomInt(1,2)
if RandomQuest == 1 then
call StartQ40()
elseif RandomQuest == 2 then
call StartQ41()
endif
endif
endif
set allied = null
return false
endfunction
private function CheckNearbyAllied takes nothing returns boolean
local unit allied = GetFilterUnit()
local str dat = str[allied]
if IsUnitInGroup(allied,VillagerGroup) then
if dat.found == false then
set dat.found = true
set CurrentWayPointArrivedUnit = CurrentWayPointArrivedUnit + 1
set VillagerAlive = 0
call ForGroup(VillagerGroup,function CountAliveAllied)
set QuestEta[IDQ] = I2S(CurrentWayPointArrivedUnit) + "/"+I2S(VillagerAll)+" scientists found"
call UpdateQuest(IDQ)
call IssuePointOrder(allied,"move",GetRectCenterX(gg_rct_LastQuest),GetRectCenterY(gg_rct_LastQuest))
if CurrentWayPointArrivedUnit >= VillagerAlive then
call DestroyQuestTrigger(IDQ,0)
endif
endif
endif
set allied = null
return true
endfunction
private function AlliedFound takes nothing returns boolean
if IsUnitType(GetTriggerUnit(),UNIT_TYPE_HERO) then
call GroupEnumUnitsInRange(ENUM_GROUP,GetUnitX(GetTriggerUnit()),GetUnitY(GetTriggerUnit()),AOE,Filter(function CheckNearbyAllied))
endif
return false
endfunction
private function AlliedDeath takes nothing returns boolean
local unit allied = GetTriggerUnit()
if IsUnitInGroup(allied,VillagerGroup) then
set VillagerKill = VillagerKill + 1
call GroupRemoveUnit(VillagerGroup,allied)
set GeneralTarget = FirstOfGroup(VillagerGroup)
set VillagerAlive = 0
call ForGroup(VillagerGroup,function CountAliveAllied)
set QuestEta[IDQ] = I2S(VillagerKill) + "/"+I2S(VillagerAll)+" scientists killed"
call UpdateQuest(IDQ)
set QuestRank[IDQ] = QuestRank[IDQ] - 3
if VillagerAlive == 0 then
if VillagerAll <= VillagerKill then
call ReleaseGroup(VillagerGroup)
call EndQuest(IDQ,false)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call DestroyQuestTrigger(IDQ,2)
else
call EndQuest(IDQ,true)
call ReleaseGroup(VillagerGroup)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call DestroyQuestTrigger(IDQ,2)
endif
set RandomQuest = GetRandomInt(1,2)
if RandomQuest == 1 then
call StartQ40()
elseif RandomQuest == 2 then
call StartQ41()
endif
endif
endif
set allied = null
return false
endfunction
private function Run takes nothing returns nothing
local integer i = 0
local unit spawned = null
local unit escort = null
local real x = 0.
local real y = 0.
local real angle = 0.
call ReleaseTimer(GetExpiredTimer())
set QuestTrig[IDQ][0] = CreateTrigger()
set VillagerGroup = NewGroup()
loop
exitwhen i > AMOUNT - 1
set angle = GetRandomReal(0.,360.)
set x = GetRandomReal(GetRectMinX(gg_rct_FailedAirdrop),GetRectMaxX(gg_rct_FailedAirdrop))
set y = GetRandomReal(GetRectMinY(gg_rct_FailedAirdrop),GetRectMaxY(gg_rct_FailedAirdrop))
set spawned = CreateUnit(Player(ALLIEDID),UNIT_ID,x,y,angle)
call GroupAddUnit(VillagerGroup,spawned)
call UnitAddAbility(spawned,QUESTUNIT)
set escort = CreateUnit(Player(ALLIEDID),'h00P',x+GetRandomReal(-50.,50),y+GetRandomReal(-50.,50),0.)
call IndieSummon_SetMaster(escort,spawned)
call UnitAddAbility(escort,QUESTUNIT)
set escort = CreateUnit(Player(ALLIEDID),'h003',x+GetRandomReal(-50.,50),y+GetRandomReal(-50.,50),0.)
call IndieSummon_SetMaster(escort,spawned)
call UnitAddAbility(escort,QUESTUNIT)
call TriggerRegisterUnitInRange(QuestTrig[IDQ][0], spawned,AOE, null)
call PingQuest(GetUnitX(spawned),GetUnitY(spawned),10.,30.)
set i = i + 1
endloop
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function AlliedFound) )
set GeneralTarget = FirstOfGroup(VillagerGroup)
set spawned = null
set escort = null
call ForGroup(VillagerGroup,function CountAllAllied)
set QuestTrig[IDQ][1] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][1],Player(ALLIEDID),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(QuestTrig[IDQ][1], Condition( function AlliedDeath) )
set QuestTrig[IDQ][2] = CreateTrigger()
call TriggerRegisterEnterRectSimple(QuestTrig[IDQ][2], gg_rct_LastQuest)
call TriggerAddCondition(QuestTrig[IDQ][2], Condition( function ArrivedToEnd ) )
endfunction
function StartQ36 takes nothing returns nothing
local timer t = NewTimer()
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
endlibrary
//TESH.scrollpos=98
//TESH.alwaysfold=0
library q53 needs qsys,q54,q55,HeroDeath,AlliedSpawnSystem, GroupUtils,IndieSummons, TimerUtils
globals
private constant integer IDQ = 53
private constant integer HUMVEE_ID = 'n01F'
private constant integer LAST_WAYPOINT = 6
private constant integer AMOUNT = 7
endglobals
private function AlliedDeath takes nothing returns boolean
local unit allied = GetTriggerUnit()
if IsUnitInGroup(allied,VillagerGroup) then
set VillagerKill = VillagerKill + 1
call GroupRemoveUnit(VillagerGroup,allied)
set GeneralTarget = FirstOfGroup(VillagerGroup)
set VillagerAlive = 0
call ForGroup(VillagerGroup,function CountAliveAllied)
set QuestEta[IDQ] = I2S(VillagerKill) + "/"+I2S(VillagerAll)+" units destroyed"
call UpdateQuest(IDQ)
set QuestRank[IDQ] = QuestRank[IDQ] - 1
if VillagerAlive == 0 then
if VillagerAll <= VillagerKill then
call ReleaseGroup(VillagerGroup)
call EndQuest(IDQ,false)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
else
call ReleaseGroup(VillagerGroup)
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
endif
set RandomQuest = GetRandomInt(1,2)
if RandomQuest == 1 then
call StartQ54()
elseif RandomQuest == 2 then
call StartQ55()
endif
endif
endif
set allied = null
return false
endfunction
private function ArrivedToEnd takes nothing returns boolean
local unit convoyUnit = GetTriggerUnit()
if IsUnitInGroup(convoyUnit,VillagerGroup) then
call GroupRemoveUnit(VillagerGroup,convoyUnit)
set GeneralTarget = FirstOfGroup(VillagerGroup)
call EraseUnit(convoyUnit)
set VillagerAlive = 0
set CurrentLastWayPointArrivedUnit = CurrentLastWayPointArrivedUnit + 1
call ForGroup(VillagerGroup,function CountAliveAllied)
set QuestEta[IDQ] = I2S(CurrentLastWayPointArrivedUnit) + "/"+I2S(VillagerAll)+" units arrived"
call UpdateQuestMbOnly(IDQ)
if VillagerAlive==0 then
call ReleaseGroup(VillagerGroup)
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
set RandomQuest = GetRandomInt(1,2)
if RandomQuest == 1 then
call StartQ54()
elseif RandomQuest == 2 then
call StartQ55()
endif
endif
endif
set convoyUnit = null
return false
endfunction
private function FindCivilians takes nothing returns boolean
local integer i = 0
local unit whichUnit = GetFilterUnit()
local real x
local real y
loop
exitwhen i > VillagerIdMax
if GetUnitTypeId(whichUnit)==VillagerId[i] and not (IsUnitType(whichUnit,UNIT_TYPE_DEAD)) and whichUnit != null then
call GroupAddUnit(VillagerGroup,whichUnit)
call UnitAddAbility(whichUnit,QUESTUNIT)
call UnitAddAbility(whichUnit,MOVE_SPELL)
set x = GetRandomReal(GetRectMinX(CurrentRect),GetRectMaxX(CurrentRect))
set y = GetRandomReal(GetRectMinY(CurrentRect),GetRectMaxY(CurrentRect))
call IssuePointOrder(whichUnit,MOVE_ORDER,x,y)
endif
set i = i + 1
endloop
set whichUnit = null
return true
endfunction
private function Run takes nothing returns nothing
local integer i = 0
local unit convoyUnit = null
local unit escort = null
local real x = 0.
local real y = 0.
local real angle = 0.
call ReleaseTimer(GetExpiredTimer())
set CurrentWayPoint = 1
set CurrentLastWayPoint = LAST_WAYPOINT
set CurrentRect = ConvoyRect[CurrentWayPoint]
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(ALLIEDID),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function AlliedDeath) )
call PingQuest(GetRectCenterX(gg_rct_Humvee001),GetRectCenterY(gg_rct_Humvee001),15.,30.)
set VillagerGroup = NewGroup()
call GroupEnumUnitsOfPlayer(ENUM_GROUP,Player(ALLIEDID),Filter(function FindCivilians))
set i = 0
loop
exitwhen i > AMOUNT
set x = GetRandomReal(GetRectMinX(CurrentRect),GetRectMaxX(CurrentRect))
set y = GetRandomReal(GetRectMinY(CurrentRect),GetRectMaxY(CurrentRect))
set convoyUnit = CreateUnit(Player(ALLIEDID),HUMVEE_ID,GetRectCenterX(gg_rct_Humvee001)+GetRandomReal(-50.,50),GetRectCenterY(gg_rct_Humvee001)+GetRandomReal(-50.,50),0.)
call UnitAddAbility(convoyUnit,QUESTUNIT)
call UnitAddAbility(convoyUnit,MOVE_SPELL)
call GroupAddUnit(VillagerGroup,convoyUnit)
call IssuePointOrder(convoyUnit,MOVE_ORDER,x,y)
if GetRandomInt(0,1)==1 then
set escort = CreateUnit(Player(ALLIEDID),AlliedId[GetRandomInt(0,AlliedIdLightMax)],GetRectCenterX(gg_rct_Humvee001)+GetRandomReal(-50.,50),GetRectCenterY(gg_rct_Humvee001)+GetRandomReal(-50.,50),0.)
call IndieSummon_SetMaster(escort,convoyUnit)
call UnitAddAbility(escort,QUESTUNIT)
endif
set i = i + 1
endloop
set GeneralTarget = FirstOfGroup(VillagerGroup)
call ForGroup(VillagerGroup,function CountAllAllied)
set QuestTrig[IDQ][1] = CreateTrigger()
call TriggerRegisterEnterRectSimple(QuestTrig[IDQ][1], ConvoyRect[CurrentLastWayPoint])
call TriggerAddCondition(QuestTrig[IDQ][1], Condition(function ArrivedToEnd))
set convoyUnit = null
set escort = null
endfunction
function StartQ53 takes nothing returns nothing
local timer t = NewTimer()
set ConvoyRect[1]=gg_rct_Humvee001
set ConvoyRect[2]=gg_rct_Humvee002
set ConvoyRect[3]=gg_rct_Humvee003
set ConvoyRect[4]=gg_rct_Humvee004
set ConvoyRect[5]=gg_rct_Humvee005
set ConvoyRect[6]=gg_rct_Humvee006
set ConvoySpawn[1][0] = 2
set ConvoySpawn[1][1] = 19
set ConvoySpawn[1][2] = 29
set ConvoySpawn[2][0] = 2
set ConvoySpawn[2][1] = 19
set ConvoySpawn[2][2] = 29
set ConvoySpawn[3][0] = 9
set ConvoySpawn[3][1] = 19
set ConvoySpawn[3][2] = 46
set ConvoySpawn[4][0] = 8
set ConvoySpawn[4][1] = 9
set ConvoySpawn[4][2] = 46
set ConvoySpawn[5][0] = 8
set ConvoySpawn[5][1] = 46
set ConvoySpawn[5][2] = 47
set ConvoySpawn[6][0] = 8
set ConvoySpawn[6][1] = 46
set ConvoySpawn[6][2] = 47
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library q56 needs qsys,q57,q58,HeroDeath,AlliedSpawnSystem, GroupUtils,IndieSummons, TimerUtils
globals
private constant integer IDQ = 56
private constant integer LAST_WAYPOINT = 10
private constant integer AMOUNT = 10
endglobals
private function AlliedDeath takes nothing returns boolean
local unit allied = GetTriggerUnit()
if IsUnitInGroup(allied,VillagerGroup) then
set VillagerKill = VillagerKill + 1
call GroupRemoveUnit(VillagerGroup,allied)
set GeneralTarget = FirstOfGroup(VillagerGroup)
set VillagerAlive = 0
call ForGroup(VillagerGroup,function CountAliveAllied)
set QuestEta[IDQ] = I2S(VillagerKill) + "/"+I2S(VillagerAll)+" civilians killed"
call UpdateQuest(IDQ)
set QuestRank[IDQ] = QuestRank[IDQ] - 1
if VillagerAlive == 0 then
if VillagerAll <= VillagerKill then
call ReleaseGroup(VillagerGroup)
call EndQuest(IDQ,false)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
else
call ReleaseGroup(VillagerGroup)
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
endif
set RandomQuest = GetRandomInt(1,2)
if RandomQuest == 1 then
call StartQ57()
elseif RandomQuest == 2 then
call StartQ58()
endif
endif
endif
set allied = null
return false
endfunction
private function ArrivedToEnd takes nothing returns boolean
local unit convoyUnit = GetTriggerUnit()
if IsUnitInGroup(convoyUnit,VillagerGroup) then
call GroupRemoveUnit(VillagerGroup,convoyUnit)
set GeneralTarget = FirstOfGroup(VillagerGroup)
call EraseUnit(convoyUnit)
set VillagerAlive = 0
set CurrentLastWayPointArrivedUnit = CurrentLastWayPointArrivedUnit + 1
call ForGroup(VillagerGroup,function CountAliveAllied)
set QuestEta[IDQ] = I2S(CurrentLastWayPointArrivedUnit) + "/"+I2S(VillagerAll)+" civilians arrived"
call UpdateQuestMbOnly(IDQ)
if VillagerAlive==0 then
call ReleaseGroup(VillagerGroup)
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
set RandomQuest = GetRandomInt(1,2)
if RandomQuest == 1 then
call StartQ57()
elseif RandomQuest == 2 then
call StartQ58()
endif
endif
endif
set convoyUnit = null
return false
endfunction
private function FindCivilians takes nothing returns boolean
local integer i = 0
local unit whichUnit = GetFilterUnit()
loop
exitwhen i > VillagerIdMax
if GetUnitTypeId(whichUnit)==VillagerId[i] and not (IsUnitType(whichUnit,UNIT_TYPE_DEAD)) and whichUnit != null then
call UnitAddAbility(whichUnit,LASTQUESTUNIT_SPELL)
call IssuePointOrder(whichUnit,LASTQUESTUNIT_ORDER,GetRectCenterX(gg_rct_LastQuest),GetRectCenterY(gg_rct_LastQuest))
endif
set i = i + 1
endloop
set whichUnit = null
return true
endfunction
private function Run takes nothing returns nothing
local integer i = 0
local unit convoyUnit = null
local unit escort = null
local real x = 0.
local real y = 0.
local real angle = 0.
call ReleaseTimer(GetExpiredTimer())
set CurrentWayPoint = 1
set CurrentLastWayPoint = LAST_WAYPOINT
set CurrentRect = ConvoyRect[CurrentWayPoint]
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(ALLIEDID),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function AlliedDeath) )
call PingQuest(GetRectCenterX(gg_rct_Crash),GetRectCenterY(gg_rct_Crash),15.,30.)
set VillagerGroup = NewGroup()
call GroupEnumUnitsOfPlayer(ENUM_GROUP,Player(ALLIEDID),Filter(function FindCivilians))
set i = 0
loop
exitwhen i > AMOUNT
set x = GetRandomReal(GetRectMinX(CurrentRect),GetRectMaxX(CurrentRect))
set y = GetRandomReal(GetRectMinY(CurrentRect),GetRectMaxY(CurrentRect))
set convoyUnit = CreateUnit(Player(ALLIEDID),VillagerId[GetRandomInt(0,VillagerIdMax)],GetRectCenterX(gg_rct_Village)+GetRandomReal(-50.,50),GetRectCenterY(gg_rct_Village)+GetRandomReal(-50.,50),0.)
call UnitAddAbility(convoyUnit,QUESTUNIT)
call UnitAddAbility(convoyUnit,MOVE_SPELL)
call GroupAddUnit(VillagerGroup,convoyUnit)
call IssuePointOrder(convoyUnit,MOVE_ORDER,x,y)
if GetRandomInt(0,1)==1 then
set escort = CreateUnit(Player(ALLIEDID),AlliedId[GetRandomInt(0,AlliedIdLightMax)],GetRectCenterX(gg_rct_Village)+GetRandomReal(-50.,50),GetRectCenterY(gg_rct_Village)+GetRandomReal(-50.,50),0.)
call IndieSummon_SetMaster(escort,convoyUnit)
call UnitAddAbility(escort,QUESTUNIT)
endif
set i = i + 1
endloop
set GeneralTarget = FirstOfGroup(VillagerGroup)
call ForGroup(VillagerGroup,function CountAllAllied)
set QuestTrig[IDQ][1] = CreateTrigger()
call TriggerRegisterEnterRectSimple(QuestTrig[IDQ][1], ConvoyRect[CurrentLastWayPoint])
call TriggerAddCondition(QuestTrig[IDQ][1], Condition(function ArrivedToEnd))
set convoyUnit = null
set escort = null
endfunction
function StartQ56 takes nothing returns nothing
local timer t = NewTimer()
set ConvoyRect[1]=gg_rct_ToTheTown001
set ConvoyRect[2]=gg_rct_ToTheTown002
set ConvoyRect[3]=gg_rct_ToTheTown003
set ConvoyRect[4]=gg_rct_ToTheTown004
set ConvoyRect[5]=gg_rct_ToTheTown005
set ConvoyRect[6]=gg_rct_ToTheTown006
set ConvoyRect[7]=gg_rct_ToTheTown007
set ConvoyRect[8]=gg_rct_ToTheTown008
set ConvoyRect[9]=gg_rct_ToTheTown009
set ConvoyRect[10]=gg_rct_ToTheTown010
set ConvoySpawn[1][0] = 2
set ConvoySpawn[1][1] = 7
set ConvoySpawn[1][2] = 36
set ConvoySpawn[2][0] = 19
set ConvoySpawn[2][1] = 24
set ConvoySpawn[2][2] = 29
set ConvoySpawn[3][0] = 2
set ConvoySpawn[3][1] = 19
set ConvoySpawn[3][2] = 29
set ConvoySpawn[4][0] = 29
set ConvoySpawn[4][1] = 50
set ConvoySpawn[4][2] = 52
set ConvoySpawn[5][0] = 29
set ConvoySpawn[5][1] = 50
set ConvoySpawn[5][2] = 52
set ConvoySpawn[6][0] = 49
set ConvoySpawn[6][1] = 50
set ConvoySpawn[6][2] = 52
set ConvoySpawn[7][0] = 6
set ConvoySpawn[7][1] = 17
set ConvoySpawn[7][2] = 28
set ConvoySpawn[8][0] = 5
set ConvoySpawn[8][1] = 17
set ConvoySpawn[8][2] = 44
set ConvoySpawn[9][0] = 5
set ConvoySpawn[9][1] = 14
set ConvoySpawn[9][2] = 44
set ConvoySpawn[10][0] = 5
set ConvoySpawn[10][1] = 17
set ConvoySpawn[10][2] = 44
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
endlibrary
//TESH.scrollpos=36
//TESH.alwaysfold=0
library q4 needs qsys, TimerUtils, AlliedSpawnSystem, GroupUtils, q6
globals
private constant integer IDQ = 4
private constant integer GROUPID = 2
private constant integer REQ_BASE = 500 //Per Player
private constant integer REQ_PLAYER = 10 //Per Player
private constant integer DELTA = 100 //each delta update the quest
endglobals
private function AlliedDeath takes nothing returns boolean
call DisplayAll("Control", "Good job on defence... Generator is destroyed.")
call EndQuest(IDQ,false)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call StartQ6()
call SwitchPatrolToAssaut(GROUPID)
call SwitchTowerToAssaut(GROUPID)
return false
endfunction
private function EnemyDeath takes nothing returns boolean
if QuestBoolean[IDQ]==true then
set CreepsSubKill = CreepsSubKill + 1
set CreepsKill = CreepsKill + 1
set QuestEta[IDQ] = I2S(R2I(100*CreepsKill/CreepsRequiredKill)) + "% targets down"
call UpdateQuestMbOnly(IDQ)
if CreepsSubKill == DELTA then
call UpdateQuest(IDQ)
set CreepsSubKill = 0
endif
if CreepsKill >= CreepsRequiredKill then
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call StartQ6()
call SwitchPatrolToAssaut(GROUPID)
call SwitchTowerToAssaut(GROUPID)
endif
endif
return false
endfunction
private function Run takes nothing returns nothing
call ReleaseTimer(GetExpiredTimer())
set GeneralTarget = Building
call SetUnitInvulnerable(Building,false)
call SetUnitOwner(Building,Player(ALLIEDID),true)
call PingQuest(GetUnitX(Building),GetUnitY(Building),10.,30.)
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(11),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(13),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(14),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function EnemyDeath ) )
set QuestTrig[IDQ][1] = CreateTrigger()
call TriggerRegisterUnitEvent(QuestTrig[IDQ][1],Building,EVENT_UNIT_DEATH)
call TriggerAddCondition(QuestTrig[IDQ][1], Condition( function AlliedDeath ) )
endfunction
function StartQ4 takes nothing returns nothing
local timer t = NewTimer()
local integer i = 0
loop
exitwhen i > 3
call AlliedAddUnitToPatrolGroup(AlliedId[GetRandomInt(0,AlliedIdLightMax)],GROUPID)
call AlliedAddUnitToTowerGroup(AlliedId[GetRandomInt(0,AlliedIdLightMax)],GROUPID)
set i = i + 1
endloop
set Building = ExternalOutpostGenerator
set CreepsRequiredKill = REQ_BASE+REQ_PLAYER*PlayerAmount
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
endlibrary
//TESH.scrollpos=81
//TESH.alwaysfold=0
library q5 needs qsys TimerUtils,HeroDeath,q6, SpellEvent, TextDisplay, TimerUtils, AbilityPreload, AlliedSpawnSystem, IndieSummons
globals
private constant integer IDQ = 5
private constant integer GROUPID1 = 3
private constant integer GROUPID2 = 4
private constant integer REQ_MAX = 300
private constant integer REQ_BASE = 150
private constant integer WAVE_MAX = 4
private constant integer DELTA = 50 //each delta update the quest
private constant integer ID1 = 'h00A'
private constant integer ID2 = 'h009'
private constant real TIMEOUT_WAVE = 5.
private constant string FX = "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportCaster.mdl"
private rect array TeleporterRect [4]
endglobals
private struct str
integer i = 0
unit troop = null
endstruct
private function RemoveTroopsFromGroup takes nothing returns nothing
call GroupRemoveUnit(VillagerGroup,GetEnumUnit())
endfunction
private function SpawnTroop takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
local real x = 0.
local real y = 0.
local integer i = 0
local integer random = 0
if QuestBoolean[IDQ] and dat.i < REQ_MAX then
loop
exitwhen i > WAVE_MAX
if GetRandomInt(0,1) == 0 then
set random = ID1
else
set random = ID2
endif
set x = GetRandomReal(GetRectMinX(gg_rct_TeleporterSpawn),GetRectMaxX(gg_rct_TeleporterSpawn))
set y = GetRandomReal(GetRectMinY(gg_rct_TeleporterSpawn),GetRectMaxY(gg_rct_TeleporterSpawn))
call DestroyEffect(AddSpecialEffect(FX,x,y))
set dat.troop = CreateUnit(Player(ALLIEDID),random,x,y,0.)
call GroupAddUnit(VillagerGroup,dat.troop)
call UnitAddAbility(dat.troop,QUESTUNIT)
call UnitAddAbility(dat.troop,MOVE_SPELL)
call IssuePointOrder(dat.troop,MOVE_ORDER,GetRectCenterX(gg_rct_Teleporter),GetRectCenterY(gg_rct_Teleporter))
set dat.i = dat.i + 1
set i = i + 1
endloop
else
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function IniSpawn takes nothing returns nothing
local timer t = NewTimer()
local str dat = str.create()
set dat.i = 0
call SetTimerData(t, dat)
call TimerStart (t,TIMEOUT_WAVE, true, function SpawnTroop )
endfunction
private function ArrivedToEnd takes nothing returns boolean
local unit troop = GetTriggerUnit()
if IsUnitInGroup(troop,VillagerGroup) then
call GroupRemoveUnit(VillagerGroup,troop)
call DestroyEffect(AddSpecialEffect(FX,GetUnitX(troop),GetUnitY(troop)))
call EraseUnit(troop)
set CreepsSubKill = CreepsSubKill + 1
set CreepsKill = CreepsKill + 1
set QuestEta[IDQ] = I2S(CreepsKill) + "/"+I2S(REQ_BASE)+" Troops entered."
call UpdateQuestMbOnly(IDQ)
set GeneralTarget = FirstOfGroup(VillagerGroup)
if CreepsSubKill == DELTA then
call UpdateQuest(IDQ)
set CreepsSubKill = 0
endif
if CreepsKill >= REQ_BASE then
call ForGroup(VillagerGroup,function RemoveTroopsFromGroup)
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call DestroyQuestTrigger(IDQ,2)
call StartQ6()
endif
endif
set troop = null
return false
endfunction
private function ForceToArrive takes nothing returns boolean
local unit troop = GetTriggerUnit()
local integer random = GetRandomInt(0,3)
if IsUnitInGroup(troop,VillagerGroup) then
call UnitRemoveAbility(troop,MOVE_SPELL)
call IssuePointOrder(troop,"move",GetRectCenterX(TeleporterRect[random]),GetRectCenterY(TeleporterRect[random]))
endif
set troop = null
return false
endfunction
private function CheckDeathTroop takes nothing returns boolean
local integer i = 0
local unit victim = GetTriggerUnit()
if IsUnitInGroup(victim,VillagerGroup) then
call GroupRemoveUnit(VillagerGroup,victim)
set VillagerKill = VillagerKill + 1
set GeneralTarget = FirstOfGroup(VillagerGroup)
if VillagerKill > REQ_BASE then
call ForGroup(VillagerGroup,function RemoveTroopsFromGroup)
set QuestEta[IDQ] = "Too much troops have been killed. Operation aborted."
call UpdateQuest(IDQ)
call EndQuest(IDQ,false)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call DestroyQuestTrigger(IDQ,2)
call StartQ6()
endif
endif
set victim = null
return false
endfunction
private function Run takes nothing returns nothing
local integer i = 0
loop
exitwhen i > 4
call AlliedAddUnitToPatrolGroupForced('h00U',GROUPID2,GetRectCenterX(gg_rct_TeleporterSpawn),GetRectCenterY(gg_rct_TeleporterSpawn))
set i = i + 1
endloop
set ConvoyRect[1] = gg_rct_Teleporter
set CurrentWayPoint = 1
set CurrentLastWayPoint = 1
set CurrentRect = ConvoyRect[1]
set VillagerGroup = NewGroup()
call ReleaseTimer(GetExpiredTimer())
call PingQuest(GetRectCenterX(gg_rct_Teleporter),GetRectCenterY(gg_rct_Teleporter),10.,30.)
call IniSpawn()
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(ALLIEDID),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function CheckDeathTroop ) )
set QuestTrig[IDQ][1] = CreateTrigger()
set i = 0
loop
exitwhen i > 3
call TriggerRegisterEnterRectSimple(QuestTrig[IDQ][1], TeleporterRect[i])
set i = i + 1
endloop
call TriggerAddCondition(QuestTrig[IDQ][1], Condition(function ArrivedToEnd))
set QuestTrig[IDQ][2] = CreateTrigger()
call TriggerRegisterEnterRectSimple(QuestTrig[IDQ][2], gg_rct_Teleporter)
call TriggerAddCondition(QuestTrig[IDQ][2], Condition(function ForceToArrive))
call AlliedAddUnitToPatrolGroup('h003',GROUPID1)
call AlliedAddUnitToPatrolGroup('h003',GROUPID1)
call AlliedAddUnitToPatrolGroup('h00P',GROUPID1)
call AlliedAddUnitToTowerGroup('h003',GROUPID1)
call AlliedAddUnitToTowerGroup('h003',GROUPID1)
call AlliedAddUnitToTowerGroup('h003',GROUPID1)
call AlliedAddUnitToTowerGroup('h003',GROUPID1)
call ForGroup(VillagerGroup,function CountAllAllied)
endfunction
function StartQ5 takes nothing returns nothing
local timer t = NewTimer()
local integer i = 0
local real x = 0.
local real y = 0.
loop
exitwhen i > 3
set x = GetUnitX(TeleporterReceptor[i])
set y = GetUnitY(TeleporterReceptor[i])
set TeleporterRect[i] = Rect(x-50.,y-50.,x+50.,y+50.)
set i = i + 1
endloop
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
endlibrary
//TESH.scrollpos=3
//TESH.alwaysfold=0
library q7 needs qsys, TimerUtils, AlliedSpawnSystem, GroupUtils, q6
globals
private constant integer IDQ = 7
private constant integer GROUPID = 2
private constant integer REQ_BASE = 500 //Per Player
private constant integer REQ_PLAYER = 10 //Per Player
private constant integer DELTA = 100 //each delta update the quest
endglobals
private function EnemyDeath takes nothing returns boolean
if QuestBoolean[IDQ]==true then
set CreepsSubKill = CreepsSubKill + 1
set CreepsKill = CreepsKill + 1
set QuestEta[IDQ] = I2S(R2I(100*CreepsKill/CreepsRequiredKill)) + "% targets down"
call UpdateQuestMbOnly(IDQ)
if CreepsSubKill == DELTA then
call UpdateQuest(IDQ)
set CreepsSubKill = 0
endif
if CreepsKill >= CreepsRequiredKill then
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call StartQ6()
call SwitchPatrolToAssaut(GROUPID)
call SwitchTowerToAssaut(GROUPID)
endif
endif
return false
endfunction
private function Run takes nothing returns nothing
call ReleaseTimer(GetExpiredTimer())
set GeneralTarget = null
call PingQuest(GetRectCenterX(gg_rct_ExternalOutpost),GetRectCenterY(gg_rct_ExternalOutpost),10.,30.)
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(11),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(13),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(14),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function EnemyDeath ) )
endfunction
function StartQ7 takes nothing returns nothing
local timer t = NewTimer()
local integer i = 0
loop
exitwhen i > 3
call AlliedAddUnitToPatrolGroup(AlliedId[GetRandomInt(0,AlliedIdLightMax)],GROUPID)
call AlliedAddUnitToTowerGroup(AlliedId[GetRandomInt(0,AlliedIdLightMax)],GROUPID)
set i = i + 1
endloop
set CreepsRequiredKill = REQ_BASE+REQ_PLAYER*PlayerAmount
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
endlibrary
//TESH.scrollpos=30
//TESH.alwaysfold=0
library q24 needs qsys,TimerUtils, q6, SpawnSystem
globals
private constant integer IDQ = 24
private constant integer BOSS_ID = 'u00L'
private constant real TIMEOUT_SPAWN = 6.
private constant integer SPAWNED_ID = 'u007'
private constant real FAIL_DURATION = 360.
endglobals
private struct str
unit caster
endstruct
private function Spawn takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
if not (IsUnitType(dat.caster,UNIT_TYPE_DEAD)) and dat.caster!=null and CreepsPop <= CREEPS_TOTALMAX+30 then
call SpawnCreeps(SPAWNED_ID,14,GetUnitX(dat.caster),GetUnitY(dat.caster))
else
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function ActivateSpawn takes unit boss returns nothing
local timer t = NewTimer()
local str dat = str.create()
set dat.caster = boss
call SetTimerData(t,dat)
call TimerStart(t,TIMEOUT_SPAWN,true,function Spawn)
endfunction
private function BossDeath takes nothing returns boolean
call ReleaseTimer(FailTimer)
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call StartQ6()
return false
endfunction
private function Failed takes nothing returns nothing
call ReleaseTimer(FailTimer)
if not (IsUnitType(Boss,UNIT_TYPE_DEAD)) then
call EndQuest(IDQ,false)
call DestroyQuestTrigger(IDQ,0)
call StartQ6()
call KillUnit(Boss)
endif
endfunction
private function Run takes nothing returns nothing
local real x = GetRandomReal(GetRectMinX(gg_rct_Vortex),GetRectMaxX(gg_rct_Vortex))
local real y = GetRandomReal(GetRectMinY(gg_rct_Vortex),GetRectMaxY(gg_rct_Vortex))
local unit boss = CreateUnit(Player(11),BOSS_ID,x,y,0.)
set GeneralTarget = null
call PingQuest(x,y,30.,60.)
call ReleaseTimer(GetExpiredTimer())
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterUnitEvent(QuestTrig[IDQ][0],boss, EVENT_UNIT_DEATH )
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function BossDeath ) )
call ActivateSpawn(boss)
set FailTimer = NewTimer()
call TimerStart(FailTimer,FAIL_DURATION,false,function Failed)
set Boss = boss
set boss = null
endfunction
function StartQ24 takes nothing returns nothing
local timer t = NewTimer()
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library q38 needs qsys,q6 TimerUtils, AlliedSpawnSystem, GroupUtils
globals
private constant integer IDQ = 38
private constant integer REQ_BASE = 500 //Per Player
private constant integer REQ_PLAYER = 10 //Per Player
private constant integer DELTA = 100 //each delta update the quest
endglobals
private function AlliedDeath takes nothing returns boolean
call DisplayAll("Control", "Nice. We lost a base.")
call EndQuest(IDQ,false)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call StartQ6()
return false
endfunction
private function EnemyDeath takes nothing returns boolean
if QuestBoolean[IDQ]==true then
set CreepsSubKill = CreepsSubKill + 1
set CreepsKill = CreepsKill + 1
set QuestEta[IDQ] = I2S(R2I(100*CreepsKill/CreepsRequiredKill)) + "% targets down"
call UpdateQuestMbOnly(IDQ)
if CreepsSubKill == DELTA then
call UpdateQuest(IDQ)
set CreepsSubKill = 0
endif
if CreepsKill >= CreepsRequiredKill then
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call StartQ6()
endif
endif
return false
endfunction
private function Run takes nothing returns nothing
local integer i = 0
set Building = WarehouseBunker
loop
exitwhen i > 3
call AddUnitToAssautGroup(AlliedId[GetRandomInt(0,AlliedIdLightMax)],GetUnitX(Building),GetUnitY(Building))
set i = i + 1
endloop
call ReleaseTimer(GetExpiredTimer())
set Building = WarehouseBunker
call SetUnitInvulnerable(Building,false)
call SetUnitOwner(Building,Player(ALLIEDID),true)
set GeneralTarget = Building
call PingQuest(GetUnitX(Building),GetUnitY(Building),10.,30.)
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(11),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(13),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(14),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function EnemyDeath ) )
set QuestTrig[IDQ][1] = CreateTrigger()
call TriggerRegisterUnitEvent(QuestTrig[IDQ][1],Building,EVENT_UNIT_DEATH)
call TriggerAddCondition(QuestTrig[IDQ][1], Condition( function AlliedDeath ) )
endfunction
function StartQ38 takes nothing returns nothing
local timer t = NewTimer()
set CreepsRequiredKill = REQ_BASE+REQ_PLAYER*PlayerAmount
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library q39 needs qsys,q6, TimerUtils, AlliedSpawnSystem, GroupUtils
globals
private constant integer IDQ = 39
private constant integer REQ_BASE = 500 //Per Player
private constant integer REQ_PLAYER = 10 //Per Player
private constant integer DELTA = 100 //each delta update the quest
endglobals
private function AlliedDeath takes nothing returns boolean
call DisplayAll("Control", "Nice. We lost a base.")
call EndQuest(IDQ,false)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call StartQ6()
return false
endfunction
private function EnemyDeath takes nothing returns boolean
if QuestBoolean[IDQ]==true then
set CreepsSubKill = CreepsSubKill + 1
set CreepsKill = CreepsKill + 1
set QuestEta[IDQ] = I2S(R2I(100*CreepsKill/CreepsRequiredKill)) + "% targets down"
call UpdateQuestMbOnly(IDQ)
if CreepsSubKill == DELTA then
call UpdateQuest(IDQ)
set CreepsSubKill = 0
endif
if CreepsKill >= CreepsRequiredKill then
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call StartQ6()
endif
endif
return false
endfunction
private function Run takes nothing returns nothing
call ReleaseTimer(GetExpiredTimer())
set Building = MechFactory
call SetUnitInvulnerable(Building,false)
call SetUnitOwner(Building,Player(ALLIEDID),true)
set GeneralTarget = Building
call PingQuest(GetUnitX(Building),GetUnitY(Building),10.,30.)
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(11),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(13),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(14),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function EnemyDeath ) )
set QuestTrig[IDQ][1] = CreateTrigger()
call TriggerRegisterUnitEvent(QuestTrig[IDQ][1],Building,EVENT_UNIT_DEATH)
call TriggerAddCondition(QuestTrig[IDQ][1], Condition( function AlliedDeath ) )
endfunction
function StartQ39 takes nothing returns nothing
local timer t = NewTimer()
set CreepsRequiredKill = REQ_BASE+REQ_PLAYER*PlayerAmount
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
endlibrary
//TESH.scrollpos=32
//TESH.alwaysfold=0
library q40 needs qsys,q6, TimerUtils, AlliedSpawnSystem, GroupUtils,IndieSummons
globals
private constant integer IDQ = 40
private constant integer UNIT_ID = 'n014'
private constant integer REQ_BASE = 500 //Per Player
private constant integer REQ_PLAYER = 10 //Per Player
private constant integer DELTA = 100 //each delta update the quest
endglobals
private function AlliedDeath takes nothing returns boolean
call DisplayAll("Control", "You failed!")
call EndQuest(IDQ,false)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call StartQ6()
return false
endfunction
private function EnemyDeath takes nothing returns boolean
if QuestBoolean[IDQ]==true then
set CreepsSubKill = CreepsSubKill + 1
set CreepsKill = CreepsKill + 1
set QuestEta[IDQ] = I2S(R2I(100*CreepsKill/CreepsRequiredKill)) + "% targets down"
call UpdateQuestMbOnly(IDQ)
if CreepsSubKill == DELTA then
call UpdateQuest(IDQ)
set CreepsSubKill = 0
endif
if CreepsKill >= CreepsRequiredKill then
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call StartQ6()
endif
endif
return false
endfunction
private function Run takes nothing returns nothing
local unit escort = null
local integer i = 0
call ReleaseTimer(GetExpiredTimer())
set Building = CreateUnit(Player(ALLIEDID),UNIT_ID,GetRectCenterX(gg_rct_OmicronRush),GetRectCenterY(gg_rct_OmicronRush),0.)
call UnitAddAbility(Building,QUESTUNIT)
set GeneralTarget = Building
call PingQuest(GetUnitX(Building),GetUnitY(Building),10.,30.)
loop
exitwhen i > 3
set escort = CreateUnit(Player(ALLIEDID),AlliedId[GetRandomInt(0,AlliedIdLightMax)],GetRectCenterX(gg_rct_OmicronRush)+GetRandomReal(-50.,50),GetRectCenterY(gg_rct_OmicronRush)+GetRandomReal(-50.,50),0.)
call IndieSummon_SetMaster(escort,Building)
call UnitAddAbility(escort,QUESTUNIT)
set i = i + 1
endloop
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(11),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(13),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(14),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function EnemyDeath ) )
set QuestTrig[IDQ][1] = CreateTrigger()
call TriggerRegisterUnitEvent(QuestTrig[IDQ][1],Building,EVENT_UNIT_DEATH)
call TriggerAddCondition(QuestTrig[IDQ][1], Condition( function AlliedDeath ) )
set escort = null
endfunction
function StartQ40 takes nothing returns nothing
local timer t = NewTimer()
set CreepsRequiredKill = REQ_BASE+REQ_PLAYER*PlayerAmount
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
endlibrary
//TESH.scrollpos=32
//TESH.alwaysfold=0
library q41 needs qsys,q6, TimerUtils, AlliedSpawnSystem, GroupUtils
globals
private constant integer IDQ = 41
private constant integer UNIT_ID = 'n015'
private constant integer REQ_BASE = 500 //Per Player
private constant integer REQ_PLAYER = 10 //Per Player
private constant integer DELTA = 100 //each delta update the quest
endglobals
private function AlliedDeath takes nothing returns boolean
call DisplayAll("Control", "The car is down, I repeat, the car is down!")
call EndQuest(IDQ,false)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call StartQ6()
return false
endfunction
private function EnemyDeath takes nothing returns boolean
if QuestBoolean[IDQ]==true then
set CreepsSubKill = CreepsSubKill + 1
set CreepsKill = CreepsKill + 1
set QuestEta[IDQ] = I2S(R2I(100*CreepsKill/CreepsRequiredKill)) + "% targets down"
call UpdateQuestMbOnly(IDQ)
if CreepsSubKill == DELTA then
call UpdateQuest(IDQ)
set CreepsSubKill = 0
endif
if CreepsKill >= CreepsRequiredKill then
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call StartQ6()
endif
endif
return false
endfunction
private function Run takes nothing returns nothing
call ReleaseTimer(GetExpiredTimer())
set Building = CreateUnit(Player(ALLIEDID),UNIT_ID,GetRectCenterX(gg_rct_Containment),GetRectCenterY(gg_rct_Containment),0.)
call UnitAddAbility(Building,QUESTUNIT)
set GeneralTarget = Building
call PingQuest(GetUnitX(Building),GetUnitY(Building),10.,30.)
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(11),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(13),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(14),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function EnemyDeath ) )
set QuestTrig[IDQ][1] = CreateTrigger()
call TriggerRegisterUnitEvent(QuestTrig[IDQ][1],Building,EVENT_UNIT_DEATH)
call TriggerAddCondition(QuestTrig[IDQ][1], Condition( function AlliedDeath ) )
endfunction
function StartQ41 takes nothing returns nothing
local timer t = NewTimer()
set CreepsRequiredKill = REQ_BASE+REQ_PLAYER*PlayerAmount
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
endlibrary
//TESH.scrollpos=42
//TESH.alwaysfold=0
library q54 needs qsys,q6, TimerUtils, AlliedSpawnSystem, GroupUtils, IndieSummons
globals
private constant integer IDQ = 54
private constant integer UNIT_ID = 'h01R'
private constant integer REQ_BASE = 500 //Per Player
private constant integer REQ_PLAYER = 10 //Per Player
private constant integer DELTA = 100 //each delta update the quest
endglobals
private function AlliedDeath takes nothing returns boolean
call DisplayAll("Control", "You failed!")
call EndQuest(IDQ,false)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call StartQ6()
return false
endfunction
private function EnemyDeath takes nothing returns boolean
if QuestBoolean[IDQ]==true then
set CreepsSubKill = CreepsSubKill + 1
set CreepsKill = CreepsKill + 1
set QuestEta[IDQ] = I2S(R2I(100*CreepsKill/CreepsRequiredKill)) + "% targets down"
call UpdateQuestMbOnly(IDQ)
if CreepsSubKill == DELTA then
call UpdateQuest(IDQ)
set CreepsSubKill = 0
endif
if CreepsKill >= CreepsRequiredKill then
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call StartQ6()
endif
endif
return false
endfunction
private function Run takes nothing returns nothing
local unit escort = null
local integer i = 0
call ReleaseTimer(GetExpiredTimer())
set Building = CreateUnit(Player(ALLIEDID),UNIT_ID,GetRectCenterX(gg_rct_NorthHill),GetRectCenterY(gg_rct_NorthHill),0.)
call UnitAddAbility(Building,QUESTUNIT)
set GeneralTarget = Building
loop
exitwhen i > 3
set escort = CreateUnit(Player(ALLIEDID),'h003',GetRectCenterX(gg_rct_NorthHill)+GetRandomReal(-50.,50),GetRectCenterY(gg_rct_NorthHill)+GetRandomReal(-50.,50),0.)
call IndieSummon_SetMaster(escort,Building)
call UnitAddAbility(escort,QUESTUNIT)
set i = i + 1
endloop
call PingQuest(GetUnitX(Building),GetUnitY(Building),10.,30.)
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(11),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(13),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(14),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function EnemyDeath ) )
set QuestTrig[IDQ][1] = CreateTrigger()
call TriggerRegisterUnitEvent(QuestTrig[IDQ][1],Building,EVENT_UNIT_DEATH)
call TriggerAddCondition(QuestTrig[IDQ][1], Condition( function AlliedDeath ) )
set escort = null
endfunction
function StartQ54 takes nothing returns nothing
local timer t = NewTimer()
set CreepsRequiredKill = REQ_BASE+REQ_PLAYER*PlayerAmount
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
endlibrary
//TESH.scrollpos=121
//TESH.alwaysfold=0
library q55 needs qsys,q6,HeroDeath,AlliedSpawnSystem, GroupUtils,SpellEvent,AbilityPreload, SpawnSystem,IndieSummons, TimerUtils
globals
private constant integer IDQ = 55
private constant integer PEPPER_ID = 'h012'
private constant integer REQ_BASE = 500 //Per Player
private constant integer REQ_PLAYER = 10 //Per Player
private constant integer DELTA = 100 //each delta update the quest
private unit array Pepper [2]
private constant integer DRONE_ID = 'n00G'
private constant integer SPEED = 40
private constant real SPAWN_Z = 500.
private constant real WALKER_Z = 50.
private constant real WAIT = 3.
endglobals
private function AlliedDeath takes nothing returns boolean
local unit allied = GetTriggerUnit()
if IsUnitInGroup(allied,VillagerGroup) then
set VillagerKill = VillagerKill + 1
call GroupRemoveUnit(VillagerGroup,allied)
set GeneralTarget = FirstOfGroup(VillagerGroup)
set VillagerAlive = 0
call ForGroup(VillagerGroup,function CountAliveAllied)
set QuestEta[IDQ] = I2S(VillagerKill) + "/"+I2S(VillagerAll)+" pepper destroyed"
call UpdateQuest(IDQ)
if VillagerAlive == 0 then
call ReleaseGroup(VillagerGroup)
call EndQuest(IDQ,false)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call StartQ6()
endif
endif
set allied = null
return false
endfunction
private function EnemyDeath takes nothing returns boolean
if QuestBoolean[IDQ]==true then
set CreepsSubKill = CreepsSubKill + 1
set CreepsKill = CreepsKill + 1
set QuestEta[IDQ] = I2S(R2I(100*CreepsKill/CreepsRequiredKill)) + "% targets down"
call UpdateQuestMbOnly(IDQ)
if CreepsSubKill == DELTA then
call UpdateQuest(IDQ)
set CreepsSubKill = 0
endif
if CreepsKill >= CreepsRequiredKill then
call ReleaseGroup(VillagerGroup)
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call StartQ6()
endif
endif
return false
endfunction
private function Run takes nothing returns nothing
call ReleaseTimer(GetExpiredTimer())
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(ALLIEDID),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function AlliedDeath) )
call PingQuest(GetRectCenterX(gg_rct_EntranceClosure),GetRectCenterY(gg_rct_EntranceClosure),10.,30.)
set VillagerGroup = NewGroup()
call UnitAddAbility(Pepper[0],QUESTUNIT)
call GroupAddUnit(VillagerGroup,Pepper[0])
call IssuePointOrder(Pepper[0],"attackground",-12400.,11200.)
call UnitAddAbility(Pepper[1],QUESTUNIT)
call GroupAddUnit(VillagerGroup,Pepper[1])
call IssuePointOrder(Pepper[1],"attackground",-12400.,11200.)
set GeneralTarget = FirstOfGroup(VillagerGroup)
set CreepsRequiredKill = REQ_BASE+REQ_PLAYER*PlayerAmount
call ForGroup(VillagerGroup,function CountAllAllied)
set QuestTrig[IDQ][1] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][1],Player(11),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][1],Player(13),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][1],Player(14),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(QuestTrig[IDQ][1], Condition( function EnemyDeath ) )
endfunction
private struct s_delay
unit drone
unit walker
endstruct
private function Wait takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_delay dat = GetTimerData(t)
call SetUnitFlyHeight(dat.drone,SPAWN_Z,300.)
call SetUnitFlyHeight(dat.walker, 0., 0.)
call UnitRemoveAbility(dat.walker,GARN)
call SetUnitInvulnerable(dat.walker,false)
call UnitAddAbility(dat.drone,LASTQUESTUNIT_SPELL)
call IssuePointOrder(dat.drone,LASTQUESTUNIT_ORDER,GetRectCenterX(gg_rct_LastQuest),GetRectCenterY(gg_rct_LastQuest))
call ReleaseTimer(t)
call dat.destroy()
endfunction
private function DelayControl takes unit drone, unit walker returns nothing
local timer t = NewTimer()
local s_delay dat = s_delay.create()
set dat.walker = walker
set dat.drone = drone
call SetTimerData(t, dat)
call TimerStart (t, WAIT, false, function Wait)
endfunction
private struct s_drop
player owner
unit drone
unit walker
real angle
integer distance
integer i
endstruct
private function Update takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_drop dat = GetTimerData(t)
local real newX = GetUnitX(dat.drone) + SPEED*Cos(dat.angle)
local real newY = GetUnitY(dat.drone) + SPEED*Sin(dat.angle)
if dat.i < dat.distance then
set dat.i = dat.i + 1
call SetUnitPosition(dat.drone, newX, newY)
call SetUnitPosition(dat.walker, newX, newY)
else
call SetUnitFlyHeight(dat.drone,100.,300.)
call SetUnitFlyHeight(dat.walker, 0., 300.)
call DelayControl(dat.drone,dat.walker)
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function StartDrop takes real x1, real y1, real x2, real y2, integer frogId returns nothing
local timer t = NewTimer()
local s_drop dat = s_drop.create()
set dat.angle = Atan2((y2 -y1), (x2 - x1))
set dat.distance =R2I(SquareRoot((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1))/SPEED)
set dat.i = 0
set dat.drone = CreateUnit(Player(ALLIEDID),DRONE_ID,x1,y1, dat.angle*bj_RADTODEG )
call SetUnitFlyHeight(dat.drone,SPAWN_Z,0.)
set dat.walker = CreateUnit(Player(ALLIEDID),PEPPER_ID,x1,y1,0.)
call SetUnitFlyHeight(dat.walker, SPAWN_Z-WALKER_Z, 0.)
call UnitAddAbility(dat.walker,GARN)
call SetUnitPathing(dat.walker,false)
call SetUnitInvulnerable(dat.walker,true)
set Pepper[frogId]=dat.walker
call SetTimerData(t, dat)
call TimerStart (t, TIMEOUT, true, function Update)
endfunction
function StartQ55 takes nothing returns nothing
local timer t = NewTimer()
local real x1 = -5600.
local real y1 = 10600.
local real x2 = -9700.
local real y2 = 9040.
call StartDrop(x1+GetRandomReal(-50.,50.),y1+GetRandomReal(-50.,50.),x2+GetRandomReal(-50.,50.),y2+GetRandomReal(-50.,50.),0)
call StartDrop(x1+GetRandomReal(-50.,50.),y1+GetRandomReal(-50.,50.),x2+GetRandomReal(-50.,50.),y2+GetRandomReal(-50.,50.),1)
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library q57 needs qsys, TimerUtils, q6, AlliedSpawnSystem, GroupUtils
globals
private constant integer IDQ = 57
private constant integer REQ_BASE = 500 //Per Player
private constant integer REQ_PLAYER = 10 //Per Player
private constant integer DELTA = 100 //each delta update the quest
private constant integer AMOUNT = 4
private constant integer UNIT_ID = 'n01G'
endglobals
private function AlliedDeath takes nothing returns boolean
local unit allied = GetTriggerUnit()
if IsUnitInGroup(allied,VillagerGroup) then
set VillagerKill = VillagerKill + 1
call GroupRemoveUnit(VillagerGroup,allied)
set GeneralTarget = FirstOfGroup(VillagerGroup)
set VillagerAlive = 0
call ForGroup(VillagerGroup,function CountAliveAllied)
set QuestEta[IDQ] = I2S(VillagerKill) + "/"+I2S(VillagerAll)+" humvee destroyed"
call UpdateQuest(IDQ)
if VillagerAlive == 0 then
call ReleaseGroup(VillagerGroup)
call EndQuest(IDQ,false)
call StartQ6()
endif
endif
set allied = null
return false
endfunction
private function Switch takes nothing returns nothing
call SwitchUnitToAssautGroup(GetEnumUnit())
endfunction
private function EnemyDeath takes nothing returns boolean
if QuestBoolean[IDQ]==true then
set CreepsSubKill = CreepsSubKill + 1
set CreepsKill = CreepsKill + 1
set QuestEta[IDQ] = I2S(R2I(100*CreepsKill/CreepsRequiredKill)) + "% targets down"
call UpdateQuestMbOnly(IDQ)
if CreepsSubKill == DELTA then
call UpdateQuest(IDQ)
set CreepsSubKill = 0
endif
if CreepsKill >= CreepsRequiredKill then
call ForGroup(VillagerGroup,function Switch)
call ReleaseGroup(VillagerGroup)
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call StartQ6()
endif
endif
return false
endfunction
private function Run takes nothing returns nothing
local integer i = 0
local unit spawned = null
local real x = 0.
local real y = 0.
call ReleaseTimer(GetExpiredTimer())
set VillagerGroup = NewGroup()
loop
exitwhen i > AMOUNT - 1
set x = GetRandomReal(GetRectMinX(gg_rct_Tango),GetRectMaxX(gg_rct_Tango))
set y = GetRandomReal(GetRectMinY(gg_rct_Tango),GetRectMaxY(gg_rct_Tango))
set spawned = CreateUnit(Player(ALLIEDID),UNIT_ID,x,y,0.)
call GroupAddUnit(VillagerGroup,spawned)
set i = i + 1
endloop
call ForGroup(VillagerGroup,function CountAllAllied)
set GeneralTarget = FirstOfGroup(VillagerGroup)
set CreepsRequiredKill = REQ_BASE+REQ_PLAYER*PlayerAmount
call PingQuest(GetRectCenterX(gg_rct_Tango),GetRectCenterY(gg_rct_Tango),10.,30.)
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(11),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(13),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(14),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function EnemyDeath ) )
set QuestTrig[IDQ][1] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][1],Player(ALLIEDID),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(QuestTrig[IDQ][1], Condition( function AlliedDeath) )
set spawned = null
endfunction
function StartQ57 takes nothing returns nothing
local timer t = NewTimer()
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
endlibrary
//TESH.scrollpos=31
//TESH.alwaysfold=0
library q58 needs qsys,q6, TimerUtils, AlliedSpawnSystem, GroupUtils
globals
private constant integer IDQ = 58
private constant integer REQ_BASE = 500 //Per Player
private constant integer REQ_PLAYER = 10 //Per Player
private constant integer DELTA = 100 //each delta update the quest
endglobals
private function AlliedDeath takes nothing returns boolean
call DisplayAll("Control", "Nice. We lost a base.")
call EndQuest(IDQ,false)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call StartQ6()
return false
endfunction
private function EnemyDeath takes nothing returns boolean
if QuestBoolean[IDQ]==true then
set CreepsSubKill = CreepsSubKill + 1
set CreepsKill = CreepsKill + 1
set QuestEta[IDQ] = I2S(R2I(100*CreepsKill/CreepsRequiredKill)) + "% targets down"
call UpdateQuestMbOnly(IDQ)
if CreepsSubKill == DELTA then
call UpdateQuest(IDQ)
set CreepsSubKill = 0
endif
if CreepsKill >= CreepsRequiredKill then
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call StartQ6()
endif
endif
return false
endfunction
private function Run takes nothing returns nothing
call ReleaseTimer(GetExpiredTimer())
call SetUnitInvulnerable(Building,false)
call SetUnitOwner(Building,Player(ALLIEDID),true)
set GeneralTarget = EnergeticFactoryGenerator[0]
call PingQuest(GetUnitX(Building),GetUnitY(Building),10.,30.)
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(11),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(13),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(14),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function EnemyDeath ) )
set QuestTrig[IDQ][1] = CreateTrigger()
call TriggerRegisterUnitEvent(QuestTrig[IDQ][1],Building,EVENT_UNIT_DEATH)
call TriggerAddCondition(QuestTrig[IDQ][1], Condition( function AlliedDeath ) )
endfunction
function StartQ58 takes nothing returns nothing
local timer t = NewTimer()
set CreepsRequiredKill = REQ_BASE+REQ_PLAYER*PlayerAmount
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
endlibrary
//TESH.scrollpos=43
//TESH.alwaysfold=0
library q6 initializer init needs qsys,TimerUtils,TextDisplay,Chapter2
globals
private constant integer IDQ = 6
private integer array BossId [16]
private string array Text[16]
private integer BossMax
endglobals
private function BossDeath takes nothing returns boolean
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call Chapter2()
return false
endfunction
private function Run takes nothing returns nothing
local integer random = GetRandomInt(0,BossMax)
set Boss = CreateUnit(Player(11),BossId[random],GetRectCenterX(gg_rct_Spawn008),GetRectCenterY(gg_rct_Spawn008),0.)
call BossSound()
call DisplayAll("Control",Text[random])
set GeneralTarget = null
call ReleaseTimer(GetExpiredTimer())
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterUnitEvent(QuestTrig[IDQ][0],Boss, EVENT_UNIT_DEATH )
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function BossDeath ) )
endfunction
function StartQ6 takes nothing returns nothing
local timer t = NewTimer()
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
private function init takes nothing returns nothing
local integer i = 0
set BossId[i]='u000'
set Text[i]="A mutation Gamma of type B has appeared on our sector. Codename Amphibius. Kill it! It is moving into the direction of the Old Teleporter, North of the External Outpost."
set i = i + 1
set BossId[i]='u00R'
set Text[i]="A big thing is incoming. Codename Howl Bear. Kill it! It is moving into the direction of the Old Teleporter, North of the External Outpost."
set i = i + 1
set BossId[i]='u014'
set Text[i]="There is a fucking dead craw which seems really bigger than those we saw earlier. Fire at will!"
set i = i + 1
set BossId[i]='u015'
set Text[i]="Those damned scientists have tried to assemblate some snakes with regenerated cells. Now we have a fucking hudge beast incoming. Kill it!"
set i = i + 1
set BossId[i]='u016'
set Text[i]="The RC601 feeds a Mutation Gamma since months. It is gigantic. Of course, it is running to your squad. Warn there."
set i = i + 1
set BossId[i]='u017'
set Text[i]="Windstalker is the codename of a living acid bomb. It is the symbiosis between regenerated cells, birds and varuns. It's a failed experiment, but they still live!"
set i = i + 1
set BossId[i]='u018'
set Text[i]="It seems zombies are able to grow up as they eat living flesh. One subject of these experiments is still alive."
set i = i + 1
set BossId[i]='u019'
set Text[i]="A hudge cloud is incoming on your position. Warn there."
set i = i + 1
set BossId[i]='u01A'
set Text[i]="Ghouls have been used for experiments. Eralid is probably the most achieved. And the fastest ever...Good luck!"
set i = i + 1
set BossId[i]='u01B'
set Text[i]="Mother is the codename of one of the first experiments. She was a prisonner years ago, and one of the most resistants. You have to destroy this thing."
set i = i + 1
set BossId[i]='u01C'
set Text[i]="Research about the invisbility have sometimes failed. Nanites used on dead cells have created a strange dead being, codename: Ghost."
set i = i + 1
set BossId[i]='u01D'
set Text[i]="Using antimatter on dead humans was definitly not a good idea. Now we have to deal with a hudge thing which throws lightnings everywhere.."
set i = i + 1
set BossId[i]='u01E'
set Text[i]="Developping hudge armored fighter which disperse the enemy fire is one of the main development of the RC601. Bugs are heavy units. And more when they have muted..."
set i = i + 1
set BossId[i]='u01F'
set Text[i]="Vampire was one of the objective of the RC601: one of the ultimate undead form. They just forgot the death would flush any intelligence."
set i = i + 1
set BossId[i]='u01G'
set Text[i]="Reports speaks about a Waterfall project. It should be this thing. No idea what it can do."
set i = i + 1
set BossId[i]='u01H'
set Text[i]="A hudge thing is incoming. Bigger than all we met until now. Take care of it!"
set BossMax = i
endfunction
endlibrary
//TESH.scrollpos=4
//TESH.alwaysfold=0
library Chapter2 needs TimerUtils, q8,q27,ItemSpawn, SpawnSystem, Reinforcements,qsys
globals
private constant string MASK = "ReplaceableTextures\\CameraMasks\\Black_mask.blp"
endglobals
private struct str
integer i
endstruct
private function Wait takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
local integer i = 0
if dat.i < CHAPTER_WAIT+20 then
set dat.i = dat.i + 1
if dat.i == CHAPTER_WAIT+5 then
call MusicChapter()
elseif dat.i == CHAPTER_WAIT+10 then
loop
exitwhen i > MAXPLAYER
call DisplayTextToPlayer(Player(i),0.,0.,"|c00AFAAFF Chapter II : We will not die|r")
set i = i + 1
endloop
endif
else
call StartItemSpawn(6,10)
if GetRandomInt(0,100)<50 then
call StartQ8()
else
call StartQ27()
endif
call QuestSetTimeToNight()
set ChapterIntermission = false
call MusicOff()
call ReleaseTimer(t)
call dat.destroy()
call SpawnReinforcements()
endif
endfunction
function Chapter2 takes nothing returns nothing
local timer t = NewTimer()
local str dat = str.create()
set dat.i = 0
set ChapterDone = 1
set ChapterIntermission = true
call CreepsKillAllNormal()
call SetTimerData(t,dat)
call TimerStart (t, 1., true, function Wait )
endfunction
endlibrary
//TESH.scrollpos=132
//TESH.alwaysfold=0
library q8 initializer init needs qsys,q9,q10,q25,q26,AlliedSpawnSystem, HeroDeath,TimerUtils, TextDisplay, GroupUtils, IndieSummons, TimerUtils
globals
private constant integer IDQ = 8
private constant integer MARINE_MAX = 2
private constant integer BARRACK_MAX = 4
private rect array MarineRect [4]
private constant integer PILOT_ID = 'h00F'
private constant integer LAST_WAYPOINT = 10
private constant integer GROUPID = 4
endglobals
private function AlliedDeath takes nothing returns boolean
local unit allied = GetTriggerUnit()
if IsUnitInGroup(allied,VillagerGroup) then
set VillagerKill = VillagerKill + 1
call GroupRemoveUnit(VillagerGroup,allied)
set GeneralTarget = FirstOfGroup(VillagerGroup)
set VillagerAlive = 0
call ForGroup(VillagerGroup,function CountAliveAllied)
set QuestEta[IDQ] = I2S(VillagerKill) + "/"+I2S(VillagerAll)+" pilots killed"
call UpdateQuest(IDQ)
set QuestRank[IDQ] = QuestRank[IDQ] - 2
if VillagerAlive == 0 then
if VillagerAll <= VillagerKill then
call ReleaseGroup(VillagerGroup)
call EndQuest(IDQ,false)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call SwitchPatrolToAssaut(GROUPID)
call SwitchTowerToAssaut(GROUPID)
else
call ReleaseGroup(VillagerGroup)
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call SwitchPatrolToAssaut(GROUPID)
call SwitchTowerToAssaut(GROUPID)
endif
set RandomQuest = GetRandomInt(1,4)
if RandomQuest == 1 then
call StartQ9()
elseif RandomQuest == 2 then
call StartQ10()
elseif RandomQuest == 3 then
call StartQ25()
elseif RandomQuest == 4 then
call StartQ26()
endif
endif
endif
set allied = null
return false
endfunction
private function ArrivedToEnd takes nothing returns boolean
local unit convoyUnit = GetTriggerUnit()
if IsUnitInGroup(convoyUnit,VillagerGroup) then
call GroupRemoveUnit(VillagerGroup,convoyUnit)
set GeneralTarget = FirstOfGroup(VillagerGroup)
call EraseUnit(convoyUnit)
set VillagerAlive = 0
set CurrentLastWayPointArrivedUnit = CurrentLastWayPointArrivedUnit + 1
call ForGroup(VillagerGroup,function CountAliveAllied)
set QuestEta[IDQ] = I2S(CurrentLastWayPointArrivedUnit) + "/"+I2S(VillagerAll)+" pilots arrived"
call UpdateQuestMbOnly(IDQ)
if CurrentLastWayPointArrivedUnit>=VillagerAlive then
call ReleaseGroup(VillagerGroup)
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call SwitchPatrolToAssaut(GROUPID)
call SwitchTowerToAssaut(GROUPID)
set RandomQuest = GetRandomInt(1,4)
if RandomQuest == 1 then
call StartQ9()
elseif RandomQuest == 2 then
call StartQ10()
elseif RandomQuest == 3 then
call StartQ25()
elseif RandomQuest == 4 then
call StartQ26()
endif
endif
endif
set convoyUnit = null
return false
endfunction
private function ActivateMarine takes nothing returns nothing
local integer i = 0
local integer j = 0
local unit convoyUnit = null
local unit escort = null
local real x = 0.
local real y = 0.
call DestroyQuestTrigger(IDQ,0)
set CurrentWayPoint = 1
set CurrentLastWayPoint = LAST_WAYPOINT
set CurrentRect = ConvoyRect[CurrentWayPoint]
set VillagerGroup = NewGroup()
call DisplayAll("Pilot","Thanks to assist. We will try to join the Mechanoids Facilities")
loop
exitwhen i > BARRACK_MAX
set j = 0
loop
exitwhen j > MARINE_MAX
set x = GetRandomReal(GetRectMinX(CurrentRect),GetRectMaxX(CurrentRect))
set y = GetRandomReal(GetRectMinY(CurrentRect),GetRectMaxY(CurrentRect))
set convoyUnit = CreateUnit(Player(ALLIEDID),PILOT_ID,GetRectCenterX(MarineRect[i])+GetRandomReal(-50.,50.),GetRectCenterY(MarineRect[i])+GetRandomReal(-50.,50.),0.)
call UnitAddAbility(convoyUnit,QUESTUNIT)
call UnitAddAbility(convoyUnit,MOVE_SPELL)
call GroupAddUnit(VillagerGroup,convoyUnit)
call IssuePointOrder(convoyUnit,MOVE_ORDER,x,y)
if GetRandomInt(0,1)==1 then
set escort = CreateUnit(Player(ALLIEDID),AlliedId[GetRandomInt(0,AlliedIdMax)],GetRectCenterX(MarineRect[i])+GetRandomReal(-50.,50),GetRectCenterY(MarineRect[i])+GetRandomReal(-50.,50),0.)
call IndieSummon_SetMaster(escort,convoyUnit)
call UnitAddAbility(escort,QUESTUNIT)
endif
set j = j + 1
endloop
set i = i + 1
endloop
set GeneralTarget = FirstOfGroup(VillagerGroup)
set convoyUnit = null
set escort = null
call ForGroup(VillagerGroup,function CountAllAllied)
set QuestTrig[IDQ][1] = CreateTrigger()
call TriggerRegisterEnterRectSimple(QuestTrig[IDQ][1], ConvoyRect[CurrentLastWayPoint])
call TriggerAddCondition(QuestTrig[IDQ][1], Condition(function ArrivedToEnd))
endfunction
private function CheckMarine takes nothing returns boolean
if IsUnitType(GetTriggerUnit(),UNIT_TYPE_HERO)==true then
call ActivateMarine()
endif
return false
endfunction
private function Run takes nothing returns nothing
local integer i = 0
call ReleaseTimer(GetExpiredTimer())
set GeneralTarget = null
call PingQuest(GetRectCenterX(gg_rct_Barrack1),GetRectCenterY(gg_rct_Barrack1),5.,15.)
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterEnterRectSimple(QuestTrig[IDQ][0], MarineRect[0])
call TriggerRegisterEnterRectSimple(QuestTrig[IDQ][0], MarineRect[1])
call TriggerRegisterEnterRectSimple(QuestTrig[IDQ][0], MarineRect[2])
call TriggerRegisterEnterRectSimple(QuestTrig[IDQ][0], MarineRect[3])
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function CheckMarine ) )
set QuestTrig[IDQ][1] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][1],Player(ALLIEDID),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(QuestTrig[IDQ][1], Condition( function AlliedDeath ) )
call AlliedAddUnitToPatrolGroup('h003',GROUPID)
call AlliedAddUnitToTowerGroup('h003',GROUPID)
call AlliedAddUnitToTowerGroup('h003',GROUPID)
call AlliedAddUnitToTowerGroup('h003',GROUPID)
call AlliedAddUnitToTowerGroup('h003',GROUPID)
endfunction
function StartQ8 takes nothing returns nothing
local timer t = NewTimer()
set ConvoyRect[1]=gg_rct_PilotConvoy001
set ConvoyRect[2]=gg_rct_PilotConvoy002
set ConvoyRect[3]=gg_rct_PilotConvoy003
set ConvoyRect[4]=gg_rct_PilotConvoy004
set ConvoyRect[5]=gg_rct_PilotConvoy005
set ConvoyRect[6]=gg_rct_PilotConvoy006
set ConvoyRect[7]=gg_rct_PilotConvoy007
set ConvoyRect[8]=gg_rct_PilotConvoy008
set ConvoyRect[9]=gg_rct_PilotConvoy009
set ConvoyRect[10]=gg_rct_PilotConvoy010
set ConvoySpawn[1][0] = 4
set ConvoySpawn[1][1] = 11
set ConvoySpawn[1][2] = 16
set ConvoySpawn[2][0] = 4
set ConvoySpawn[2][1] = 11
set ConvoySpawn[2][2] = 16
set ConvoySpawn[3][0] = 14
set ConvoySpawn[3][1] = 16
set ConvoySpawn[3][2] = 17
set ConvoySpawn[4][0] = 6
set ConvoySpawn[4][1] = 14
set ConvoySpawn[4][2] = 16
set ConvoySpawn[5][0] = 5
set ConvoySpawn[5][1] = 14
set ConvoySpawn[5][2] = 17
set ConvoySpawn[6][0] = 1
set ConvoySpawn[6][1] = 5
set ConvoySpawn[6][2] = 20
set ConvoySpawn[7][0] = 1
set ConvoySpawn[7][1] = 6
set ConvoySpawn[7][2] = 20
set ConvoySpawn[8][0] = 15
set ConvoySpawn[8][1] = 20
set ConvoySpawn[8][2] = 21
set ConvoySpawn[9][0] = 15
set ConvoySpawn[9][1] = 20
set ConvoySpawn[9][2] = 21
set ConvoySpawn[10][0] = 15
set ConvoySpawn[10][1] = 20
set ConvoySpawn[10][2] = 21
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
private function init takes nothing returns nothing
set MarineRect[0]=gg_rct_Barrack1
set MarineRect[1]=gg_rct_Barrack2
set MarineRect[2]=gg_rct_Barrack3
set MarineRect[3]=gg_rct_Barrack4
endfunction
endlibrary
//TESH.scrollpos=43
//TESH.alwaysfold=0
library q27 needs qsys,TimerUtils, q9,q10,q25,q26, SpawnSystem,HeroDeath
globals
private constant integer IDQ = 27
private constant integer BOSS_ID = 'u00P'
private constant real TIMEOUT_SPAWN = 10.
private constant integer SPAWNED_ID = 'u00Q'
private constant real FAIL_DURATION = 360.
endglobals
private struct str
unit caster
endstruct
private function Spawn takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
if not (IsUnitType(dat.caster,UNIT_TYPE_DEAD)) and dat.caster!=null and CreepsPop <= CREEPS_TOTALMAX+30 then
call SpawnCreeps(SPAWNED_ID,14,GetUnitX(dat.caster),GetUnitY(dat.caster))
else
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function ActivateSpawn takes unit boss returns nothing
local timer t = NewTimer()
local str dat = str.create()
set dat.caster = boss
call SetTimerData(t,dat)
call TimerStart(t,TIMEOUT_SPAWN,true,function Spawn)
endfunction
private function BossDeath takes nothing returns boolean
if QuestBoolean[IDQ]==true then
set CreepsKill = CreepsKill + 1
set QuestEta[IDQ] = I2S(CreepsKill)+"/"+I2S(CreepsRequiredKill) + " targets destroyed"
call UpdateQuest(IDQ)
if CreepsKill >= CreepsRequiredKill then
call ReleaseTimer(FailTimer)
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
set RandomQuest = GetRandomInt(1,4)
if RandomQuest == 1 then
call StartQ9()
elseif RandomQuest == 2 then
call StartQ10()
elseif RandomQuest == 3 then
call StartQ25()
elseif RandomQuest == 4 then
call StartQ26()
endif
endif
endif
return false
endfunction
private function Failed takes nothing returns nothing
call ReleaseTimer(FailTimer)
if CreepsKill < CreepsRequiredKill then
call EndQuest(IDQ,false)
call DestroyQuestTrigger(IDQ,0)
set RandomQuest = GetRandomInt(1,4)
if RandomQuest == 1 then
call StartQ9()
elseif RandomQuest == 2 then
call StartQ10()
elseif RandomQuest == 3 then
call StartQ25()
elseif RandomQuest == 4 then
call StartQ26()
endif
endif
endfunction
private function Run takes nothing returns nothing
local integer i = 0
local real x = 0.
local real y = 0.
local unit boss = null
local integer amount = 0
call ReleaseTimer(GetExpiredTimer())
set GeneralTarget = null
set QuestTrig[IDQ][0] = CreateTrigger()
loop
exitwhen i > MAXPLAYER
if GetPlayerSlotState(Player(i))==PLAYER_SLOT_STATE_PLAYING and IsHeroDefinitelyDead(i)==false then
set amount = amount + 1
endif
set i = i + 1
endloop
set CreepsRequiredKill = R2I(0.5*amount)
set i = 0
loop
exitwhen i > CreepsRequiredKill-1
set x = GetRandomReal(MapXMin,MapXMax)
set y = GetRandomReal(MapYMin,MapYMax)
set boss = CreateUnit(Player(11),BOSS_ID,x,y,0.)
call PingQuest(x,y,30.,60.)
call TriggerRegisterUnitEvent(QuestTrig[IDQ][0],boss, EVENT_UNIT_DEATH )
call ActivateSpawn(boss)
set i = i + 1
endloop
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function BossDeath ) )
set FailTimer = NewTimer()
call TimerStart(FailTimer,FAIL_DURATION,false,function Failed)
set boss = null
endfunction
function StartQ27 takes nothing returns nothing
local timer t = NewTimer()
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
endlibrary
//TESH.scrollpos=24
//TESH.alwaysfold=0
library q9 needs qsys,q11,q12,q13,q14,q34,q50,q51,q52,AlliedSpawnSystem, HeroDeath,TimerUtils, TextDisplay,AlliedSpawnSystem, GroupUtils, IndieSummons, TimerUtils
globals
private constant integer IDQ = 9
private rect array WorkerRect [3]
private rect array FuryRect [3]
private rect array SentryRect [3]
private constant integer PILOT_ID = 'h00F'
private constant integer LAST_WAYPOINT = 7
private constant integer FIELD_ID = 'B001'
private group PilotGroup
endglobals
private function AlliedDeath takes nothing returns boolean
local unit allied = GetTriggerUnit()
if IsUnitInGroup(allied,VillagerGroup) then
set VillagerKill = VillagerKill + 1
call GroupRemoveUnit(VillagerGroup,allied)
set GeneralTarget = FirstOfGroup(VillagerGroup)
set VillagerAlive = 0
call ForGroup(VillagerGroup,function CountAliveAllied)
set QuestEta[IDQ] = I2S(VillagerKill) + "/"+I2S(VillagerAll)+" GW-Worker destroyed"
call UpdateQuest(IDQ)
set QuestRank[IDQ] = QuestRank[IDQ] - 15
if VillagerAlive == 0 then
if VillagerAll <= VillagerKill then
call ReleaseGroup(VillagerGroup)
call EndQuest(IDQ,false)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
else
call ReleaseGroup(VillagerGroup)
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
endif
set RandomQuest = GetRandomInt(1,8)
if RandomQuest == 1 then
call StartQ11()
elseif RandomQuest == 2 then
call StartQ12()
elseif RandomQuest == 3 then
call StartQ13()
elseif RandomQuest == 4 then
call StartQ14()
elseif RandomQuest == 5 then
call StartQ34()
elseif RandomQuest == 6 then
call StartQ50()
elseif RandomQuest == 7 then
call StartQ51()
elseif RandomQuest == 8 then
call StartQ52()
endif
endif
endif
set allied = null
return false
endfunction
private function ArrivedToEnd takes nothing returns boolean
local unit convoyUnit = GetTriggerUnit()
if IsUnitInGroup(convoyUnit,VillagerGroup) then
call GroupRemoveUnit(VillagerGroup,convoyUnit)
set GeneralTarget = FirstOfGroup(VillagerGroup)
call EraseUnit(convoyUnit)
set VillagerAlive = 0
set CurrentLastWayPointArrivedUnit = CurrentLastWayPointArrivedUnit + 1
call ForGroup(VillagerGroup,function CountAliveAllied)
set QuestEta[IDQ] = I2S(CurrentLastWayPointArrivedUnit) + "/"+I2S(VillagerAll)+" GW-Worker arrived"
call UpdateQuest(IDQ)
if VillagerAlive==0 then
call ReleaseGroup(VillagerGroup)
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call StartQ11()
endif
endif
set convoyUnit = null
return false
endfunction
private function RunWorker takes nothing returns nothing
local integer i = 0
local real x = 0.
local real y = 0.
set CurrentWayPoint = 1
set CurrentLastWayPoint = LAST_WAYPOINT
set CurrentRect = ConvoyRect[CurrentWayPoint]
set VillagerGroup = NewGroup()
call DisplayAll("GW-Worker Pilot","Okay guys, let's try to go trough this shit.")
loop
exitwhen i > 2
set x = GetRandomReal(GetRectMinX(CurrentRect),GetRectMaxX(CurrentRect))
set y = GetRandomReal(GetRectMinY(CurrentRect),GetRectMaxY(CurrentRect))
call AddUnitAnimationProperties(MechWorker[i], "Alternate", false)
call UnitAddAbility(MechWorker[i],QUESTUNIT)
call UnitAddAbility(MechWorker[i],MOVE_SPELL)
call GroupAddUnit(VillagerGroup,MechWorker[i])
call IssuePointOrder(MechWorker[i],MOVE_ORDER,x,y)
set i = i + 1
endloop
set GeneralTarget = FirstOfGroup(VillagerGroup)
call ForGroup(VillagerGroup,function CountAllAllied)
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(ALLIEDID),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function AlliedDeath ) )
set QuestTrig[IDQ][1] = CreateTrigger()
call TriggerRegisterEnterRectSimple(QuestTrig[IDQ][1], ConvoyRect[CurrentLastWayPoint])
call TriggerAddCondition(QuestTrig[IDQ][1], Condition(function ArrivedToEnd))
endfunction
private function ActivateWorker takes integer i returns nothing
if not (IsUnitType(MechWorker[i],UNIT_TYPE_DEAD)) then
call SetUnitAnimation(MechWorker[i],"Morph")
call SetUnitOwner(MechWorker[i],Player(ALLIEDID),true)
endif
endfunction
private function ActivateSentry takes integer i returns nothing
if not (IsUnitType(MechSentry[i],UNIT_TYPE_DEAD)) then
call SetUnitOwner(MechSentry[i],Player(ALLIEDID),true)
call SwitchUnitToAssautGroup(MechSentry[i])
call SetUnitFlyHeight(GetFilterUnit(),200.,50.)
call AddUnitAnimationProperties(MechSentry[i], "Alternate", false)
endif
endfunction
private function ActivateFury takes integer i returns nothing
if not (IsUnitType(MechFury[i],UNIT_TYPE_DEAD)) then
call SetUnitOwner(MechFury[i],Player(ALLIEDID),true)
call IndieSummon_SetMaster(MechFury[i],MechWorker[i])
call UnitAddAbility(MechFury[i],QUESTUNIT)
call AddUnitAnimationProperties(MechFury[i], "Alternate", false)
endif
endfunction
private function RemovePilot takes nothing returns nothing
call GroupRemoveUnit(PilotGroup,GetEnumUnit())
call EraseUnit(GetEnumUnit())
endfunction
private function LoadPilots takes nothing returns nothing
local integer i = 0
local timer t =GetExpiredTimer()
call ReleaseTimer(t)
call ForGroup(PilotGroup,function RemovePilot)
call ReleaseGroup(PilotGroup)
loop
exitwhen i > 2
call ActivateWorker(i)
call ActivateSentry(i)
call ActivateFury(i)
set i = i + 1
endloop
set t = NewTimer()
call TimerStart(t,1.,false,function RunWorker)
endfunction
private function Run takes nothing returns nothing
local integer i = 0
local unit marine = null
local timer t = GetExpiredTimer()
call ReleaseTimer(t)
set PilotGroup = NewGroup()
set i = 0
loop
exitwhen i > 2
call SetUnitInvulnerable(MechSentry[i],false)
call SetUnitInvulnerable(MechWorker[i],false)
call SetUnitInvulnerable(MechFury[i],false)
set i = i + 1
endloop
set i = 0
loop
exitwhen i > 2
set marine = CreateUnit(Player(ALLIEDID),PILOT_ID,GetRectCenterX(gg_rct_MechanoidsFacilitiesSpawn),GetRectCenterY(gg_rct_MechanoidsFacilitiesSpawn),0.)
call IssuePointOrder(marine,"move",GetRectCenterX(WorkerRect[i]),GetRectCenterY(WorkerRect[i]))
call GroupAddUnit(PilotGroup,marine)
set marine = CreateUnit(Player(ALLIEDID),PILOT_ID,GetRectCenterX(gg_rct_MechanoidsFacilitiesSpawn),GetRectCenterY(gg_rct_MechanoidsFacilitiesSpawn),0.)
call IssuePointOrder(marine,"move",GetRectCenterX(SentryRect[i]),GetRectCenterY(SentryRect[i]))
call GroupAddUnit(PilotGroup,marine)
set marine = CreateUnit(Player(ALLIEDID),PILOT_ID,GetRectCenterX(gg_rct_MechanoidsFacilitiesSpawn),GetRectCenterY(gg_rct_MechanoidsFacilitiesSpawn),0.)
call IssuePointOrder(marine,"move",GetRectCenterX(FuryRect[i]),GetRectCenterY(FuryRect[i]))
call GroupAddUnit(PilotGroup,marine)
set i = i + 1
endloop
set t = NewTimer()
call TimerStart(t,10.,false,function LoadPilots)
set marine = null
endfunction
function StartQ9 takes nothing returns nothing
local timer t = NewTimer()
set ConvoyRect[1]=gg_rct_MechConvoy001
set ConvoyRect[2]=gg_rct_MechConvoy002
set ConvoyRect[3]=gg_rct_MechConvoy003
set ConvoyRect[4]=gg_rct_MechConvoy004
set ConvoyRect[5]=gg_rct_MechConvoy005
set ConvoyRect[6]=gg_rct_MechConvoy006
set ConvoyRect[7]=gg_rct_MechConvoy007
set ConvoySpawn[1][0] = 15
set ConvoySpawn[1][1] = 20
set ConvoySpawn[1][2] = 21
set ConvoySpawn[2][0] = 6
set ConvoySpawn[2][1] = 16
set ConvoySpawn[2][2] = 21
set ConvoySpawn[3][0] = 5
set ConvoySpawn[3][1] = 16
set ConvoySpawn[3][2] = 17
set ConvoySpawn[4][0] = 5
set ConvoySpawn[4][1] = 15
set ConvoySpawn[4][2] = 16
set ConvoySpawn[5][0] = 12
set ConvoySpawn[5][1] = 15
set ConvoySpawn[5][2] = 17
set ConvoySpawn[6][0] = 12
set ConvoySpawn[6][1] = 15
set ConvoySpawn[6][2] = 16
set ConvoySpawn[7][0] = 12
set ConvoySpawn[7][1] = 15
set ConvoySpawn[7][2] = 16
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
endlibrary
//TESH.scrollpos=21
//TESH.alwaysfold=0
library q10 initializer init needs qsys,q11,q12,q13,q14,q34,q50,q51,q52,AlliedSpawnSystem, HeroDeath,TimerUtils, TextDisplay,,AlliedSpawnSystem, GroupUtils,SpellEvent,AbilityPreload, SpawnSystem,IndieSummons, TimerUtils
globals
private constant integer IDQ = 10
private rect array FrogRect [3]
private constant integer PILOT_ID = 'h00F'
private group PilotGroup
endglobals
private function AlliedDeath takes nothing returns boolean
local unit allied = GetTriggerUnit()
if IsUnitInGroup(allied,VillagerGroup) then
set VillagerKill = VillagerKill + 1
call GroupRemoveUnit(VillagerGroup,allied)
set GeneralTarget = FirstOfGroup(VillagerGroup)
set VillagerAlive = 0
call ForGroup(VillagerGroup,function CountAliveAllied)
set QuestEta[IDQ] = I2S(VillagerKill) + "/"+I2S(VillagerAll)+" GW-Frog destroyed"
call UpdateQuest(IDQ)
set QuestRank[IDQ] = QuestRank[IDQ] - 5
if VillagerAlive == 0 then
if VillagerAll <= VillagerKill then
call ReleaseGroup(VillagerGroup)
call EndQuest(IDQ,false)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
else
call ReleaseGroup(VillagerGroup)
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
endif
set RandomQuest = GetRandomInt(1,8)
if RandomQuest == 1 then
call StartQ11()
elseif RandomQuest == 2 then
call StartQ12()
elseif RandomQuest == 3 then
call StartQ13()
elseif RandomQuest == 4 then
call StartQ14()
elseif RandomQuest == 5 then
call StartQ34()
elseif RandomQuest == 6 then
call StartQ50()
elseif RandomQuest == 7 then
call StartQ51()
elseif RandomQuest == 8 then
call StartQ52()
endif
endif
endif
set allied = null
return false
endfunction
private function ArrivedToEnd takes nothing returns boolean
local unit convoyUnit = GetTriggerUnit()
if IsUnitInGroup(convoyUnit,VillagerGroup) then
call GroupRemoveUnit(VillagerGroup,convoyUnit)
set GeneralTarget = FirstOfGroup(VillagerGroup)
call EraseUnit(convoyUnit)
set VillagerAlive = 0
set CurrentLastWayPointArrivedUnit = CurrentLastWayPointArrivedUnit + 1
call ForGroup(VillagerGroup,function CountAliveAllied)
set QuestEta[IDQ] = I2S(CurrentLastWayPointArrivedUnit) + "/"+I2S(VillagerAll)+" GW-Frog arrived"
call UpdateQuest(IDQ)
if VillagerAlive==0 then
call ReleaseGroup(VillagerGroup)
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call StartQ12()
endif
endif
set convoyUnit = null
return false
endfunction
private function RunFrog takes nothing returns nothing
local integer i = 0
local real x = 0.
local real y = 0.
set ConvoyRect[1] = gg_rct_FrogDestination
set CurrentWayPoint = 1
set CurrentLastWayPoint = 1
set CurrentRect = ConvoyRect[1]
set VillagerGroup = NewGroup()
call DisplayAll("GW-Frog Pilot","There we are. We need to scout the swamps...")
loop
exitwhen i > 2
set x = GetRandomReal(GetRectMinX(CurrentRect),GetRectMaxX(CurrentRect))
set y = GetRandomReal(GetRectMinY(CurrentRect),GetRectMaxY(CurrentRect))
call AddUnitAnimationProperties(MechFrog[i], "Alternate", false)
call SetUnitInvulnerable(MechFrog[i],false)
call UnitAddAbility(MechFrog[i],QUESTUNIT)
call UnitAddAbility(MechFrog[i],MOVE_SPELL)
call GroupAddUnit(VillagerGroup,MechFrog[i])
call IssuePointOrder(MechFrog[i],MOVE_ORDER,x,y)
set i = i + 1
endloop
call PingQuest(GetRectCenterX(CurrentRect),GetRectCenterY(CurrentRect),5.,15.)
set GeneralTarget = FirstOfGroup(VillagerGroup)
call ForGroup(VillagerGroup,function CountAllAllied)
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(10),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function AlliedDeath ) )
set QuestTrig[IDQ][1] = CreateTrigger()
call TriggerRegisterEnterRectSimple(QuestTrig[IDQ][1], ConvoyRect[CurrentLastWayPoint])
call TriggerAddCondition(QuestTrig[IDQ][1], Condition(function ArrivedToEnd))
endfunction
private function ActivateFrog takes integer i returns nothing
if not (IsUnitType(MechFrog[i],UNIT_TYPE_DEAD)) then
call SetUnitAnimation(MechFrog[i],"Morph Alternate")
call SetUnitOwner(MechFrog[i],Player(ALLIEDID),true)
endif
endfunction
private function RemovePilot takes nothing returns nothing
call GroupRemoveUnit(PilotGroup,GetEnumUnit())
call EraseUnit(GetEnumUnit())
endfunction
private function LoadPilots takes nothing returns nothing
local integer i = 0
local timer t =GetExpiredTimer()
call ReleaseTimer(t)
call ForGroup(PilotGroup,function RemovePilot)
call ReleaseGroup(PilotGroup)
loop
exitwhen i > 2
call ActivateFrog(i)
set i = i + 1
endloop
set t = NewTimer()
call TimerStart(t,1.,false,function RunFrog)
endfunction
private function ActivateMarine takes nothing returns nothing
local integer i = 0
local unit marine = null
local timer t = NewTimer()
call DestroyQuestTrigger(IDQ,0)
set PilotGroup = NewGroup()
loop
exitwhen i > 2
set marine = CreateUnit(Player(ALLIEDID),PILOT_ID,GetRectCenterX(gg_rct_MechanoidsFacilitiesSpawn),GetRectCenterY(gg_rct_MechanoidsFacilitiesSpawn),0.)
call IssuePointOrder(marine,"move",GetRectCenterX(FrogRect[i]),GetRectCenterY(FrogRect[i]))
call GroupAddUnit(PilotGroup,marine)
set i = i + 1
endloop
call TimerStart(t,10.,false,function LoadPilots)
set marine = null
endfunction
private function CheckMarine takes nothing returns boolean
if IsUnitType(GetTriggerUnit(),UNIT_TYPE_HERO)==true then
call ActivateMarine()
endif
return false
endfunction
private function Run takes nothing returns nothing
call ReleaseTimer(GetExpiredTimer())
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterEnterRectSimple(QuestTrig[IDQ][0], gg_rct_MechanoidsFacilities)
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function CheckMarine ) )
call PingQuest(GetRectCenterX(gg_rct_MechanoidsFacilities),GetRectCenterY(gg_rct_MechanoidsFacilities),5.,30.)
set GeneralTarget = null
endfunction
function StartQ10 takes nothing returns nothing
local timer t = NewTimer()
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
private function init takes nothing returns nothing
set FrogRect[0]=gg_rct_FrogRect001
set FrogRect[1]=gg_rct_FrogRect002
set FrogRect[2]=gg_rct_FrogRect003
endfunction
endlibrary
//TESH.scrollpos=36
//TESH.alwaysfold=0
library q25 needs qsys,TimerUtils, q11,q12,q13,q14,q34,q50,q51,q52, SpawnSystem
globals
private constant integer IDQ = 25
private constant integer BOSS_ID = 'u00M'
private constant real TIMEOUT_SPAWN = 3.
private constant integer SPAWNED_ID = 'u00N'
private constant real FAIL_DURATION = 360.
endglobals
private struct str
unit caster
endstruct
private function Spawn takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
if not (IsUnitType(dat.caster,UNIT_TYPE_DEAD)) and dat.caster!=null and CreepsPop <= CREEPS_TOTALMAX+30 then
call SpawnCreeps(SPAWNED_ID,14,GetUnitX(dat.caster),GetUnitY(dat.caster))
else
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function ActivateSpawn takes unit boss returns nothing
local timer t = NewTimer()
local str dat = str.create()
set dat.caster = boss
call SetTimerData(t,dat)
call TimerStart(t,TIMEOUT_SPAWN,true,function Spawn)
endfunction
private function BossDeath takes nothing returns boolean
if QuestBoolean[IDQ]==true then
set CreepsKill = CreepsKill + 1
set QuestEta[IDQ] = I2S(CreepsKill)+"/"+I2S(CreepsRequiredKill) + " targets destroyed"
call UpdateQuest(IDQ)
if CreepsKill >= CreepsRequiredKill then
call ReleaseTimer(FailTimer)
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
set RandomQuest = GetRandomInt(1,8)
if RandomQuest == 1 then
call StartQ11()
elseif RandomQuest == 2 then
call StartQ12()
elseif RandomQuest == 3 then
call StartQ13()
elseif RandomQuest == 4 then
call StartQ14()
elseif RandomQuest == 5 then
call StartQ34()
elseif RandomQuest == 6 then
call StartQ50()
elseif RandomQuest == 7 then
call StartQ51()
elseif RandomQuest == 8 then
call StartQ52()
endif
endif
endif
return false
endfunction
private function Failed takes nothing returns nothing
call ReleaseTimer(FailTimer)
if CreepsKill < CreepsRequiredKill then
call EndQuest(IDQ,false)
call DestroyQuestTrigger(IDQ,0)
set RandomQuest = GetRandomInt(1,8)
if RandomQuest == 1 then
call StartQ11()
elseif RandomQuest == 2 then
call StartQ12()
elseif RandomQuest == 3 then
call StartQ13()
elseif RandomQuest == 4 then
call StartQ14()
elseif RandomQuest == 5 then
call StartQ34()
elseif RandomQuest == 6 then
call StartQ50()
elseif RandomQuest == 7 then
call StartQ51()
elseif RandomQuest == 8 then
call StartQ52()
endif
endif
endfunction
private function Run takes nothing returns nothing
local integer i = 0
local real x = 0.
local real y = 0.
local unit boss = null
local integer amount = 0
call ReleaseTimer(GetExpiredTimer())
set GeneralTarget = null
set QuestTrig[IDQ][0] = CreateTrigger()
loop
exitwhen i > MAXPLAYER
if GetPlayerSlotState(Player(i))==PLAYER_SLOT_STATE_PLAYING and IsHeroDefinitelyDead(i)==false then
set amount = amount + 1
endif
set i = i + 1
endloop
set CreepsRequiredKill = R2I(0.5*amount)
set i = 0
loop
exitwhen i > CreepsRequiredKill-1
set x = GetRandomReal(MapXMin,MapXMax)
set y = GetRandomReal(MapYMin,MapYMax)
set boss = CreateUnit(Player(11),BOSS_ID,x,y,0.)
call PingQuest(x,y,30.,60.)
call TriggerRegisterUnitEvent(QuestTrig[IDQ][0],boss, EVENT_UNIT_DEATH )
call ActivateSpawn(boss)
set i = i + 1
endloop
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function BossDeath ) )
set FailTimer = NewTimer()
call TimerStart(FailTimer,FAIL_DURATION,false,function Failed)
set boss = null
endfunction
function StartQ25 takes nothing returns nothing
local timer t = NewTimer()
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
endlibrary
//TESH.scrollpos=30
//TESH.alwaysfold=0
library q26 needs qsys,TimerUtils, q11,q12,q13,q14,q34,q50,q51,q52, SpawnSystem
globals
private constant integer IDQ = 26
private constant integer BOSS_ID = 'u00O'
private constant real FAIL_DURATION = 360.
endglobals
private function BossDeath takes nothing returns boolean
if QuestBoolean[IDQ]==true then
set CreepsKill = CreepsKill + 1
set QuestEta[IDQ] = I2S(CreepsKill)+"/"+I2S(CreepsRequiredKill) + " targets destroyed"
call UpdateQuest(IDQ)
if CreepsKill >= CreepsRequiredKill then
call ReleaseTimer(FailTimer)
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
set RandomQuest = GetRandomInt(1,8)
if RandomQuest == 1 then
call StartQ11()
elseif RandomQuest == 2 then
call StartQ12()
elseif RandomQuest == 3 then
call StartQ13()
elseif RandomQuest == 4 then
call StartQ14()
elseif RandomQuest == 5 then
call StartQ34()
elseif RandomQuest == 6 then
call StartQ50()
elseif RandomQuest == 7 then
call StartQ51()
elseif RandomQuest == 8 then
call StartQ52()
endif
endif
endif
return false
endfunction
private function Failed takes nothing returns nothing
call ReleaseTimer(FailTimer)
if CreepsKill < CreepsRequiredKill then
call EndQuest(IDQ,false)
call DestroyQuestTrigger(IDQ,0)
set RandomQuest = GetRandomInt(1,8)
if RandomQuest == 1 then
call StartQ11()
elseif RandomQuest == 2 then
call StartQ12()
elseif RandomQuest == 3 then
call StartQ13()
elseif RandomQuest == 4 then
call StartQ14()
elseif RandomQuest == 5 then
call StartQ34()
elseif RandomQuest == 6 then
call StartQ50()
elseif RandomQuest == 7 then
call StartQ51()
elseif RandomQuest == 8 then
call StartQ52()
endif
endif
endfunction
private function Run takes nothing returns nothing
local integer i = 0
local real x = 0.
local real y = 0.
local integer amount = 0
local unit boss = null
call ReleaseTimer(GetExpiredTimer())
set GeneralTarget = null
set QuestTrig[IDQ][0] = CreateTrigger()
loop
exitwhen i > MAXPLAYER
if GetPlayerSlotState(Player(i))==PLAYER_SLOT_STATE_PLAYING and IsHeroDefinitelyDead(i)==false then
set amount = amount + 1
endif
set i = i + 1
endloop
set CreepsRequiredKill = R2I(0.5*amount)
set i = 0
loop
exitwhen i > CreepsRequiredKill-1
set x = GetRandomReal(MapXMin,MapXMax)
set y = GetRandomReal(MapYMin,MapYMax)
set boss = CreateUnit(Player(11),BOSS_ID,x,y,0.)
call PingQuest(x,y,30.,60.)
call TriggerRegisterUnitEvent(QuestTrig[IDQ][0],boss, EVENT_UNIT_DEATH )
set i = i + 1
endloop
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function BossDeath ) )
set FailTimer = NewTimer()
call TimerStart(FailTimer,FAIL_DURATION,false,function Failed)
set boss = null
endfunction
function StartQ26 takes nothing returns nothing
local timer t = NewTimer()
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
endlibrary
//TESH.scrollpos=64
//TESH.alwaysfold=0
library q11 needs qsys,q15, TimerUtils, AlliedSpawnSystem, GroupUtils
globals
private constant integer IDQ = 11
private constant integer GROUPID = 5
private constant integer REQ_BASE = 600 //Per Player
private constant integer REQ_PLAYER = 10 //Per Player
private constant integer DELTA = 200 //each delta update the quest
endglobals
private function AlliedDeath takes nothing returns boolean
local unit allied = GetTriggerUnit()
if IsUnitInGroup(allied,VillagerGroup) then
set VillagerKill = VillagerKill + 1
call GroupRemoveUnit(VillagerGroup,allied)
set GeneralTarget = FirstOfGroup(VillagerGroup)
set VillagerAlive = 0
call ForGroup(VillagerGroup,function CountAliveAllied)
set QuestEta[IDQ] = I2S(VillagerKill) + "/"+I2S(VillagerAll)+" ships killed"
call UpdateQuest(IDQ)
if VillagerAlive == 0 then
call ReleaseGroup(VillagerGroup)
call EndQuest(IDQ,false)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call StartQ15()
endif
endif
set allied = null
return false
endfunction
private function EnemyDeath takes nothing returns boolean
if QuestBoolean[IDQ]==true then
set CreepsSubKill = CreepsSubKill + 1
set CreepsKill = CreepsKill + 1
set QuestEta[IDQ] = I2S(R2I(100*CreepsKill/CreepsRequiredKill)) + "% ready"
call UpdateQuestMbOnly(IDQ)
if CreepsSubKill == DELTA then
call UpdateQuest(IDQ)
set CreepsSubKill = 0
endif
if CreepsKill >= CreepsRequiredKill then
call ReleaseGroup(VillagerGroup)
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call StartQ15()
call SwitchPatrolToAssaut(GROUPID)
call SwitchTowerToAssaut(GROUPID)
endif
endif
return false
endfunction
private function Run takes nothing returns nothing
call ReleaseTimer(GetExpiredTimer())
call PingQuest(GetRectCenterX(gg_rct_ShipFacilities),GetRectCenterY(gg_rct_ShipFacilities),5.,15.)
set GeneralTarget = FirstOfGroup(VillagerGroup)
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(11),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(13),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(14),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function EnemyDeath ) )
set QuestTrig[IDQ][1] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][1],Player(ALLIEDID),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(QuestTrig[IDQ][1], Condition( function AlliedDeath) )
endfunction
function StartQ11 takes nothing returns nothing
local timer t = NewTimer()
local integer i = 0
loop
exitwhen i > 3
call AlliedAddUnitToPatrolGroup(AlliedId[GetRandomInt(0,AlliedIdMax)],GROUPID)
call AlliedAddUnitToTowerGroup(AlliedId[GetRandomInt(0,AlliedIdMax)],GROUPID)
set i = i + 1
endloop
set VillagerGroup = NewGroup()
set i = 0
loop
exitwhen i > 1
call GroupAddUnit(VillagerGroup,Ship[i])
call UnitAddAbility(Ship[i],QUESTUNIT)
call SetUnitOwner(Ship[i],Player(ALLIEDID),true)
call SetUnitInvulnerable(Ship[i],false)
set i = i + 1
endloop
set VillagerAll = 2
set CreepsRequiredKill = REQ_BASE+REQ_PLAYER*PlayerAmount
call ForGroup(VillagerGroup,function CountAllAllied)
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library q12 needs qsys,q15,AlliedSpawnSystem,IndieSummons, TimerUtils
globals
private constant integer IDQ = 12
private constant integer UP_HP = 'A05B'
private constant integer BUILDERID = 'h00T'
private constant integer SCOUT_TOWER_ID = 'h00S'
private constant integer ESCORTMAX = 5
private constant integer REPAIR_SPELL = 'Ahrp'
private constant string REPAIR_ORDER = "repair"
endglobals
private function BossOrder takes nothing returns boolean
if OrderId2String(GetIssuedOrderId())!= REPAIR_ORDER then
call IssueTargetOrder(Boss,REPAIR_ORDER,Building)
endif
return false
endfunction
private function BuildingStart takes nothing returns boolean
local unit tower = GetConstructingStructure()
if GetUnitTypeId(tower)==SCOUT_TOWER_ID then
set Building = tower
set QuestEta[IDQ] = "Defend the builder and the tower"
call UpdateQuest(IDQ)
set QuestTrig[IDQ][3] = CreateTrigger()
call TriggerRegisterUnitEvent(QuestTrig[IDQ][3],Boss, EVENT_UNIT_ISSUED_TARGET_ORDER)
call TriggerRegisterUnitEvent(QuestTrig[IDQ][3],Boss, EVENT_UNIT_ISSUED_POINT_ORDER)
call TriggerRegisterUnitEvent(QuestTrig[IDQ][3],Boss, EVENT_UNIT_ISSUED_ORDER )
call TriggerAddCondition(QuestTrig[IDQ][3], Condition( function BossOrder) )
endif
set tower = null
return false
endfunction
private function BuildingConstructed takes nothing returns boolean
local unit tower = GetConstructedStructure()
if tower == Building then
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call DestroyQuestTrigger(IDQ,2)
call DestroyQuestTrigger(IDQ,3)
call StartQ15()
endif
set tower = null
return false
endfunction
private function BossKill takes nothing returns boolean
call EndQuest(IDQ,false)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call DestroyQuestTrigger(IDQ,2)
call DestroyQuestTrigger(IDQ,3)
call StartQ15()
return false
endfunction
private function Run takes nothing returns nothing
local integer i = 0
local real x1 = GetRectCenterX(gg_rct_ExternalOutpostSpawn)
local real y1 = GetRectCenterY(gg_rct_ExternalOutpostSpawn)
local real x2 = GetRectCenterX(gg_rct_Tower)
local real y2 = GetRectCenterY(gg_rct_Tower)
local real x3 = GetRectCenterX(gg_rct_TeleporterSpawn)
local real y3 = GetRectCenterY(gg_rct_TeleporterSpawn)
local unit marine = null
call ReleaseTimer(GetExpiredTimer())
set Boss = CreateUnit(Player(ALLIEDID),BUILDERID,x1,y1,0.)
call SetUnitPathing(Boss,true)
call UnitAddAbility(Boss,QUESTUNIT)
call UnitAddAbility(Boss,UP_HP)
call IssueBuildOrderById(Boss,SCOUT_TOWER_ID,x2,y2)
set GeneralTarget = Boss
set marine = CreateUnit(Player(ALLIEDID),AlliedId[GetRandomInt(0,AlliedIdMax)],x1,y1,0.)
call UnitAddAbility(marine,QUESTUNIT)
call IssuePointOrder(marine,"attack",x2,y2)
set marine = CreateUnit(Player(ALLIEDID),AlliedId[GetRandomInt(0,AlliedIdMax)],x1,y1,0.)
call UnitAddAbility(marine,QUESTUNIT)
call IssuePointOrder(marine,"attack",x2,y2)
loop
exitwhen i > ESCORTMAX
set marine = CreateUnit(Player(ALLIEDID),AlliedId[GetRandomInt(0,AlliedIdMax)],x3,y3,0.)
call IndieSummon_SetMaster(marine,Boss)
call UnitAddAbility(marine,QUESTUNIT)
set i = i + 1
endloop
call PingQuest(x1,y1,5.,15.)
call PingQuest(x2,y2,5.,15.)
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterUnitEvent(QuestTrig[IDQ][0],Boss,EVENT_UNIT_DEATH)
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function BossKill ) )
set QuestTrig[IDQ][1] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][1],Player(ALLIEDID),EVENT_PLAYER_UNIT_CONSTRUCT_FINISH, null)
call TriggerAddCondition(QuestTrig[IDQ][1], Condition( function BuildingConstructed ) )
set QuestTrig[IDQ][2] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][2],Player(ALLIEDID),EVENT_PLAYER_UNIT_CONSTRUCT_START, null)
call TriggerAddCondition(QuestTrig[IDQ][2], Condition( function BuildingStart ) )
set marine = null
endfunction
function StartQ12 takes nothing returns nothing
local timer t = NewTimer()
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library q13 needs qsys,q15 TimerUtils, AlliedSpawnSystem, GroupUtils
globals
private constant integer IDQ = 13
private constant integer GROUPID = 5
private constant integer REQ_BASE = 600 //Per Player
private constant integer REQ_PLAYER = 10 //Per Player
private constant integer DELTA = 200 //each delta update the quest
private constant integer AMOUNT = 7
private constant integer ID1 = 'h00A'
private constant integer ID2 = 'h009'
endglobals
private function AlliedDeath takes nothing returns boolean
local unit allied = GetTriggerUnit()
if IsUnitInGroup(allied,VillagerGroup) then
set VillagerKill = VillagerKill + 1
call GroupRemoveUnit(VillagerGroup,allied)
set GeneralTarget = FirstOfGroup(VillagerGroup)
set VillagerAlive = 0
call ForGroup(VillagerGroup,function CountAliveAllied)
set QuestEta[IDQ] = I2S(VillagerKill) + "/"+I2S(VillagerAll)+" Engineers and Scientists killed"
call UpdateQuest(IDQ)
if VillagerAlive == 0 then
call ReleaseGroup(VillagerGroup)
call EndQuest(IDQ,false)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call StartQ15()
endif
endif
set allied = null
return false
endfunction
private function EnemyDeath takes nothing returns boolean
if QuestBoolean[IDQ]==true then
set CreepsSubKill = CreepsSubKill + 1
set CreepsKill = CreepsKill + 1
set QuestEta[IDQ] = I2S(R2I(100*CreepsKill/CreepsRequiredKill)) + "% targets down"
call UpdateQuestMbOnly(IDQ)
if CreepsSubKill == DELTA then
call UpdateQuest(IDQ)
set CreepsSubKill = 0
endif
if CreepsKill >= CreepsRequiredKill then
call ReleaseGroup(VillagerGroup)
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call StartQ15()
call SwitchPatrolToAssaut(GROUPID)
call SwitchTowerToAssaut(GROUPID)
endif
endif
return false
endfunction
private function Run takes nothing returns nothing
call ReleaseTimer(GetExpiredTimer())
call PingQuest(GetRectCenterX(gg_rct_WaterContaminated),GetRectCenterY(gg_rct_WaterContaminated),5.,15.)
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(11),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(13),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(14),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function EnemyDeath ) )
set QuestTrig[IDQ][1] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][1],Player(ALLIEDID),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(QuestTrig[IDQ][1], Condition( function AlliedDeath) )
set GeneralTarget = FirstOfGroup(VillagerGroup)
endfunction
function StartQ13 takes nothing returns nothing
local timer t = NewTimer()
local integer i = 0
local unit spawned = null
local real x = 0.
local real y = 0.
local real angle = 0.
loop
exitwhen i > 3
call AlliedAddUnitToPatrolGroup(AlliedId[GetRandomInt(0,AlliedIdMax)],GROUPID)
call AlliedAddUnitToTowerGroup(AlliedId[GetRandomInt(0,AlliedIdMax)],GROUPID)
set i = i + 1
endloop
set VillagerGroup = NewGroup()
set i = 0
loop
exitwhen i > AMOUNT - 1
set angle = GetRandomReal(0.,360.)
set x = GetRandomReal(GetRectMinX(gg_rct_WaterContaminated),GetRectMaxX(gg_rct_WaterContaminated))
set y = GetRandomReal(GetRectMinY(gg_rct_WaterContaminated),GetRectMaxY(gg_rct_WaterContaminated))
if GetRandomInt(0,1)==1 then
set spawned = CreateUnit(Player(ALLIEDID),ID1,x,y,angle)
else
set spawned = CreateUnit(Player(ALLIEDID),ID2,x,y,angle)
endif
call GroupAddUnit(VillagerGroup,spawned)
call UnitAddAbility(spawned,QUESTUNIT)
set i = i + 1
endloop
set spawned = null
set CreepsRequiredKill = REQ_BASE+REQ_PLAYER*PlayerAmount
call ForGroup(VillagerGroup,function CountAllAllied)
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library q14 needs qsys,q15, TimerUtils, AlliedSpawnSystem, GroupUtils,IndieSummons
globals
private constant integer IDQ = 14
private constant integer UNIT_ID = 'n016'
private constant integer REQ_BASE = 600 //Per Player
private constant integer REQ_PLAYER = 10 //Per Player
private constant integer DELTA = 100 //each delta update the quest
private constant integer AMOUNT = 6
endglobals
private function AlliedDeath takes nothing returns boolean
call DisplayAll("Control", "You failed!")
call EndQuest(IDQ,false)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call StartQ15()
return false
endfunction
private function EnemyDeath takes nothing returns boolean
if QuestBoolean[IDQ]==true then
set CreepsSubKill = CreepsSubKill + 1
set CreepsKill = CreepsKill + 1
set QuestEta[IDQ] = I2S(R2I(100*CreepsKill/CreepsRequiredKill)) + "% targets down"
call UpdateQuestMbOnly(IDQ)
if CreepsSubKill == DELTA then
call UpdateQuest(IDQ)
set CreepsSubKill = 0
endif
if CreepsKill >= CreepsRequiredKill then
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call StartQ15()
endif
endif
return false
endfunction
private function Run takes nothing returns nothing
local integer i = 0
local unit escort = null
call ReleaseTimer(GetExpiredTimer())
set Building = CreateUnit(Player(ALLIEDID),UNIT_ID,GetRectCenterX(gg_rct_Tower),GetRectCenterY(gg_rct_Tower),0.)
call UnitAddAbility(Building,QUESTUNIT)
set GeneralTarget = Building
loop
exitwhen i > AMOUNT-1
set escort = CreateUnit(Player(ALLIEDID),AlliedId[GetRandomInt(0,AlliedIdMax)],GetRectCenterX(gg_rct_Tower)+GetRandomReal(-50.,50),GetRectCenterY(gg_rct_Tower)+GetRandomReal(-50.,50),0.)
call IndieSummon_SetMaster(escort,Building)
call UnitAddAbility(escort,QUESTUNIT)
set i = i + 1
endloop
call PingQuest(GetUnitX(Building),GetUnitY(Building),10.,30.)
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(11),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(13),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(14),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function EnemyDeath ) )
set QuestTrig[IDQ][1] = CreateTrigger()
call TriggerRegisterUnitEvent(QuestTrig[IDQ][1],Building,EVENT_UNIT_DEATH)
call TriggerAddCondition(QuestTrig[IDQ][1], Condition( function AlliedDeath ) )
set escort = null
endfunction
function StartQ14 takes nothing returns nothing
local timer t = NewTimer()
set CreepsRequiredKill = REQ_BASE+REQ_PLAYER*PlayerAmount
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
endlibrary
//TESH.scrollpos=32
//TESH.alwaysfold=0
library q34 needs qsys, TimerUtils, AlliedSpawnSystem, GroupUtils, q15
globals
private constant integer IDQ = 34
private constant integer REQ_BASE = 500 //Per Player
private constant integer REQ_PLAYER = 10 //Per Player
private constant integer DELTA = 100 //each delta update the quest
endglobals
private function AlliedDeath takes nothing returns boolean
call DisplayAll("Control", "Nice. We lost a base.")
call EndQuest(IDQ,false)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call StartQ15()
return false
endfunction
private function EnemyDeath takes nothing returns boolean
if QuestBoolean[IDQ]==true then
set CreepsSubKill = CreepsSubKill + 1
set CreepsKill = CreepsKill + 1
set QuestEta[IDQ] = I2S(R2I(100*CreepsKill/CreepsRequiredKill)) + "% targets down"
call UpdateQuestMbOnly(IDQ)
if CreepsSubKill == DELTA then
call UpdateQuest(IDQ)
set CreepsSubKill = 0
endif
if CreepsKill >= CreepsRequiredKill then
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call StartQ15()
endif
endif
return false
endfunction
private function Run takes nothing returns nothing
call ReleaseTimer(GetExpiredTimer())
set Building = MechBunker
call SetUnitInvulnerable(Building,false)
call SetUnitOwner(Building,Player(ALLIEDID),true)
set GeneralTarget = Building
call PingQuest(GetUnitX(Building),GetUnitY(Building),10.,30.)
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(11),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(13),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(14),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function EnemyDeath ) )
set QuestTrig[IDQ][1] = CreateTrigger()
call TriggerRegisterUnitEvent(QuestTrig[IDQ][1],Building,EVENT_UNIT_DEATH)
call TriggerAddCondition(QuestTrig[IDQ][1], Condition( function AlliedDeath ) )
endfunction
function StartQ34 takes nothing returns nothing
local timer t = NewTimer()
set CreepsRequiredKill = REQ_BASE+REQ_PLAYER*PlayerAmount
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library q50 needs qsys, TimerUtils, q15, AlliedSpawnSystem, GroupUtils
globals
private constant integer IDQ = 50
private constant integer REQ_BASE = 500 //Per Player
private constant integer REQ_PLAYER = 10 //Per Player
private constant integer DELTA = 100 //each delta update the quest
private constant integer AMOUNT = 14
private constant string FX = "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportCaster.mdl"
private constant integer UNIT_ID = 'h00A'
endglobals
private function AlliedDeath takes nothing returns boolean
local unit allied = GetTriggerUnit()
if IsUnitInGroup(allied,VillagerGroup) then
set VillagerKill = VillagerKill + 1
call GroupRemoveUnit(VillagerGroup,allied)
set GeneralTarget = FirstOfGroup(VillagerGroup)
set VillagerAlive = 0
call ForGroup(VillagerGroup,function CountAliveAllied)
set QuestEta[IDQ] = I2S(VillagerKill) + "/"+I2S(VillagerAll)+" civilians killed"
call UpdateQuest(IDQ)
if VillagerAlive == 0 then
call ReleaseGroup(VillagerGroup)
call EndQuest(IDQ,false)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call StartQ15()
endif
endif
set allied = null
return false
endfunction
private function EnemyDeath takes nothing returns boolean
if QuestBoolean[IDQ]==true then
set CreepsSubKill = CreepsSubKill + 1
set CreepsKill = CreepsKill + 1
set QuestEta[IDQ] = I2S(R2I(100*CreepsKill/CreepsRequiredKill)) + "% targets down"
call UpdateQuestMbOnly(IDQ)
if CreepsSubKill == DELTA then
call UpdateQuest(IDQ)
set CreepsSubKill = 0
endif
if CreepsKill >= CreepsRequiredKill then
call ReleaseGroup(VillagerGroup)
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call StartQ15()
endif
endif
return false
endfunction
private function Run takes nothing returns nothing
local integer i = 0
local unit spawned = null
local real x = 0.
local real y = 0.
call ReleaseTimer(GetExpiredTimer())
set VillagerGroup = NewGroup()
loop
exitwhen i > AMOUNT - 1
set x = GetRandomReal(GetRectMinX(gg_rct_EnergeticFactory),GetRectMaxX(gg_rct_EnergeticFactory))
set y = GetRandomReal(GetRectMinY(gg_rct_EnergeticFactory),GetRectMaxY(gg_rct_EnergeticFactory))
call DestroyEffect(AddSpecialEffect(FX,x,y))
set spawned = CreateUnit(Player(ALLIEDID),UNIT_ID,x,y,0.)
call GroupAddUnit(VillagerGroup,spawned)
call UnitAddAbility(spawned,QUESTUNIT)
set i = i + 1
endloop
call ForGroup(VillagerGroup,function CountAllAllied)
set GeneralTarget = FirstOfGroup(VillagerGroup)
set CreepsRequiredKill = REQ_BASE+REQ_PLAYER*PlayerAmount
call PingQuest(GetRectCenterX(gg_rct_EnergeticFactory),GetRectCenterY(gg_rct_EnergeticFactory),10.,30.)
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(11),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(13),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(14),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function EnemyDeath ) )
set QuestTrig[IDQ][1] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][1],Player(ALLIEDID),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(QuestTrig[IDQ][1], Condition( function AlliedDeath) )
set spawned = null
endfunction
function StartQ50 takes nothing returns nothing
local timer t = NewTimer()
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library q51 initializer init needs qsys, TimerUtils, q15, AlliedSpawnSystem, GroupUtils
globals
private constant integer IDQ = 51
private constant integer GROUPID = 8
private constant integer REQ_BASE = 500 //Per Player
private constant integer REQ_PLAYER = 10 //Per Player
private constant integer DELTA = 100 //each delta update the quest
private constant integer AMOUNT = 14
private rect array VillagerSpawnRect [5]
private integer VillagerSpawnMax = 0
endglobals
private function AlliedDeath takes nothing returns boolean
local unit allied = GetTriggerUnit()
if IsUnitInGroup(allied,VillagerGroup) then
set VillagerKill = VillagerKill + 1
call GroupRemoveUnit(VillagerGroup,allied)
set GeneralTarget = FirstOfGroup(VillagerGroup)
set VillagerAlive = 0
call ForGroup(VillagerGroup,function CountAliveAllied)
set QuestEta[IDQ] = I2S(VillagerKill) + "/"+I2S(VillagerAll)+" civilians killed"
call UpdateQuest(IDQ)
if VillagerAlive == 0 then
call ReleaseGroup(VillagerGroup)
call EndQuest(IDQ,false)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call StartQ15()
endif
endif
set allied = null
return false
endfunction
private function EnemyDeath takes nothing returns boolean
if QuestBoolean[IDQ]==true then
set CreepsSubKill = CreepsSubKill + 1
set CreepsKill = CreepsKill + 1
set QuestEta[IDQ] = I2S(R2I(100*CreepsKill/CreepsRequiredKill)) + "% targets down"
call UpdateQuestMbOnly(IDQ)
if CreepsSubKill == DELTA then
call UpdateQuest(IDQ)
set CreepsSubKill = 0
endif
if CreepsKill >= CreepsRequiredKill then
call ReleaseGroup(VillagerGroup)
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call StartQ15()
call SwitchPatrolToAssaut(GROUPID)
call SwitchTowerToAssaut(GROUPID)
endif
endif
return false
endfunction
private function Run takes nothing returns nothing
local integer i = 0
local unit spawned = null
local real x = 0.
local real y = 0.
local integer random = 0
call ReleaseTimer(GetExpiredTimer())
set VillagerGroup = NewGroup()
loop
exitwhen i > AMOUNT - 1
set random = GetRandomInt(0,VillagerSpawnMax)
set x = GetRectCenterX(VillagerSpawnRect[random])
set y = GetRectCenterY(VillagerSpawnRect[random])
set spawned = CreateUnit(Player(ALLIEDID),VillagerId[GetRandomInt(0,VillagerIdMax)],x,y,0.)
call GroupAddUnit(VillagerGroup,spawned)
set x = GetRandomReal(GetRectMinX(gg_rct_Town),GetRectMaxX(gg_rct_Town))
set y = GetRandomReal(GetRectMinY(gg_rct_Town),GetRectMaxY(gg_rct_Town))
call IssuePointOrder(spawned,"move",x,y)
call UnitAddAbility(spawned,QUESTUNIT)
set i = i + 1
endloop
call ForGroup(VillagerGroup,function CountAllAllied)
set GeneralTarget = FirstOfGroup(VillagerGroup)
set CreepsRequiredKill = REQ_BASE+REQ_PLAYER*PlayerAmount
call PingQuest(GetRectCenterX(gg_rct_Town),GetRectCenterY(gg_rct_Town),10.,30.)
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(11),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(13),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(14),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function EnemyDeath ) )
set QuestTrig[IDQ][1] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][1],Player(ALLIEDID),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(QuestTrig[IDQ][1], Condition( function AlliedDeath) )
set spawned = null
endfunction
function StartQ51 takes nothing returns nothing
local timer t = NewTimer()
local integer i = 0
loop
exitwhen i > 3
call AlliedAddUnitToPatrolGroup(AlliedId[GetRandomInt(0,AlliedIdMax)],GROUPID)
set i = i + 1
endloop
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
private function init takes nothing returns nothing
set VillagerSpawnRect[0] = gg_rct_TownHouse1
set VillagerSpawnRect[1] = gg_rct_TownHouse2
set VillagerSpawnRect[2] = gg_rct_TownHouse3
set VillagerSpawnRect[3] = gg_rct_TownHouse4
set VillagerSpawnRect[4] = gg_rct_TownHouse5
set VillagerSpawnMax = 4
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library q52 needs qsys, TimerUtils, AlliedSpawnSystem, GroupUtils, q15
globals
private constant integer IDQ = 52
private constant integer REQ_BASE = 500 //Per Player
private constant integer REQ_PLAYER = 10 //Per Player
private constant integer DELTA = 100 //each delta update the quest
endglobals
private function AlliedDeath takes nothing returns boolean
call DisplayAll("Control", "Move! Move! Move! Nuclear explosion will...")
call EndQuest(IDQ,false)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call StartQ15()
return false
endfunction
private function EnemyDeath takes nothing returns boolean
if QuestBoolean[IDQ]==true then
set CreepsSubKill = CreepsSubKill + 1
set CreepsKill = CreepsKill + 1
set QuestEta[IDQ] = I2S(R2I(100*CreepsKill/CreepsRequiredKill)) + "% targets down"
call UpdateQuestMbOnly(IDQ)
if CreepsSubKill == DELTA then
call UpdateQuest(IDQ)
set CreepsSubKill = 0
endif
if CreepsKill >= CreepsRequiredKill then
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call StartQ15()
endif
endif
return false
endfunction
private function Run takes nothing returns nothing
call ReleaseTimer(GetExpiredTimer())
set Building = NukeReactor
call SetUnitInvulnerable(Building,false)
call SetUnitOwner(Building,Player(ALLIEDID),true)
set GeneralTarget = Building
call PingQuest(GetUnitX(Building),GetUnitY(Building),10.,30.)
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(11),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(13),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(14),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function EnemyDeath ) )
set QuestTrig[IDQ][1] = CreateTrigger()
call TriggerRegisterUnitEvent(QuestTrig[IDQ][1],Building,EVENT_UNIT_DEATH)
call TriggerAddCondition(QuestTrig[IDQ][1], Condition( function AlliedDeath ) )
endfunction
function StartQ52 takes nothing returns nothing
local timer t = NewTimer()
set CreepsRequiredKill = REQ_BASE+REQ_PLAYER*PlayerAmount
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library q15 initializer init needs qsys,TimerUtils,TextDisplay, Chapter3
globals
private constant integer IDQ = 15
private integer array BossId [16]
private string array Text[16]
private integer BossMax
endglobals
private function BossDeath takes nothing returns boolean
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call Chapter3()
return false
endfunction
private function Run takes nothing returns nothing
local integer random = GetRandomInt(0,BossMax)
set Boss = CreateUnit(Player(11),BossId[random],GetRectCenterX(gg_rct_Spawn008),GetRectCenterY(gg_rct_Spawn008),0.)
call BossSound()
call DisplayAll("Control",Text[random])
set GeneralTarget = null
call ReleaseTimer(GetExpiredTimer())
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterUnitEvent(QuestTrig[IDQ][0],Boss, EVENT_UNIT_DEATH )
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function BossDeath ) )
endfunction
function StartQ15 takes nothing returns nothing
local timer t = NewTimer()
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
private function init takes nothing returns nothing
local integer i = 0
set BossId[i]='u00D'
set Text[i]="Oh my god. Something extremely big just get out of the Restricted Complex 601. It seems equiped with human technology."
set i = i + 1
set BossId[i]='u01I'
set Text[i]="Sludge was designed to be a good weapon.Like most things there it is out of control"
set i = i + 1
set BossId[i]='u01K'
set Text[i]="Codename: Lich. Destroy the new target we are uploading on your internal CPU."
set i = i + 1
set BossId[i]='u01L'
set Text[i]="There is an other bigger abomination walking near your position. It seems it is able to grow up by eating other abominations."
set i = i + 1
set BossId[i]='u01M'
set Text[i]="Symbiosis between mechanical and organic troops is rarely a succes. The RC chain has tried to develop a kind of Firebat Mark II. Codename Inferno."
set i = i + 1
set BossId[i]='u01N'
set Text[i]="This experiment is supposed to help during camouflage mission. Nanites have failed there, you will have to erradicate this hudge zombie."
set i = i + 1
set BossId[i]='u00I'
set Text[i]="Time to stop to joke. A sustained Repear is running there. Try to eliminate him."
set i = i + 1
set BossId[i]='u01O'
set Text[i]="Without energetic field we are not able to contain the Obliterus. Survive!"
set i = i + 1
set BossId[i]='u01P'
set Text[i]="Manthis is one of the first pure artificial organism developped in the Restricted chain. This experiment is closed since it has been described as unstable."
set i = i + 1
set BossId[i]='u01Q'
set Text[i]="Okay, remember. It looks like a giant spider, but it is really harder most mutation you saw before."
set i = i + 1
set BossId[i]='u01R'
set Text[i]="Ether was the codename of a air-assaut experiment. The flying troops should be the next way of war. This experiment is kinda failed since it is not able to choose targets. Kill it."
set i = i + 1
set BossId[i]='u01S'
set Text[i]="Gentlemen, you have a lady to seduce there. Just remember not to dance with her. She bites a lot after Delta group tried to capture her."
set i = i + 1
set BossId[i]='u01T'
set Text[i]="Something wrong is going on. We have spotted a big unknown thing incoming there."
set i = i + 1
set BossId[i]='u01U'
set Text[i]="Of course scientists worked on a strongh unit able to disipate any damage. Have fun with it!"
set i = i + 1
set BossId[i]='u01V'
set Text[i]="Radiation is a ranged flamer weapon developped years ago. Its violent behaviour is the reason why RC601 just sealed it. Destroy it at all costs!"
set i = i + 1
set BossId[i]='u01W'
set Text[i]="A big beast which has nothing to do with zombies is running through the area. It was one of the first experiment on animals. Warn, it is not able to recognize humans as masters."
set BossMax = i
endfunction
endlibrary
//TESH.scrollpos=5
//TESH.alwaysfold=0
library Chapter3 needs TimerUtils, q16,q37,ItemSpawn, SpawnSystem,Reinforcements
globals
private constant string MASK = "ReplaceableTextures\\CameraMasks\\Black_mask.blp"
endglobals
private struct str
integer i
endstruct
private function Wait takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
local integer i = 0
if dat.i < CHAPTER_WAIT+20 then
set dat.i = dat.i + 1
if dat.i == CHAPTER_WAIT+5 then
call MusicChapter()
elseif dat.i == CHAPTER_WAIT+10 then
loop
exitwhen i > MAXPLAYER
call DisplayTextToPlayer(Player(i),0.,0.,"|c00AFAAFF Chapter III : The offensive|r")
set i = i + 1
endloop
endif
else
call StartItemSpawn(6,10)
if GetRandomInt(0,100)<50 then
call StartQ16()
else
call StartQ37()
endif
call QuestSetTimeToMorning()
set ChapterIntermission = false
call MusicOff()
call ReleaseTimer(t)
call dat.destroy()
call SpawnReinforcements()
endif
endfunction
function Chapter3 takes nothing returns nothing
local timer t = NewTimer()
local str dat = str.create()
set dat.i = 0
set ChapterDone = 2
set ChapterIntermission = true
call CreepsKillAllNormal()
call SetTimerData(t,dat)
call TimerStart (t, 1., true, function Wait )
endfunction
endlibrary
//TESH.scrollpos=1
//TESH.alwaysfold=0
library q16 needs qsys,q17,q18,AlliedSpawnSystem, HeroDeath,TimerUtils, TextDisplay,GroupUtils,IndieSummons, TimerUtils
globals
private constant integer IDQ = 16
private constant integer ANTILLES_ID = 'h00W'
private constant integer LAST_WAYPOINT = 7
endglobals
private function AlliedDeath takes nothing returns boolean
call GroupRemoveUnit(VillagerGroup,Building)
call ReleaseGroup(VillagerGroup)
call DisplayAll("Control", "Shit. We lost Harry.")
call EndQuest(IDQ,false)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
set RandomQuest = GetRandomInt(1,2)
if RandomQuest == 1 then
call StartQ17()
elseif RandomQuest == 2 then
call StartQ18()
endif
return false
endfunction
private function ArrivedToEnd takes nothing returns boolean
if GetTriggerUnit()==Building then
call GroupRemoveUnit(VillagerGroup,Building)
call UnitRemoveAbility(Building, MOVE_SPELL)
call ReleaseGroup(VillagerGroup)
call DisplayAll("Major Harry", "Okay, it seems you are a little less stupid than I expected. Thanks.")
call SwitchUnitToAssautGroup(Building)
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
set RandomQuest = GetRandomInt(1,2)
if RandomQuest == 1 then
call StartQ17()
elseif RandomQuest == 2 then
call StartQ18()
endif
endif
return false
endfunction
private function ActivateMarine takes nothing returns nothing
local integer i = 0
local unit escort = null
local real x = 0.
local real y = 0.
call DestroyQuestTrigger(IDQ,0)
set CurrentWayPoint = 1
set CurrentLastWayPoint = LAST_WAYPOINT
set CurrentRect = ConvoyRect[CurrentWayPoint]
set VillagerGroup = NewGroup()
call DisplayAll("Major Harry","It's not to late. I was about to loose my patience...")
set x = GetRandomReal(GetRectMinX(CurrentRect),GetRectMaxX(CurrentRect))
set y = GetRandomReal(GetRectMinY(CurrentRect),GetRectMaxY(CurrentRect))
set Building = CreateUnit(Player(ALLIEDID),ANTILLES_ID,GetRectCenterX(gg_rct_AntillesSpawn),GetRectCenterY(gg_rct_AntillesSpawn),0.)
call UnitAddAbility(Building,QUESTUNIT)
call GroupAddUnit(VillagerGroup,Building)
call UnitAddAbility(Building,MOVE_SPELL)
call IssuePointOrder(Building,MOVE_ORDER,x,y)
set GeneralTarget = Building
loop
exitwhen i > 2
set x = GetRectCenterX(gg_rct_AntillesSpawn)+GetRandomReal(-50.,50.)
set y = GetRectCenterY(gg_rct_AntillesSpawn)+GetRandomReal(-50.,50.)
set escort = CreateUnit(Player(ALLIEDID),AlliedId[GetRandomInt(0,AlliedIdMax)],x,y,0.)
call IndieSummon_SetMaster(escort,Building)
set x = GetRectCenterX(gg_rct_AntillesSpawn)+GetRandomReal(-50.,50.)
set y = GetRectCenterY(gg_rct_AntillesSpawn)+GetRandomReal(-50.,50.)
set escort = CreateUnit(Player(ALLIEDID),AlliedId[GetRandomInt(0,AlliedIdMax)],x,y,0.)
call IndieSummon_SetMaster(escort,Building)
set i = i + 1
endloop
set QuestTrig[IDQ][1] = CreateTrigger()
call TriggerRegisterUnitEvent(QuestTrig[IDQ][1],Building,EVENT_UNIT_DEATH)
call TriggerAddCondition(QuestTrig[IDQ][1], Condition( function AlliedDeath ) )
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterEnterRectSimple(QuestTrig[IDQ][0], ConvoyRect[CurrentLastWayPoint])
call TriggerAddCondition(QuestTrig[IDQ][0], Condition(function ArrivedToEnd))
set escort = null
endfunction
private function CheckMarine takes nothing returns boolean
if IsUnitType(GetTriggerUnit(),UNIT_TYPE_HERO)==true then
call ActivateMarine()
endif
return false
endfunction
private function Run takes nothing returns nothing
local integer i = 0
call ReleaseTimer(GetExpiredTimer())
call PingQuest(GetRectCenterX(gg_rct_AntillesSpawn),GetRectCenterY(gg_rct_AntillesSpawn),10.,30.)
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterEnterRectSimple(QuestTrig[IDQ][0], gg_rct_AntillesSpawn)
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function CheckMarine ) )
endfunction
function StartQ16 takes nothing returns nothing
local timer t = NewTimer()
set ConvoyRect[1]=gg_rct_Antilles001
set ConvoyRect[2]=gg_rct_Antilles002
set ConvoyRect[3]=gg_rct_Antilles003
set ConvoyRect[4]=gg_rct_Antilles004
set ConvoyRect[5]=gg_rct_Antilles005
set ConvoyRect[6]=gg_rct_Antilles006
set ConvoyRect[7]=gg_rct_Antilles007
set ConvoySpawn[1][0] = 10
set ConvoySpawn[1][1] = 19
set ConvoySpawn[1][2] = 24
set ConvoySpawn[2][0] = 8
set ConvoySpawn[2][1] = 9
set ConvoySpawn[2][2] = 24
set ConvoySpawn[3][0] = 14
set ConvoySpawn[3][1] = 19
set ConvoySpawn[3][2] = 24
set ConvoySpawn[4][0] = 14
set ConvoySpawn[4][1] = 15
set ConvoySpawn[4][2] = 17
set ConvoySpawn[5][0] = 15
set ConvoySpawn[5][1] = 17
set ConvoySpawn[5][2] = 21
set ConvoySpawn[6][0] = 5
set ConvoySpawn[6][1] = 15
set ConvoySpawn[6][2] = 22
set ConvoySpawn[7][0] = 5
set ConvoySpawn[7][1] = 16
set ConvoySpawn[7][2] = 25
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
endlibrary
//TESH.scrollpos=13
//TESH.alwaysfold=0
library q37 needs qsys,q49,q48,AlliedSpawnSystem, HeroDeath,TimerUtils, TextDisplay,GroupUtils,IndieSummons, TimerUtils
globals
private constant integer IDQ = 37
private constant integer BEEF_ID = 'h01A'
private constant integer LAST_WAYPOINT = 7
endglobals
private function AlliedDeath takes nothing returns boolean
call GroupRemoveUnit(VillagerGroup,Building)
call DisplayAll("Control", "Shit. We lost the Beef. Operation Aborted")
call EndQuest(IDQ,false)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
set RandomQuest = GetRandomInt(1,2)
if RandomQuest == 1 then
call StartQ48()
elseif RandomQuest == 2 then
call StartQ49()
endif
return false
endfunction
private function ArrivedToEnd takes nothing returns boolean
if GetTriggerUnit()==Building then
call UnitRemoveAbility(Building, MOVE_SPELL)
call GroupRemoveUnit(VillagerGroup,Building)
call DisplayAll("GW-Beef Pilot", "Now, let's try to survive in the complex. Have fun outside.")
call SwitchUnitToAssautGroup(Building)
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
set RandomQuest = GetRandomInt(1,2)
if RandomQuest == 1 then
call StartQ48()
elseif RandomQuest == 2 then
call StartQ49()
endif
endif
return false
endfunction
private function ActivateMarine takes nothing returns nothing
local integer i = 0
local unit escort = null
local real x = 0.
local real y = 0.
call DestroyQuestTrigger(IDQ,0)
set CurrentWayPoint = 1
set CurrentLastWayPoint = LAST_WAYPOINT
set CurrentRect = ConvoyRect[CurrentWayPoint]
set VillagerGroup = NewGroup()
call DisplayAll("GW-Beef Pilot", "There we are. Thanks to assist. It will not be easy to enter the RC601.")
set x = GetRandomReal(GetRectMinX(CurrentRect),GetRectMaxX(CurrentRect))
set y = GetRandomReal(GetRectMinY(CurrentRect),GetRectMaxY(CurrentRect))
set Building = CreateUnit(Player(ALLIEDID),BEEF_ID,GetRectCenterX(gg_rct_BeefSpawn),GetRectCenterY(gg_rct_BeefSpawn),0.)
call UnitAddAbility(Building,QUESTUNIT)
call GroupAddUnit(VillagerGroup,Building)
call UnitAddAbility(Building,MOVE_SPELL)
call IssuePointOrder(Building,MOVE_ORDER,x,y)
call SetUnitPathing(Building,false)
set GeneralTarget = Building
loop
exitwhen i > 2
set x = GetRectCenterX(gg_rct_BeefSpawn)+GetRandomReal(-150.,150.)
set y = GetRectCenterY(gg_rct_BeefSpawn)+GetRandomReal(-150.,150.)
set escort = CreateUnit(Player(ALLIEDID),AlliedId[GetRandomInt(0,AlliedIdMax)],x,y,0.)
call IndieSummon_SetMaster(escort,Building)
set x = GetRectCenterX(gg_rct_BeefSpawn)+GetRandomReal(-150.,150.)
set y = GetRectCenterY(gg_rct_BeefSpawn)+GetRandomReal(-150.,150.)
set escort = CreateUnit(Player(ALLIEDID),AlliedId[GetRandomInt(0,AlliedIdMax)],x,y,0.)
call IndieSummon_SetMaster(escort,Building)
set i = i + 1
endloop
set QuestTrig[IDQ][1] = CreateTrigger()
call TriggerRegisterUnitEvent(QuestTrig[IDQ][1],Building,EVENT_UNIT_DEATH)
call TriggerAddCondition(QuestTrig[IDQ][1], Condition( function AlliedDeath ) )
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterEnterRectSimple(QuestTrig[IDQ][0], ConvoyRect[CurrentLastWayPoint])
call TriggerAddCondition(QuestTrig[IDQ][0], Condition(function ArrivedToEnd))
set escort = null
endfunction
private function CheckMarine takes nothing returns boolean
if IsUnitType(GetTriggerUnit(),UNIT_TYPE_HERO)==true then
call ActivateMarine()
endif
return false
endfunction
private function Run takes nothing returns nothing
local integer i = 0
call ReleaseTimer(GetExpiredTimer())
call PingQuest(GetRectCenterX(gg_rct_BeefSpawn),GetRectCenterY(gg_rct_BeefSpawn),10.,30.)
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterEnterRectSimple(QuestTrig[IDQ][0], gg_rct_BeefStart)
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function CheckMarine ) )
endfunction
function StartQ37 takes nothing returns nothing
local timer t = NewTimer()
set ConvoyRect[1]=gg_rct_Beef001
set ConvoyRect[2]=gg_rct_Beef002
set ConvoyRect[3]=gg_rct_Beef003
set ConvoyRect[4]=gg_rct_Beef004
set ConvoyRect[5]=gg_rct_Beef005
set ConvoyRect[6]=gg_rct_Beef006
set ConvoyRect[7]=gg_rct_Beef007
set ConvoySpawn[1][0] = 5
set ConvoySpawn[1][1] = 16
set ConvoySpawn[1][2] = 25
set ConvoySpawn[2][0] = 5
set ConvoySpawn[2][1] = 15
set ConvoySpawn[2][2] = 22
set ConvoySpawn[3][0] = 15
set ConvoySpawn[3][1] = 17
set ConvoySpawn[3][2] = 21
set ConvoySpawn[4][0] = 14
set ConvoySpawn[4][1] = 15
set ConvoySpawn[4][2] = 17
set ConvoySpawn[5][0] = 14
set ConvoySpawn[5][1] = 19
set ConvoySpawn[5][2] = 24
set ConvoySpawn[6][0] = 8
set ConvoySpawn[6][1] = 9
set ConvoySpawn[6][2] = 24
set ConvoySpawn[7][0] = 10
set ConvoySpawn[7][1] = 19
set ConvoySpawn[7][2] = 24
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
endlibrary
//TESH.scrollpos=78
//TESH.alwaysfold=0
library q17 initializer init needs SpellEvent,TextDisplay,qsys,q19,q20,q21,q22, TimerUtils, AbilityPreload, AlliedSpawnSystem, IndieSummons
globals
private constant real FAIL_DURATION = 360.
private constant integer IDQ = 17
private constant real TIMEOUT_SPAWN = 3.
private constant real TIMEOUT_PING = 15.
private constant integer GROUPID = 6
private constant integer BEACONID = 'I012'
private constant integer DUMMY_BEACON = 'o00E'
private timer FailTimer
private rect array BeaconRect[10]
private string array BeaconName[10]
private boolean array BeaconPicked[10]
private boolean array BeaconDone[10]
endglobals
private function RemoveDummyBeacon takes nothing returns boolean
if GetUnitTypeId(GetFilterUnit())==DUMMY_BEACON then
call RemoveUnit(GetFilterUnit())
endif
return true
endfunction
private function FilterBeacon takes nothing returns boolean
if GetItemTypeId(GetFilterItem())==BEACONID then
call RemoveItem(GetFilterItem())
endif
return true
endfunction
private function BeaconSummoned takes nothing returns boolean
local unit marine = GetTriggerUnit()
local player owner = GetOwningPlayer(marine)
local item baliseItem = GetManipulatedItem()
local integer i = 0
local real x = 0.
local real y = 0.
if GetItemTypeId(baliseItem)==BEACONID then
loop
exitwhen i > MAXPLAYER
if BeaconPicked[i]==true and BeaconDone[i]==false and RectContainsUnit(BeaconRect[i],marine) then
set x = GetRectCenterX(BeaconRect[i])
set y = GetRectCenterY(BeaconRect[i])
set BeaconDone[i]=true
set CreepsKill = CreepsKill + 1
call RemoveItem(baliseItem)
call CreateUnit(owner,DUMMY_BEACON,x,y,0.)
call DisplayAll(GetPlayerName(owner),BeaconName[i]+" beacon works now")
set owner = null
set marine = null
set baliseItem = null
if CreepsKill == CreepsRequiredKill then
call ReleaseTimer(FailTimer)
call EndQuest(IDQ,true)
call EnumItemsInRect(bj_mapInitialPlayableArea,Filter(function FilterBeacon),null)
call GroupEnumUnitsOfPlayer(ENUM_GROUP,Player(ALLIEDID),Filter(function RemoveDummyBeacon))
call DestroyQuestTrigger(IDQ,0)
call DisplayAll("Control","Good job there. Planes should be able to find the good targets now.")
set RandomQuest = GetRandomInt(1,4)
if RandomQuest == 1 then
call StartQ19()
elseif RandomQuest == 2 then
call StartQ20()
elseif RandomQuest == 3 then
call StartQ21()
elseif RandomQuest == 3 then
call StartQ22()
endif
endif
return false
endif
set i = i + 1
endloop
endif
set owner = null
set marine = null
set baliseItem = null
return false
endfunction
private function Update takes nothing returns nothing
call ReleaseTimer(FailTimer)
if CreepsKill < CreepsRequiredKill then
call EndQuest(IDQ,false)
call DisplayAll("Control","You stupid men! Planes will not be able to blow them up")
set RandomQuest = GetRandomInt(1,4)
if RandomQuest == 1 then
call StartQ19()
elseif RandomQuest == 2 then
call StartQ20()
elseif RandomQuest == 3 then
call StartQ21()
elseif RandomQuest == 4 then
call StartQ22()
endif
endif
call EnumItemsInRect(bj_mapInitialPlayableArea,Filter(function FilterBeacon),null)
call GroupEnumUnitsOfPlayer(ENUM_GROUP,Player(ALLIEDID),Filter(function RemoveDummyBeacon))
call DestroyQuestTrigger(IDQ,0)
endfunction
private function StartFailTimer takes nothing returns nothing
set FailTimer = NewTimer()
call TimerStart(FailTimer,FAIL_DURATION,false,function Update)
endfunction
private function BeaconPing takes nothing returns nothing
local timer t = GetExpiredTimer()
local real x = 0.
local real y = 0.
local integer i = 0
if QuestBoolean[IDQ]==true then
loop
exitwhen i > MAXPLAYER
if BeaconPicked[i]==true and BeaconDone[i]==false then
set x = GetRectCenterX(BeaconRect[i])
set y = GetRectCenterY(BeaconRect[i])
call PingQuest(x,y,5.,7.)
endif
set i = i + 1
endloop
else
call ReleaseTimer(t)
endif
endfunction
private function StartBeaconPing takes nothing returns nothing
local timer t = NewTimer()
call TimerStart(t,TIMEOUT_PING,true,function BeaconPing)
endfunction
private function SetRandomBeacon takes nothing returns integer
local integer i = 0
local integer random = 0
loop
exitwhen i > MAXPLAYER
set random = GetRandomInt(0,MAXPLAYER)
if BeaconPicked[random]==false then
set BeaconPicked[random]=true
return random
endif
set i = i + 1
endloop
return MAXPLAYER+1
endfunction
private struct s_baliseSpawn
integer i
endstruct
private function BeaconSpawn takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_baliseSpawn dat = GetTimerData(t)
local real x = 0.
local real y = 0.
local integer random
if dat.i < CreepsRequiredKill then
set dat.i = dat.i + 1
set random = SetRandomBeacon()
set x = GetRectCenterX(BeaconRect[random])
set y = GetRectCenterY(BeaconRect[random])
call DisplayAll("Control", "Downloading destination for CreepsKill area "+I2S(dat.i)+": "+BeaconName[random])
call PingQuest(x,y,5.,10.)
else
call ReleaseTimer(t)
call dat.destroy()
call StartBeaconPing()
call StartFailTimer()
endif
endfunction
private function StartBeaconSpawn takes nothing returns nothing
local timer t = NewTimer()
local s_baliseSpawn dat = s_baliseSpawn.create()
set dat.i = 0
call DisplayAll("Control","Coordonates of the beacons area are downloaded on your internal CPU")
call SetTimerData(t,dat)
call TimerStart(t,TIMEOUT_SPAWN,true,function BeaconSpawn)
endfunction
private function Run takes nothing returns nothing
local integer i = 0
local real x = 0.
local real y = 0.
call StartBeaconSpawn()
set GeneralTarget = null
call ReleaseTimer(GetExpiredTimer())
set CreepsKill= 0
set CreepsRequiredKill = PlayerAmount
loop
exitwhen i > CreepsRequiredKill
call CreateItem(BEACONID,GetRectCenterX(gg_rct_AirField)+GetRandomReal(-50.,50.),GetRectCenterY(gg_rct_AirField)+GetRandomReal(-50.,50.))
set i = i + 1
endloop
call PingQuest(GetRectCenterX(gg_rct_AirField),GetRectCenterY(gg_rct_AirField),10.,30.)
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(QuestTrig[IDQ][0], EVENT_PLAYER_UNIT_USE_ITEM )
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function BeaconSummoned ) )
endfunction
function StartQ17 takes nothing returns nothing
local timer t = NewTimer()
local integer i = 0
loop
exitwhen i > 3
call AlliedAddUnitToPatrolGroup(AlliedId[GetRandomInt(0,AlliedIdMax)],GROUPID)
call AlliedAddUnitToTowerGroup(AlliedId[GetRandomInt(0,AlliedIdMax)],GROUPID)
set i = i + 1
endloop
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
private function init takes nothing returns nothing
local integer i = 0
set BeaconRect[0]=gg_rct_Beacon01
set BeaconRect[1]=gg_rct_Beacon02
set BeaconRect[2]=gg_rct_Beacon03
set BeaconRect[3]=gg_rct_Beacon04
set BeaconRect[4]=gg_rct_Beacon05
set BeaconRect[5]=gg_rct_Beacon06
set BeaconRect[6]=gg_rct_Beacon07
set BeaconRect[7]=gg_rct_Beacon08
set BeaconRect[8]=gg_rct_Beacon09
set BeaconRect[9]=gg_rct_Beacon10
set BeaconName[0]="Village"
set BeaconName[1]="Swamp"
set BeaconName[2]="Barracks"
set BeaconName[3]="Ship Facilities"
set BeaconName[4]="External Outpost"
set BeaconName[5]="Mechanoids Facilities"
set BeaconName[6]="South Airfield"
set BeaconName[7]="Fields"
set BeaconName[8]="Restricted Complex Main Entrance"
set BeaconName[9]="Teleporter"
loop
exitwhen i > MAXPLAYER
set BeaconPicked[i]=false
set BeaconDone[i]=false
set i = i + 1
endloop
endfunction
endlibrary
//TESH.scrollpos=54
//TESH.alwaysfold=0
library q18 needs TextDisplay,qsys,q19,q20,q21,q22, TimerUtils, AlliedSpawnSystem, IndieSummons
globals
private constant real FAIL_DURATION = 360.
private constant integer IDQ = 18
private constant integer GROUPID = 6
private constant integer PIECEID = 'I01B'
private constant integer PIECEMAX = 20 //Per Player
private constant integer PIECEREQ = 7 //Per Player
private constant integer DELTA = 8
endglobals
private function FilterPieces takes nothing returns boolean
if GetItemTypeId(GetFilterItem())==PIECEID then
call RemoveItem(GetFilterItem())
endif
return true
endfunction
private function PieceFind takes nothing returns boolean
local unit hero = GetTriggerUnit()
local item piece = GetManipulatedItem()
local integer pieceId = GetItemTypeId(piece)
local player owner = GetOwningPlayer(hero)
if pieceId == PIECEID then
set CreepsSubKill = CreepsSubKill + 1
set CreepsKill = CreepsKill + 1
set QuestEta[IDQ] = I2S(CreepsKill) + "/"+I2S(CreepsRequiredKill)+" equipement pieces found"
call UpdateQuestMbOnly(IDQ)
if CreepsSubKill == DELTA then
call UpdateQuest(IDQ)
set CreepsSubKill = 0
endif
if CreepsKill >= CreepsRequiredKill then
call EndQuest(IDQ,true)
call EnumItemsInRect(bj_mapInitialPlayableArea,Filter(function FilterPieces),null)
call DestroyQuestTrigger(IDQ,0)
set RandomQuest = GetRandomInt(1,4)
if RandomQuest == 1 then
call StartQ19()
elseif RandomQuest == 2 then
call StartQ20()
elseif RandomQuest == 3 then
call StartQ21()
elseif RandomQuest == 4 then
call StartQ22()
endif
endif
endif
set hero = null
set piece = null
return false
endfunction
private struct s_fail
integer i
endstruct
private function Update takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_fail dat = GetTimerData(t)
if dat.i < FAIL_DURATION then
set dat.i = dat.i + 1
else
call ReleaseTimer(t)
call dat.destroy()
if CreepsKill < CreepsRequiredKill then
call EndQuest(IDQ,false)
set RandomQuest = GetRandomInt(1,4)
if RandomQuest == 1 then
call StartQ19()
elseif RandomQuest == 2 then
call StartQ20()
elseif RandomQuest == 3 then
call StartQ21()
elseif RandomQuest == 4 then
call StartQ22()
endif
endif
call EnumItemsInRect(bj_mapInitialPlayableArea,Filter(function FilterPieces),null)
call DestroyQuestTrigger(IDQ,0)
endif
endfunction
private function StartFailTimer takes nothing returns nothing
local timer t = NewTimer()
local s_fail dat = s_fail.create()
set dat.i = 0
call SetTimerData(t,dat)
call TimerStart(t,1.,true,function Update)
endfunction
private function Run takes nothing returns nothing
local integer i = 0
local real x = 0.
local real y = 0.
call StartFailTimer()
set GeneralTarget = null
call ReleaseTimer(GetExpiredTimer())
loop
exitwhen i > PIECEMAX*PlayerAmount
set x = GetRandomReal(GetRectMinX(gg_rct_PieceToFind),GetRectMaxX(gg_rct_PieceToFind))
set y = GetRandomReal(GetRectMinY(gg_rct_PieceToFind),GetRectMaxY(gg_rct_PieceToFind))
call CreateItem(PIECEID,x,y)
call PingQuest(x,y,0.,0.5)
set i = i + 1
endloop
set CreepsSubKill = 0
set CreepsKill= 0
set CreepsRequiredKill = PIECEREQ*PlayerAmount
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(QuestTrig[IDQ][0], EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function PieceFind ) )
endfunction
function StartQ18 takes nothing returns nothing
local timer t = NewTimer()
local integer i = 0
loop
exitwhen i > 3
call AlliedAddUnitToPatrolGroup(AlliedId[GetRandomInt(0,AlliedIdMax)],GROUPID)
call AlliedAddUnitToTowerGroup(AlliedId[GetRandomInt(0,AlliedIdMax)],GROUPID)
set i = i + 1
endloop
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
endlibrary
//TESH.scrollpos=23
//TESH.alwaysfold=0
library q48 needs qsys, TimerUtils, AlliedSpawnSystem, GroupUtils, q44,q45,q46,q47
globals
private constant integer IDQ = 48
private constant integer REQ_BASE = 500 //Per Player
private constant integer REQ_PLAYER = 10 //Per Player
private constant integer DELTA = 100 //each delta update the quest
endglobals
private function AlliedDeath takes nothing returns boolean
call DisplayAll("Control", "Fine. No one will be able to help us for a while...")
call EndQuest(IDQ,false)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
set RandomQuest = GetRandomInt(1,4)
if RandomQuest == 1 then
call StartQ44()
elseif RandomQuest == 2 then
call StartQ45()
elseif RandomQuest == 3 then
call StartQ46()
elseif RandomQuest == 4 then
call StartQ47()
endif
return false
endfunction
private function EnemyDeath takes nothing returns boolean
if QuestBoolean[IDQ]==true then
set CreepsSubKill = CreepsSubKill + 1
set CreepsKill = CreepsKill + 1
set QuestEta[IDQ] = I2S(R2I(100*CreepsKill/CreepsRequiredKill)) + "% targets down"
call UpdateQuestMbOnly(IDQ)
if CreepsSubKill == DELTA then
call UpdateQuest(IDQ)
set CreepsSubKill = 0
endif
if CreepsKill >= CreepsRequiredKill then
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
set RandomQuest = GetRandomInt(1,4)
if RandomQuest == 1 then
call StartQ44()
elseif RandomQuest == 2 then
call StartQ45()
elseif RandomQuest == 3 then
call StartQ46()
elseif RandomQuest == 4 then
call StartQ47()
endif
endif
endif
return false
endfunction
private function Run takes nothing returns nothing
call ReleaseTimer(GetExpiredTimer())
set Building = BarrackBunker
call SetUnitInvulnerable(Building,false)
call SetUnitOwner(Building,Player(ALLIEDID),true)
set GeneralTarget = Building
call PingQuest(GetUnitX(Building),GetUnitY(Building),10.,30.)
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(11),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(13),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(14),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function EnemyDeath ) )
set QuestTrig[IDQ][1] = CreateTrigger()
call TriggerRegisterUnitEvent(QuestTrig[IDQ][1],Building,EVENT_UNIT_DEATH)
call TriggerAddCondition(QuestTrig[IDQ][1], Condition( function AlliedDeath ) )
endfunction
function StartQ48 takes nothing returns nothing
local timer t = NewTimer()
set CreepsRequiredKill = REQ_BASE+REQ_PLAYER*PlayerAmount
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
endlibrary
//TESH.scrollpos=3
//TESH.alwaysfold=0
library q49 needs qsys, TimerUtils, AlliedSpawnSystem, GroupUtils, q44,q45,q46,q47
globals
private constant integer IDQ = 49
private constant integer REQ_BASE = 500 //Per Player
private constant integer REQ_PLAYER = 10 //Per Player
private constant integer DELTA = 100 //each delta update the quest
endglobals
private function AlliedDeath takes nothing returns boolean
call DisplayAll("Control", "We are receiving reports from the Restricted Complex...")
call EndQuest(IDQ,false)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
set RandomQuest = GetRandomInt(1,4)
if RandomQuest == 1 then
call StartQ44()
elseif RandomQuest == 2 then
call StartQ45()
elseif RandomQuest == 3 then
call StartQ46()
elseif RandomQuest == 4 then
call StartQ47()
endif
return false
endfunction
private function EnemyDeath takes nothing returns boolean
if QuestBoolean[IDQ]==true then
set CreepsSubKill = CreepsSubKill + 1
set CreepsKill = CreepsKill + 1
set QuestEta[IDQ] = I2S(R2I(100*CreepsKill/CreepsRequiredKill)) + "% targets down"
call UpdateQuestMbOnly(IDQ)
if CreepsSubKill == DELTA then
call UpdateQuest(IDQ)
set CreepsSubKill = 0
endif
if CreepsKill >= CreepsRequiredKill then
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
set RandomQuest = GetRandomInt(1,4)
if RandomQuest == 1 then
call StartQ44()
elseif RandomQuest == 2 then
call StartQ45()
elseif RandomQuest == 3 then
call StartQ46()
elseif RandomQuest == 4 then
call StartQ47()
endif
endif
endif
return false
endfunction
private function Run takes nothing returns nothing
call ReleaseTimer(GetExpiredTimer())
set Building = EntranceGenerator
call SetUnitInvulnerable(Building,false)
call SetUnitOwner(Building,Player(ALLIEDID),true)
set GeneralTarget = Building
call PingQuest(GetUnitX(Building),GetUnitY(Building),10.,30.)
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(11),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(13),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(14),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function EnemyDeath ) )
set QuestTrig[IDQ][1] = CreateTrigger()
call TriggerRegisterUnitEvent(QuestTrig[IDQ][1],Building,EVENT_UNIT_DEATH)
call TriggerAddCondition(QuestTrig[IDQ][1], Condition( function AlliedDeath ) )
endfunction
function StartQ49 takes nothing returns nothing
local timer t = NewTimer()
set CreepsRequiredKill = REQ_BASE+REQ_PLAYER*PlayerAmount
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library q19 initializer init needs qsys ,q23,HeroDeath, TimerUtils, AlliedSpawnSystem, GroupUtils,IndieSummons
globals
private constant integer IDQ = 19
private constant integer PLANE_ID = 'n00J'
private constant integer PLANEMAX = 2
private constant integer PLANE_SPELL = 'A08S'
private constant string PLANE_ORDER = "impale"
private constant integer PLANE_STOP = 'n00M'
private constant integer PLANE_MOVE = 'n003'
private boolean SpawnFinished = false
private constant real TIMEOUT_ACTIVATE = 20.
private constant real DELAY = 15.
private constant integer SPEED = 75
endglobals
private function AlliedDeath takes nothing returns boolean
set VillagerKill = VillagerKill + 1
set QuestEta[IDQ] = I2S(VillagerKill) + "/"+I2S(PLANEMAX+1)+" planes destroyed"
call UpdateQuest(IDQ)
set QuestRank[IDQ]=QuestRank[IDQ] - 15
if PLANEMAX+1-(VillagerKill+CreepsKill) == 0 then
if PLANEMAX+1 <= VillagerKill then
call EndQuest(IDQ,false)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call StartQ23()
else
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call AddUnitToAssautGroup('n00Z',13000.,-13000.)
call AddUnitToAssautGroup('n00Z',13000.,-13000.)
call AddUnitToAssautGroup('n00Z',13000.,-13000.)
call AddUnitToAssautGroup('n00Z',13000.,-13000.)
call StartQ23()
endif
endif
return false
endfunction
private function LastPlane takes nothing returns nothing
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call StartQ23()
endfunction
private struct s_move
unit plane
real angle
integer distance
integer i
endstruct
private function UpdateMove takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_move dat = GetTimerData(t)
local real newX = GetUnitX(dat.plane) + SPEED*Cos(dat.angle)
local real newY = GetUnitY(dat.plane) + SPEED*Sin(dat.angle)
if dat.i < dat.distance then
set dat.i = dat.i + 1
call SetUnitX(dat.plane, newX)
call SetUnitY(dat.plane, newY)
else
set CreepsKill = CreepsKill + 1
if SpawnFinished==true then
call LastPlane()
endif
call RemoveUnit(dat.plane)
call DisplayAll("Pilot","See you soon.")
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function StartFly takes unit plane returns nothing
local timer t = NewTimer()
local s_move dat = s_move.create()
local real x = GetUnitX(plane)
local real y = GetUnitY(plane)
local real facing = GetUnitFacing(plane)
local real x1 = GetUnitX(plane)
local real y1 = GetUnitY(plane)
local real x2 = GetRectCenterX(gg_rct_PlaneMove2)
local real y2 = GetRectCenterY(gg_rct_PlaneMove2)
set dat.angle = Atan2((y2 -y1), (x2 - x1))
set dat.distance =R2I(SquareRoot((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1))/SPEED)
set dat.i = 0
call RemoveUnit(plane)
set dat.plane = CreateUnit(Player(ALLIEDID),PLANE_MOVE,x,y,facing)
call SetUnitFacing(dat.plane,dat.angle*bj_RADTODEG)
call SetUnitPathing(dat.plane,false)
call SetTimerData(t, dat)
call TimerStart (t, TIMEOUT, true, function UpdateMove)
call FlySound()
endfunction
private struct s_delay
unit plane
endstruct
private function Wait takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_delay dat = GetTimerData(t)
call StartFly(dat.plane)
call DisplayAll("Pilot","There we go!")
call ReleaseTimer(t)
call dat.destroy()
endfunction
private function PlaneReady takes nothing returns nothing
local timer t = NewTimer()
local s_delay dat = s_delay.create()
local real x = GetUnitX(SpellEvent.CastingUnit)
local real y = GetUnitY(SpellEvent.CastingUnit)
local real facing = GetUnitFacing(SpellEvent.CastingUnit)
call DisplayAll("Pilot","Checking the commands")
call RemoveUnit(SpellEvent.CastingUnit)
set dat.plane = CreateUnit(Player(ALLIEDID),PLANE_STOP,x,y,facing)
call TriggerRegisterUnitEvent(QuestTrig[IDQ][0],dat.plane, EVENT_UNIT_DEATH )
call SetTimerData(t,dat)
call TimerStart(t,DELAY,false,function Wait)
endfunction
private struct s_plane
integer i = 0
endstruct
private function SpawnPilot takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_plane dat = GetTimerData(t)
local real x = 0.
local real y = 0.
local real facing = 0.
local unit plane = null
if dat.i < PLANEMAX+1 then
set dat.i = dat.i + 1
set facing = GetUnitFacing(AirfieldPlane[dat.i-1])
set x = GetUnitX(AirfieldPlane[dat.i-1])
set y = GetUnitY(AirfieldPlane[dat.i-1])
call DisplayAll("Pilot","On my way, hold them a bit more!")
call RemoveUnit(AirfieldPlane[dat.i-1])
set plane = CreateUnit(Player(ALLIEDID),PLANE_MOVE,x,y,facing)
call TriggerRegisterUnitEvent(QuestTrig[IDQ][0],plane, EVENT_UNIT_DEATH )
call UnitAddAbility(plane,PLANE_SPELL)
call IssuePointOrder(plane,PLANE_ORDER,GetRectCenterX(gg_rct_PlaneMove1),GetRectCenterY(gg_rct_PlaneMove1))
else
set SpawnFinished = true
call ReleaseTimer(t)
call dat.destroy()
endif
set plane = null
endfunction
private function StartSpawnPilot takes nothing returns nothing
local timer t = NewTimer()
local s_plane dat = s_plane.create()
call DisplayAll("Control","First plane launched in: "+I2S(R2I(TIMEOUT_ACTIVATE))+" seconds")
set dat.i = 0
call SetTimerData(t,dat)
call TimerStart(t,TIMEOUT_ACTIVATE,true,function SpawnPilot)
endfunction
private function Run takes nothing returns nothing
local integer i = 0
local unit escort
set VillagerKill = 0
set CreepsKill = 0
set SpawnFinished = false
set GeneralTarget = AirfieldGenerator
call ReleaseTimer(GetExpiredTimer())
set QuestTrig[IDQ][0] = CreateTrigger()
loop
exitwhen i > PLANEMAX
call UnitAddAbility(AirfieldPlane[i],QUESTUNIT)
call SetUnitOwner(AirfieldPlane[i],Player(ALLIEDID),true)
call SetUnitInvulnerable(AirfieldPlane[i],false)
call PingQuest(GetUnitX(AirfieldPlane[i]),GetUnitY(AirfieldPlane[i]),10.,30.)
call TriggerRegisterUnitEvent(QuestTrig[IDQ][0],AirfieldPlane[i], EVENT_UNIT_DEATH )
set escort = CreateUnit(Player(ALLIEDID),AlliedId[GetRandomInt(0,AlliedIdMax)],GetUnitX(AirfieldPlane[i]),GetUnitY(AirfieldPlane[i]),0.)
call IndieSummon_SetMaster(escort,AirfieldPlane[i])
call UnitAddAbility(escort,QUESTUNIT)
set i = i + 1
endloop
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function AlliedDeath ) )
call StartSpawnPilot()
set SpawnFinished = false
set escort = null
endfunction
function StartQ19 takes nothing returns nothing
local timer t = NewTimer()
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
private function init takes nothing returns nothing
set SpawnFinished = false
call AbilityPreload(PLANE_SPELL)
call RegisterSpellFinishResponse(PLANE_SPELL, PlaneReady)
endfunction
endlibrary
//TESH.scrollpos=75
//TESH.alwaysfold=0
library q20 needs qsys, TimerUtils, q23, AlliedSpawnSystem, GroupUtils,IndieSummons
globals
private constant integer IDQ = 20
private constant integer REQ_BASE = 600 //Per Player
private constant integer REQ_PLAYER = 10 //Per Player
private constant integer DELTA = 100 //each delta update the quest
private constant integer AMOUNT = 8
private constant string FX = "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportCaster.mdl"
private constant integer UNIT_ID = 'h00A'
endglobals
private function AlliedDeath takes nothing returns boolean
local unit allied = GetTriggerUnit()
if IsUnitInGroup(allied,VillagerGroup) then
set VillagerKill = VillagerKill + 1
call GroupRemoveUnit(VillagerGroup,allied)
set GeneralTarget = FirstOfGroup(VillagerGroup)
set VillagerAlive = 0
call ForGroup(VillagerGroup,function CountAliveAllied)
set QuestEta[IDQ] = I2S(VillagerKill) + "/"+I2S(VillagerAll)+" engineers killed"
call UpdateQuest(IDQ)
if VillagerAlive == 0 then
call ReleaseGroup(VillagerGroup)
call EndQuest(IDQ,false)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call StartQ23()
endif
endif
set allied = null
return false
endfunction
private function EnemyDeath takes nothing returns boolean
if QuestBoolean[IDQ]==true then
set CreepsSubKill = CreepsSubKill + 1
set CreepsKill = CreepsKill + 1
set QuestEta[IDQ] = I2S(R2I(100*CreepsKill/CreepsRequiredKill)) + "% targets down"
call UpdateQuestMbOnly(IDQ)
if CreepsSubKill == DELTA then
call UpdateQuest(IDQ)
set CreepsSubKill = 0
endif
if CreepsKill >= CreepsRequiredKill then
call ReleaseGroup(VillagerGroup)
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call SetUnitInvulnerable(AirfieldChopper,false)
call UnitRemoveAbility(AirfieldChopper,GARN)
call AddUnitAnimationProperties(AirfieldChopper, "Alternate", false)
call SetUnitFlyHeight(AirfieldChopper, 400., 300.)
call SwitchUnitToAssautGroup(AirfieldChopper)
call AddUnitToAssautGroup('n00C',13000.,-13000.)
call AddUnitToAssautGroup('n00C',13000.,-13000.)
call StartQ23()
endif
endif
return false
endfunction
private function Run takes nothing returns nothing
local integer i = 0
local unit spawned = null
local unit escort = null
local real x = 0.
local real y = 0.
call ReleaseTimer(GetExpiredTimer())
set VillagerGroup = NewGroup()
loop
exitwhen i > AMOUNT - 1
set x = GetRandomReal(GetRectMinX(gg_rct_ChopperSpawn),GetRectMaxX(gg_rct_ChopperSpawn))
set y = GetRandomReal(GetRectMinY(gg_rct_ChopperSpawn),GetRectMaxY(gg_rct_ChopperSpawn))
call DestroyEffect(AddSpecialEffect(FX,x,y))
set spawned = CreateUnit(Player(ALLIEDID),UNIT_ID,x,y,0.)
call GroupAddUnit(VillagerGroup,spawned)
call UnitAddAbility(spawned,QUESTUNIT)
set escort = CreateUnit(Player(ALLIEDID),AlliedId[GetRandomInt(0,AlliedIdMax)],GetRectCenterX(gg_rct_ChopperSpawn)+GetRandomReal(-50.,50),GetRectCenterY(gg_rct_ChopperSpawn)+GetRandomReal(-50.,50),0.)
call IndieSummon_SetMaster(escort,AirfieldPlane[i])
call UnitAddAbility(escort,QUESTUNIT)
set i = i + 1
endloop
call ForGroup(VillagerGroup,function CountAllAllied)
set GeneralTarget = AirfieldChopper
set CreepsRequiredKill = REQ_BASE+REQ_PLAYER*PlayerAmount
call PingQuest(GetRectCenterX(gg_rct_ChopperSpawn),GetRectCenterY(gg_rct_ChopperSpawn),5.,15.)
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(11),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(13),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(14),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function EnemyDeath ) )
set QuestTrig[IDQ][1] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][1],Player(ALLIEDID),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(QuestTrig[IDQ][1], Condition( function AlliedDeath) )
set spawned = null
set escort = null
endfunction
function StartQ20 takes nothing returns nothing
local timer t = NewTimer()
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
endlibrary
//TESH.scrollpos=38
//TESH.alwaysfold=0
library q21 needs qsys,q23, TimerUtils, AlliedSpawnSystem, GroupUtils,IndieSummons
globals
private constant integer IDQ = 21
private constant integer REQ_BASE = 600 //Per Player
private constant integer REQ_PLAYER = 10 //Per Player
private constant integer DELTA = 250 //each delta update the quest
endglobals
private function AlliedDeath takes nothing returns boolean
call DisplayAll("Control", "Good job on defence... Generator is destroyed.")
call EndQuest(IDQ,false)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call StartQ23()
return false
endfunction
private function EnemyDeath takes nothing returns boolean
local integer i = 0
if QuestBoolean[IDQ]==true then
set CreepsSubKill = CreepsSubKill + 1
set CreepsKill = CreepsKill + 1
set QuestEta[IDQ] = I2S(R2I(100*CreepsKill/CreepsRequiredKill)) + "% targets down"
call UpdateQuestMbOnly(IDQ)
if CreepsSubKill == DELTA then
call UpdateQuest(IDQ)
set CreepsSubKill = 0
endif
if CreepsKill >= CreepsRequiredKill then
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call StartQ23()
loop
exitwhen i > 9
call AddUnitToAssautGroup('h00U',680.,-4300.)
set i = i + 1
endloop
endif
endif
return false
endfunction
private function Run takes nothing returns nothing
local integer i = 0
local unit escort = null
call ReleaseTimer(GetExpiredTimer())
set Building = AirfieldGenerator
call SetUnitInvulnerable(Building,false)
call SetUnitOwner(Building,Player(ALLIEDID),true)
set GeneralTarget = Building
call PingQuest(GetUnitX(Building),GetUnitY(Building),10.,30.)
loop
exitwhen i > 3
set escort = CreateUnit(Player(ALLIEDID),AlliedId[GetRandomInt(0,AlliedIdMax)],GetUnitX(Building)+GetRandomReal(-50.,50),GetUnitY(Building)+GetRandomReal(-50.,50),0.)
call IndieSummon_SetMaster(escort,Building)
call UnitAddAbility(escort,QUESTUNIT)
set i = i + 1
endloop
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(11),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(13),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(14),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function EnemyDeath ) )
set QuestTrig[IDQ][1] = CreateTrigger()
call TriggerRegisterUnitEvent(QuestTrig[IDQ][1],Building,EVENT_UNIT_DEATH)
call TriggerAddCondition(QuestTrig[IDQ][1], Condition( function AlliedDeath ) )
set escort = null
endfunction
function StartQ21 takes nothing returns nothing
local timer t = NewTimer()
set CreepsRequiredKill = REQ_BASE+REQ_PLAYER*PlayerAmount
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
endlibrary
//TESH.scrollpos=38
//TESH.alwaysfold=0
library q22 needs qsys,q23, TimerUtils, AlliedSpawnSystem, GroupUtils,IndieSummons
globals
private constant integer IDQ = 22
private constant integer REQ_BASE = 600 //Per Player
private constant integer REQ_PLAYER = 10 //Per Player
private constant integer DELTA = 250 //each delta update the quest
endglobals
private function AlliedDeath takes nothing returns boolean
call DisplayAll("Control", "Good job on defence... Generator is destroyed.")
call EndQuest(IDQ,false)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call StartQ23()
return false
endfunction
private function EnemyDeath takes nothing returns boolean
local integer i = 0
if QuestBoolean[IDQ]==true then
set CreepsSubKill = CreepsSubKill + 1
set CreepsKill = CreepsKill + 1
set QuestEta[IDQ] = I2S(R2I(100*CreepsKill/CreepsRequiredKill)) + "% targets down"
call UpdateQuestMbOnly(IDQ)
if CreepsSubKill == DELTA then
call UpdateQuest(IDQ)
set CreepsSubKill = 0
endif
if CreepsKill >= CreepsRequiredKill then
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call StartQ23()
loop
exitwhen i > 19
call AddUnitToAssautGroup('h004',680.,-4300.)
set i = i + 1
endloop
endif
endif
return false
endfunction
private function Run takes nothing returns nothing
local integer i = 0
local unit escort = null
call ReleaseTimer(GetExpiredTimer())
set Building = AirfieldGenerator
call SetUnitInvulnerable(Building,false)
set GeneralTarget = Building
call SetUnitOwner(Building,Player(ALLIEDID),true)
call PingQuest(GetUnitX(Building),GetUnitY(Building),10.,30.)
loop
exitwhen i > 3
set escort = CreateUnit(Player(ALLIEDID),AlliedId[GetRandomInt(0,AlliedIdMax)],GetUnitX(Building)+GetRandomReal(-50.,50),GetUnitY(Building)+GetRandomReal(-50.,50),0.)
call IndieSummon_SetMaster(escort,Building)
call UnitAddAbility(escort,QUESTUNIT)
set i = i + 1
endloop
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(11),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(13),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(14),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function EnemyDeath ) )
set QuestTrig[IDQ][1] = CreateTrigger()
call TriggerRegisterUnitEvent(QuestTrig[IDQ][1],Building,EVENT_UNIT_DEATH)
call TriggerAddCondition(QuestTrig[IDQ][1], Condition( function AlliedDeath ) )
set escort = null
endfunction
function StartQ22 takes nothing returns nothing
local timer t = NewTimer()
set CreepsRequiredKill = REQ_BASE+REQ_PLAYER*PlayerAmount
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library q44 needs qsys, TimerUtils, q23, AlliedSpawnSystem, GroupUtils,IndieSummons
globals
private constant integer IDQ = 44
private constant integer REQ_BASE = 500 //Per Player
private constant integer REQ_PLAYER = 10 //Per Player
private constant integer DELTA = 100 //each delta update the quest
private constant integer AMOUNT = 4
private constant integer UNIT_ID = 'h01N'
endglobals
private function AlliedDeath takes nothing returns boolean
local unit allied = GetTriggerUnit()
if IsUnitInGroup(allied,VillagerGroup) then
set VillagerKill = VillagerKill + 1
call GroupRemoveUnit(VillagerGroup,allied)
set GeneralTarget = FirstOfGroup(VillagerGroup)
set VillagerAlive = 0
call ForGroup(VillagerGroup,function CountAliveAllied)
set QuestEta[IDQ] = I2S(VillagerKill) + "/"+I2S(VillagerAll)+" bradley destroyed"
call UpdateQuest(IDQ)
if VillagerAlive == 0 then
call ReleaseGroup(VillagerGroup)
call EndQuest(IDQ,false)
call StartQ23()
endif
endif
set allied = null
return false
endfunction
private function Switch takes nothing returns nothing
call SwitchUnitToAssautGroup(GetEnumUnit())
endfunction
private function EnemyDeath takes nothing returns boolean
if QuestBoolean[IDQ]==true then
set CreepsSubKill = CreepsSubKill + 1
set CreepsKill = CreepsKill + 1
set QuestEta[IDQ] = I2S(R2I(100*CreepsKill/CreepsRequiredKill)) + "% targets down"
call UpdateQuestMbOnly(IDQ)
if CreepsSubKill == DELTA then
call UpdateQuest(IDQ)
set CreepsSubKill = 0
endif
if CreepsKill >= CreepsRequiredKill then
call ForGroup(VillagerGroup,function Switch)
call ReleaseGroup(VillagerGroup)
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call StartQ23()
call AddUnitToAssautGroup(UNIT_ID,680.,-4300.)
call AddUnitToAssautGroup(UNIT_ID,680.,-4300.)
endif
endif
return false
endfunction
private function Run takes nothing returns nothing
local integer i = 0
local unit spawned = null
local real x = 0.
local real y = 0.
call ReleaseTimer(GetExpiredTimer())
set VillagerGroup = NewGroup()
loop
exitwhen i > AMOUNT - 1
set x = GetRandomReal(GetRectMinX(gg_rct_Town),GetRectMaxX(gg_rct_Town))
set y = GetRandomReal(GetRectMinY(gg_rct_Town),GetRectMaxY(gg_rct_Town))
set spawned = CreateUnit(Player(ALLIEDID),UNIT_ID,x,y,0.)
call GroupAddUnit(VillagerGroup,spawned)
set i = i + 1
endloop
call ForGroup(VillagerGroup,function CountAllAllied)
set GeneralTarget = FirstOfGroup(VillagerGroup)
set CreepsRequiredKill = REQ_BASE+REQ_PLAYER*PlayerAmount
call PingQuest(GetRectCenterX(gg_rct_Town),GetRectCenterY(gg_rct_Town),10.,30.)
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(11),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(13),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(14),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function EnemyDeath ) )
set QuestTrig[IDQ][1] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][1],Player(ALLIEDID),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(QuestTrig[IDQ][1], Condition( function AlliedDeath) )
set spawned = null
endfunction
function StartQ44 takes nothing returns nothing
local timer t = NewTimer()
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library q45 needs qsys, TimerUtils, AlliedSpawnSystem, GroupUtils, q23,IndieSummons
globals
private constant integer IDQ = 45
private constant integer REQ_BASE = 500 //Per Player
private constant integer REQ_PLAYER = 10 //Per Player
private constant integer DELTA = 100 //each delta update the quest
private constant integer UNIT_ID = 'o036'
endglobals
private function AlliedDeath takes nothing returns boolean
call DisplayAll("Control", "Yeah, a chopper down. We have lost the reinforcements")
call EndQuest(IDQ,false)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call StartQ23()
return false
endfunction
private function EnemyDeath takes nothing returns boolean
local integer i = 0
if QuestBoolean[IDQ]==true then
set CreepsSubKill = CreepsSubKill + 1
set CreepsKill = CreepsKill + 1
set QuestEta[IDQ] = I2S(R2I(100*CreepsKill/CreepsRequiredKill)) + "% targets down"
call UpdateQuestMbOnly(IDQ)
if CreepsSubKill == DELTA then
call UpdateQuest(IDQ)
set CreepsSubKill = 0
endif
if CreepsKill >= CreepsRequiredKill then
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
loop
exitwhen i > 9
call AddUnitToAssautGroup('h00V',GetUnitX(Building),GetUnitY(Building))
set i = i + 1
endloop
call StartQ23()
endif
endif
return false
endfunction
private function Run takes nothing returns nothing
local integer i = 0
local unit escort = null
local real x = 0.
local real y = 0.
call ReleaseTimer(GetExpiredTimer())
set Building = CreateUnit(Player(ALLIEDID),UNIT_ID,GetRectCenterX(gg_rct_LostReinforcements),GetRectCenterY(gg_rct_LostReinforcements),0.)
set GeneralTarget = Building
loop
exitwhen i > 7
set x = GetRectCenterX(gg_rct_LostReinforcements)+GetRandomReal(-50.,50.)
set y = GetRectCenterY(gg_rct_LostReinforcements)+GetRandomReal(-50.,50.)
set escort = CreateUnit(Player(ALLIEDID),'h00U',x,y,0.)
call IndieSummon_SetMaster(escort,Building )
set i = i + 1
endloop
call PingQuest(GetRectCenterX(gg_rct_LostReinforcements),GetRectCenterY(gg_rct_LostReinforcements),10.,30.)
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(11),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(13),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(14),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function EnemyDeath ) )
set QuestTrig[IDQ][1] = CreateTrigger()
call TriggerRegisterUnitEvent(QuestTrig[IDQ][1],Building,EVENT_UNIT_DEATH)
call TriggerAddCondition(QuestTrig[IDQ][1], Condition( function AlliedDeath ) )
set escort = null
endfunction
function StartQ45 takes nothing returns nothing
local timer t = NewTimer()
set CreepsRequiredKill = REQ_BASE+REQ_PLAYER*PlayerAmount
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library q46 needs qsys,q23,AlliedSpawnSystem, HeroDeath,TimerUtils, TextDisplay, GroupUtils,IndieSummons, TimerUtils
globals
private constant integer IDQ = 46
private constant integer SOLDIER_ID = 'h01M'
private constant integer AMOUNT = 6
endglobals
private function AlliedDeath takes nothing returns boolean
local unit allied = GetTriggerUnit()
if IsUnitInGroup(allied,VillagerGroup) then
set VillagerKill = VillagerKill + 1
call GroupRemoveUnit(VillagerGroup,allied)
set GeneralTarget = FirstOfGroup(VillagerGroup)
set VillagerAlive = 0
call ForGroup(VillagerGroup,function CountAliveAllied)
set QuestEta[IDQ] = I2S(VillagerKill) + "/"+I2S(VillagerAll)+" soldiers killed"
call UpdateQuest(IDQ)
set QuestRank[IDQ] = QuestRank[IDQ] - 5
if VillagerAlive == 0 then
if VillagerAll <= VillagerKill then
call ReleaseGroup(VillagerGroup)
call EndQuest(IDQ,false)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call StartQ23()
else
call ReleaseGroup(VillagerGroup)
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call StartQ23()
call AddUnitToAssautGroup('h001',680.,-4300.)
call AddUnitToAssautGroup('h001',680.,-4300.)
call AddUnitToAssautGroup('h001',680.,-4300.)
call AddUnitToAssautGroup('h001',680.,-4300.)
endif
endif
endif
set allied = null
return false
endfunction
private function ArrivedToEnd takes nothing returns boolean
local unit convoyUnit = GetTriggerUnit()
if IsUnitInGroup(convoyUnit,VillagerGroup) then
call GroupRemoveUnit(VillagerGroup,convoyUnit)
set GeneralTarget = FirstOfGroup(VillagerGroup)
call EraseUnit(convoyUnit)
set VillagerAlive = 0
set CurrentLastWayPointArrivedUnit = CurrentLastWayPointArrivedUnit + 1
call ForGroup(VillagerGroup,function CountAliveAllied)
set QuestEta[IDQ] = I2S(CurrentLastWayPointArrivedUnit) + "/"+I2S(VillagerAll)+" soldiers teleported"
call UpdateQuest(IDQ)
if VillagerAlive==0 then
call ReleaseGroup(VillagerGroup)
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call StartQ23()
endif
endif
set convoyUnit = null
return false
endfunction
private function Run takes nothing returns nothing
local integer i = 0
local real x = 0.
local real y = 0.
local unit spawned = null
call ReleaseTimer(GetExpiredTimer())
call PingQuest(GetRectCenterX(gg_rct_SquadRescueStart),GetRectCenterY(gg_rct_SquadRescueStart),10.,30.)
set ConvoyRect[1] = gg_rct_SquadRescueDestination
set CurrentWayPoint = 1
set CurrentLastWayPoint = 1
set CurrentRect = ConvoyRect[1]
set VillagerGroup = NewGroup()
loop
exitwhen i > AMOUNT
set x = GetRandomReal(GetRectMinX(gg_rct_SquadRescueStart),GetRectMaxX(gg_rct_SquadRescueStart))
set y = GetRandomReal(GetRectMinY(gg_rct_SquadRescueStart),GetRectMaxY(gg_rct_SquadRescueStart))
set spawned = CreateUnit(Player(ALLIEDID),SOLDIER_ID,x,y,0.)
set x = GetRandomReal(GetRectMinX(CurrentRect),GetRectMaxX(CurrentRect))
set y = GetRandomReal(GetRectMinY(CurrentRect),GetRectMaxY(CurrentRect))
call UnitAddAbility(spawned,QUESTUNIT)
call UnitAddAbility(spawned,MOVE_SPELL)
call GroupAddUnit(VillagerGroup,spawned)
call IssuePointOrder(spawned,MOVE_ORDER,x,y)
set i = i + 1
endloop
call PingQuest(GetRectCenterX(CurrentRect),GetRectCenterY(CurrentRect),10.,30.)
set GeneralTarget = FirstOfGroup(VillagerGroup)
call ForGroup(VillagerGroup,function CountAllAllied)
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(10),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function AlliedDeath ) )
set QuestTrig[IDQ][1] = CreateTrigger()
call TriggerRegisterEnterRectSimple(QuestTrig[IDQ][1], ConvoyRect[CurrentLastWayPoint])
call TriggerAddCondition(QuestTrig[IDQ][1], Condition(function ArrivedToEnd))
set spawned = null
endfunction
function StartQ46 takes nothing returns nothing
local timer t = NewTimer()
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library q47 needs qsys, TimerUtils, AlliedSpawnSystem, GroupUtils, q23
globals
private constant integer IDQ = 47
private constant integer REQ_BASE = 500 //Per Player
private constant integer REQ_PLAYER = 10 //Per Player
private constant integer DELTA = 100 //each delta update the quest
private constant integer UNIT_ID = 'h01Q'
endglobals
private function AlliedDeath takes nothing returns boolean
call DisplayAll("Control", "Crap. The Hurricane has been destroyed")
call EndQuest(IDQ,false)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call StartQ23()
return false
endfunction
private function EnemyDeath takes nothing returns boolean
if QuestBoolean[IDQ]==true then
set CreepsSubKill = CreepsSubKill + 1
set CreepsKill = CreepsKill + 1
set QuestEta[IDQ] = I2S(R2I(100*CreepsKill/CreepsRequiredKill)) + "% targets down"
call UpdateQuestMbOnly(IDQ)
if CreepsSubKill == DELTA then
call UpdateQuest(IDQ)
set CreepsSubKill = 0
endif
if CreepsKill >= CreepsRequiredKill then
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call UnitRemoveAbility(Building,AWAN)
call SwitchUnitToAssautGroup(Building)
call AddUnitToAssautGroup(UNIT_ID,680.,-4300.)
call AddUnitToAssautGroup(UNIT_ID,680.,-4300.)
call StartQ23()
endif
endif
return false
endfunction
private function Run takes nothing returns nothing
call ReleaseTimer(GetExpiredTimer())
set Building = CreateUnit(Player(ALLIEDID),UNIT_ID,GetRectCenterX(gg_rct_Entrance),GetRectCenterY(gg_rct_Entrance),0.)
call UnitAddAbility(Building,AWAN)
call IssuePointOrder(Building,"attack",GetRectCenterX(gg_rct_AirField),GetRectCenterY(gg_rct_AirField))
set GeneralTarget = Building
call PingQuest(GetUnitX(Building),GetUnitY(Building),10.,30.)
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(11),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(13),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(14),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function EnemyDeath ) )
set QuestTrig[IDQ][1] = CreateTrigger()
call TriggerRegisterUnitEvent(QuestTrig[IDQ][1],Building,EVENT_UNIT_DEATH)
call TriggerAddCondition(QuestTrig[IDQ][1], Condition( function AlliedDeath ) )
endfunction
function StartQ47 takes nothing returns nothing
local timer t = NewTimer()
set CreepsRequiredKill = REQ_BASE+REQ_PLAYER*PlayerAmount
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
endlibrary
//TESH.scrollpos=63
//TESH.alwaysfold=0
library q23 initializer init needs qsys, TimerUtils, AlliedSpawnSystem, GroupUtils,GameEndSuccess, SpawnSystem, TextDisplay,CheckPointValidity
globals
private constant integer IDQ = 23
private constant integer GROUPID = 2
private constant integer UNIT_ID = 'o037'
private constant real RANDOMSPAWN_DISTANCEMIN = 2000.
private constant real RANDOMSPAWN_DISTANCEMAX = 4000.
private constant integer BOSS_ID = 'u00G'
private integer array BossId1 [4]
private integer array BossId2 [4]
private integer array BossId3 [8]
private integer Boss1Max
private integer Boss2Max
private integer Boss3Max
endglobals
private function BossDeath takes nothing returns boolean
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call GameEndSuccess(300,"|c00AFAAFF That was not so easy. It seems you are not so stupid, Marines.|r")
return false
endfunction
private function BossEnd takes nothing returns nothing
local unit boss = CreateUnit(Player(11),BOSS_ID,GetRandomReal(MapXMin,MapXMax),GetRandomReal(MapYMin,MapYMax),0.)
call BossSound()
call SpawnCreeps(BossId3[GetRandomInt(0,Boss3Max)],11,GetRandomReal(MapXMin,MapXMax),GetRandomReal(MapYMin,MapYMax))
call SpawnCreeps(BossId3[GetRandomInt(0,Boss3Max)],11,GetRandomReal(MapXMin,MapXMax),GetRandomReal(MapYMin,MapYMax))
set GeneralTarget = null
call IssuePointOrder(boss,"patrol",GetRectCenterX(gg_rct_ShipFacilities),GetRectCenterY(gg_rct_ShipFacilities))
call ReleaseTimer(GetExpiredTimer())
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterUnitEvent(QuestTrig[IDQ][0],boss, EVENT_UNIT_DEATH )
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function BossDeath ) )
set boss = null
endfunction
private function AlliedDeath takes nothing returns boolean
call DisplayAll("Control", "Epic fail. The impulsion generator is destroyed. Nothing will be able to kill those zombies.")
call EndQuest(IDQ,false)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
return false
endfunction
private function SpawnRandomBoss takes integer bossId returns nothing
local real distance = GetRandomReal(RANDOMSPAWN_DISTANCEMIN,RANDOMSPAWN_DISTANCEMAX)
local real angle = GetRandomReal(0,6.28)
local real x = CheckPointValidity(GetUnitX(Building)+distance*Cos(angle),MapXMin,MapXMax)
local real y = CheckPointValidity(GetUnitY(Building)+distance*Sin(angle),MapYMin,MapYMax)
call SpawnCreeps(bossId,13,x,y)
endfunction
private function Boss3 takes nothing returns nothing
local timer t = GetExpiredTimer()
call ReleaseTimer(t)
call SpawnRandomBoss(BossId3[GetRandomInt(0,Boss3Max)])
call SpawnRandomBoss(BossId3[GetRandomInt(0,Boss3Max)])
set t = NewTimer()
call TimerStart (t, 120., false, function BossEnd)
endfunction
private function Boss2 takes nothing returns nothing
local timer t = GetExpiredTimer()
call ReleaseTimer(t)
call SpawnRandomBoss(BossId2[GetRandomInt(0,Boss2Max)])
call SpawnRandomBoss(BossId2[GetRandomInt(0,Boss2Max)])
set t = NewTimer()
call TimerStart (t, 120., false, function Boss3)
endfunction
private function Boss1 takes nothing returns nothing
local timer t = GetExpiredTimer()
call ReleaseTimer(t)
call SpawnRandomBoss(BossId1[GetRandomInt(0,Boss1Max)])
call SpawnRandomBoss(BossId1[GetRandomInt(0,Boss1Max)])
set t = NewTimer()
call TimerStart (t, 120., false, function Boss2)
endfunction
private function UpdateCreeps takes nothing returns nothing
local timer t = GetExpiredTimer()
call ReleaseTimer(t)
call CreepsResetSpawn()
set SpawnTrue[49] = true
set SpawnTrue[50] = true
set SpawnTrue[51] = true
set SpawnTrue[52] = true
set t = NewTimer()
call TimerStart (t, 120., false, function Boss1)
endfunction
private function Run takes nothing returns nothing
local integer i = 0
local unit escort = null
local real x = 0.
local real y = 0.
local timer t = GetExpiredTimer()
call ReleaseTimer(t)
set Building = CreateUnit(Player(ALLIEDID),UNIT_ID,GetRectCenterX(gg_rct_ExternalOutpost),GetRectCenterY(gg_rct_ExternalOutpost),0.)
set GeneralTarget = Building
call PingQuest(GetUnitX(Building),GetUnitY(Building),10.,30.)
set QuestTrig[IDQ][1] = CreateTrigger()
call TriggerRegisterUnitEvent(QuestTrig[IDQ][1],Building,EVENT_UNIT_DEATH)
call TriggerAddCondition(QuestTrig[IDQ][1], Condition( function AlliedDeath ) )
set t = NewTimer()
call TimerStart (t, 60., false, function UpdateCreeps)
endfunction
function StartQ23 takes nothing returns nothing
local timer t = NewTimer()
local integer i = 0
loop
exitwhen i > 7
call AlliedAddUnitToPatrolGroup(AlliedId[GetRandomInt(0,AlliedIdMax)],GROUPID)
call AlliedAddUnitToTowerGroup(AlliedId[GetRandomInt(0,AlliedIdMax)],GROUPID)
set i = i + 1
endloop
call CreepsKillAllNormal()
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
private function init takes nothing returns nothing
set BossId1[0] = 'u002'
set BossId1[1] = 'u012'
set BossId1[2] = 'u00A'
set BossId1[3] = 'u00U'
set Boss1Max = 3
set BossId2[0] = 'u00S'
set BossId2[1] = 'u01B'
set BossId2[2] = 'u00D'
set BossId2[3] = 'u000'
set Boss2Max = 3
set BossId3[0] = 'u01L'
set BossId3[1] = 'u000'
set BossId3[2] = 'u018'
set BossId3[3] = 'u01Q'
set BossId3[4] = 'u01I'
set BossId3[5] = 'u01P'
set BossId3[6] = 'u01S'
set BossId3[7] = 'u01O'
set Boss3Max = 7
endfunction
endlibrary
//TESH.scrollpos=1
//TESH.alwaysfold=0
library ChapterSurvival needs TimerUtils,q28, TextDisplay,ItemSpawn,ParasiteSpore
globals
private constant string MASK = "ReplaceableTextures\\CameraMasks\\Black_mask.blp"
endglobals
private struct str
integer i
endstruct
private function Wait takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
local integer i = 0
if dat.i < CHAPTER_WAIT+20 then
set dat.i = dat.i + 1
if dat.i == CHAPTER_WAIT+5 then
call MusicChapter()
elseif dat.i == CHAPTER_WAIT+10 then
loop
exitwhen i > MAXPLAYER
call DisplayTextToPlayer(Player(i),0.,0.,"|c00AFAAFF Survival Mode|r")
set i = i + 1
endloop
endif
else
call StartItemSpawn(6,10)
call DisplayAll("Control","This is over. We are surrounded by those things. Good luck there to survive. We...AAAAAAARGH")
call StartQ28()
set ChapterIntermission = false
call MusicOff()
call StartParasiteSpore()
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
function ChapterSurvival takes nothing returns nothing
local timer t = NewTimer()
local str dat = str.create()
set dat.i = 0
set ChapterIntermission = true
call SetTimerData(t,dat)
call TimerStart (t, 1., true, function Wait )
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library q28 needs qsys,q29, TimerUtils, SpawnSystem
globals
private constant integer IDQ = 28
private constant integer DURATION = 420
private constant integer BOSS1 = 'u002'
private constant integer BOSS2 = 'u000'
endglobals
private struct str
integer i = 0
endstruct
private function Update takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
if dat.i < DURATION then
set dat.i = dat.i + 1
set QuestEta[IDQ] = I2S(dat.i) + "/" + I2S(DURATION) +"seconds"
call UpdateQuestMbOnly(IDQ)
if dat.i == 60 or dat.i == 120 or dat.i == 180 or dat.i == 240 or dat.i == 360 then
set QuestEta[IDQ] = I2S(7-(R2I(dat.i/60))) + "/" + "minute(s) remaining"
call UpdateQuest(IDQ)
endif
else
if CreepsCheckHeroAmount() > 0 then
call EndQuest(IDQ,true)
else
call EndQuest(IDQ,false)
endif
call SpawnCreeps(BOSS1,11,GetRandomReal(MapXMin,MapXMax),GetRandomReal(MapYMin,MapYMax))
call SpawnCreeps(BOSS2,11,GetRandomReal(MapXMin,MapXMax),GetRandomReal(MapYMin,MapYMax))
call StartQ29()
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function Run takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = str.create()
call ReleaseTimer(t)
set t = NewTimer()
set dat.i = 0
call SetTimerData(t,dat)
call TimerStart(t,1.,true,function Update)
set GeneralTarget = null
endfunction
function StartQ28 takes nothing returns nothing
local timer t = NewTimer()
call QuestSetTimeToEvening()
call SpawnReinforcements()
call StartItemSpawn(6,10)
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library q29 needs qsys,q30, TimerUtils, SpawnSystem
globals
private constant integer IDQ = 29
private constant integer BOSS1 = 'u00A'
private constant integer BOSS2 = 'u00D'
private constant integer REQ_BASE = 750 //Per Player
private constant integer REQ_PLAYER = 50 //Per Player
private constant integer DELTA = 100 //each delta update the quest
endglobals
private function EnemyDeath takes nothing returns boolean
if QuestBoolean[IDQ]==true then
set CreepsSubKill = CreepsSubKill + 1
set CreepsKill = CreepsKill + 1
set QuestEta[IDQ] = I2S(R2I(100*CreepsKill/CreepsRequiredKill)) + "% targets down"
call UpdateQuestMbOnly(IDQ)
if CreepsSubKill == DELTA then
call UpdateQuest(IDQ)
set CreepsSubKill = 0
endif
if CreepsKill >= CreepsRequiredKill then
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call SpawnCreeps(BOSS1,11,GetRandomReal(MapXMin,MapXMax),GetRandomReal(MapYMin,MapYMax))
call SpawnCreeps(BOSS2,11,GetRandomReal(MapXMin,MapXMax),GetRandomReal(MapYMin,MapYMax))
call StartQ30()
endif
endif
return false
endfunction
private function Run takes nothing returns nothing
call ReleaseTimer(GetExpiredTimer())
set GeneralTarget = null
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(11),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(13),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(14),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function EnemyDeath ) )
endfunction
function StartQ29 takes nothing returns nothing
local timer t = NewTimer()
call QuestSetTimeToNight()
set ChapterDone = 1
call SpawnReinforcements()
set CreepsRequiredKill = REQ_BASE+REQ_PLAYER*PlayerAmount
call StartItemSpawn(6,10)
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library q30 needs qsys,q31, TimerUtils, SpawnSystem
globals
private constant integer IDQ = 30
private constant integer REQ_BASE = 750 //Per Player
private constant integer REQ_PLAYER = 50 //Per Player
private constant integer DELTA = 100 //each delta update the quest
private constant integer BOSS1 = 'u002'
private constant integer BOSS2 = 'u00G'
endglobals
private function EnemyDeath takes nothing returns boolean
if QuestBoolean[IDQ]==true then
set CreepsSubKill = CreepsSubKill + 1
set CreepsKill = CreepsKill + 1
set QuestEta[IDQ] = I2S(R2I(100*CreepsKill/CreepsRequiredKill)) + "% targets down"
call UpdateQuestMbOnly(IDQ)
if CreepsSubKill == DELTA then
call UpdateQuest(IDQ)
set CreepsSubKill = 0
endif
if CreepsKill >= CreepsRequiredKill then
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call SpawnCreeps(BOSS1,11,GetRandomReal(MapXMin,MapXMax),GetRandomReal(MapYMin,MapYMax))
call SpawnCreeps(BOSS2,11,GetRandomReal(MapXMin,MapXMax),GetRandomReal(MapYMin,MapYMax))
call StartQ31()
endif
endif
return false
endfunction
private function Run takes nothing returns nothing
call ReleaseTimer(GetExpiredTimer())
set GeneralTarget = null
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(11),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(13),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(14),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function EnemyDeath ) )
endfunction
function StartQ30 takes nothing returns nothing
local timer t = NewTimer()
call QuestSetTimeToNight()
set ChapterDone = 2
call SpawnReinforcements()
set CreepsRequiredKill = REQ_BASE+REQ_PLAYER*PlayerAmount
call StartItemSpawn(6,10)
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library q31 needs qsys,q33, TimerUtils, SpawnSystem
globals
private constant integer IDQ = 31
private constant integer REQ_BASE = 750 //Per Player
private constant integer REQ_PLAYER = 50 //Per Player
private constant integer DELTA = 100 //each delta update the quest
private constant integer BOSS1 = 'u01B'
private constant integer BOSS2 = 'u01E'
private constant integer UP_CREEPS = 'R00G'
endglobals
private function EnemyDeath takes nothing returns boolean
if QuestBoolean[IDQ]==true then
set CreepsSubKill = CreepsSubKill + 1
set CreepsKill = CreepsKill + 1
set QuestEta[IDQ] = I2S(R2I(100*CreepsKill/CreepsRequiredKill)) + "% targets down"
call UpdateQuestMbOnly(IDQ)
if CreepsSubKill == DELTA then
call UpdateQuest(IDQ)
set CreepsSubKill = 0
endif
if CreepsKill >= CreepsRequiredKill then
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call SpawnCreeps(BOSS1,11,GetRandomReal(MapXMin,MapXMax),GetRandomReal(MapYMin,MapYMax))
call SpawnCreeps(BOSS2,11,GetRandomReal(MapXMin,MapXMax),GetRandomReal(MapYMin,MapYMax))
call StartQ33()
endif
endif
return false
endfunction
private function Run takes nothing returns nothing
call ReleaseTimer(GetExpiredTimer())
set GeneralTarget = null
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(11),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(13),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(14),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function EnemyDeath ) )
endfunction
function StartQ31 takes nothing returns nothing
local timer t = NewTimer()
call QuestSetTimeToNight()
set ChapterDone = 1
call SpawnReinforcements()
set CreepsRequiredKill = REQ_BASE+REQ_PLAYER*PlayerAmount
call SetPlayerTechResearched(Player(11),UP_CREEPS,1)
call StartItemSpawn(6,10)
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library q33 needs qsys,GameEndSuccess, TimerUtils, SpawnSystem
globals
private constant integer IDQ = 33
private constant integer REQ_BASE = 750 //Per Player
private constant integer REQ_PLAYER = 50 //Per Player
private constant integer DELTA = 100 //each delta update the quest
endglobals
private function EnemyDeath takes nothing returns boolean
if QuestBoolean[IDQ]==true then
set CreepsSubKill = CreepsSubKill + 1
set CreepsKill = CreepsKill + 1
set QuestEta[IDQ] = I2S(R2I(100*CreepsKill/CreepsRequiredKill)) + "% targets down"
call UpdateQuestMbOnly(IDQ)
if CreepsSubKill == DELTA then
call UpdateQuest(IDQ)
set CreepsSubKill = 0
endif
if CreepsKill >= CreepsRequiredKill then
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call GameEndSuccess(250,"|c00AFAAFF We finially erradicated all threat there. Good job.|r")
endif
endif
return false
endfunction
private function Run takes nothing returns nothing
call ReleaseTimer(GetExpiredTimer())
set GeneralTarget = null
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(11),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(13),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][0],Player(14),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function EnemyDeath ) )
endfunction
function StartQ33 takes nothing returns nothing
local timer t = NewTimer()
call QuestSetTimeToNight()
set ChapterDone = 1
call SpawnReinforcements()
set CreepsRequiredKill = REQ_BASE+REQ_PLAYER*PlayerAmount
call StartItemSpawn(6,10)
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
endlibrary
//TESH.scrollpos=9
//TESH.alwaysfold=0
library ChapterLastStand needs TimerUtils,q43, TextDisplay,ItemSpawn,ParasiteSpore
globals
private constant string MASK = "ReplaceableTextures\\CameraMasks\\Black_mask.blp"
endglobals
private struct str
integer i
endstruct
private function Wait takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
local integer i = 0
if dat.i < CHAPTER_WAIT+20 then
set dat.i = dat.i + 1
if dat.i == CHAPTER_WAIT+5 then
call MusicChapter()
elseif dat.i == CHAPTER_WAIT+10 then
loop
exitwhen i > MAXPLAYER
call DisplayTextToPlayer(Player(i),0.,0.,"|c00AFAAFF Last Stand Mode|r")
call DisplayTextToPlayer(Player(i),0.,0.,"|c00AFAAFF Proposed by Namorax on jk2pach.com|r")
set i = i + 1
endloop
endif
else
call StartItemSpawn(10,10)
call DisplayAll("Control","The team sent to secure the RC has failed because they've either died or deserted.")
call DisplayAll("Control","Save the Database of RC601, which contains everything that was ever researched or ever happened inside the RC.")
call DisplayAll("Control","The necesary security protocols have been activated and the Database was transferred to the External Outpost.")
call DisplayAll("Control","Dr. Frank intercepted the soldiers who were supposed to transport the Database, so you need to defend it while the army starts mobilising")
call StartQ43()
set ChapterIntermission = false
call MusicOff()
call StartParasiteSpore()
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
function ChapterLastStand takes nothing returns nothing
local timer t = NewTimer()
local str dat = str.create()
call RemoveUnit(ExternalOutpostGenerator)
set dat.i = 0
set ChapterIntermission = true
call SetTimerData(t,dat)
call TimerStart (t, 1., true, function Wait )
endfunction
endlibrary
//TESH.scrollpos=145
//TESH.alwaysfold=0
library q43 initializer init needs qsys, TimerUtils, AlliedSpawnSystem, GroupUtils,GameEndSuccess, SpawnSystem, TextDisplay,CheckPointValidity
globals
private constant integer IDQ = 43
private constant integer GROUPID = 2
private constant integer UNIT_ID = 'n017'
private constant real RANDOMSPAWN_DISTANCEMIN = 2000.
private constant real RANDOMSPAWN_DISTANCEMAX = 4000.
private constant integer BOSS_ID = 'u00G'
private integer array Spawn [10][4]
private integer array BossId1 [4]
private integer array BossId2 [4]
private integer array BossId3 [8]
private integer Boss1Max
private integer Boss2Max
private integer Boss3Max
private timer Timer
private constant integer DURATION = 2700 //45min*60sec
private constant integer UP_CREEPS = 'R00G'
private constant integer DRONE_ID = 'n00G'
private constant integer SPEED = 25
private constant real SPAWN_DISTANCE = 4000.
private constant real SPAWN_Z = 500.
private constant real WAIT = 3.
endglobals
private struct s_delay
unit drone
endstruct
private function Wait takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_delay dat = GetTimerData(t)
local integer i = 0
local real x = GetUnitX(dat.drone)
local real y = GetUnitY(dat.drone)
local player owner = GetOwningPlayer(dat.drone)
call SetUnitFlyHeight(dat.drone,SPAWN_Z,300.)
call UnitAddAbility(dat.drone,LASTQUESTUNIT_SPELL)
call IssuePointOrder(dat.drone,LASTQUESTUNIT_ORDER,GetRectCenterX(gg_rct_LastQuest),GetRectCenterY(gg_rct_LastQuest))
loop
exitwhen i > MAXPLAYER
if GetPlayerSlotState(Player(i))==PLAYER_SLOT_STATE_PLAYING then
call CreateUnit(Player(i),AlliedId[GetRandomInt(0,AlliedIdMax)],x,y,0.)
call CreateUnit(Player(i),AlliedId[GetRandomInt(0,AlliedIdMax)],x,y,0.)
endif
set i = i + 1
endloop
call ReleaseTimer(t)
call dat.destroy()
set owner = null
endfunction
private function DelayControl takes unit drone returns nothing
local timer t = NewTimer()
local s_delay dat = s_delay.create()
set dat.drone = drone
call SetTimerData(t, dat)
call TimerStart (t, WAIT, false, function Wait)
endfunction
private struct s_drop
player owner
unit drone
real angle
integer distance
integer i
endstruct
private function UpdateArmyIncome takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_drop dat = GetTimerData(t)
local real newX = GetUnitX(dat.drone) + SPEED*Cos(dat.angle)
local real newY = GetUnitY(dat.drone) + SPEED*Sin(dat.angle)
if dat.i < dat.distance then
set dat.i = dat.i + 1
call SetUnitPosition(dat.drone, newX, newY)
else
call SetUnitFlyHeight(dat.drone,100.,300.)
call DelayControl(dat.drone)
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function LastStandArmyIncome takes real x1, real y1 returns nothing
local timer t = NewTimer()
local s_drop dat = s_drop.create()
local real x2 = 0.
local real y2 = 0.
local real angle = Atan2((y2 -y1), (x2 - x1))
local real x3 = CheckPointValidity(x1 - SPAWN_DISTANCE*Cos(angle),MapXMin,MapXMax)
local real y3 = CheckPointValidity(y1 - SPAWN_DISTANCE*Sin(angle),MapYMin,MapYMax)
call PingMinimap(x2,y2,1.)
set dat.angle = angle
set dat.distance =R2I(SquareRoot((x3-x2)*(x3-x2)+(y3-y2)*(y3-y2))/SPEED)
set dat.i = 0
set dat.drone = CreateUnit(Player(ALLIEDID),DRONE_ID,x3,y3, dat.angle*bj_RADTODEG )
call SetUnitFlyHeight(dat.drone,SPAWN_Z,0.)
call SetTimerData(t, dat)
call TimerStart (t, TIMEOUT, true, function UpdateArmyIncome)
endfunction
private function UpgradeCreeps takes integer currentUniverse returns nothing
local integer i = 0
local integer j = 0
call CreepsResetCreepsId()
call CreepsAddSpecialId(CreepsUniverseSpecial[currentUniverse][0])
call CreepsAddSpecialId(CreepsUniverseSpecial[currentUniverse][1])
call CreepsAddRushId(CreepsUniverseRush[currentUniverse])
call CreepsAddAirId(CreepsUniverseAir[currentUniverse])
loop
exitwhen i > CreepsUniverseMaxId-1
if IsUnitTypeId(CreepsUniverseId[currentUniverse][i])==true then
set j = 0
loop
exitwhen j > CreepsUniverseCoeff[currentUniverse][i]
call CreepsAddCreepsId(CreepsUniverseId[currentUniverse][i])
set j = j + 1
endloop
endif
set i = i + 1
endloop
endfunction
private function MiniBossDeath takes nothing returns boolean
if GetUnitAbilityLevel(GetTriggerUnit(),BUFF_VETERAN)>=1 then
call DisplayAll("Control","A primary target has been killed. Good job.")
call RankAllQuest(IDQ,25)
endif
return false
endfunction
private function BossDeath takes nothing returns boolean
if not (IsUnitType(Building,UNIT_TYPE_DEAD))then
call EndQuest(IDQ,true)
call LastStandEnd(true)
endif
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call DestroyQuestTrigger(IDQ,0)
return false
endfunction
private function BossEnd takes nothing returns nothing
local unit boss = CreateUnit(Player(11),BOSS_ID,GetRectCenterX(gg_rct_Piponce),GetRectCenterY(gg_rct_Piponce),0.)
call DisplayAll("Control","Army has arrived, time to rape those bitches")
call LastStandArmyIncome(GetUnitX(Building)+GetRandomReal(-500.,500.),GetUnitY(Building)+GetRandomReal(-500.,500.))
call LastStandArmyIncome(GetUnitX(Building)+GetRandomReal(-500.,500.),GetUnitY(Building)+GetRandomReal(-500.,500.))
call LastStandArmyIncome(GetUnitX(Building)+GetRandomReal(-500.,500.),GetUnitY(Building)+GetRandomReal(-500.,500.))
call LastStandArmyIncome(GetUnitX(Building)+GetRandomReal(-500.,500.),GetUnitY(Building)+GetRandomReal(-500.,500.))
call BossSound()
call SpawnCreeps(BossId1[GetRandomInt(0,Boss3Max)],11,GetRandomReal(MapXMin,MapXMax),GetRandomReal(MapYMin,MapYMax))
call SpawnCreeps(BossId1[GetRandomInt(0,Boss3Max)],11,GetRandomReal(MapXMin,MapXMax),GetRandomReal(MapYMin,MapYMax))
call SpawnCreeps(BossId2[GetRandomInt(0,Boss3Max)],11,GetRandomReal(MapXMin,MapXMax),GetRandomReal(MapYMin,MapYMax))
call SpawnCreeps(BossId2[GetRandomInt(0,Boss3Max)],11,GetRandomReal(MapXMin,MapXMax),GetRandomReal(MapYMin,MapYMax))
call SpawnCreeps(BossId3[GetRandomInt(0,Boss3Max)],11,GetRandomReal(MapXMin,MapXMax),GetRandomReal(MapYMin,MapYMax))
call SpawnCreeps(BossId3[GetRandomInt(0,Boss3Max)],11,GetRandomReal(MapXMin,MapXMax),GetRandomReal(MapYMin,MapYMax))
set GeneralTarget = null
call IssuePointOrder(boss,"patrol",GetRectCenterX(gg_rct_ShipFacilities),GetRectCenterY(gg_rct_ShipFacilities))
call ReleaseTimer(GetExpiredTimer())
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterUnitEvent(QuestTrig[IDQ][0],boss, EVENT_UNIT_DEATH )
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function BossDeath ) )
set boss = null
endfunction
private function AlliedDeath takes nothing returns boolean
call DisplayAll("Control", "Good job. Database is lost now...")
call EndQuest(IDQ,false)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call DestroyQuestTrigger(IDQ,0)
call LastStandEnd(false)
return false
endfunction
private function SpawnRandomBoss takes integer bossId returns nothing
local real distance = GetRandomReal(RANDOMSPAWN_DISTANCEMIN,RANDOMSPAWN_DISTANCEMAX)
local real angle = GetRandomReal(0,6.28)
local real x = CheckPointValidity(GetUnitX(Building)+distance*Cos(angle),MapXMin,MapXMax)
local real y = CheckPointValidity(GetUnitY(Building)+distance*Sin(angle),MapYMin,MapYMax)
call SpawnVeteranCreeps(bossId,13,x,y)
endfunction
private struct str
integer i
endstruct
private function Update takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
if dat.i < DURATION and not (IsUnitType(Building,UNIT_TYPE_DEAD)) then
if dat.i==120 or dat.i==240 or dat.i==360 or dat.i==480 or dat.i==600 then
call SpawnRandomBoss(BossId1[GetRandomInt(0,Boss1Max)])
call SpawnRandomBoss(BossId1[GetRandomInt(0,Boss1Max)])
elseif dat.i==720 or dat.i==840 or dat.i==960 or dat.i==1080 or dat.i==1200 then
call SpawnRandomBoss(BossId2[GetRandomInt(0,Boss2Max)])
call SpawnRandomBoss(BossId2[GetRandomInt(0,Boss2Max)])
elseif dat.i==1320 or dat.i==1440 or dat.i==1560 or dat.i==1680 or dat.i==1800 then
call SpawnRandomBoss(BossId2[GetRandomInt(0,Boss2Max)])
call SpawnRandomBoss(BossId3[GetRandomInt(0,Boss3Max)])
elseif dat.i==1920 or dat.i==2040 or dat.i==2160 or dat.i==2280 or dat.i==2400 then
call SpawnRandomBoss(BossId3[GetRandomInt(0,Boss3Max)])
call SpawnRandomBoss(BossId3[GetRandomInt(0,Boss3Max)])
endif
if dat.i == 675 then
call UpgradeCreeps(2)
elseif dat.i == 1350 then
call UpgradeCreeps(3)
elseif dat.i == 2025 then
call SetPlayerTechResearched(Player(11),UP_CREEPS,1)
endif
set dat.i = dat.i + 1
set QuestEta[IDQ] = "allied arriving:"+I2S(R2I( (DURATION-dat.i)/60. ))
call UpdateQuestMbOnly(IDQ)
else
if not (IsUnitType(Building,UNIT_TYPE_DEAD))then
call BossEnd()
call RunSound(SOUND_QUESTSUCCESS)
endif
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function Run takes nothing returns nothing
local integer i = 0
local unit escort = null
local real x = 0.
local real y = 0.
local timer t = GetExpiredTimer()
local str dat = str.create()
call ReleaseTimer(t)
set Building = CreateUnit(Player(ALLIEDID),UNIT_ID,GetRectCenterX(gg_rct_ExternalOutpost),GetRectCenterY(gg_rct_ExternalOutpost),0.)
set GeneralTarget = Building
call PingQuest(GetUnitX(Building),GetUnitY(Building),10.,30.)
set QuestTrig[IDQ][1] = CreateTrigger()
call TriggerRegisterUnitEvent(QuestTrig[IDQ][1],Building,EVENT_UNIT_DEATH)
call TriggerAddCondition(QuestTrig[IDQ][1], Condition( function AlliedDeath ) )
set QuestTrig[IDQ][2] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(QuestTrig[IDQ][2],Player(13),EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(QuestTrig[IDQ][2], Condition( function MiniBossDeath ) )
set Timer = NewTimer()
set dat.i = 0
call SetTimerData(Timer,dat)
call TimerStart (Timer, 1., true, function Update)
endfunction
function StartQ43 takes nothing returns nothing
local timer t = NewTimer()
local integer i = 0
loop
exitwhen i > 5
call AlliedAddUnitToPatrolGroup(AlliedId[GetRandomInt(0,AlliedIdMax)],GROUPID)
call AlliedAddUnitToTowerGroup(AlliedId[GetRandomInt(0,AlliedIdMax)],GROUPID)
set i = i + 1
endloop
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
private function init takes nothing returns nothing
set BossId1[0] = 'u002'
set BossId1[1] = 'u012'
set BossId1[2] = 'u00A'
set BossId1[3] = 'u00U'
set Boss1Max = 3
set BossId2[0] = 'u00S'
set BossId2[1] = 'u01B'
set BossId2[2] = 'u00D'
set BossId2[3] = 'u000'
set Boss2Max = 3
set BossId3[0] = 'u01L'
set BossId3[1] = 'u000'
set BossId3[2] = 'u018'
set BossId3[3] = 'u01Q'
set BossId3[4] = 'u01I'
set BossId3[5] = 'u01P'
set BossId3[6] = 'u01S'
set BossId3[7] = 'u01O'
set Boss3Max = 7
endfunction
endlibrary
//TESH.scrollpos=20
//TESH.alwaysfold=0
library LastStandEnd needs TimerUtils, SpawnSystem,TextDisplay,qsys
private struct str
integer i
boolean success
string text
endstruct
private function Wait takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
local integer i = 0
if dat.i < 35 then
set dat.i = dat.i + 1
if dat.i == 15 then
call CinematicModeBJ(true,bj_FORCE_ALL_PLAYERS)
call PauseAllUnitsBJ(true)
elseif dat.i == 20 then
loop
exitwhen i > MAXPLAYER
call DisplayTextToPlayer(Player(i),1.,0.5,dat.text)
set i = i + 1
endloop
endif
else
call ReleaseTimer(t)
call dat.destroy()
call CinematicModeBJ(false,bj_FORCE_ALL_PLAYERS)
call PauseAllUnitsBJ(false)
set XpAvailable = false
call DisplayAll("Game", "Game is ended. Experience is disabled")
endif
endfunction
function LastStandEnd takes boolean success returns nothing
local timer t = NewTimer()
local str dat = str.create()
set dat.i = 0
set ChapterIntermission = true
if success == true then
call ChapterRank("Operation",300)
set dat.text = "|c00AFAAFF Good job! We get the data secured now.|r"
else
set dat.text = "|c00AFAAFF Amazing. You are not even able to guard a computer during a few minutes...|r"
endif
set dat.success = success
call CreepsDestroySystem()
call SetTimerData(t,dat)
call TimerStart (t, 1., true, function Wait )
endfunction
endlibrary
//TESH.scrollpos=15
//TESH.alwaysfold=0
library ChapterSiege needs TimerUtils,q42, TextDisplay,ItemSpawn,ParasiteSpore
globals
private constant string MASK = "ReplaceableTextures\\CameraMasks\\Black_mask.blp"
endglobals
private struct str
integer i
endstruct
private function Wait takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
local integer i = 0
if dat.i < CHAPTER_WAIT+20 then
set dat.i = dat.i + 1
if dat.i == CHAPTER_WAIT+5 then
call MusicChapter()
elseif dat.i == CHAPTER_WAIT+10 then
loop
exitwhen i > MAXPLAYER
call DisplayTextToPlayer(Player(i),0.,0.,"|c00AFAAFF Siege Mode|r")
set i = i + 1
endloop
endif
else
call StartItemSpawn(6,10)
call StartQ42()
set ChapterIntermission = false
call MusicOff()
call StartParasiteSpore()
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
function ChapterSiege takes nothing returns nothing
local timer t = NewTimer()
local str dat = str.create()
set dat.i = 0
set ChapterIntermission = true
call SetTimerData(t,dat)
call TimerStart (t, 1., true, function Wait )
endfunction
endlibrary
//TESH.scrollpos=39
//TESH.alwaysfold=0
library q42 initializer init needs qsys, TimerUtils, AlliedSpawnSystem, GroupUtils,GameEndSuccess, SpawnSystem, TextDisplay,CheckPointValidity
globals
private constant integer IDQ = 42
private constant integer UNIT_ID = 'o037'
private constant real RANDOMSPAWN_DISTANCEMIN = 2000.
private constant real RANDOMSPAWN_DISTANCEMAX = 4000.
private constant integer BOSS_ID = 'u00G'
private integer array Spawn [10][4]
private integer array BossId1 [4]
private integer array BossId2 [4]
private integer array BossId3 [8]
private integer Boss1Max
private integer Boss2Max
private integer Boss3Max
private rect array BaseRect [10]
private string array BaseName [10]
private integer BaseMax
private integer SiegeRandom
endglobals
private function UpgradeCreeps takes integer currentUniverse returns nothing
local integer i = 0
local integer j = 0
call CreepsResetCreepsId()
call CreepsAddSpecialId(CreepsUniverseSpecial[currentUniverse][0])
call CreepsAddSpecialId(CreepsUniverseSpecial[currentUniverse][1])
call CreepsAddRushId(CreepsUniverseRush[currentUniverse])
call CreepsAddAirId(CreepsUniverseAir[currentUniverse])
loop
exitwhen i > CreepsUniverseMaxId-1
if IsUnitTypeId(CreepsUniverseId[currentUniverse][i])==true then
set j = 0
loop
exitwhen j > CreepsUniverseCoeff[currentUniverse][i]
call CreepsAddCreepsId(CreepsUniverseId[currentUniverse][i])
set j = j + 1
endloop
endif
set i = i + 1
endloop
endfunction
private function BossDeath takes nothing returns boolean
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
call GameEndSuccess(250,"|c00AFAAFF Base is safe. We will send the army to clean up the sector now.|r")
return false
endfunction
private function BossEnd takes nothing returns nothing
local unit boss = CreateUnit(Player(11),BOSS_ID,GetRectCenterX(gg_rct_Piponce),GetRectCenterY(gg_rct_Piponce),0.)
call BossSound()
call SpawnCreeps(BossId3[GetRandomInt(0,Boss3Max)],11,GetRandomReal(MapXMin,MapXMax),GetRandomReal(MapYMin,MapYMax))
call SpawnCreeps(BossId3[GetRandomInt(0,Boss3Max)],11,GetRandomReal(MapXMin,MapXMax),GetRandomReal(MapYMin,MapYMax))
set GeneralTarget = null
call IssuePointOrder(boss,"patrol",GetRectCenterX(gg_rct_ShipFacilities),GetRectCenterY(gg_rct_ShipFacilities))
call ReleaseTimer(GetExpiredTimer())
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerRegisterUnitEvent(QuestTrig[IDQ][0],boss, EVENT_UNIT_DEATH )
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function BossDeath ) )
set boss = null
endfunction
private function AlliedDeath takes nothing returns boolean
call DisplayAll("Control", "Good job. The impulsion generator is lost now...")
call EndQuest(IDQ,false)
call DestroyQuestTrigger(IDQ,0)
call DestroyQuestTrigger(IDQ,1)
return false
endfunction
private function SpawnRandomBoss takes integer bossId returns nothing
local real distance = GetRandomReal(RANDOMSPAWN_DISTANCEMIN,RANDOMSPAWN_DISTANCEMAX)
local real angle = GetRandomReal(0,6.28)
local real x = CheckPointValidity(GetUnitX(Building)+distance*Cos(angle),MapXMin,MapXMax)
local real y = CheckPointValidity(GetUnitY(Building)+distance*Sin(angle),MapYMin,MapYMax)
call SpawnCreeps(bossId,13,x,y)
endfunction
private function Boss3 takes nothing returns nothing
local timer t = GetExpiredTimer()
call ReleaseTimer(t)
call SpawnRandomBoss(BossId3[GetRandomInt(0,Boss3Max)])
call SpawnRandomBoss(BossId3[GetRandomInt(0,Boss3Max)])
call UpgradeCreeps(3)
set t = NewTimer()
call TimerStart (t, 180., false, function BossEnd)
endfunction
private function Boss2 takes nothing returns nothing
local timer t = GetExpiredTimer()
call ReleaseTimer(t)
call SpawnRandomBoss(BossId2[GetRandomInt(0,Boss2Max)])
call SpawnRandomBoss(BossId2[GetRandomInt(0,Boss2Max)])
call UpgradeCreeps(2)
set t = NewTimer()
call TimerStart (t, 180., false, function Boss3)
endfunction
private function Boss1 takes nothing returns nothing
local timer t = GetExpiredTimer()
call ReleaseTimer(t)
call SpawnRandomBoss(BossId1[GetRandomInt(0,Boss1Max)])
call SpawnRandomBoss(BossId1[GetRandomInt(0,Boss1Max)])
set t = NewTimer()
call TimerStart (t, 240., false, function Boss2)
endfunction
private function UpdateCreeps takes nothing returns nothing
local integer i = 0
local timer t = GetExpiredTimer()
call ReleaseTimer(t)
call CreepsResetSpawn()
loop
exitwhen i > 3
if Spawn[SiegeRandom][i]!= null then
set SpawnTrue[Spawn[SiegeRandom][i]] = true
endif
set i = i + 1
endloop
set t = NewTimer()
call TimerStart (t, 240., false, function Boss1)
endfunction
private function Run takes nothing returns nothing
local integer i = 0
local unit escort = null
local real x = 0.
local real y = 0.
local timer t = GetExpiredTimer()
call ReleaseTimer(t)
call DisplayAll("Control","Okay guys, we have chosen our base. Defend the impulsion generator at the "+BaseName[SiegeRandom])
set Building = CreateUnit(Player(10),'o037',GetRectCenterX(BaseRect[SiegeRandom]),GetRectCenterY(BaseRect[SiegeRandom]),0.)
set GeneralTarget = Building
call PingQuest(GetUnitX(Building),GetUnitY(Building),60.,120.)
set QuestTrig[IDQ][1] = CreateTrigger()
call TriggerRegisterUnitEvent(QuestTrig[IDQ][1],Building,EVENT_UNIT_DEATH)
call TriggerAddCondition(QuestTrig[IDQ][1], Condition( function AlliedDeath ) )
loop
exitwhen i > MAXPLAYER
if not (IsUnitType(Hero[i],UNIT_TYPE_DEAD)) and GetPlayerSlotState(Player(i))==PLAYER_SLOT_STATE_PLAYING then
call SetUnitPosition(Hero[i],GetRectCenterX(BaseRect[SiegeRandom])+GetRandomReal(-150.,150.),GetRectCenterY(BaseRect[SiegeRandom])+GetRandomReal(-150.,150.))
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\NightElf\\Blink\\BlinkTarget.mdl",GetUnitX(Hero[i]),GetUnitY(Hero[i])))
endif
set i = i + 1
endloop
set t = NewTimer()
call TimerStart (t, 10., false, function UpdateCreeps)
endfunction
function StartQ42 takes nothing returns nothing
local timer t = NewTimer()
set SiegeRandom = GetRandomInt(0,BaseMax)
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
private function init takes nothing returns nothing
local integer i = 0
set BaseRect[i]=gg_rct_ExternalOutpost
set BaseName[i]="External Outpost"
set Spawn[i][0] = 49
set Spawn[i][1] = 50
set Spawn[i][2] = 51
set Spawn[i][3] = 52
set i = i + 1
set BaseRect[i]=gg_rct_Barracks
set BaseName[i]="Barracks"
set Spawn[i][0] = 4
set Spawn[i][1] = 11
set Spawn[i][2] = 18
set Spawn[i][3] = 35
set i = i + 1
set BaseRect[i]=gg_rct_ShipFacilitiesSiege
set BaseName[i]="Ship Facilities"
set Spawn[i][0] = 11
set Spawn[i][1] = 12
set Spawn[i][2] = 44
set Spawn[i][3] = 45
set i = i + 1
set BaseRect[i]=gg_rct_AirfieldBase
set BaseName[i]="Airfield"
set Spawn[i][0] = 5
set Spawn[i][1] = 27
set Spawn[i][2] = 28
set Spawn[i][3] = 33
set i = i + 1
set BaseRect[i]=gg_rct_MechanoidsFacilities
set BaseName[i]="Mechanoids Facilities"
set Spawn[i][0] = 22
set Spawn[i][1] = 33
set Spawn[i][2] = 37
set Spawn[i][3] = 39
set i = i + 1
set BaseRect[i]=gg_rct_TeleporterBase
set BaseName[i]="Old Teleporter"
set Spawn[i][0] = 4
set Spawn[i][1] = 9
set Spawn[i][2] = 10
set Spawn[i][3] = 49
set i = i + 1
set BaseRect[i]=gg_rct_ContainerBase
set BaseName[i]="Container Storage"
set Spawn[i][0] = 4
set Spawn[i][1] = 10
set Spawn[i][2] = 18
set Spawn[i][3] = 23
set BaseMax = i
set BossId1[0] = 'u002'
set BossId1[1] = 'u012'
set BossId1[2] = 'u00A'
set BossId1[3] = 'u00U'
set Boss1Max = 3
set BossId2[0] = 'u00S'
set BossId2[1] = 'u01B'
set BossId2[2] = 'u00D'
set BossId2[3] = 'u000'
set Boss2Max = 3
set BossId3[0] = 'u01L'
set BossId3[1] = 'u000'
set BossId3[2] = 'u018'
set BossId3[3] = 'u01Q'
set BossId3[4] = 'u01I'
set BossId3[5] = 'u01P'
set BossId3[6] = 'u01S'
set BossId3[7] = 'u01O'
set Boss3Max = 7
endfunction
endlibrary
//TESH.scrollpos=15
//TESH.alwaysfold=0
library ChapterAssaut needs TimerUtils,q59, TextDisplay,ItemSpawn,ParasiteSpore, AlliedSpawnSystem
globals
private constant string MASK = "ReplaceableTextures\\CameraMasks\\Black_mask.blp"
endglobals
private struct str
integer i
endstruct
private function Wait takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
local integer i = 0
if dat.i < CHAPTER_WAIT+20 then
set dat.i = dat.i + 1
if dat.i == CHAPTER_WAIT+5 then
call MusicChapter()
elseif dat.i == CHAPTER_WAIT+10 then
loop
exitwhen i > MAXPLAYER
call DisplayTextToPlayer(Player(i),0.,0.,"|c00AFAAFF Assaut Mode|r")
set i = i + 1
endloop
endif
else
call StartItemSpawn(6,10)
call StartQ59()
set ChapterIntermission = false
call MusicOff()
call StartParasiteSpore()
call AlliedSetHostile()
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
function ChapterAssaut takes nothing returns nothing
local timer t = NewTimer()
local str dat = str.create()
set dat.i = 0
set ChapterIntermission = true
call SetTimerData(t,dat)
call TimerStart (t, 1., true, function Wait )
endfunction
endlibrary
//TESH.scrollpos=125
//TESH.alwaysfold=0
library q59 initializer init needs qsys, TimerUtils, AlliedSpawnSystem, GroupUtils,GameEndSuccess, SpawnSystem, TextDisplay,CheckPointValidity
globals
private constant integer IDQ = 59
private constant real RANDOMSPAWN_DISTANCEMIN = 2000.
private constant real RANDOMSPAWN_DISTANCEMAX = 4000.
private integer array Spawn [10][4]
private integer array BossId1 [4]
private integer array BossId2 [4]
private integer array BossId3 [8]
private integer Boss1Max
private integer Boss2Max
private integer Boss3Max
private rect array BaseRect [10]
private string array BaseName [10]
private integer array AlliedCamp [10]
private integer BaseMax
private constant real FAIL_DURATION = 1800.
endglobals
private function UpgradeCreeps takes integer currentUniverse returns nothing
local integer i = 0
local integer j = 0
call CreepsResetCreepsId()
call CreepsAddSpecialId(CreepsUniverseSpecial[currentUniverse][0])
call CreepsAddSpecialId(CreepsUniverseSpecial[currentUniverse][1])
call CreepsAddRushId(CreepsUniverseRush[currentUniverse])
call CreepsAddAirId(CreepsUniverseAir[currentUniverse])
loop
exitwhen i > CreepsUniverseMaxId-1
if IsUnitTypeId(CreepsUniverseId[currentUniverse][i])==true then
set j = 0
loop
exitwhen j > CreepsUniverseCoeff[currentUniverse][i]
call CreepsAddCreepsId(CreepsUniverseId[currentUniverse][i])
set j = j + 1
endloop
endif
set i = i + 1
endloop
endfunction
private function Failed takes nothing returns nothing
call ReleaseTimer(FailTimer)
if not (IsUnitType(Building,UNIT_TYPE_DEAD)) then
call EndQuest(IDQ,false)
call DestroyQuestTrigger(IDQ,0)
call DisplayAll("Control", "Great. Now the RC601 will go into the TV set...")
endif
endfunction
private function BaseDeath takes nothing returns boolean
if QuestBoolean[IDQ]==true then
set CreepsKill = CreepsKill + 1
set QuestEta[IDQ] = I2S(CreepsKill)+"/"+I2S(CreepsRequiredKill) + " targets destroyed"
call UpdateQuest(IDQ)
if CreepsKill >= CreepsRequiredKill then
call ReleaseTimer(FailTimer)
call EndQuest(IDQ,true)
call DestroyQuestTrigger(IDQ,0)
call GameEndSuccess(250,"|c00AFAAFF Good job. They will not be able to send any data.|r")
endif
endif
return false
endfunction
private function SpawnRandomBoss takes integer bossId returns nothing
local real distance = GetRandomReal(RANDOMSPAWN_DISTANCEMIN,RANDOMSPAWN_DISTANCEMAX)
local real angle = GetRandomReal(0,6.28)
local real x = CheckPointValidity(GetUnitX(Building)+distance*Cos(angle),MapXMin,MapXMax)
local real y = CheckPointValidity(GetUnitY(Building)+distance*Sin(angle),MapYMin,MapYMax)
call SpawnCreeps(bossId,13,x,y)
endfunction
private function Boss3 takes nothing returns nothing
local timer t = GetExpiredTimer()
call ReleaseTimer(t)
call SpawnRandomBoss(BossId3[GetRandomInt(0,Boss3Max)])
call UpgradeCreeps(3)
endfunction
private function Boss2 takes nothing returns nothing
local timer t = GetExpiredTimer()
call ReleaseTimer(t)
call SpawnRandomBoss(BossId2[GetRandomInt(0,Boss2Max)])
call UpgradeCreeps(2)
set t = NewTimer()
call TimerStart (t, 180., false, function Boss3)
endfunction
private function Boss1 takes nothing returns nothing
local timer t = GetExpiredTimer()
call ReleaseTimer(t)
call SpawnRandomBoss(BossId1[GetRandomInt(0,Boss1Max)])
set t = NewTimer()
call TimerStart (t, 240., false, function Boss2)
endfunction
private function UpdateCreeps takes nothing returns nothing
local integer i = 0
local timer t = GetExpiredTimer()
call ReleaseTimer(t)
set t = NewTimer()
call TimerStart (t, 240., false, function Boss1)
endfunction
private function Run takes nothing returns nothing
local integer i = 0
local unit escort = null
local real x = 0.
local real y = 0.
local timer t = GetExpiredTimer()
local integer j = 0
set QuestTrig[IDQ][0] = CreateTrigger()
call TriggerAddCondition(QuestTrig[IDQ][0], Condition( function BaseDeath ) )
loop
exitwhen i > BaseMax
set j = 0
set Building = CreateUnit(Player(10),'o002',GetRectCenterX(BaseRect[i]),GetRectCenterY(BaseRect[i]),0.)
call TriggerRegisterUnitEvent(QuestTrig[IDQ][0],Building,EVENT_UNIT_DEATH)
if AlliedCamp[i]>=1 then
loop
exitwhen j > 5
call AlliedAddUnitToPatrolGroup(AlliedId[GetRandomInt(0,AlliedIdMax)],AlliedCamp[i])
call AlliedAddUnitToTowerGroup(AlliedId[GetRandomInt(0,AlliedIdMax)],AlliedCamp[i])
set Building = CreateUnit(Player(10),'o002',GetRectCenterX(BaseRect[i]),GetRectCenterY(BaseRect[i]),0.)
set j = j + 1
endloop
endif
set i = i + 1
endloop
set CreepsRequiredKill = BaseMax+1
call DisplayAll("Control","Just hurry, find and destroy the Com Towers before they upload all classified files!")
call ReleaseTimer(t)
set GeneralTarget = null
set t = NewTimer()
call TimerStart (t, 10., false, function UpdateCreeps)
set FailTimer = NewTimer()
call TimerStart(FailTimer,FAIL_DURATION,false,function Failed)
endfunction
function StartQ59 takes nothing returns nothing
local timer t = NewTimer()
call AlliedSetHostile()
call IniQuest(IDQ)
call TimerStart (t, (QUEST_WAIT-1.), false, function Run)
endfunction
private function init takes nothing returns nothing
local integer i = 0
set BaseRect[i]=gg_rct_ExternalOutpost
set AlliedCamp[i] = 2
set i = i + 1
set BaseRect[i]=gg_rct_Barracks
set AlliedCamp[i] = 4
set i = i + 1
set BaseRect[i]=gg_rct_ShipFacilitiesSiege
set AlliedCamp[i] = 5
set i = i + 1
set BaseRect[i]=gg_rct_AirfieldBase
set AlliedCamp[i] = 6
set i = i + 1
set BaseRect[i]=gg_rct_MechanoidsFacilities
set AlliedCamp[i] = 0
set i = i + 1
set BaseRect[i]=gg_rct_TeleporterBase
set AlliedCamp[i] = 3
set i = i + 1
set BaseRect[i]=gg_rct_ContainerBase
set AlliedCamp[i] = 0
set BaseMax = i
set BossId1[0] = 'u002'
set BossId1[1] = 'u012'
set BossId1[2] = 'u00A'
set BossId1[3] = 'u00U'
set Boss1Max = 3
set BossId2[0] = 'u00S'
set BossId2[1] = 'u01B'
set BossId2[2] = 'u00D'
set BossId2[3] = 'u000'
set Boss2Max = 3
set BossId3[0] = 'u01L'
set BossId3[1] = 'u000'
set BossId3[2] = 'u018'
set BossId3[3] = 'u01Q'
set BossId3[4] = 'u01I'
set BossId3[5] = 'u01P'
set BossId3[6] = 'u01S'
set BossId3[7] = 'u01O'
set Boss3Max = 7
endfunction
endlibrary
//TESH.scrollpos=747
//TESH.alwaysfold=0
library SpawnSystem initializer init requires LeaderBoard,TimerUtils,SideQuestSystem,CheckPointValidity, BoundSentinel,AbilityPreload,GroupFunction,Ranks, AutoIndex
globals
unit GeneralTarget
private constant real WAIT = 0.7
real array SpecialCreepsChance [4]
private constant integer CHANCE_RUSH = 5
private constant integer CHANCE_AIR = 15
private constant integer UP_HP = 'A02L'
private constant integer UP_DMG = 'A02G'
private real TimeOutNormal = 15.
private real TimeOutRush = 60.
private real TimeOutHero = 15.
constant integer BUFF_VETERAN = 'A0J3'
private constant real TIMEOUT_UPDATE = 6.
constant integer CREEPS_TOTALMAX = 100
private constant integer NORMAL_MAX = 70
private constant integer HERO_MAX = 20
private constant integer RUSH_MAX = 20
private constant integer CREEPS_AMOUNT_PER_SPAWNPOINT = 3
private constant integer CREEPS_WAVEMAXCOEFF = 3
private constant integer CREEPS_RANDOMMAX = 2
private constant integer CREEPS_BASE_SPAWN = 4
private rect array SpawnRect [60]
private rect array BaseRect [10]
private integer BaseRectMax = 0
private real array BaseXMin [10]
private real array BaseYMin [10]
private real array BaseXMax [10]
private real array BaseYMax [10]
boolean array SpawnTrue [60]
boolean array SpawnCaveDestroyed [60]
boolean array SpawnIsCave [60]
integer CaveToDestroy = 0
integer SpawnMax = 0
private real SpawnRushX = 0.
private real SpawnRushY = 0.
private real array SpawnX [60]
private real array SpawnY [60]
private integer array SpawnCreepsId [40]
private integer array SpawnSpecialId [10]
private integer SpawnRushId
private integer SpawnAirId
private integer SpawnCreepsIdMax = 0
private integer SpawnSpecialIdMax = 0
private integer SpawnCreepsAmount = 0
private integer SpawnCreepsWaveAmount = 0
private timer TimerSpawnNormal = null
private timer TimerSpawnRush = null
private timer TimerSpawnHero = null
private constant integer OWNER_NORMAL = 11
private constant integer OWNER_RUSH = 13
private constant integer OWNER_HERO = 14
integer CreepsPop = 0
integer NormalPop = 0
integer RushPop = 0
integer HeroPop = 0
private integer array SubKill [10]
private constant integer WINDSTALKER_ID = 'u00Y'
private constant integer WINDSTALKER_REQ = 75000
private constant integer WINDSTALKER_CHANCE = 15
private constant integer IMMORTAL_ID = 'u013'
private constant integer IMMORTAL_REQ = 100000
private constant integer IMMORTAL_CHANCE = 15
private constant integer DEGENERESCENCE_ID = 'u00Z'
private constant integer DEGENERESCENCE_REQ = 60000
private constant integer DEGENERESCENCE_CHANCE = 5
private constant integer EVOLVED_BUG_ID = 'u01Z'
private constant integer EVOLVED_BUG_CHANCE = 50
private constant integer HORROR_ID = 'u020'
private constant integer HORROR_CHANCE = 50
private constant integer THETA_ID = 'u021'
private constant integer THETA_CHANCE = 20
private constant integer REBORN_ID = 'u010'
private constant integer REBORN_REQ = 40000
private constant integer REBORN_CHANCE = 15
private constant integer CRUSHER_ID = 'u022'
private constant integer CRUSHER_AMOUNT = 3
private group NormalGroup
private group RushGroup
private group HeroGroup
private constant real RANDOMSPAWN_DISTANCEMIN = 1000.
private constant real RANDOMSPAWN_DISTANCEMAX = 2000.
private trigger Trig_UpdateNormal
private trigger Trig_UpdateRush
private trigger Trig_UpdateHero
private constant integer MINIBOSS = 'A0CN'
private constant integer CHAPBOSS = 'A0CO'
private integer array MiniBossKill [12]
private integer array ChapBossKill [12]
endglobals
private function SetSpawnVariables takes nothing returns nothing
local integer i = 0
set BaseRect[i]=gg_rct_ExternalOutpost
set i = i + 1
set BaseRect[i]=gg_rct_Barracks
set i = i + 1
set BaseRect[i]=gg_rct_ShipBase
set i = i + 1
set BaseRect[i]=gg_rct_AirfieldBase
set i = i + 1
set BaseRect[i]=gg_rct_MechanoidsFacilities
set i = i + 1
set BaseRect[i]=gg_rct_TeleporterBase
set i = i + 1
set BaseRect[i]=gg_rct_ContainerBase
set BaseRectMax = i
set i = 1
set SpawnRect[i]=gg_rct_Spawn001
set SpawnIsCave[i]=true
set i = i + 1
set SpawnRect[i]=gg_rct_Spawn002
set SpawnIsCave[i]=true
set i = i + 1
set SpawnRect[i]=gg_rct_Spawn003
set SpawnIsCave[i]=true
set i = i + 1
set SpawnRect[i]=gg_rct_Spawn004
set SpawnIsCave[i]=true
set i = i + 1
set SpawnRect[i]=gg_rct_Spawn005
set SpawnIsCave[i]=true
set i = i + 1
set SpawnRect[i]=gg_rct_Spawn006
set SpawnIsCave[i]=true
set i = i + 1
set SpawnRect[i]=gg_rct_Spawn007
set SpawnIsCave[i]=false
set i = i + 1
set SpawnRect[i]=gg_rct_Spawn008
set SpawnIsCave[i]=false
set i = i + 1
set SpawnRect[i]=gg_rct_Spawn009
set SpawnIsCave[i]=false
set i = i + 1
set SpawnRect[i]=gg_rct_Spawn010
set SpawnIsCave[i]=false
set i = i + 1
set SpawnRect[i]=gg_rct_Spawn011
set SpawnIsCave[i]=false
set i = i + 1
set SpawnRect[i]=gg_rct_Spawn012
set SpawnIsCave[i]=false
set i = i + 1
set SpawnRect[i]=gg_rct_Spawn013
set SpawnIsCave[i]=false
set i = i + 1
set SpawnRect[i]=gg_rct_Spawn014
set SpawnIsCave[i]=false
set i = i + 1
set SpawnRect[i]=gg_rct_Spawn015
set SpawnIsCave[i]=false
set i = i + 1
set SpawnRect[i]=gg_rct_Spawn016
set SpawnIsCave[i]=false
set i = i + 1
set SpawnRect[i]=gg_rct_Spawn017
set SpawnIsCave[i]=false
set i = i + 1
set SpawnRect[i]=gg_rct_Spawn018
set SpawnIsCave[i]=false
set i = i + 1
set SpawnRect[i]=gg_rct_Spawn019
set SpawnIsCave[i]=false
set i = i + 1
set SpawnRect[i]=gg_rct_Spawn020
set SpawnIsCave[i]=false
set i = i + 1
set SpawnRect[i]=gg_rct_Spawn021
set SpawnIsCave[i]=false
set i = i + 1
set SpawnRect[i]=gg_rct_Spawn022
set SpawnIsCave[i]=false
set i = i + 1
set SpawnRect[i]=gg_rct_Spawn023
set SpawnIsCave[i]=false
set i = i + 1
set SpawnRect[i]=gg_rct_Spawn024
set SpawnIsCave[i]=false
set i = i + 1
set SpawnRect[i]=gg_rct_Spawn025
set SpawnIsCave[i]=false
set i = i + 1
set SpawnRect[i]=gg_rct_Spawn026
set SpawnIsCave[i]=false
set i = i + 1
set SpawnRect[i]=gg_rct_Spawn027
set SpawnIsCave[i]=false
set i = i + 1
set SpawnRect[i]=gg_rct_Spawn028
set SpawnIsCave[i]=false
set i = i + 1
set SpawnRect[i]=gg_rct_Spawn029
set SpawnIsCave[i]=false
set i = i + 1
set SpawnRect[i]=gg_rct_Spawn030
set SpawnIsCave[i]=false
set i = i + 1
set SpawnRect[i]=gg_rct_Spawn031
set SpawnIsCave[i]=false
set i = i + 1
set SpawnRect[i]=gg_rct_Spawn032
set SpawnIsCave[i]=false
set i = i + 1
set SpawnRect[i]=gg_rct_Spawn033
set SpawnIsCave[i]=false
set i = i + 1
set SpawnRect[i]=gg_rct_Spawn034
set SpawnIsCave[i]=false
set i = i + 1
set SpawnRect[i]=gg_rct_Spawn035
set SpawnIsCave[i]=false
set i = i + 1
set SpawnRect[i]=gg_rct_Spawn036
set SpawnIsCave[i]=false
set i = i + 1
set SpawnRect[i]=gg_rct_Spawn037
set SpawnIsCave[i]=false
set i = i + 1
set SpawnRect[i]=gg_rct_Spawn038
set SpawnIsCave[i]=false
set i = i + 1
set SpawnRect[i]=gg_rct_Spawn039
set SpawnIsCave[i]=false
set i = i + 1
set SpawnRect[i]=gg_rct_Spawn040
set SpawnIsCave[i]=false
set i = i + 1
set SpawnRect[i]=gg_rct_Spawn041
set SpawnIsCave[i]=false
set i = i + 1
set SpawnRect[i]=gg_rct_Spawn042
set SpawnIsCave[i]=false
set i = i + 1
set SpawnRect[i]=gg_rct_Spawn043
set SpawnIsCave[i]=false
set i = i + 1
set SpawnRect[i]=gg_rct_Spawn044
set SpawnIsCave[i]=false
set i = i + 1
set SpawnRect[i]=gg_rct_Spawn045
set SpawnIsCave[i]=false
set i = i + 1
set SpawnRect[i]=gg_rct_Spawn046
set SpawnIsCave[i]=false
set i = i + 1
set SpawnRect[i]=gg_rct_Spawn047
set SpawnIsCave[i]=false
set i = i + 1
set SpawnRect[i]=gg_rct_Spawn048
set SpawnIsCave[i]=false
set i = i + 1
set SpawnRect[i]=gg_rct_Spawn049
set SpawnIsCave[i]=false
set i = i + 1
set SpawnRect[i]=gg_rct_Spawn050
set SpawnIsCave[i]=false
set i = i + 1
set SpawnRect[i]=gg_rct_Spawn051
set SpawnIsCave[i]=false
set i = i + 1
set SpawnRect[i]=gg_rct_Spawn052
set SpawnIsCave[i]=false
set SpawnMax = i
endfunction
function CreepsCheckHeroAmount takes nothing returns integer
local integer i = 0
local integer k = 0
loop
exitwhen i > MAXPLAYER
if not (IsUnitType(Hero[i],UNIT_TYPE_DEAD)) and Hero[i]!= null then
set k = k + 1
endif
set i = i + 1
endloop
return k
endfunction
function CreepsRemoveUnitFromGroup takes unit creeps returns nothing
set CreepsPop = CreepsPop - 1
if IsUnitInGroup(creeps,NormalGroup) then
call GroupRemoveUnit(NormalGroup,creeps)
set NormalPop = NormalPop - 1
elseif IsUnitInGroup(creeps,RushGroup) then
call GroupRemoveUnit(RushGroup,creeps)
set RushPop = RushPop - 1
elseif IsUnitInGroup(creeps,HeroGroup) then
call GroupRemoveUnit(HeroGroup,creeps)
set HeroPop = HeroPop - 1
endif
endfunction
private function SetRandomHeroTarget takes nothing returns integer
local integer random = 0
local boolean picked = false
if HeroAlive >=1 then
loop
exitwhen picked == true
set random = GetRandomInt(0,MAXPLAYER)
if not (IsUnitType(Hero[random],UNIT_TYPE_DEAD)) and Hero[random]!=null then
set picked = true
endif
endloop
endif
return random
endfunction
private struct s_targetId
integer targetId = 0
private static method createFilter takes unit u returns boolean
return (GetOwningPlayer(u)==Player(OWNER_NORMAL) or GetOwningPlayer(u)==Player(OWNER_RUSH) or GetOwningPlayer(u)==Player(OWNER_HERO)) and not (IsUnitType(u,UNIT_TYPE_TAUREN))
endmethod
private method onCreate takes nothing returns nothing
local integer ownerId = GetPlayerId(GetOwningPlayer(me))
set CreepsPop = CreepsPop + 1
if ownerId == OWNER_NORMAL then
set NormalPop = NormalPop + 1
call GroupAddUnit(NormalGroup,me)
elseif ownerId == OWNER_RUSH then
set RushPop = RushPop + 1
call GroupAddUnit(RushGroup,me)
elseif ownerId == OWNER_HERO then
set HeroPop = HeroPop + 1
call GroupAddUnit(HeroGroup,me)
endif
if not (IsUnitType(GeneralTarget,UNIT_TYPE_DEAD)) and GeneralTarget!= null then
call IssuePointOrder(me,"attack",GetUnitX(GeneralTarget)+GetRandomReal(-500.,500.),GetUnitY(GeneralTarget)+GetRandomReal(-500.,500.))
else
if HeroAlive >=1 then
set .targetId = SetRandomHeroTarget()
call IssuePointOrder(me,"attack",GetUnitX(Hero[.targetId]),GetUnitY(Hero[.targetId]))
endif
endif
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
set .targetId = 0
endmethod
implement AutoDestroy
endstruct
function SpawnCreeps takes integer unitId,integer ownerId, real x, real y returns nothing
local unit creeps = CreateUnit(Player(ownerId),unitId,x,y,0.)
call SetUnitAbilityLevel(creeps,UP_DMG,XpAverageCoeff)
call SetUnitAbilityLevel(creeps,UP_HP,XpAverageCoeff)
set creeps = null
endfunction
function SpawnVeteranCreeps takes integer unitId,integer ownerId, real x, real y returns nothing
local unit creeps = CreateUnit(Player(ownerId),unitId,x,y,0.)
call SetUnitAbilityLevel(creeps,UP_DMG,XpAverageCoeff)
call SetUnitAbilityLevel(creeps,UP_HP,XpAverageCoeff)
call UnitAddAbility(creeps,BUFF_VETERAN)
set creeps = null
endfunction
private function SetCreepsDestination takes unit creeps returns nothing
local s_targetId dat = s_targetId[creeps]
if not (IsUnitType(GeneralTarget,UNIT_TYPE_DEAD)) and GeneralTarget!= null then
call IssuePointOrder(creeps,"attack",GetUnitX(GeneralTarget)+GetRandomReal(-500.,500.),GetUnitY(GeneralTarget)+GetRandomReal(-500.,500.))
else
if HeroAlive >=1 then
if IsUnitType(Hero[dat.targetId],UNIT_TYPE_DEAD) or Hero[dat.targetId]==null then
set dat.targetId = SetRandomHeroTarget()
endif
call IssuePointOrder(creeps,"attack",GetUnitX(Hero[dat.targetId]),GetUnitY(Hero[dat.targetId]))
endif
endif
endfunction
private struct s_update
unit creeps
group g
endstruct
private function CreepsOrderUnit takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_update dat = GetTimerData(t)
set dat.creeps = FirstOfGroup(dat.g)
if dat.creeps != null then
call SetCreepsDestination(dat.creeps)
call GroupRemoveUnit(dat.g,dat.creeps)
else
call ReleaseGroup(dat.g)
set dat.g = null
set dat.creeps = null
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function CreepsOrderPlayerGroup takes player owner returns boolean
local timer t = NewTimer()
local s_update dat = s_update.create()
set dat.g = NewGroup()
call GroupEnumUnitsOfPlayer(dat.g,owner,null)
call SetTimerData(t,dat)
call TimerStart(t,0.1,true,function CreepsOrderUnit)
return false
endfunction
private function PeriodicNormalUpdate takes nothing returns boolean
call CreepsOrderPlayerGroup(Player(OWNER_NORMAL))
return false
endfunction
private function PeriodicRushUpdate takes nothing returns boolean
call CreepsOrderPlayerGroup(Player(OWNER_RUSH))
return false
endfunction
private function PeriodicHeroUpdate takes nothing returns boolean
call CreepsOrderPlayerGroup(Player(OWNER_HERO))
return false
endfunction
private function SpawnHero takes nothing returns nothing
local integer i = 0
local integer j = 0
local integer r = 0
local real x1 = 0.
local real y1 = 0.
local real x2 = 0.
local real y2 = 0.
local real x3 = 0.
local real y3 = 0.
local real angle = 0.
local real distance = 0
if ChapterIntermission == false then
loop
exitwhen i > MAXPLAYER
if CreepsPop <= CREEPS_TOTALMAX and HeroPop <= HERO_MAX and GetRandomInt(0,100)<=REBORN_CHANCE and XpAverage >= REBORN_REQ then
call SpawnCreeps(REBORN_ID,OWNER_HERO,GetRandomReal(MapXMin,MapXMax),GetRandomReal(MapYMin,MapYMax))
endif
set j = 0
loop
exitwhen j > CREEPS_RANDOMMAX
if not (IsUnitType(Hero[i],UNIT_TYPE_DEAD)) and Hero[i]!=null and CreepsPop <= CREEPS_TOTALMAX and HeroPop <= HERO_MAX then
set angle = GetRandomReal(0,6.28)
set x1 = GetUnitX(Hero[i])
set y1 = GetUnitY(Hero[i])
set distance = GetRandomReal(RANDOMSPAWN_DISTANCEMIN,RANDOMSPAWN_DISTANCEMAX)
set x2 = CheckPointValidity(x1+distance*Cos(angle),MapXMin,MapXMax)
set y2 = CheckPointValidity(y1+distance*Sin(angle),MapYMin,MapYMax)
set r = 0
loop
exitwhen r > BaseRectMax
set x3 = CheckPointValidity(x2,BaseXMin[r],BaseXMax[r])
set y3 = CheckPointValidity(y2,BaseYMin[r],BaseYMax[r])
set x2 = x3
set y2 = y3
set r = r + 1
endloop
call SpawnCreeps(SpawnCreepsId[GetRandomInt(0,SpawnCreepsIdMax)],OWNER_RUSH,x2,y2)
endif
set j = j + 1
endloop
set i = i + 1
endloop
endif
endfunction
private function SpawnCrusher takes nothing returns nothing
local integer i = 0
loop
exitwhen i > CRUSHER_AMOUNT
if CreepsPop <= CREEPS_TOTALMAX and RushPop <= RUSH_MAX and GameMode==4 then
call SpawnCreeps(CRUSHER_ID,OWNER_RUSH,GetRandomReal(MapXMin,MapXMax),GetRandomReal(MapYMin,MapYMax))
endif
set i = i + 1
endloop
endfunction
private function SpawnRush takes nothing returns nothing
local integer i = 0
if ChapterIntermission == false then
set i = 0
if CreepsPop <= CREEPS_TOTALMAX and RushPop <= RUSH_MAX and GetRandomInt(0,100)<=EVOLVED_BUG_CHANCE and GameMode==2 then
call SpawnCreeps(EVOLVED_BUG_ID,OWNER_RUSH,GetRandomReal(MapXMin,MapXMax),GetRandomReal(MapYMin,MapYMax))
endif
if CreepsPop <= CREEPS_TOTALMAX and RushPop <= RUSH_MAX and GetRandomInt(0,100)<=HORROR_CHANCE and GameMode==2 then
call SpawnCreeps(HORROR_ID,OWNER_RUSH,GetRandomReal(MapXMin,MapXMax),GetRandomReal(MapYMin,MapYMax))
endif
call SpawnCrusher()
set i = 0
loop
exitwhen i > SpawnCreepsWaveAmount
if CreepsPop <= CREEPS_TOTALMAX and RushPop <= RUSH_MAX then
if GetRandomInt(0,100)<=THETA_CHANCE and GameMode==2 then
call SpawnCreeps(THETA_ID,OWNER_RUSH,SpawnRushX,SpawnRushY)
endif
call SpawnCreeps(SpawnRushId,OWNER_RUSH,SpawnRushX,SpawnRushY)
endif
set i = i + 1
endloop
set i = 0
loop
exitwhen i > SpawnCreepsWaveAmount
if CreepsPop <= CREEPS_TOTALMAX and RushPop <= RUSH_MAX then
call SpawnCreeps(SpawnAirId,OWNER_RUSH,GetRandomReal(MapXMin,MapXMax),GetRandomReal(MapYMin,MapYMax))
endif
set i = i + 1
endloop
endif
endfunction
private function SpawnNormal takes nothing returns nothing
local integer spawnRectIndex = 1
local integer i = 0
set SpawnCreepsAmount = CREEPS_BASE_SPAWN+PlayerAmount
set SpawnCreepsWaveAmount = SpawnCreepsAmount+CREEPS_WAVEMAXCOEFF*R2I((1+(PlayerAmount/8)))
if ChapterIntermission == false then
if GetRandomInt(0,100)<=CHANCE_AIR then
set i = 0
loop
exitwhen i > SpawnCreepsWaveAmount
if CreepsPop <= CREEPS_TOTALMAX and RushPop <= RUSH_MAX then
call SpawnCreeps(SpawnAirId,OWNER_RUSH,GetRandomReal(MapXMin,MapXMax),GetRandomReal(MapYMin,MapYMax))
endif
set i = i + 1
endloop
endif
if CreepsPop <= CREEPS_TOTALMAX and NormalPop <= NORMAL_MAX and GetRandomInt(0,100)<=WINDSTALKER_CHANCE and XpAverage >= WINDSTALKER_REQ then
call SpawnCreeps(WINDSTALKER_ID,OWNER_NORMAL,GetRandomReal(MapXMin,MapXMax),GetRandomReal(MapYMin,MapYMax))
endif
if CreepsPop <= CREEPS_TOTALMAX and RushPop <= RUSH_MAX and GetRandomInt(0,100)<=DEGENERESCENCE_CHANCE and XpAverage >= DEGENERESCENCE_REQ then
call SpawnCreeps(DEGENERESCENCE_ID,OWNER_RUSH,GetRandomReal(MapXMin,MapXMax),GetRandomReal(MapYMin,MapYMax))
endif
if CreepsPop <= CREEPS_TOTALMAX and RushPop <= RUSH_MAX and GetRandomInt(0,100)<=IMMORTAL_CHANCE and ((GameMode != 3 and XpAverage >= IMMORTAL_REQ) or (GameMode ==3)) then
call SpawnCreeps(IMMORTAL_ID,OWNER_RUSH,GetRandomReal(MapXMin,MapXMax),GetRandomReal(MapYMin,MapYMax))
endif
loop
exitwhen i > SpawnCreepsWaveAmount
set spawnRectIndex = 1
loop
exitwhen spawnRectIndex > SpawnMax
if SpawnTrue[spawnRectIndex]==true and SpawnRect[spawnRectIndex]!=null and not (SpawnCaveDestroyed[spawnRectIndex]) and SpawnX[spawnRectIndex]!=0. and SpawnY[spawnRectIndex]!=0. then
if CreepsPop <= CREEPS_TOTALMAX and NormalPop <= NORMAL_MAX then
call SpawnCreeps(SpawnCreepsId[GetRandomInt(0,SpawnCreepsIdMax)],OWNER_NORMAL,SpawnX[spawnRectIndex],SpawnY[spawnRectIndex])
endif
if CreepsPop <= CREEPS_TOTALMAX and NormalPop <= NORMAL_MAX and GetRandomInt(0,100)<XpAverageCoeff*SpecialCreepsChance[GameMode] then
call SpawnCreeps(SpawnSpecialId[GetRandomInt(0,SpawnSpecialIdMax)],OWNER_NORMAL,SpawnX[spawnRectIndex],SpawnY[spawnRectIndex])
endif
endif
set spawnRectIndex = spawnRectIndex + 1
endloop
set i = i + 1
endloop
endif
endfunction
function CreepsSpawnFirstWave takes nothing returns nothing
local integer spawnRectIndex = 1
local integer i = 0
set SpawnCreepsAmount = CREEPS_BASE_SPAWN+PlayerAmount
set SpawnCreepsWaveAmount = SpawnCreepsAmount+CREEPS_WAVEMAXCOEFF*R2I((1+(PlayerAmount/8)))
if CreepsPop <= CREEPS_TOTALMAX and NormalPop <= NORMAL_MAX and XpAverage >= DEGENERESCENCE_REQ then
call SpawnCreeps(DEGENERESCENCE_ID,OWNER_NORMAL,GetRandomReal(MapXMin,MapXMax),GetRandomReal(MapYMin,MapYMax))
endif
loop
exitwhen i > SpawnCreepsWaveAmount
set spawnRectIndex = 1
loop
exitwhen spawnRectIndex > 6
if SpawnTrue[spawnRectIndex]==true and not (SpawnCaveDestroyed[spawnRectIndex]) then
if CreepsPop <= CREEPS_TOTALMAX and NormalPop <= NORMAL_MAX then
call SpawnCreeps(SpawnCreepsId[GetRandomInt(0,SpawnCreepsIdMax)],OWNER_NORMAL,SpawnX[spawnRectIndex],SpawnY[spawnRectIndex])
endif
if CreepsPop <= CREEPS_TOTALMAX and NormalPop <= NORMAL_MAX and GetRandomInt(0,100)<XpAverageCoeff*SpecialCreepsChance[GameMode] then
call SpawnCreeps(SpawnSpecialId[GetRandomInt(0,SpawnSpecialIdMax)],OWNER_NORMAL,SpawnX[spawnRectIndex],SpawnY[spawnRectIndex])
endif
endif
set spawnRectIndex = spawnRectIndex + 1
endloop
set i = i + 1
endloop
endfunction
function CreepsResetCreepsId takes nothing returns nothing
local integer i = 0
loop
exitwhen i > SpawnCreepsIdMax
set SpawnCreepsId[i]= 0
set i = i + 1
endloop
set SpawnCreepsIdMax = 0
set i = 0
loop
exitwhen i > SpawnSpecialIdMax
set SpawnSpecialId[i]= 0
set i = i + 1
endloop
set SpawnCreepsIdMax = 0
set SpawnSpecialIdMax = 0
endfunction
function CreepsAddRushId takes integer idcreeps returns nothing
set SpawnRushId = idcreeps
endfunction
function CreepsAddAirId takes integer idcreeps returns nothing
set SpawnAirId = idcreeps
endfunction
function CreepsAddCreepsId takes integer idcreeps returns nothing
set SpawnCreepsId[SpawnCreepsIdMax] = idcreeps
set SpawnCreepsIdMax = SpawnCreepsIdMax + 1
endfunction
function CreepsAddSpecialId takes integer idcreeps returns nothing
set SpawnSpecialId[SpawnSpecialIdMax] = idcreeps
set SpawnSpecialIdMax = SpawnSpecialIdMax + 1
endfunction
function CreepsChangeTimerRate takes real whichTimeout returns nothing
set TimeOutNormal = whichTimeout
set TimeOutHero = whichTimeout
call ReleaseTimer(TimerSpawnNormal)
call ReleaseTimer(TimerSpawnHero)
set TimerSpawnNormal = NewTimer()
set TimerSpawnHero = NewTimer()
call TimerStart( TimerSpawnNormal, TimeOutNormal, true, function SpawnNormal )
call TimerStart( TimerSpawnHero, TimeOutHero, true, function SpawnHero )
endfunction
function CreepsResetSpawn takes nothing returns nothing
local integer i = 0
loop
exitwhen i > SpawnMax
set SpawnTrue[i]=false
set i = i + 1
endloop
endfunction
function CreepsAddAmount takes integer whichInteger returns nothing
set SpawnCreepsAmount = SpawnCreepsAmount + whichInteger
endfunction
private function FilterAllNormalCreeps takes nothing returns boolean
if (GetOwningPlayer(GetFilterUnit())==Player(OWNER_NORMAL) or GetOwningPlayer(GetFilterUnit())==Player(OWNER_RUSH) or GetOwningPlayer(GetFilterUnit())==Player(OWNER_HERO)) and not (IsUnitType(GetFilterUnit(),UNIT_TYPE_MECHANICAL)) and not (IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE)) then
call KillUnit(GetFilterUnit())
endif
return true
endfunction
function CreepsKillAllNormal takes nothing returns nothing
call GroupEnumUnitsInRect(ENUM_GROUP,bj_mapInitialPlayableArea,Filter(function FilterAllNormalCreeps))
set CreepsPop = 0
set NormalPop = 0
set RushPop = 0
set HeroPop = 0
endfunction
function CreepsDestroySystem takes nothing returns nothing
call ReleaseTimer(TimerSpawnNormal)
call ReleaseTimer(TimerSpawnRush)
call ReleaseTimer(TimerSpawnHero)
call DisableTrigger(Trig_UpdateRush)
call DestroyTrigger(Trig_UpdateRush)
call DisableTrigger(Trig_UpdateNormal)
call DestroyTrigger(Trig_UpdateNormal)
call DisableTrigger(Trig_UpdateHero)
call DestroyTrigger(Trig_UpdateHero)
endfunction
private function CreepsInitializeSpawns takes nothing returns boolean
local integer i = 0
set PlayerAmount = 0
set NormalGroup = NewGroup()
set RushGroup = NewGroup()
set HeroGroup = NewGroup()
loop
exitwhen i > 9
if GetPlayerSlotState(Player(i))==PLAYER_SLOT_STATE_PLAYING then
set PlayerAmount = PlayerAmount + 1
endif
set i = i + 1
endloop
set SpawnCreepsAmount = CREEPS_BASE_SPAWN+PlayerAmount
set TimerSpawnNormal = NewTimer()
set TimerSpawnRush = NewTimer()
set TimerSpawnHero = NewTimer()
call TimerStart(TimerSpawnNormal, TimeOutNormal, true, function SpawnNormal)
call TimerStart(TimerSpawnRush, TimeOutRush, true, function SpawnRush)
call TimerStart(TimerSpawnHero, TimeOutHero, true, function SpawnHero)
return false
endfunction
private function CreepsDeath takes nothing returns boolean
local player killerOwner = GetOwningPlayer(GetKillingUnit())
local integer killerOwnerId = GetPlayerId(killerOwner)
local unit victim = GetTriggerUnit()
call CreepsRemoveUnitFromGroup(GetTriggerUnit())
if GetPlayerSlotState(killerOwner)==PLAYER_SLOT_STATE_PLAYING and GetPlayerController(killerOwner) == MAP_CONTROL_USER then
set Kill[killerOwnerId]=Kill[killerOwnerId]+1
call BoardUpdateKill(killerOwner)
set SubKill[killerOwnerId] = SubKill[killerOwnerId] + 1
if SubKill[killerOwnerId] >= HeroCoeff[killerOwnerId] then
set SubKill[killerOwnerId] = 0
if XpAvailable == true then
set Xp[killerOwnerId] = Xp[killerOwnerId] + 1
set CurrentGameXp[killerOwnerId] = CurrentGameXp[killerOwnerId] + 1
endif
endif
if GetUnitAbilityLevel(victim,CHAPBOSS)>=1 then
set ChapBossKill[killerOwnerId] = ChapBossKill[killerOwnerId] + 1
//Disabled in order to prevent noob hackers to generate codes
endif
if GetUnitAbilityLevel(victim,MINIBOSS)>=1 then
set MiniBossKill[killerOwnerId] = MiniBossKill[killerOwnerId] + 1
//Disabled in order to prevent noob hackers to generate codes
endif
call CheckRank(killerOwnerId)
endif
set victim = null
set killerOwner = null
return false
endfunction
private function init takes nothing returns nothing
local integer i = 1
local trigger t1 = CreateTrigger()
local trigger t2 = CreateTrigger()
set CreepsPop = 0
set NormalPop = 0
set RushPop = 0
set HeroPop = 0
call SetSpawnVariables()
call AbilityPreload(UP_HP)
call AbilityPreload(UP_DMG)
call AbilityPreload(BUFF_VETERAN)
set CaveToDestroy = 0
set SpawnRushX = GetRectCenterX(gg_rct_SpawnRush)
set SpawnRushY = GetRectCenterY(gg_rct_SpawnRush)
loop
exitwhen i > SpawnMax
set SpawnTrue[i] = false
set SpawnX[i]=GetRectCenterX(SpawnRect[i])
set SpawnY[i]=GetRectCenterY(SpawnRect[i])
set SpawnCaveDestroyed[i]=false
if SpawnIsCave[i]==true then
set CaveToDestroy = CaveToDestroy + 1
endif
set i = i + 1
endloop
set i = 0
loop
exitwhen i > BaseRectMax
set BaseXMin[i] = GetRectMinX(BaseRect[i])
set BaseYMin[i] = GetRectMinY(BaseRect[i])
set BaseXMax[i] = GetRectMaxX(BaseRect[i])
set BaseYMax[i] = GetRectMaxY(BaseRect[i])
set i = i + 1
endloop
call TriggerRegisterPlayerUnitEvent(t1, Player(OWNER_NORMAL), EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(t1, Player(OWNER_RUSH), EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(t1, Player(OWNER_HERO), EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(t1, Condition(function CreepsDeath))
call TriggerRegisterTimerEvent(t2, WAIT,false)
call TriggerAddCondition(t2, Condition(function CreepsInitializeSpawns))
set Trig_UpdateHero = CreateTrigger()
call TriggerRegisterTimerEvent(Trig_UpdateHero, TIMEOUT_UPDATE,true)
call TriggerAddCondition(Trig_UpdateHero, Condition(function PeriodicHeroUpdate))
set Trig_UpdateNormal = CreateTrigger()
call TriggerRegisterTimerEvent(Trig_UpdateNormal, TIMEOUT_UPDATE+0.1,true)
call TriggerAddCondition(Trig_UpdateNormal, Condition(function PeriodicNormalUpdate))
set Trig_UpdateRush = CreateTrigger()
call TriggerRegisterTimerEvent(Trig_UpdateRush, TIMEOUT_UPDATE+0.2,true)
call TriggerAddCondition(Trig_UpdateRush, Condition(function PeriodicRushUpdate))
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library AlliedSpawnSystem initializer init requires TimerUtils, BoundSentinel,AbilityPreload, TextDisplay, AutoIndex
globals
boolean HostileAllied
private real TimeOutWave = 60.
constant integer ALLIED_CAN_BE_ORDERED = 'A09E'
constant integer ALLIED_WAVEMAX = 6 //Factor of spawn/wave
constant integer ALLIED_TOTALMAX = 15
private constant real TIMEOUT_UPDATE = 20.
private constant real WAIT = 5.
integer array AlliedId [10]
integer AlliedIdMax = 0
integer AlliedIdLightMax = 0
integer AlliedAmount = 0
integer AlliedWaveAmount = 0
private timer TimerWave = null
constant integer ALLIEDID = 10
integer AlliedPop = 0
private integer GroupAmount = 0
private integer GroupMax = 0
private group array PatrolGroup [10]
private group array TowerGroup [10]
private rect array PatrolRect [10][4]
private real array PatrolX [10][4]
private real array PatrolY [10][4]
private real array TowerX [10][4]
private real array TowerY [10][4]
private rect array TowerRect [10][4]
private rect array SpawnRect [10]
private rect array BaseRect [10]
private group AssautAlliedGroup
private real array BaseX [10]
private real array BaseY [10]
private real array SpawnX [10]
private real array SpawnY [10]
private constant integer PATROL_MAX = 2
private constant integer TOWER_MAX = 4
private integer AssautMax = 6
private integer TmpGroupId
endglobals
private function SetCreepsVariables takes nothing returns nothing
set AlliedId[0] = 'h003'//Npc SO
set AlliedId[1] = 'h00P'//NPC Bio
set AlliedId[2] = 'h004'//NPC FB
set AlliedId[3] = 'h00V'//NPC CF
set AlliedId[4] = 'h00O'//NPC HS
set AlliedId[5] = 'h00U'//NPC ST
set AlliedIdLightMax = 2
set AlliedIdMax = 5
endfunction
private function SetSpawnVariables takes nothing returns nothing
local integer i = 0
//1 Village
set i = i + 1
set BaseRect[i] = gg_rct_Village
set SpawnRect[i] = gg_rct_VillageSpawn
set TowerRect[i][0]= gg_rct_VillagePatrol1
set TowerRect[i][1]= gg_rct_VillagePatrol2
set TowerRect[i][2]= gg_rct_VillagePatrol3
set TowerRect[i][3]= gg_rct_VillagePatrol4
set PatrolRect[i][0]= gg_rct_VillagePatrol1
set PatrolRect[i][1]= gg_rct_VillagePatrol2
set PatrolRect[i][2]= gg_rct_VillagePatrol3
set PatrolRect[i][3]= gg_rct_VillagePatrol4
//2 External Outpost
set i = i + 1
set BaseRect[i] = gg_rct_ExternalOutpost
set SpawnRect[i] = gg_rct_ExternalOutpostSpawn
set TowerRect[i][0]= gg_rct_ExternalOutpostTower1
set TowerRect[i][1]= gg_rct_ExternalOutpostTower2
set TowerRect[i][2]= gg_rct_ExternalOutpostTower3
set TowerRect[i][3]= gg_rct_ExternalOutpostTower4
set PatrolRect[i][0]= gg_rct_ExternalOutpostPatrol1
set PatrolRect[i][1]= gg_rct_ExternalOutpostPatrol2
set PatrolRect[i][2]= gg_rct_ExternalOutpostPatrol3
set PatrolRect[i][3]= gg_rct_ExternalOutpostPatrol4
//3 Teleporter
set i = i + 1
set BaseRect[i] = gg_rct_Teleporter
set SpawnRect[i] = gg_rct_TeleporterSpawn
set TowerRect[i][0]= gg_rct_TeleporterTower1
set TowerRect[i][1]= gg_rct_TeleporterTower2
set TowerRect[i][2]= gg_rct_TeleporterTower3
set TowerRect[i][3]= gg_rct_TeleporterTower4
set PatrolRect[i][0]= gg_rct_TeleporterPatrol1
set PatrolRect[i][1]= gg_rct_TeleporterPatrol2
set PatrolRect[i][2]= gg_rct_TeleporterPatrol3
set PatrolRect[i][3]= gg_rct_TeleporterPatrol4
//4 Barracks
set i = i + 1
set BaseRect[i] = gg_rct_Barracks
set SpawnRect[i] = gg_rct_BarracksSpawn
set TowerRect[i][0]= gg_rct_BarracksTower1
set TowerRect[i][1]= gg_rct_BarracksTower2
set TowerRect[i][2]= gg_rct_BarracksTower3
set TowerRect[i][3]= gg_rct_BarracksTower4
set PatrolRect[i][0]= gg_rct_BarracksPatrol1
set PatrolRect[i][1]= gg_rct_BarracksPatrol2
set PatrolRect[i][2]= gg_rct_BarracksPatrol3
set PatrolRect[i][3]= gg_rct_BarracksPatrol4
//5 Ship Facilities
set i = i + 1
set BaseRect[i] = gg_rct_ShipFacilities
set SpawnRect[i] = gg_rct_ShipFacilitiesSpawn
set TowerRect[i][0]= gg_rct_ShipFacilitiesTower1
set TowerRect[i][1]= gg_rct_ShipFacilitiesTower2
set TowerRect[i][2]= gg_rct_ShipFacilitiesTower3
set TowerRect[i][3]= gg_rct_ShipFacilitiesTower4
set PatrolRect[i][0]= gg_rct_ShipFacilitiesPatrol1
set PatrolRect[i][1]= gg_rct_ShipFacilitiesPatrol2
set PatrolRect[i][2]= gg_rct_ShipFacilitiesPatrol3
set PatrolRect[i][3]= gg_rct_ShipFacilitiesPatrol4
//6 Airfield
set i = i + 1
set BaseRect[i] = gg_rct_AirField
set SpawnRect[i] = gg_rct_AirFieldSpawn
set TowerRect[i][0]= gg_rct_AirFieldTower1
set TowerRect[i][1]= gg_rct_AirFieldTower2
set TowerRect[i][2]= gg_rct_AirFieldTower3
set TowerRect[i][3]= gg_rct_AirFieldTower4
set PatrolRect[i][0]= gg_rct_AirFieldPatrol1
set PatrolRect[i][1]= gg_rct_AirFieldPatrol2
set PatrolRect[i][2]= gg_rct_AirFieldPatrol3
set PatrolRect[i][3]= gg_rct_AirFieldPatrol4
//7 combat engineer base
set i = i + 1
set BaseRect[i] = gg_rct_CommandCenter
set SpawnRect[i] = gg_rct_CommandCenterSpawn
set TowerRect[i][0]= gg_rct_CommandCenterTower1
set TowerRect[i][1]= gg_rct_CommandCenterTower2
set TowerRect[i][2]= gg_rct_CommandCenterTower3
set TowerRect[i][3]= gg_rct_CommandCenterTower4
set PatrolRect[i][0]= gg_rct_CommandCenterPatrol1
set PatrolRect[i][1]= gg_rct_CommandCenterPatrol2
set PatrolRect[i][2]= gg_rct_CommandCenterPatrol3
set PatrolRect[i][3]= gg_rct_CommandCenterPatrol4
//8 town
set i = i + 1
set BaseRect[i] = gg_rct_Town
set SpawnRect[i] = gg_rct_TownSpawn
set TowerRect[i][0]= gg_rct_TownPatrol1
set TowerRect[i][1]= gg_rct_TownPatrol2
set TowerRect[i][2]= gg_rct_TownPatrol3
set TowerRect[i][3]= gg_rct_TownPatrol4
set PatrolRect[i][0]= gg_rct_TownPatrol1
set PatrolRect[i][1]= gg_rct_TownPatrol2
set PatrolRect[i][2]= gg_rct_TownPatrol3
set PatrolRect[i][3]= gg_rct_TownPatrol4
set GroupMax = i
endfunction
function AlliedSetHostile takes nothing returns nothing
local integer i = 0
set HostileAllied = true
loop
exitwhen i > MAXPLAYER
call SetPlayerAllianceStateBJ(Player(i),Player(ALLIEDID),bj_ALLIANCE_UNALLIED)
call SetPlayerAllianceStateBJ(Player(ALLIEDID),Player(i),bj_ALLIANCE_UNALLIED)
set i = i + 1
endloop
endfunction
private struct s_groupId
integer groupId = 0
private static method createFilter takes unit u returns boolean
return GetOwningPlayer(u)==Player(ALLIEDID) and GetUnitAbilityLevel(u,QUESTUNIT)<=0
endmethod
private method onCreate takes nothing returns nothing
set .groupId = 0
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
set .groupId = 0
endmethod
implement AutoDestroy
endstruct
private function SetGroupId takes unit whichUnit, integer groupId returns nothing
local s_groupId dat = s_groupId[whichUnit]
set dat.groupId = groupId
endfunction
private function GetGroupId takes unit whichUnit returns integer
local s_groupId dat = s_groupId[whichUnit]
return dat.groupId
endfunction
private function CountLivingUnit takes nothing returns nothing
if not (IsUnitType(GetEnumUnit(),UNIT_TYPE_DEAD)) then
set GroupAmount = GroupAmount + 1
endif
endfunction
private function GetGroupAmount takes group whichGroup returns integer
set GroupAmount = 0
call ForGroup(whichGroup, function CountLivingUnit)
return GroupAmount
endfunction
function AlliedSetAssautMax takes integer whichAmount returns nothing
set AssautMax = whichAmount
endfunction
private function SetAssautDestination takes nothing returns nothing
if not (IsUnitType(GeneralTarget,UNIT_TYPE_DEAD)) and GeneralTarget!= null then
call IssuePointOrder(GetEnumUnit(),"attack",GetUnitX(GeneralTarget)+GetRandomReal(-500.,500.),GetUnitY(GeneralTarget)+GetRandomReal(-500.,500.))
else
call IssuePointOrder(GetEnumUnit(),"attack",GetRandomReal(MapXMin,MapXMax),GetRandomReal(MapYMin,MapYMax))
endif
endfunction
private function PeriodicAlliedUpdate takes nothing returns boolean
call ForGroup(AssautAlliedGroup,function SetAssautDestination)
return false
endfunction
private function SwitchToAssaut takes nothing returns nothing
local unit whichUnit = GetEnumUnit()
local integer assautCount = CountUnitsInGroup(AssautAlliedGroup)
local integer groupId = GetGroupId(whichUnit)
if IsUnitInGroup(whichUnit,PatrolGroup[groupId]) then
call GroupRemoveUnit(PatrolGroup[groupId],whichUnit)
if assautCount<AssautMax and AlliedPop<ALLIED_TOTALMAX then
call GroupAddUnit(AssautAlliedGroup,whichUnit)
else
call UnitAddAbility(whichUnit,LASTQUESTUNIT_SPELL)
call IssuePointOrder(whichUnit,LASTQUESTUNIT_ORDER,GetRectCenterX(gg_rct_LastQuest),GetRectCenterY(gg_rct_LastQuest))
endif
elseif IsUnitInGroup(whichUnit,TowerGroup[groupId]) then
call GroupRemoveUnit(TowerGroup[groupId],whichUnit)
if assautCount<AssautMax and AlliedPop<ALLIED_TOTALMAX then
call GroupAddUnit(AssautAlliedGroup,whichUnit)
else
call UnitAddAbility(whichUnit,LASTQUESTUNIT_SPELL)
call IssuePointOrder(whichUnit,LASTQUESTUNIT_ORDER,GetRectCenterX(gg_rct_LastQuest),GetRectCenterY(gg_rct_LastQuest))
endif
endif
set whichUnit = null
endfunction
function SwitchPatrolToAssaut takes integer groupId returns nothing
call ForGroup(PatrolGroup[groupId],function SwitchToAssaut)
endfunction
function SwitchTowerToAssaut takes integer groupId returns nothing
call ForGroup(TowerGroup[groupId],function SwitchToAssaut)
endfunction
function SwitchUnitToAssautGroup takes unit whichUnit returns nothing
local integer assautCount = CountUnitsInGroup(AssautAlliedGroup)
local integer groupId = GetGroupId(whichUnit)
if assautCount<AssautMax and AlliedPop<ALLIED_TOTALMAX then
call GroupAddUnit(AssautAlliedGroup,whichUnit)
else
call UnitAddAbility(whichUnit,LASTQUESTUNIT_SPELL)
call IssuePointOrder(whichUnit,LASTQUESTUNIT_ORDER,GetRectCenterX(gg_rct_LastQuest),GetRectCenterY(gg_rct_LastQuest))
endif
endfunction
function AddUnitToAssautGroup takes integer unitId, real x, real y returns nothing
local unit allied = CreateUnit(Player(ALLIEDID),unitId,x,y,0.)
call IssuePointOrder(allied,"attack",GetUnitX(GeneralTarget),GetUnitY(GeneralTarget))
call SwitchUnitToAssautGroup(allied)
set allied = null
endfunction
private function UpdatePatrolGroup takes nothing returns nothing
local integer random = GetRandomInt(0,3)
call IssuePointOrder(GetEnumUnit(),"patrol",PatrolX[TmpGroupId][random],PatrolY[TmpGroupId][random])
endfunction
private function UpdateTowerGroup takes nothing returns nothing
local integer random = GetRandomInt(0,3)
local unit allied = GetEnumUnit()
call IssuePointOrder(GetEnumUnit(),"move",TowerX[TmpGroupId][random],TowerY[TmpGroupId][random])
endfunction
function BaseUpdateGroup takes integer groupId returns nothing
set TmpGroupId = groupId
call ForGroup(PatrolGroup[groupId], function UpdatePatrolGroup)
call ForGroup(TowerGroup[groupId], function UpdateTowerGroup)
endfunction
function UpdateTowerRect takes integer groupId, integer rectId, rect whichRect returns nothing
set TowerRect[groupId][rectId] = whichRect
set TowerX[groupId][rectId] = GetRectCenterX(whichRect)
set TowerY[groupId][rectId] = GetRectCenterY(whichRect)
endfunction
function UpdatePatrolRect takes integer groupId, integer rectId, rect whichRect returns nothing
set PatrolRect[groupId][rectId] = whichRect
set PatrolX[groupId][rectId] = GetRectCenterX(whichRect)
set PatrolY[groupId][rectId] = GetRectCenterY(whichRect)
endfunction
function UpdateBaseRect takes integer groupId, rect whichRect returns nothing
set BaseRect[groupId] = whichRect
set BaseX[groupId] = GetRectCenterX(whichRect)
set BaseY[groupId] = GetRectCenterY(whichRect)
endfunction
function UpdateSpawnRect takes integer groupId, rect whichRect returns nothing
set SpawnRect[groupId] = whichRect
set SpawnX[groupId] = GetRectCenterX(whichRect)
set SpawnY[groupId] = GetRectCenterY(whichRect)
endfunction
function AlliedAddUnitToPatrolGroupForced takes integer whichUnitId, integer groupId, real x, real y returns nothing
local integer random = GetRandomInt(0,3)
local unit allied = CreateUnit(Player(ALLIEDID),whichUnitId,x,y,0.)
call GroupAddUnit(PatrolGroup[groupId],allied)
call SetGroupId(allied,groupId)
call IssuePointOrder(allied,"patrol",PatrolX[groupId][random],PatrolY[groupId][random])
set allied = null
endfunction
function AlliedAddUnitToPatrolGroup takes integer whichUnitId, integer groupId returns nothing
local integer random = GetRandomInt(0,3)
local unit allied = CreateUnit(Player(ALLIEDID),whichUnitId,SpawnX[groupId]+GetRandomReal(-500.,500),SpawnY[groupId]+GetRandomReal(-500.,500),0.)
call GroupAddUnit(PatrolGroup[groupId],allied)
call SetGroupId(allied,groupId)
call IssuePointOrder(allied,"patrol",PatrolX[groupId][random],PatrolY[groupId][random])
set allied = null
endfunction
function AlliedAddUnitToTowerGroup takes integer whichUnitId, integer groupId returns nothing
local integer random = GetRandomInt(0,3)
local unit allied = CreateUnit(Player(ALLIEDID),whichUnitId,SpawnX[groupId]+GetRandomReal(-500.,500),SpawnY[groupId]+GetRandomReal(-500.,500),0.)
call GroupAddUnit(TowerGroup[groupId],allied)
call SetGroupId(allied,groupId)
call IssuePointOrder(allied,"move",TowerX[groupId][random],TowerY[groupId][random])
set allied = null
endfunction
private function ChangeCampOwner takes nothing returns boolean
if GetOwningPlayer(GetFilterUnit())==Player(PLAYER_NEUTRAL_PASSIVE) then
call SetUnitOwner(GetFilterUnit(),Player(ALLIEDID),TRUE)
endif
return true
endfunction
private function UpdateWave takes nothing returns nothing
local integer k = 0
local integer i = 0
local integer count = 0
if GameMode ==1 or GameMode == 2 then
set AlliedWaveAmount = AlliedAmount+ALLIED_WAVEMAX*R2I((1+(PlayerAmount/32)))
loop
exitwhen i > AlliedWaveAmount
if AlliedPop <= ALLIED_TOTALMAX and i < AssautMax then
call AddUnitToAssautGroup(AlliedId[GetRandomInt(0,AlliedIdMax)],GetRectCenterX(gg_rct_SpawnAllied),GetRectCenterY(gg_rct_SpawnAllied)+GetRandomReal(-500.,500))
endif
set i = i + 1
endloop
endif
endfunction
private function AlliedEnterMap takes nothing returns boolean
if GetOwningPlayer(GetTriggerUnit()) == Player(ALLIEDID) then
set AlliedPop = AlliedPop + 1
endif
return false
endfunction
private function AlliedDeath takes nothing returns boolean
local unit victim = GetTriggerUnit()
local integer groupId = GetGroupId(victim)
set AlliedPop = AlliedPop - 1
if IsUnitInGroup(victim,PatrolGroup[groupId]) then
call GroupRemoveUnit(PatrolGroup[groupId],victim)
elseif IsUnitInGroup(victim,TowerGroup[groupId]) then
call GroupRemoveUnit(TowerGroup[groupId],victim)
endif
set victim = null
return false
endfunction
private function SetGroupOrder takes nothing returns boolean
local unit allied = GetTriggerUnit()
local integer random = GetRandomInt(0,3)
local integer groupId = GetGroupId(allied)
if groupId != 0 then
if IsUnitInGroup(allied,PatrolGroup[groupId]) then
call IssuePointOrder(allied,"patrol",PatrolX[groupId][random],PatrolY[groupId][random])
elseif IsUnitInGroup(allied,TowerGroup[groupId]) then
call IssuePointOrder(allied,"move",TowerX[groupId][random],TowerY[groupId][random])
endif
endif
set allied = null
return false
endfunction
private function PathForNormalGame takes nothing returns nothing
local trigger t = CreateTrigger()
local integer i = 1
local integer j = 0
set AssautAlliedGroup = NewGroup()
loop
exitwhen i > GroupMax
set PatrolGroup[i] = NewGroup()
set TowerGroup[i] = NewGroup()
set BaseX[i] = GetRectCenterX(BaseRect[i])
set BaseY[i] = GetRectCenterY(BaseRect[i])
set SpawnX[i] = GetRectCenterX(SpawnRect[i])
set SpawnY[i] = GetRectCenterY(SpawnRect[i])
set j = 0
loop
exitwhen j > 4
call TriggerRegisterEnterRectSimple(t, TowerRect[i][j])
call TriggerRegisterEnterRectSimple(t, PatrolRect[i][j])
set TowerX[i][j] = GetRectCenterX(TowerRect[i][j])
set TowerY[i][j] = GetRectCenterY(TowerRect[i][j])
set PatrolX[i][j] = GetRectCenterX(PatrolRect[i][j])
set PatrolY[i][j] = GetRectCenterY(PatrolRect[i][j])
set j = j + 1
endloop
set i = i + 1
endloop
call TriggerAddCondition(t, Condition(function SetGroupOrder))
endfunction
private function InitializeSpawns takes nothing returns boolean
local integer i = 0
set PlayerAmount = 0
call PathForNormalGame()
loop
exitwhen i > 9
if GetPlayerSlotState(Player(i))==PLAYER_SLOT_STATE_PLAYING then
set PlayerAmount = PlayerAmount + 1
endif
set i = i + 1
endloop
set TimeOutWave = 60.
set TimerWave = NewTimer()
call TimerStart(TimerWave, TimeOutWave, true, function UpdateWave)
return false
endfunction
private function init takes nothing returns nothing
local integer i = 1
local trigger t1 = CreateTrigger()
local trigger t2 = CreateTrigger()
local trigger t3 = CreateTrigger()
local trigger t4 = CreateTrigger()
set HostileAllied = false
set AlliedPop = 0
call SetSpawnVariables()
call SetCreepsVariables()
call TriggerRegisterTimerEventSingle( t1,WAIT)
call TriggerAddCondition(t1, Condition(function InitializeSpawns))
call TriggerRegisterEnterRectSimple(t2, bj_mapInitialPlayableArea)
call TriggerAddCondition(t2, Condition(function AlliedEnterMap))
call TriggerRegisterPlayerUnitEvent(t3, Player(ALLIEDID), EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(t3, Condition(function AlliedDeath))
call TriggerRegisterTimerEvent(t4, TIMEOUT_UPDATE,true)
call TriggerAddCondition(t4, Condition(function PeriodicAlliedUpdate))
endfunction
endlibrary
//TESH.scrollpos=6
//TESH.alwaysfold=0
scope ActivateAi initializer init
globals
constant string ACTIVATE_AI_ORDER = "phoenixmorph"
constant integer AI_ON = 'A02V'
constant integer AI_OFF = 'A002'
constant integer AI_ENABLED = 'A002'
endglobals
private function Activate takes nothing returns nothing
if GetUnitAbilityLevel(SpellEvent.CastingUnit,AI_ON)>=1 then
call UnitRemoveAbility(SpellEvent.CastingUnit,AI_ON)
endif
if GetUnitAbilityLevel(SpellEvent.CastingUnit,AI_OFF)<=1 then
call UnitAddAbility(SpellEvent.CastingUnit,AI_OFF)
endif
call IndieSummon_SetMaster(SpellEvent.CastingUnit,Hero[GetPlayerId(GetOwningPlayer(SpellEvent.CastingUnit))])
endfunction
private function Disactivate takes nothing returns nothing
if GetUnitAbilityLevel(SpellEvent.CastingUnit,AI_OFF)>=1 then
call UnitRemoveAbility(SpellEvent.CastingUnit,AI_OFF)
endif
if GetUnitAbilityLevel(SpellEvent.CastingUnit,AI_ON)<=1 then
call UnitAddAbility(SpellEvent.CastingUnit,AI_ON)
endif
endfunction
public function init takes nothing returns nothing
call AbilityPreload(AI_ON)
call AbilityPreload(AI_OFF)
call RegisterSpellFinishResponse(AI_ON, Activate)
call RegisterSpellFinishResponse(AI_OFF, Disactivate)
endfunction
endscope
//TESH.scrollpos=130
//TESH.alwaysfold=0
scope TowerSystem initializer init
globals
private constant integer BONUS_SIGHT = 'A07J'
private constant integer BONUS_DEF = 'A06U'
private constant real RANGE = 100.
private constant real HEIGHT = 350.
private constant real WAIT = 0.5
private constant integer DUMMY_ID = 'o000' //On tower death, AOE stun
private constant real DUR = 2.
private constant real DMG = 100. //On tower death, AOE dmg
private constant integer TOWER1 = 'h00S'//NPC
private constant integer TOWER2 = 'h01K'//Combat Engineer
endglobals
private function RemoveTowerBonus takes nothing returns boolean
local unit target = GetFilterUnit()
if GetOwningPlayer(target)!=Player(11) and not (IsUnitType(target,UNIT_TYPE_MECHANICAL)) then
call SetUnitFlyHeight(target,0,0.)
call UnitRemoveAbility(target,BONUS_SIGHT)
call UnitRemoveAbility(target,BONUS_DEF)
call SetUnitPathing(target,true)
endif
set target = null
return true
endfunction
private function Leave takes nothing returns boolean
local unit leaver = GetTriggerUnit()
if GetOwningPlayer(leaver)!=Player(11) and not (IsUnitType(leaver,UNIT_TYPE_MECHANICAL)) then
call SetUnitFlyHeight(leaver,0,0.)
call UnitRemoveAbility(leaver,BONUS_SIGHT)
call UnitRemoveAbility(leaver,BONUS_DEF)
call SetUnitPathing(leaver,true)
set leaver = null
endif
return false
endfunction
private function Enter takes nothing returns boolean
local unit entering = GetTriggerUnit()
if GetOwningPlayer(entering)!=Player(11) and not (IsUnitType(entering,UNIT_TYPE_MECHANICAL)) then
call SetUnitPathing(entering,false)
call SetUnitFlyHeight(entering,HEIGHT,0.)
call UnitAddAbility(entering,BONUS_SIGHT)
call UnitAddAbility(entering,BONUS_DEF)
endif
set entering = null
return false
endfunction
private struct s_TowerSystem
trigger enter = null
trigger leave = null
rect re = null
implement AutoData
private static method createFilter takes unit u returns boolean
return GetUnitTypeId(u)==TOWER1 or GetUnitTypeId(u)==TOWER2
endmethod
private method onCreate takes nothing returns nothing
local real x = GetUnitX(me)
local real y = GetUnitY(me)
call SetUnitPathing(me,false)
set .re = Rect(x-RANGE,y-RANGE,x+RANGE,y+RANGE)
set .enter = CreateTrigger()
call TriggerRegisterEnterRectSimple(.enter,.re )
call TriggerAddCondition(.enter, Condition(function Enter))
set .leave = CreateTrigger()
call TriggerRegisterLeaveRectSimple(.leave,.re )
call TriggerAddCondition(.leave, Condition(function Leave))
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
set .re = null
set .enter = null
set .leave = null
endmethod
implement AutoDestroy
endstruct
private function InitializeTower takes unit tower returns nothing
local s_TowerSystem this = s_TowerSystem[tower]
local real x = GetUnitX(tower)
local real y = GetUnitY(tower)
call SetUnitPathing(tower,false)
if this.re == null then
set this.re = Rect(x-RANGE,y-RANGE,x+RANGE,y+RANGE)
endif
if this.enter == null then
set this.enter = CreateTrigger()
call TriggerRegisterEnterRectSimple(this.enter,this.re )
call TriggerAddCondition(this.enter, Condition(function Enter))
endif
if this.leave == null then
set this.leave = CreateTrigger()
call TriggerRegisterLeaveRectSimple(this.leave,this.re )
call TriggerAddCondition(this.leave, Condition(function Leave))
endif
endfunction
private function ReleaseTower takes unit tower returns nothing
local s_TowerSystem this = s_TowerSystem[tower]
local real x = GetRectCenterX(this.re)
local real y = GetRectCenterY(this.re)
set this.re = Rect(x-(RANGE+50),y-(RANGE+50),x+(RANGE+50),y+(RANGE+50))
call GroupEnumUnitsInRect(ENUM_GROUP,this.re,Filter(function RemoveTowerBonus))
call UnitApplyTimedLife(CreateUnit(Player(PLAYER_NEUTRAL_AGGRESSIVE),DUMMY_ID,x,y,0.),'BTLF',DUR)
call UnitDamageAll(tower,false,2*RANGE,x,y,DMG,DMG_ENERGETIC,false,0,0,0)
call RemoveRect(this.re)
call DisableTrigger(this.enter)
call DestroyTrigger(this.enter)
set this.enter = null
call DisableTrigger(this.leave)
call DestroyTrigger(this.leave)
set this.leave = null
endfunction
private function TowerDeath takes nothing returns boolean
if GetUnitTypeId(GetTriggerUnit())==TOWER1 or GetUnitTypeId(GetTriggerUnit())==TOWER2 then
call ReleaseTower(GetTriggerUnit())
endif
return false
endfunction
private function TowerConstructed takes nothing returns boolean
if GetUnitTypeId(GetTriggerUnit())==TOWER1 or GetUnitTypeId(GetTriggerUnit())==TOWER2 then
call InitializeTower(GetTriggerUnit())
endif
return false
endfunction
private function FilterTower takes nothing returns boolean
if GetUnitTypeId(GetTriggerUnit())==TOWER1 or GetUnitTypeId(GetTriggerUnit())==TOWER2 then
call InitializeTower(GetFilterUnit())
endif
return true
endfunction
private function TowerAlreadyOnMap takes nothing returns boolean
call GroupEnumUnitsInRect(ENUM_GROUP,bj_mapInitialPlayableArea, Filter(function FilterTower))
return false
endfunction
public function init takes nothing returns nothing
local trigger t = CreateTrigger()
call AbilityPreload(BONUS_SIGHT)
call AbilityPreload(BONUS_DEF)
call RegisterAnyUnitEvent(EVENT_PLAYER_UNIT_DEATH,function TowerDeath)
call RegisterAnyUnitEvent(EVENT_PLAYER_UNIT_UPGRADE_FINISH,function TowerConstructed)
call TriggerRegisterTimerEvent(t, WAIT,false)
call TriggerAddCondition(t, Condition(function TowerAlreadyOnMap))
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
library AdrenalineNPC needs AutoIndex
globals
private constant integer SPELL = 'A0FX'
private constant string SPELL_ORDER = "divineshied"
private constant real LIFE_PERCENT = 0.25
endglobals
private function UnitAttacked takes nothing returns boolean
local unit whichUnit = GetTriggerUnit()
if (GetUnitAbilityLevel(whichUnit,AI_ENABLED)>=1 or GetOwningPlayer(whichUnit)==Player(10)) and GetUnitAbilityLevel(whichUnit,LASTQUESTUNIT_SPELL)<=0 and GetUnitState(whichUnit,UNIT_STATE_LIFE)<LIFE_PERCENT*GetUnitState(whichUnit,UNIT_STATE_MAX_LIFE) then
call IssueImmediateOrder(whichUnit,SPELL_ORDER)
endif
set whichUnit = null
return false
endfunction
private struct str
trigger trig
private static method createFilter takes unit u returns boolean
return GetUnitAbilityLevel(u,SPELL)>=1
endmethod
private method onCreate takes nothing returns nothing
set .trig = CreateTrigger()
call TriggerRegisterUnitEvent(.trig,me,EVENT_UNIT_ATTACKED)
call TriggerAddCondition(.trig,Condition(function UnitAttacked))
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
call DisableTrigger(.trig)
call DestroyTrigger(.trig)
set .trig = null
endmethod
implement AutoDestroy
endstruct
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library AnomalyNPC needs AutoIndex
globals
private constant integer SPELL = 'A0FY'
private constant string SPELL_ORDER = "grabtree"
private constant integer CHANCE = 25
endglobals
private function UnitAttacked takes nothing returns boolean
local unit whichUnit = GetTriggerUnit()
if (GetUnitAbilityLevel(whichUnit,AI_ENABLED)>=1 or GetOwningPlayer(whichUnit)==Player(10)) and GetUnitAbilityLevel(whichUnit,LASTQUESTUNIT_SPELL)<=0 and GetRandomInt(0,100)<=CHANCE then
call IssueImmediateOrder(whichUnit,SPELL_ORDER)
endif
set whichUnit = null
return false
endfunction
private struct str
trigger trig
private static method createFilter takes unit u returns boolean
return GetUnitAbilityLevel(u,SPELL)>=1
endmethod
private method onCreate takes nothing returns nothing
set .trig = CreateTrigger()
call TriggerRegisterUnitEvent(.trig,me,EVENT_UNIT_ATTACKED)
call TriggerAddCondition(.trig,Condition(function UnitAttacked))
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
call DisableTrigger(.trig)
call DestroyTrigger(.trig)
set .trig = null
endmethod
implement AutoDestroy
endstruct
endlibrary
//TESH.scrollpos=64
//TESH.alwaysfold=0
library AvoidJumpCreeps needs AutoIndex, TimerUtils,BuffSystem
globals
private constant integer SPELL = 'A0AA'
private constant real LIFE_PERCENT = 0.25
private constant real IMP = 0.60
private constant integer SPEED = 20
private constant string ANIM = "Spell Third"
private constant real DISTANCE = 300.
endglobals
private struct s_update
unit caster
real angle
integer distance
integer i
integer deltaZ
endstruct
private function Update takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_update dat = GetTimerData(t)
local real newX = GetUnitX(dat.caster) + SPEED*Cos(dat.angle)
local real newY = GetUnitY(dat.caster) + SPEED*Sin(dat.angle)
local real z = GetUnitFlyHeight(dat.caster)
local real newz = 0.
if dat.i < dat.distance then
set dat.i = dat.i + 1
call SetUnitX(dat.caster, newX)
call SetUnitY(dat.caster, newY)
if dat.i < (dat.distance * 0.5) then
set newz = z + (dat.distance * IMP)
else
set newz = z - (dat.distance * IMP)
endif
call SetUnitFlyHeight(dat.caster, newz, 0.00)
else
call SetUnitPathing( dat.caster, true)
call SetUnitAnimation(dat.caster, "Stand")
if dat.deltaZ > 1 then
call UnitAddBuffFract(dat.caster)
endif
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function StartAvoidJump takes unit whichUnit returns nothing
local timer t = NewTimer()
local s_update dat = s_update.create()
local real x1 = GetUnitX(whichUnit)
local real y1 = GetUnitY(whichUnit)
local real x2 = CheckPointValidity(x1 - DISTANCE*Cos(GetUnitFacing(whichUnit)* bj_DEGTORAD),MapXMin,MapXMax)
local real y2 = CheckPointValidity(y1 - DISTANCE*Sin(GetUnitFacing(whichUnit)* bj_DEGTORAD) ,MapYMin,MapYMax)
set dat.deltaZ = GetTerrainCliffLevel(x1,y1)-GetTerrainCliffLevel(x2,y2)
if dat.deltaZ >= 0 then
set dat.caster = whichUnit
set dat.angle = Atan2((y2 -y1), (x2 - x1))
set dat.distance = R2I(SquareRoot((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)))/SPEED
set dat.i = 0
call SetUnitPathing( dat.caster, false)
call SetUnitAnimation(dat.caster,ANIM)
call SetTimerData(t, dat)
call TimerStart (t, TIMEOUT, true, function Update )
else
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function UnitAttacked takes nothing returns boolean
local unit whichUnit = GetTriggerUnit()
if (GetUnitAbilityLevel(whichUnit,AI_ENABLED)>=1 or GetOwningPlayer(whichUnit)==Player(10)) and GetUnitAbilityLevel(whichUnit,LASTQUESTUNIT_SPELL)<=0 then
if GetUnitState(whichUnit,UNIT_STATE_LIFE)<=LIFE_PERCENT*GetUnitState(whichUnit,UNIT_STATE_MAX_LIFE) then
call StartAvoidJump(whichUnit)
endif
endif
set whichUnit = null
return false
endfunction
private struct str
trigger trig
private static method createFilter takes unit u returns boolean
return GetUnitAbilityLevel(u,SPELL)>=1
endmethod
private method onCreate takes nothing returns nothing
set .trig = CreateTrigger()
call TriggerRegisterUnitEvent(.trig,me,EVENT_UNIT_ATTACKED)
call TriggerAddCondition(.trig,Condition(function UnitAttacked))
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
call DisableTrigger(.trig)
call DestroyTrigger(.trig)
set .trig = null
endmethod
implement AutoDestroy
endstruct
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library BattleRoarNPCS needs AutoIndex,TimerUtils,GroupUtils
globals
private constant integer SPELL = 'A0FU'
private constant string SPELL_ORDER = "roar"
private constant integer CHANCE = 25
private constant real TIMEOUT_CHECK = 10.
private constant real AOE = 700.
private unit Caster
endglobals
private struct s_check
unit caster
endstruct
private function CheckEnemies takes nothing returns boolean
local unit target = GetFilterUnit()
if IsUnitEnemy(Caster,GetOwningPlayer(target))==true and IsUnitType(target,UNIT_TYPE_MECHANICAL) then
call IssueImmediateOrder(Caster,SPELL_ORDER)
endif
set target = null
return true
endfunction
private function UpdateCheck takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_check dat = GetTimerData(t)
if dat.caster!= null and not (IsUnitType(dat.caster,UNIT_TYPE_DEAD)) then
set Caster = dat.caster
call GroupEnumUnitsInRange(ENUM_GROUP,GetUnitX(dat.caster),GetUnitY(dat.caster),AOE,Filter(function CheckEnemies))
else
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function StartCheck takes unit caster returns nothing
local timer t = NewTimer()
local s_check dat = s_check.create()
set dat.caster = caster
call SetTimerData(t,dat)
call TimerStart(t,TIMEOUT_CHECK,true,function UpdateCheck)
endfunction
private function UnitAttacked takes nothing returns boolean
local unit whichUnit = GetTriggerUnit()
if (GetUnitAbilityLevel(whichUnit,AI_ENABLED)>=1 or GetOwningPlayer(whichUnit)==Player(10)) and GetUnitAbilityLevel(whichUnit,LASTQUESTUNIT_SPELL)<=0 and GetRandomInt(0,100)<=CHANCE then
call IssueImmediateOrder(Caster,SPELL_ORDER)
endif
set whichUnit = null
return false
endfunction
private struct str
trigger trig
private static method createFilter takes unit u returns boolean
return GetUnitAbilityLevel(u,SPELL)>=1
endmethod
private method onCreate takes nothing returns nothing
set .trig = CreateTrigger()
call TriggerRegisterUnitEvent(.trig,me,EVENT_UNIT_ATTACKED)
call TriggerAddCondition(.trig,Condition(function UnitAttacked))
call StartCheck(me)
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
call DisableTrigger(.trig)
call DestroyTrigger(.trig)
set .trig = null
endmethod
implement AutoDestroy
endstruct
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library NPCBurstFire needs AutoIndex
globals
private constant integer SPELL = 'A08H'
private constant string SPELL_ORDER = "breathoffire"
private constant integer CHANCE = 25
endglobals
private function UnitAttacked takes nothing returns boolean
local unit whichUnit = GetTriggerUnit()
local unit attacker = GetAttacker()
if (GetUnitAbilityLevel(whichUnit,AI_ENABLED)>=1 or GetOwningPlayer(whichUnit)==Player(10)) and GetUnitAbilityLevel(whichUnit,LASTQUESTUNIT_SPELL)<=0 and GetRandomInt(0,100)<=CHANCE then
call IssuePointOrder(whichUnit,SPELL_ORDER,GetUnitX(attacker),GetUnitY(attacker))
endif
set whichUnit = null
set attacker = null
return false
endfunction
private struct str
trigger trig
private static method createFilter takes unit u returns boolean
return GetUnitAbilityLevel(u,SPELL)>=1
endmethod
private method onCreate takes nothing returns nothing
set .trig = CreateTrigger()
call TriggerRegisterUnitEvent(.trig,me,EVENT_UNIT_ATTACKED)
call TriggerAddCondition(.trig,Condition(function UnitAttacked))
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
call DisableTrigger(.trig)
call DestroyTrigger(.trig)
set .trig = null
endmethod
implement AutoDestroy
endstruct
endlibrary
//TESH.scrollpos=15
//TESH.alwaysfold=0
library NPCCharge needs AutoIndex
globals
private constant integer SPELL = 'A0G4'
private constant string ORDER = "summonwareagle"
private constant integer CHANCE = 25
endglobals
private function Attacked takes nothing returns boolean
local unit whichUnit = GetTriggerUnit()
local unit attacker = GetAttacker()
if (GetUnitAbilityLevel(whichUnit,AI_ENABLED)>=1 or GetOwningPlayer(whichUnit)==Player(10)) and GetUnitAbilityLevel(whichUnit,LASTQUESTUNIT_SPELL)<=0 then
if GetRandomInt(0,100)<=CHANCE then
call IssueTargetOrder(whichUnit,ORDER,attacker)
endif
endif
set whichUnit = null
set attacker = null
return false
endfunction
private struct str
trigger trig
private static method createFilter takes unit u returns boolean
return GetUnitAbilityLevel(u,SPELL)>=1
endmethod
private method onCreate takes nothing returns nothing
set .trig = CreateTrigger()
call TriggerRegisterUnitEvent(.trig,me,EVENT_UNIT_ATTACKED)
call TriggerAddCondition(.trig,Condition(function Attacked))
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
call DisableTrigger(.trig)
call DestroyTrigger(.trig)
set .trig = null
endmethod
implement AutoDestroy
endstruct
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library NPCDefensiveStance needs AutoIndex
globals
private constant integer SPELL = 'A0G6'
private constant string SPELL_ORDER = "spiritwolf"
private constant integer CHANCE = 15
endglobals
private function UnitAttacked takes nothing returns boolean
local unit whichUnit = GetTriggerUnit()
if (GetUnitAbilityLevel(whichUnit,AI_ENABLED)>=1 or GetOwningPlayer(whichUnit)==Player(10)) and GetUnitAbilityLevel(whichUnit,LASTQUESTUNIT_SPELL)<=0 and GetRandomInt(0,100)<=CHANCE then
call IssueImmediateOrder(whichUnit,SPELL_ORDER)
endif
set whichUnit = null
return false
endfunction
private struct str
trigger trig
private static method createFilter takes unit u returns boolean
return GetUnitAbilityLevel(u,SPELL)>=1
endmethod
private method onCreate takes nothing returns nothing
set .trig = CreateTrigger()
call TriggerRegisterUnitEvent(.trig,me,EVENT_UNIT_ATTACKED)
call TriggerAddCondition(.trig,Condition(function UnitAttacked))
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
call DisableTrigger(.trig)
call DestroyTrigger(.trig)
set .trig = null
endmethod
implement AutoDestroy
endstruct
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library NPCDiscFliush needs AutoIndex
globals
private constant integer SPELL = 'A0FV'
private constant string ORDER = "forceofnature"
private constant integer CHANCE = 25
endglobals
private function Attacked takes nothing returns boolean
local unit whichUnit = GetTriggerUnit()
local unit attacker = GetAttacker()
if (GetUnitAbilityLevel(whichUnit,AI_ENABLED)>=1 or GetOwningPlayer(whichUnit)==Player(10)) and GetUnitAbilityLevel(whichUnit,LASTQUESTUNIT_SPELL)<=0 then
if GetRandomInt(0,100)<=CHANCE then
call IssueTargetOrder(whichUnit,ORDER,attacker)
endif
endif
set whichUnit = null
set attacker = null
return false
endfunction
private struct str
trigger trig
private static method createFilter takes unit u returns boolean
return GetUnitAbilityLevel(u,SPELL)>=1
endmethod
private method onCreate takes nothing returns nothing
set .trig = CreateTrigger()
call TriggerRegisterUnitEvent(.trig,me,EVENT_UNIT_ATTACKED)
call TriggerAddCondition(.trig,Condition(function Attacked))
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
call DisableTrigger(.trig)
call DestroyTrigger(.trig)
set .trig = null
endmethod
implement AutoDestroy
endstruct
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library FireWallNPCs needs AutoIndex
globals
private constant integer SPELL = 'A0AU'
private constant string SPELL_ORDER = "hex"
private constant integer CHANCE = 15
endglobals
private function UnitAttacked takes nothing returns boolean
local unit whichUnit = GetTriggerUnit()
if (GetUnitAbilityLevel(whichUnit,AI_ENABLED)>=1 or GetOwningPlayer(whichUnit)==Player(10)) and GetUnitAbilityLevel(whichUnit,LASTQUESTUNIT_SPELL)<=0 and GetRandomInt(0,100)<=CHANCE then
call IssueImmediateOrder(whichUnit,SPELL_ORDER)
endif
set whichUnit = null
return false
endfunction
private struct str
trigger trig
private static method createFilter takes unit u returns boolean
return GetUnitAbilityLevel(u,SPELL)>=1
endmethod
private method onCreate takes nothing returns nothing
set .trig = CreateTrigger()
call TriggerRegisterUnitEvent(.trig,me,EVENT_UNIT_ATTACKED)
call TriggerAddCondition(.trig,Condition(function UnitAttacked))
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
call DisableTrigger(.trig)
call DestroyTrigger(.trig)
set .trig = null
endmethod
implement AutoDestroy
endstruct
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library NPCFlameRelease needs AutoIndex
globals
private constant integer SPELL = 'A0FL'
private constant string SPELL_ORDER = "flamingarrowstarg"
private constant integer CHANCE = 25
endglobals
private function UnitAttacked takes nothing returns boolean
local unit whichUnit = GetTriggerUnit()
local unit attacker = GetAttacker()
if (GetUnitAbilityLevel(whichUnit,AI_ENABLED)>=1 or GetOwningPlayer(whichUnit)==Player(10)) and GetUnitAbilityLevel(whichUnit,LASTQUESTUNIT_SPELL)<=0 and GetRandomInt(0,100)<=CHANCE then
call IssuePointOrder(whichUnit,SPELL_ORDER,GetUnitX(attacker),GetUnitY(attacker))
endif
set whichUnit = null
set attacker = null
return false
endfunction
private struct str
trigger trig
private static method createFilter takes unit u returns boolean
return GetUnitAbilityLevel(u,SPELL)>=1
endmethod
private method onCreate takes nothing returns nothing
set .trig = CreateTrigger()
call TriggerRegisterUnitEvent(.trig,me,EVENT_UNIT_ATTACKED)
call TriggerAddCondition(.trig,Condition(function UnitAttacked))
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
call DisableTrigger(.trig)
call DestroyTrigger(.trig)
set .trig = null
endmethod
implement AutoDestroy
endstruct
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library FlareNPCs needs AutoIndex,TimerUtils,GroupUtils
globals
private constant integer SPELL = 'A02Y'
private constant string SPELL_ORDER = "flare"
private constant integer CHANCE = 25
private constant real TIMEOUT_CHECK = 10.
private constant real AOE = 700.
private unit Caster
endglobals
private struct s_check
unit caster
endstruct
private function CheckEnemies takes nothing returns boolean
local unit target = GetFilterUnit()
if IsUnitEnemy(Caster,GetOwningPlayer(target))==true and IsUnitType(target,UNIT_TYPE_MECHANICAL) then
call IssuePointOrder(Caster,SPELL_ORDER,GetUnitX(target),GetUnitY(target))
endif
set target = null
return true
endfunction
private function UpdateCheck takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_check dat = GetTimerData(t)
if dat.caster!= null and not (IsUnitType(dat.caster,UNIT_TYPE_DEAD)) then
set Caster = dat.caster
call GroupEnumUnitsInRange(ENUM_GROUP,GetUnitX(dat.caster),GetUnitY(dat.caster),AOE,Filter(function CheckEnemies))
else
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function StartCheck takes unit caster returns nothing
local timer t = NewTimer()
local s_check dat = s_check.create()
set dat.caster = caster
call SetTimerData(t,dat)
call TimerStart(t,TIMEOUT_CHECK,true,function UpdateCheck)
endfunction
private function UnitAttacked takes nothing returns boolean
local unit whichUnit = GetTriggerUnit()
local unit attacker = GetAttacker()
if (GetUnitAbilityLevel(whichUnit,AI_ENABLED)>=1 or GetOwningPlayer(whichUnit)==Player(10)) and GetUnitAbilityLevel(whichUnit,LASTQUESTUNIT_SPELL)<=0 and GetRandomInt(0,100)<=CHANCE then
call IssuePointOrder(whichUnit,SPELL_ORDER,GetUnitX(attacker),GetUnitY(attacker))
endif
set whichUnit = null
set attacker = null
return false
endfunction
private struct str
trigger trig
private static method createFilter takes unit u returns boolean
return GetUnitAbilityLevel(u,SPELL)>=1
endmethod
private method onCreate takes nothing returns nothing
set .trig = CreateTrigger()
call TriggerRegisterUnitEvent(.trig,me,EVENT_UNIT_ATTACKED)
call TriggerAddCondition(.trig,Condition(function UnitAttacked))
call StartCheck(me)
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
call DisableTrigger(.trig)
call DestroyTrigger(.trig)
set .trig = null
endmethod
implement AutoDestroy
endstruct
endlibrary
//TESH.scrollpos=12
//TESH.alwaysfold=0
library MedicalTroopsCheck needs AutoIndex, TimerUtils, GroupUtils
globals
private constant integer UNIT_ID = 'h00P'
private constant string ORDER_POISON = "summonwareagle"
private constant string ORDER_FRACT = "unbearform"
private constant string ORDER_HEAL = "heal"
private constant real TIMEOUT_CHECK = 5.
private constant real LIFE_PERCENT = 0.75
private constant real AOE = 700.
private unit Caster
endglobals
private struct str
unit caster
endstruct
private function CheckAllHeal takes nothing returns boolean
local unit target = GetFilterUnit()
if IsUnitAlly(Caster,GetOwningPlayer(target))==true and not (GetOwningPlayer(target)==Player(15)) then
if GetUnitAbilityLevel(target,BUFF_POISON1)>=1 or GetUnitAbilityLevel(target,BUFF_POISON2)>=1 then
call IssueTargetOrder(Caster,ORDER_POISON,target)
endif
if GetUnitAbilityLevel(target,BUFF_FRACT)>=1 then
call IssueTargetOrder(Caster,ORDER_FRACT,target)
endif
if GetUnitState(target,UNIT_STATE_LIFE)<=LIFE_PERCENT*GetUnitState(target,UNIT_STATE_MAX_LIFE) then
call IssueTargetOrder(Caster,ORDER_HEAL,target)
endif
endif
set target = null
return true
endfunction
private function CheckBuffs takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
if dat.caster!= null and not (IsUnitType(dat.caster,UNIT_TYPE_DEAD)) and (GetUnitAbilityLevel(dat.caster,AI_ENABLED)>=1 or GetOwningPlayer(dat.caster)==Player(10)) and GetUnitAbilityLevel(dat.caster,LASTQUESTUNIT_SPELL)<=0 then
set Caster = dat.caster
call GroupEnumUnitsInRange(ENUM_GROUP,GetUnitX(dat.caster),GetUnitY(dat.caster),AOE,Filter(function CheckAllHeal))
else
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function StartCheck takes unit caster returns nothing
local timer t = NewTimer()
local str dat = str.create()
set dat.caster = caster
call SetTimerData(t,dat)
call TimerStart(t,TIMEOUT_CHECK,true,function CheckBuffs)
endfunction
private struct s_enter
private static method createFilter takes unit u returns boolean
return GetUnitTypeId(u)==UNIT_ID
endmethod
private method onCreate takes nothing returns nothing
call StartCheck(me)
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
endmethod
implement AutoDestroy
endstruct
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library GWFuryEMWave needs AutoIndex
globals
private constant integer SPELL = 'A009'
private constant string ORDER = "rainoffire"
private constant integer CHANCE = 25
endglobals
private function Attacked takes nothing returns boolean
local unit whichUnit = GetTriggerUnit()
local unit attacker = GetAttacker()
if (GetUnitAbilityLevel(whichUnit,AI_ENABLED)>=1 or GetOwningPlayer(whichUnit)==Player(10)) and GetUnitAbilityLevel(whichUnit,LASTQUESTUNIT_SPELL)<=0 then
if GetRandomInt(0,100)<=CHANCE then
call IssuePointOrder(whichUnit,ORDER,GetUnitX(attacker),GetUnitY(attacker))
endif
endif
set whichUnit = null
set attacker = null
return false
endfunction
private struct str
trigger trig
private static method createFilter takes unit u returns boolean
return GetUnitAbilityLevel(u,SPELL)>=1
endmethod
private method onCreate takes nothing returns nothing
set .trig = CreateTrigger()
call TriggerRegisterUnitEvent(.trig,me,EVENT_UNIT_ATTACKED)
call TriggerAddCondition(.trig,Condition(function Attacked))
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
call DisableTrigger(.trig)
call DestroyTrigger(.trig)
set .trig = null
endmethod
implement AutoDestroy
endstruct
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library NPCRockets initializer init needs AutoIndex,TimerUtils,GroupUtils, GroupFunction
globals
private constant integer SPELL = 'A023'
private constant real AOE_DMG = 300.
private constant real DMG_BASE = 1000.
private constant real TIMEOUT_CHECK = 10.
private constant real AOE = 700.
private constant string SPELL_ORDER = "clusterrockets"
private unit Caster
private unit Target
private integer Count
endglobals
private struct s_check
unit caster
endstruct
private function CheckEnemies takes nothing returns boolean
local unit target = GetFilterUnit()
if IsUnitEnemy(Caster,GetOwningPlayer(target))==true and IsUnitType(target,UNIT_TYPE_MECHANICAL) then
set Target = target
elseif IsUnitAlly(Caster,GetOwningPlayer(target))==true then
set Count = Count + 1
endif
set target = null
return true
endfunction
private function UpdateCheck takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_check dat = GetTimerData(t)
if dat.caster!= null and not (IsUnitType(dat.caster,UNIT_TYPE_DEAD)) and (GetUnitAbilityLevel(dat.caster,AI_ENABLED)>=1 or GetOwningPlayer(dat.caster)==Player(10)) and GetUnitAbilityLevel(dat.caster,LASTQUESTUNIT_SPELL)<=0 then
set Caster = dat.caster
set Count = 0
set Target = null
call GroupEnumUnitsInRange(ENUM_GROUP,GetUnitX(dat.caster),GetUnitY(dat.caster),AOE,Filter(function CheckEnemies))
if Count <= 0 then
call IssuePointOrder(dat.caster,SPELL_ORDER,GetUnitX(Target),GetUnitY(Target))
endif
else
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function StartCheck takes unit caster returns nothing
local timer t = NewTimer()
local s_check dat = s_check.create()
set dat.caster = caster
call SetTimerData(t,dat)
call TimerStart(t,TIMEOUT_CHECK,true,function UpdateCheck)
endfunction
private struct str
private static method createFilter takes unit u returns boolean
return GetUnitAbilityLevel(u,SPELL)>=1
endmethod
private method onCreate takes nothing returns nothing
call StartCheck(me)
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
endmethod
implement AutoDestroy
endstruct
private struct s_wait
unit caster
real x
real y
endstruct
private function Wait takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_wait dat = GetTimerData(t)
call UnitDamageAll(dat.caster,true,AOE_DMG,dat.x,dat.y,DMG_BASE*GetUnitAbilityLevel(dat.caster,SPELL),DMG_EXPLOSIVE,true,50,10,0.2)
call ReleaseTimer(t)
call dat.destroy()
endfunction
private function Cast takes nothing returns nothing
local timer t = NewTimer()
local s_wait dat = s_wait.create()
set dat.x = SpellEvent.TargetX
set dat.y = SpellEvent.TargetY
set dat.caster = SpellEvent.CastingUnit
call TextTagMessage("Boom!", dat.caster, 0., 50., 64., 90., 9, 5., 2.00 )
call SetTimerData(t, dat)
call TimerStart (t,0.95, false, function Wait )
endfunction
private function init takes nothing returns nothing
call RegisterSpellCastResponse(SPELL, Cast)
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library FlashGrenadeNPCHS needs AutoIndex,TimerUtils,GroupUtils
globals
private constant integer SPELL = 'A08G'
private constant string SPELL_ORDER = "clusterrockets"
private constant integer CHANCE = 15
private constant real TIMEOUT_CHECK = 10.
private constant real AOE = 700.
private unit Caster
endglobals
private struct s_check
unit caster
endstruct
private function CheckEnemies takes nothing returns boolean
local unit target = GetFilterUnit()
if IsUnitEnemy(Caster,GetOwningPlayer(target))==true and IsUnitType(target,UNIT_TYPE_MECHANICAL) then
call IssuePointOrder(Caster,SPELL_ORDER,GetUnitX(target),GetUnitY(target))
endif
set target = null
return true
endfunction
private function UpdateCheck takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_check dat = GetTimerData(t)
if dat.caster!= null and not (IsUnitType(dat.caster,UNIT_TYPE_DEAD)) then
set Caster = dat.caster
call GroupEnumUnitsInRange(ENUM_GROUP,GetUnitX(dat.caster),GetUnitY(dat.caster),AOE,Filter(function CheckEnemies))
else
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function StartCheck takes unit caster returns nothing
local timer t = NewTimer()
local s_check dat = s_check.create()
set dat.caster = caster
call SetTimerData(t,dat)
call TimerStart(t,TIMEOUT_CHECK,true,function UpdateCheck)
endfunction
private function UnitAttacked takes nothing returns boolean
local unit whichUnit = GetTriggerUnit()
local unit attacker = GetAttacker()
if (GetUnitAbilityLevel(whichUnit,AI_ENABLED)>=1 or GetOwningPlayer(whichUnit)==Player(10)) and GetUnitAbilityLevel(whichUnit,LASTQUESTUNIT_SPELL)<=0 and GetRandomInt(0,100)<=CHANCE then
call IssuePointOrder(whichUnit,SPELL_ORDER,GetUnitX(attacker),GetUnitY(attacker))
endif
set whichUnit = null
set attacker = null
return false
endfunction
private struct str
trigger trig
private static method createFilter takes unit u returns boolean
return GetUnitAbilityLevel(u,SPELL)>=1
endmethod
private method onCreate takes nothing returns nothing
set .trig = CreateTrigger()
call TriggerRegisterUnitEvent(.trig,me,EVENT_UNIT_ATTACKED)
call TriggerAddCondition(.trig,Condition(function UnitAttacked))
call StartCheck(me)
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
call DisableTrigger(.trig)
call DestroyTrigger(.trig)
set .trig = null
endmethod
implement AutoDestroy
endstruct
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library SelfHealNPCSO needs AutoIndex
globals
private constant integer SPELL = 'A0AU'
private constant string SPELL_ORDER = "poisonarrows"
private constant real LIFE_PERCENT = 0.25
endglobals
private function UnitAttacked takes nothing returns boolean
local unit whichUnit = GetTriggerUnit()
if (GetUnitAbilityLevel(whichUnit,AI_ENABLED)>=1 or GetOwningPlayer(whichUnit)==Player(10)) and GetUnitAbilityLevel(whichUnit,LASTQUESTUNIT_SPELL)<=0 and GetUnitState(whichUnit,UNIT_STATE_LIFE)<LIFE_PERCENT*GetUnitState(whichUnit,UNIT_STATE_MAX_LIFE) then
call IssueImmediateOrder(whichUnit,SPELL_ORDER)
endif
set whichUnit = null
return false
endfunction
private struct str
trigger trig
private static method createFilter takes unit u returns boolean
return GetUnitAbilityLevel(u,SPELL)>=1
endmethod
private method onCreate takes nothing returns nothing
set .trig = CreateTrigger()
call TriggerRegisterUnitEvent(.trig,me,EVENT_UNIT_ATTACKED)
call TriggerAddCondition(.trig,Condition(function UnitAttacked))
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
call DisableTrigger(.trig)
call DestroyTrigger(.trig)
set .trig = null
endmethod
implement AutoDestroy
endstruct
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library SmokeGrenadeNPCs needs AutoIndex,TimerUtils,GroupUtils
globals
private constant integer SPELL = 'A0G0'
private constant string SPELL_ORDER = "requestsacrifice"
private constant real TIMEOUT_CHECK = 10.
private constant real AOE = 700.
private unit Caster
endglobals
private struct s_check
unit caster
endstruct
private function CheckEnemies takes nothing returns boolean
local unit target = GetFilterUnit()
if IsUnitEnemy(Caster,GetOwningPlayer(target))==true and IsUnitType(target,UNIT_TYPE_MECHANICAL) then
call IssuePointOrder(Caster,SPELL_ORDER,GetUnitX(target),GetUnitY(target))
endif
set target = null
return true
endfunction
private function UpdateCheck takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_check dat = GetTimerData(t)
if dat.caster!= null and not (IsUnitType(dat.caster,UNIT_TYPE_DEAD)) then
set Caster = dat.caster
call GroupEnumUnitsInRange(ENUM_GROUP,GetUnitX(dat.caster),GetUnitY(dat.caster),AOE,Filter(function CheckEnemies))
else
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function StartCheck takes unit caster returns nothing
local timer t = NewTimer()
local s_check dat = s_check.create()
set dat.caster = caster
call SetTimerData(t,dat)
call TimerStart(t,TIMEOUT_CHECK,true,function UpdateCheck)
endfunction
private struct str
private static method createFilter takes unit u returns boolean
return GetUnitAbilityLevel(u,SPELL)>=1
endmethod
private method onCreate takes nothing returns nothing
call StartCheck(me)
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
endmethod
implement AutoDestroy
endstruct
endlibrary
//TESH.scrollpos=1
//TESH.alwaysfold=0
library ThermalAcquisitionNPCCF needs AutoIndex
globals
private constant integer SPELL = 'A0AU'
private constant string SPELL_ORDER = "howlofterror"
private constant integer CHANCE = 15
endglobals
private function UnitAttacked takes nothing returns boolean
local unit whichUnit = GetTriggerUnit()
if (GetUnitAbilityLevel(whichUnit,AI_ENABLED)>=1 or GetOwningPlayer(whichUnit)==Player(10)) and GetUnitAbilityLevel(whichUnit,LASTQUESTUNIT_SPELL)<=0 and GetRandomInt(0,100)<=CHANCE then
call IssueImmediateOrder(whichUnit,SPELL_ORDER)
endif
set whichUnit = null
return false
endfunction
private struct str
trigger trig
private static method createFilter takes unit u returns boolean
return GetUnitAbilityLevel(u,SPELL)>=1
endmethod
private method onCreate takes nothing returns nothing
set .trig = CreateTrigger()
call TriggerRegisterUnitEvent(.trig,me,EVENT_UNIT_ATTACKED)
call TriggerAddCondition(.trig,Condition(function UnitAttacked))
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
call DisableTrigger(.trig)
call DestroyTrigger(.trig)
set .trig = null
endmethod
implement AutoDestroy
endstruct
endlibrary
//TESH.scrollpos=35
//TESH.alwaysfold=0
library DeathAbomination needs SpawnSystem, AutoIndex, TimerUtils
globals
private constant integer UNIT_ID = 'u006'
private constant integer SPAWNED_ID = 'u00N'
private constant real WAIT = 5.
private constant integer AMOUNT = 6
endglobals
private struct s_delay
real x
real y
endstruct
private function Spawn takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_delay dat = GetTimerData(t)
local integer i = 0
if ChapterIntermission == false then
loop
exitwhen i > AMOUNT - 1
call SpawnCreeps(SPAWNED_ID,14,dat.x,dat.y)
set i = i + 1
endloop
endif
call ReleaseTimer(t)
call dat.destroy()
endfunction
private function UnitDeath takes nothing returns boolean
local unit victim = GetTriggerUnit()
local s_delay dat = s_delay.create()
local timer t = NewTimer()
set dat.x = GetUnitX(victim)
set dat.y = GetUnitY(victim)
call SetTimerData(t,dat)
call TimerStart(t,WAIT,false,function Spawn)
set victim = null
return false
endfunction
private struct str
trigger trig
private static method createFilter takes unit u returns boolean
return GetUnitTypeId(u)==UNIT_ID
endmethod
private method onCreate takes nothing returns nothing
set .trig = CreateTrigger()
call TriggerRegisterUnitEvent(.trig,me,EVENT_UNIT_DEATH)
call TriggerAddCondition(.trig,Condition(function UnitDeath))
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
call DisableTrigger(.trig)
call DestroyTrigger(.trig)
set .trig = null
endmethod
implement AutoDestroy
endstruct
endlibrary
//TESH.scrollpos=21
//TESH.alwaysfold=0
library EvolvedGhoul needs TimerUtils, AutoIndex, GroupFunction
globals
private constant integer UNIT_ID = 'u00A'
private constant integer CHANCE = 10
private constant real AOE = 150
private constant integer SPEED = 20
private constant real IMP = 0.20
private constant string FX = "Abilities\\Spells\\Demon\\DemonBoltImpact\\DemonBoltImpact.mdl"
private constant string ANIM = "stand channel"
private constant real DMG = 50.
endglobals
private struct s_jump
unit caster
real angle
integer distance
integer i
endstruct
private function Update takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_jump dat = GetTimerData(t)
local real x = GetUnitX(dat.caster)
local real y = GetUnitY(dat.caster)
local real newX = x + SPEED*Cos(dat.angle)
local real newY = y + SPEED*Sin(dat.angle)
local real z = GetUnitFlyHeight(dat.caster)
local real newz = 0.
if dat.i < dat.distance then
set dat.i = dat.i + 1
call SetUnitX(dat.caster, newX)
call SetUnitY(dat.caster, newY)
if dat.i < (dat.distance * 0.5) then
set newz = z + (dat.distance * IMP)
else
set newz = z - (dat.distance * IMP)
endif
call SetUnitFlyHeight(dat.caster,newz,0.)
else
call SetUnitPathing(dat.caster, true)
call SetUnitAnimation(dat.caster, "attack slam")
call DestroyEffect(AddSpecialEffect(FX,x,y))
call UnitDamageEnemies(dat.caster,AOE,x,y,DMG,DMG_ENERGETIC,true,100,SPEED,IMP)
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function ForceJump takes unit whichUnit, unit attacker returns nothing
local timer t = NewTimer()
local s_jump dat = s_jump.create()
local real x1 = GetUnitX(whichUnit)
local real y1 = GetUnitY(whichUnit)
local real x2 = GetUnitX(attacker)
local real y2 = GetUnitY(attacker)
set dat.caster = whichUnit
set dat.angle = Atan2((y2 -y1), (x2 - x1))
set dat.distance = R2I(SquareRoot((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)))/SPEED
set dat.i = 0
call SetUnitPathing( dat.caster, false)
call SetUnitAnimation(dat.caster,ANIM)
call SetTimerData(t, dat)
call TimerStart (t, TIMEOUT, true, function Update )
endfunction
private function UnitAttacked takes nothing returns boolean
local unit whichUnit = GetTriggerUnit()
if GetRandomInt(0,100)<=CHANCE then
if GetUnitAbilityLevel(whichUnit,'Bena')<= 0 and GetUnitAbilityLevel(whichUnit,'Beng')<= 0 and GetUnitAbilityLevel(whichUnit,'Bens')<= 0 and GetUnitFlyHeight(whichUnit)<=0. then
call ForceJump(whichUnit, GetAttacker())
endif
endif
set whichUnit = null
return false
endfunction
private struct str
trigger trig
private static method createFilter takes unit u returns boolean
return GetUnitTypeId(u)==UNIT_ID
endmethod
private method onCreate takes nothing returns nothing
set .trig = CreateTrigger()
call TriggerRegisterUnitEvent(.trig,me,EVENT_UNIT_ATTACKED)
call TriggerAddCondition(.trig,Condition(function UnitAttacked))
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
call DisableTrigger(.trig)
call DestroyTrigger(.trig)
set .trig = null
endmethod
implement AutoDestroy
endstruct
endlibrary
//TESH.scrollpos=7
//TESH.alwaysfold=0
library FleshComposite needs TimerUtils, AutoIndex,SpawnSystem
globals
private constant integer UNIT_ID = 'u002'
private constant integer SPAWNED_ID = 'u006'
private constant real WAIT = 5.
private constant integer AMOUNT = 4
endglobals
private struct s_delay
real x
real y
endstruct
private function Spawn takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_delay dat = GetTimerData(t)
local integer i = 0
if ChapterIntermission == false then
loop
exitwhen i > AMOUNT - 1
call SpawnCreeps(SPAWNED_ID,14,dat.x,dat.y)
set i = i + 1
endloop
endif
call ReleaseTimer(t)
call dat.destroy()
endfunction
private function UnitDeath takes nothing returns boolean
local unit victim = GetTriggerUnit()
local s_delay dat = s_delay.create()
local timer t = NewTimer()
set dat.x = GetUnitX(victim)
set dat.y = GetUnitY(victim)
call SetTimerData(t,dat)
call TimerStart(t,WAIT,false,function Spawn)
set victim = null
return false
endfunction
private struct str
trigger trig
private static method createFilter takes unit u returns boolean
return GetUnitTypeId(u)==UNIT_ID
endmethod
private method onCreate takes nothing returns nothing
set .trig = CreateTrigger()
call TriggerRegisterUnitEvent(.trig,me,EVENT_UNIT_DEATH)
call TriggerAddCondition(.trig,Condition(function UnitDeath))
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
call DisableTrigger(.trig)
call DestroyTrigger(.trig)
set .trig = null
endmethod
implement AutoDestroy
endstruct
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library ParasiteSpore needs GroupUtils,TimerUtils,AutoIndex,SideQuestSystem,SpawnSystem
globals
private constant integer SPORE_ID = 'u00X'
private constant integer PARASITE_ID = 'u00V'
private constant integer EV_PARASITE_ID = 'u00W'
private constant integer BOSS_PARASITE_ID = 'u00W'
private constant integer PARASITE_CHANCE = 40
private constant integer EV_PARASITE_CHANCE = 15
private constant integer EV_PARASITE_REQ = 50000
private constant real TIMEOUT_SPAWN = 30.
private constant integer AMOUNT = 6
private constant real WAIT = 75.
private constant string INFO_ACTIVATED ="Parasite Spores"
private integer SporeDone = 0
private integer SporeMax = 0
endglobals
private struct s_spawn
unit spore
real x
real y
endstruct
private function SpawnParasite takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_spawn dat = GetTimerData(t)
if not(IsUnitType(dat.spore,UNIT_TYPE_DEAD)) and dat.spore!=null and ChapterIntermission == false then
if XpAverage >= EV_PARASITE_REQ and GetRandomInt(0,100)<=EV_PARASITE_CHANCE then
call SetUnitAnimation(dat.spore,"birth")
call SpawnCreeps(EV_PARASITE_ID,13,dat.x,dat.y)
endif
if GetRandomInt(0,100)<=PARASITE_CHANCE then
call SetUnitAnimation(dat.spore,"birth")
call SpawnCreeps(PARASITE_ID,13,dat.x,dat.y)
endif
else
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function StartParasiteSpawn takes unit spore returns nothing
local s_spawn dat = s_spawn.create()
local timer t = NewTimer()
set dat.x = GetUnitX(spore)
set dat.y = GetUnitY(spore)
set dat.spore = spore
call SetTimerData(t,dat)
call TimerStart(t,TIMEOUT_SPAWN,true,function SpawnParasite)
endfunction
private function UnitDeath takes nothing returns boolean
set SporeDone = SporeDone + 1
set SideQuestEta[7]=INFO_ACTIVATED+I2S(SporeDone)+"/"+I2S(SporeMax)+" killed."
call UpdateSideQuest(7)
if SporeDone == SporeMax then
call SpawnCreeps(BOSS_PARASITE_ID,14,GetUnitX(GetTriggerUnit()),GetUnitY(GetTriggerUnit()))
call EndSideQuest(7)
endif
return false
endfunction
private struct str
trigger trig
private static method createFilter takes unit u returns boolean
return GetUnitTypeId(u)==SPORE_ID
endmethod
private method onCreate takes nothing returns nothing
set .trig = CreateTrigger()
call TriggerRegisterUnitEvent(.trig,me,EVENT_UNIT_DEATH)
call TriggerAddCondition(.trig,Condition(function UnitDeath))
call StartParasiteSpawn(me)
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
call DisableTrigger(.trig)
call DestroyTrigger(.trig)
set .trig = null
endmethod
implement AutoDestroy
endstruct
private function SpawnSpores takes nothing returns boolean
local integer i = 0
set SporeMax =0
set SporeDone = 0
loop
exitwhen i > AMOUNT-1
set SporeMax = SporeMax + 1
call CreateUnit(Player(13),SPORE_ID,GetRandomReal(MapXMin,MapXMax),GetRandomReal(MapYMin,MapYMax),0.)
set i = i + 1
endloop
return false
endfunction
function StartParasiteSpore takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterTimerEvent(t, WAIT,false)
call TriggerAddCondition(t, Condition(function SpawnSpores))
endfunction
endlibrary
//TESH.scrollpos=10
//TESH.alwaysfold=0
library ProjectAbsorbtion needs AutoIndex,GroupUtils
globals
private constant integer SPELL = 'A0EO'
private constant string ORDER = "deathpact"
private constant integer CHANCE = 25
private constant real AOE = 400.
unit Caster
endglobals
private function PickUnit takes nothing returns boolean
return GetOwningPlayer(GetFilterUnit())==Player(11) or GetOwningPlayer(GetFilterUnit())==Player(13) or GetOwningPlayer(GetFilterUnit())==Player(14)
endfunction
private function UnitAttacked takes nothing returns boolean
local unit whichUnit = GetTriggerUnit()
local unit target = null
local group g = null
if GetRandomInt(0,100)<=CHANCE then
set g = NewGroup()
set Caster = whichUnit
call GroupEnumUnitsInRange(g,GetUnitX(Caster),GetUnitY(Caster),AOE,Filter(function PickUnit))
set target = FirstOfGroup(g)
call IssueTargetOrder(whichUnit,ORDER,target)
call ReleaseGroup(g)
endif
set whichUnit = null
set target = null
set g = null
return false
endfunction
private struct str
trigger trig
private static method createFilter takes unit u returns boolean
return GetUnitAbilityLevel(u,SPELL)>=1
endmethod
private method onCreate takes nothing returns nothing
set .trig = CreateTrigger()
call TriggerRegisterUnitEvent(.trig,me,EVENT_UNIT_ATTACKED)
call TriggerAddCondition(.trig,Condition(function UnitAttacked))
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
call DisableTrigger(.trig)
call DestroyTrigger(.trig)
set .trig = null
endmethod
implement AutoDestroy
endstruct
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library CreepsLocust needs AutoIndex
globals
private constant integer SPELL = 'A07F'
private constant string ORDER = "Locustswarm"
private constant integer CHANCE = 25
endglobals
private function UnitAttacked takes nothing returns boolean
local unit whichUnit = GetTriggerUnit()
if GetRandomInt(0,100)<=CHANCE then
call IssueImmediateOrder(whichUnit,ORDER)
endif
set whichUnit = null
return false
endfunction
private struct str
trigger trig
private static method createFilter takes unit u returns boolean
return GetUnitAbilityLevel(u,SPELL)>=1
endmethod
private method onCreate takes nothing returns nothing
set .trig = CreateTrigger()
call TriggerRegisterUnitEvent(.trig,me,EVENT_UNIT_ATTACKED)
call TriggerAddCondition(.trig,Condition(function UnitAttacked))
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
call DisableTrigger(.trig)
call DestroyTrigger(.trig)
set .trig = null
endmethod
implement AutoDestroy
endstruct
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library CreepsCounterMeasure needs AutoIndex
globals
private constant integer SPELL = 'A0EQ'
private constant string ORDER = "mirrorimage"
private constant integer CHANCE = 25
endglobals
private function UnitAttacked takes nothing returns boolean
local unit whichUnit = GetTriggerUnit()
if GetRandomInt(0,100)<=CHANCE then
call IssueImmediateOrder(whichUnit,ORDER)
endif
set whichUnit = null
return false
endfunction
private struct str
trigger trig
private static method createFilter takes unit u returns boolean
return GetUnitAbilityLevel(u,SPELL)>=1
endmethod
private method onCreate takes nothing returns nothing
set .trig = CreateTrigger()
call TriggerRegisterUnitEvent(.trig,me,EVENT_UNIT_ATTACKED)
call TriggerAddCondition(.trig,Condition(function UnitAttacked))
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
call DisableTrigger(.trig)
call DestroyTrigger(.trig)
set .trig = null
endmethod
implement AutoDestroy
endstruct
endlibrary
//TESH.scrollpos=3
//TESH.alwaysfold=0
library ProjectGhost needs AutoIndex
globals
private constant integer SPELL = 'A0EF'
private constant string ORDER = "blink"
private constant integer CHANCE = 25
endglobals
private function UnitAttacked takes nothing returns boolean
local unit whichUnit = GetTriggerUnit()
local unit attacker = GetAttacker()
if GetRandomInt(0,100)<=CHANCE then
call IssuePointOrder(whichUnit,ORDER,GetUnitX(attacker),GetUnitY(attacker))
endif
set whichUnit = null
set attacker = null
return false
endfunction
private struct str
trigger trig
private static method createFilter takes unit u returns boolean
return GetUnitAbilityLevel(u,SPELL)>=1
endmethod
private method onCreate takes nothing returns nothing
set .trig = CreateTrigger()
call TriggerRegisterUnitEvent(.trig,me,EVENT_UNIT_ATTACKED)
call TriggerAddCondition(.trig,Condition(function UnitAttacked))
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
call DisableTrigger(.trig)
call DestroyTrigger(.trig)
set .trig = null
endmethod
implement AutoDestroy
endstruct
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library ProjectHowlBear initializer init needs AutoIndex, GroupUtils, TextDisplay
globals
private constant integer SPELL = 'A0C6'
private constant string ORDER = "howlofterror"
private constant integer CHANCE = 25
private constant real AOE = 2000.
private string array Text [10]
private integer TextMax = 0
private player Owner
endglobals
private function Fear takes nothing returns boolean
local unit target = GetFilterUnit()
local real distance = GetRandomReal(500.,6000.)
local real angle = GetRandomReal(0.,360.)
local real x = GetUnitX(target)+distance*Cos(angle*bj_DEGTORAD)
local real y = GetUnitY(target)+distance*Sin(angle*bj_DEGTORAD)
if IsUnitEnemy(target,Owner)==true and not(IsUnitType(target,UNIT_TYPE_TAUREN)) and not(IsUnitType(target,UNIT_TYPE_HERO)) and not(IsUnitType(target,UNIT_TYPE_STRUCTURE)) and not(IsUnitType(target,UNIT_TYPE_MECHANICAL)) then
call IssuePointOrder(target,"move",x,y)
call TextTagMessage(Text[GetRandomInt(0,TextMax)],target, 0., 50., 64., 90., 9, 5., 2.00 )
endif
return true
endfunction
private function UnitAttacked takes nothing returns boolean
local unit whichUnit = GetTriggerUnit()
if GetRandomInt(0,100)<=CHANCE then
call IssueImmediateOrder(whichUnit,ORDER)
set Owner = GetOwningPlayer(whichUnit)
call GroupEnumUnitsInRange(ENUM_GROUP,GetUnitX(whichUnit),GetUnitY(whichUnit),AOE,Filter(function Fear))
endif
set whichUnit = null
return false
endfunction
private struct str
trigger trig
private static method createFilter takes unit u returns boolean
return GetUnitAbilityLevel(u,SPELL)>=1
endmethod
private method onCreate takes nothing returns nothing
set .trig = CreateTrigger()
call TriggerRegisterUnitEvent(.trig,me,EVENT_UNIT_ATTACKED)
call TriggerAddCondition(.trig,Condition(function UnitAttacked))
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
call DisableTrigger(.trig)
call DestroyTrigger(.trig)
set .trig = null
endmethod
implement AutoDestroy
endstruct
private function init takes nothing returns nothing
local integer i = 0
set Text[i]="Oh my god!"
set i = i + 1
set Text[i]="Ruuuuuun!"
set i = i + 1
set Text[i]="I don't want to die!"
set i = i + 1
set Text[i]="It will eat me!"
set i = i + 1
set Text[i]="That's enough!"
set i = i + 1
set Text[i]="Retreat!"
set i = i + 1
set Text[i]="Get the fuck out of here!"
set TextMax = i
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library ProjectManthis needs AutoIndex
globals
private constant integer SPELL = 'A0ER'
private constant string ORDER = "impale"
private constant integer CHANCE = 25
endglobals
private function UnitAttacked takes nothing returns boolean
local unit whichUnit = GetTriggerUnit()
local unit attacker = GetAttacker()
if GetRandomInt(0,100)<=CHANCE then
call IssuePointOrder(whichUnit,ORDER,GetUnitX(attacker),GetUnitY(attacker))
endif
set whichUnit = null
set attacker = null
return false
endfunction
private struct str
trigger trig
private static method createFilter takes unit u returns boolean
return GetUnitAbilityLevel(u,SPELL)>=1
endmethod
private method onCreate takes nothing returns nothing
set .trig = CreateTrigger()
call TriggerRegisterUnitEvent(.trig,me,EVENT_UNIT_ATTACKED)
call TriggerAddCondition(.trig,Condition(function UnitAttacked))
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
call DisableTrigger(.trig)
call DestroyTrigger(.trig)
set .trig = null
endmethod
implement AutoDestroy
endstruct
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library CreepsRavenCrow needs AutoIndex
globals
private constant integer SPELL = 'A0EE'
private constant string ORDER = "Locustswarm"
private constant integer CHANCE = 25
endglobals
private function UnitAttacked takes nothing returns boolean
local unit whichUnit = GetTriggerUnit()
if GetRandomInt(0,100)<=CHANCE then
call IssueImmediateOrder(whichUnit,ORDER)
endif
set whichUnit = null
return false
endfunction
private struct str
trigger trig
private static method createFilter takes unit u returns boolean
return GetUnitAbilityLevel(u,SPELL)>=1
endmethod
private method onCreate takes nothing returns nothing
set .trig = CreateTrigger()
call TriggerRegisterUnitEvent(.trig,me,EVENT_UNIT_ATTACKED)
call TriggerAddCondition(.trig,Condition(function UnitAttacked))
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
call DisableTrigger(.trig)
call DestroyTrigger(.trig)
set .trig = null
endmethod
implement AutoDestroy
endstruct
endlibrary
//TESH.scrollpos=17
//TESH.alwaysfold=0
library Supergamma needs AutoIndex, TimerUtils
globals
private constant integer UNIT_ID = 'u016'
private constant integer CHANCE = 50
private constant integer SPEED = 20
private constant real DISTANCE = 500.
private constant real IMP = 0.10
endglobals
private struct s_jump
unit caster
real angle
integer distance
integer i
endstruct
private function Update takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_jump dat = GetTimerData(t)
local real x = GetUnitX(dat.caster)
local real y = GetUnitY(dat.caster)
local real newX = x + SPEED*Cos(dat.angle)
local real newY = y + SPEED*Sin(dat.angle)
local real z = GetUnitFlyHeight(dat.caster)
local real newz = 0.
if dat.i < dat.distance then
set dat.i = dat.i + 1
call SetUnitX(dat.caster, newX)
call SetUnitY(dat.caster, newY)
if dat.i < (dat.distance * 0.5) then
set newz = z + (dat.distance * IMP)
else
set newz = z - (dat.distance * IMP)
endif
call SetUnitFlyHeight(dat.caster,newz,0.)
else
call SetUnitPathing(dat.caster, true)
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function ForceJump takes unit whichUnit, unit attacker returns nothing
local timer t = NewTimer()
local s_jump dat = s_jump.create()
local real x1 = GetUnitX(whichUnit)
local real y1 = GetUnitY(whichUnit)
local real x2 = GetUnitX(attacker)
local real y2 = GetUnitY(attacker)
set dat.caster = whichUnit
set dat.angle = Atan2((y2 -y1), (x2 - x1))
set dat.distance = R2I(SquareRoot((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)))/SPEED
if dat.distance >= DISTANCE then
set x2 = x1 + DISTANCE*Cos(dat.angle)
set y2 = y1 + DISTANCE*Sin(dat.angle)
set dat.distance = R2I(SquareRoot((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)))/SPEED
endif
set dat.i = 0
call SetUnitPathing( dat.caster, false)
call SetTimerData(t, dat)
call TimerStart (t, TIMEOUT, true, function Update )
endfunction
private function UnitAttacked takes nothing returns boolean
local unit whichUnit = GetTriggerUnit()
if GetRandomInt(0,100)<=CHANCE then
if GetUnitAbilityLevel(whichUnit,'Bena')<= 0 and GetUnitAbilityLevel(whichUnit,'Beng')<= 0 and GetUnitAbilityLevel(whichUnit,'Bens')<= 0 and GetUnitFlyHeight(whichUnit)==0. then
call ForceJump(whichUnit, GetAttacker())
endif
endif
set whichUnit = null
return false
endfunction
private struct str
trigger trig
private static method createFilter takes unit u returns boolean
return GetUnitTypeId(u)==UNIT_ID
endmethod
private method onCreate takes nothing returns nothing
set .trig = CreateTrigger()
call TriggerRegisterUnitEvent(.trig,me,EVENT_UNIT_ATTACKED)
call TriggerAddCondition(.trig,Condition(function UnitAttacked))
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
call DisableTrigger(.trig)
call DestroyTrigger(.trig)
set .trig = null
endmethod
implement AutoDestroy
endstruct
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library ProjectSymbiosis needs AutoIndex
globals
private constant integer SPELL = 'A08O'
private constant string ORDER = "shockwave"
private constant integer CHANCE = 25
endglobals
private function UnitAttacked takes nothing returns boolean
local unit whichUnit = GetTriggerUnit()
local unit attacker = GetAttacker()
if GetRandomInt(0,100)<=CHANCE then
call IssuePointOrder(whichUnit,ORDER,GetUnitX(attacker),GetUnitY(attacker))
endif
set whichUnit = null
set attacker = null
return false
endfunction
private struct str
trigger trig
private static method createFilter takes unit u returns boolean
return GetUnitAbilityLevel(u,SPELL)>=1
endmethod
private method onCreate takes nothing returns nothing
set .trig = CreateTrigger()
call TriggerRegisterUnitEvent(.trig,me,EVENT_UNIT_ATTACKED)
call TriggerAddCondition(.trig,Condition(function UnitAttacked))
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
call DisableTrigger(.trig)
call DestroyTrigger(.trig)
set .trig = null
endmethod
implement AutoDestroy
endstruct
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library ProjectVampire needs AutoIndex
globals
private constant integer SPELL = 'A0EG'
private constant string ORDER = "carrionswarm"
private constant integer CHANCE = 25
endglobals
private function UnitAttacked takes nothing returns boolean
local unit whichUnit = GetTriggerUnit()
local unit attacker = GetAttacker()
if GetRandomInt(0,100)<=CHANCE then
call IssuePointOrder(whichUnit,ORDER,GetUnitX(attacker),GetUnitY(attacker))
endif
set whichUnit = null
set attacker = null
return false
endfunction
private struct str
trigger trig
private static method createFilter takes unit u returns boolean
return GetUnitAbilityLevel(u,SPELL)>=1
endmethod
private method onCreate takes nothing returns nothing
set .trig = CreateTrigger()
call TriggerRegisterUnitEvent(.trig,me,EVENT_UNIT_ATTACKED)
call TriggerAddCondition(.trig,Condition(function UnitAttacked))
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
call DisableTrigger(.trig)
call DestroyTrigger(.trig)
set .trig = null
endmethod
implement AutoDestroy
endstruct
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library WindstalkerBoss initializer init needs AutoIndex, GroupFunction
globals
private constant integer ID = 'u017'
private constant integer BUFF = 'A0CL'
private constant real LIFESPAN = 240.
private constant real AOE = 500.
private constant real DMG = 400.
endglobals
private function UnitDeath takes nothing returns boolean
local unit victim = GetTriggerUnit()
call UnitDamageAll(victim,true,AOE,GetUnitX(victim),GetUnitY(victim),DMG,DMG_PHYSIC,false,0,0,0.)
set victim = null
return false
endfunction
private function UnitAttacked takes nothing returns boolean
local unit victim = GetTriggerUnit()
call UnitAddAbility(victim,BUFF)
call UnitApplyTimedLife(victim,'BTLF',LIFESPAN)
set victim = null
return false
endfunction
private struct str
trigger trig1
trigger trig2
private static method createFilter takes unit u returns boolean
return GetUnitTypeId(u)==ID
endmethod
private method onCreate takes nothing returns nothing
set .trig1 = CreateTrigger()
call TriggerRegisterUnitEvent(.trig1,me,EVENT_UNIT_DEATH)
call TriggerAddCondition(.trig1,Condition(function UnitDeath))
set .trig2 = CreateTrigger()
call TriggerRegisterUnitEvent(.trig2,me,EVENT_UNIT_ATTACKED)
call TriggerAddCondition(.trig2,Condition(function UnitAttacked))
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
call DisableTrigger(.trig1)
call DestroyTrigger(.trig1)
set .trig1 = null
call DisableTrigger(.trig2)
call DestroyTrigger(.trig2)
set .trig2 = null
endmethod
implement AutoDestroy
endstruct
private function init takes nothing returns nothing
call AbilityPreload(BUFF)
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library Reborn needs AutoIndex, TimerUtils
globals
private constant integer UNIT_ID = 'u010'
private constant integer CHANCE = 50
private constant integer SPEED = 20
private constant real DISTANCE = 500.
private constant real IMP = 0.20
endglobals
private struct s_jump
unit caster
real angle
integer distance
integer i
endstruct
private function Update takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_jump dat = GetTimerData(t)
local real x = GetUnitX(dat.caster)
local real y = GetUnitY(dat.caster)
local real newX = x + SPEED*Cos(dat.angle)
local real newY = y + SPEED*Sin(dat.angle)
local real z = GetUnitFlyHeight(dat.caster)
local real newz = 0.
if dat.i < dat.distance then
set dat.i = dat.i + 1
call SetUnitX(dat.caster, newX)
call SetUnitY(dat.caster, newY)
if dat.i < (dat.distance * 0.5) then
set newz = z + (dat.distance * IMP)
else
set newz = z - (dat.distance * IMP)
endif
call SetUnitFlyHeight(dat.caster,newz,0.)
else
call SetUnitPathing(dat.caster, true)
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function ForceJump takes unit whichUnit, unit attacker returns nothing
local timer t = NewTimer()
local s_jump dat = s_jump.create()
local real x1 = GetUnitX(whichUnit)
local real y1 = GetUnitY(whichUnit)
local real x2 = GetUnitX(attacker)
local real y2 = GetUnitY(attacker)
set dat.caster = whichUnit
set dat.angle = Atan2((y2 -y1), (x2 - x1))
set dat.distance = R2I(SquareRoot((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)))/SPEED
if dat.distance >= DISTANCE then
set x2 = x1 + DISTANCE*Cos(dat.angle)
set y2 = y1 + DISTANCE*Sin(dat.angle)
set dat.distance = R2I(SquareRoot((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)))/SPEED
endif
set dat.i = 0
call SetUnitPathing( dat.caster, false)
call SetTimerData(t, dat)
call TimerStart (t, TIMEOUT, true, function Update )
endfunction
private function UnitAttacked takes nothing returns boolean
local unit whichUnit = GetTriggerUnit()
if GetRandomInt(0,100)<=CHANCE then
if GetUnitAbilityLevel(whichUnit,'Bena')<= 0 and GetUnitAbilityLevel(whichUnit,'Beng')<= 0 and GetUnitAbilityLevel(whichUnit,'Bens')<= 0 and GetUnitFlyHeight(whichUnit)==0. then
call ForceJump(whichUnit, GetAttacker())
endif
endif
set whichUnit = null
return false
endfunction
private struct str
trigger trig
private static method createFilter takes unit u returns boolean
return GetUnitTypeId(u)==UNIT_ID
endmethod
private method onCreate takes nothing returns nothing
set .trig = CreateTrigger()
call TriggerRegisterUnitEvent(.trig,me,EVENT_UNIT_ATTACKED)
call TriggerAddCondition(.trig,Condition(function UnitAttacked))
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
call DisableTrigger(.trig)
call DestroyTrigger(.trig)
set .trig = null
endmethod
implement AutoDestroy
endstruct
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library WindStalkers initializer init needs AutoIndex, GroupFunction
globals
private constant integer ID = 'u00Y'
private constant integer BUFF = 'A0CL'
private constant real LIFESPAN = 10.
private constant real AOE = 200.
private constant real DMG = 200.
endglobals
private function UnitDeath takes nothing returns boolean
local unit victim = GetTriggerUnit()
call UnitDamageAll(victim,true,AOE,GetUnitX(victim),GetUnitY(victim),DMG,DMG_PHYSIC,false,0,0,0.)
set victim = null
return false
endfunction
private function UnitAttacked takes nothing returns boolean
local unit victim = GetTriggerUnit()
call UnitAddAbility(victim,BUFF)
call UnitApplyTimedLife(victim,'BTLF',LIFESPAN)
set victim = null
return false
endfunction
private struct str
trigger trig1
trigger trig2
private static method createFilter takes unit u returns boolean
return GetUnitTypeId(u)==ID
endmethod
private method onCreate takes nothing returns nothing
set .trig1 = CreateTrigger()
call TriggerRegisterUnitEvent(.trig1,me,EVENT_UNIT_DEATH)
call TriggerAddCondition(.trig1,Condition(function UnitDeath))
set .trig2 = CreateTrigger()
call TriggerRegisterUnitEvent(.trig2,me,EVENT_UNIT_ATTACKED)
call TriggerAddCondition(.trig2,Condition(function UnitAttacked))
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
call DisableTrigger(.trig1)
call DestroyTrigger(.trig1)
set .trig1 = null
call DisableTrigger(.trig2)
call DestroyTrigger(.trig2)
set .trig2 = null
endmethod
implement AutoDestroy
endstruct
private function init takes nothing returns nothing
call AbilityPreload(BUFF)
endfunction
endlibrary
//TESH.scrollpos=9
//TESH.alwaysfold=0
library DeathLivingUnit needs AutoIndex, TimerUtils,SpawnSystem
globals
private constant integer TYPE = 'A08F'
private constant integer SPAWNED_ID = 'u009'
private constant real WAIT = 10.
private constant integer CHANCE = 10
endglobals
private struct s_delay
real x
real y
endstruct
private function Spawn takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_delay dat = GetTimerData(t)
if ChapterIntermission == false then
call SpawnCreeps(SPAWNED_ID,14,dat.x,dat.y)
endif
call ReleaseTimer(t)
call dat.destroy()
endfunction
private function Start takes unit victim returns nothing
local s_delay dat = s_delay.create()
local timer t = NewTimer()
set dat.x = GetUnitX(victim)
set dat.y = GetUnitY(victim)
call SetTimerData(t,dat)
call TimerStart(t,WAIT,false,function Spawn)
endfunction
private function UnitDeath takes nothing returns boolean
local unit victim = GetTriggerUnit()
if GetRandomInt(0,100)<=CHANCE then
call Start(victim)
endif
set victim = null
return false
endfunction
private struct str
trigger trig
private static method createFilter takes unit u returns boolean
return GetUnitAbilityLevel(u,TYPE)>=1
endmethod
private method onCreate takes nothing returns nothing
set .trig = CreateTrigger()
call TriggerRegisterUnitEvent(.trig,me,EVENT_UNIT_DEATH)
call TriggerAddCondition(.trig,Condition(function UnitDeath))
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
call DisableTrigger(.trig)
call DestroyTrigger(.trig)
set .trig = null
endmethod
implement AutoDestroy
endstruct
endlibrary
//TESH.scrollpos=13
//TESH.alwaysfold=0
scope DestructableDeath initializer init
globals
private constant integer SPELL = 'A0EB'
private constant integer SPAWNED_ID = 'u001'
private constant real WAIT = 3.
private constant integer AMOUNT = 15
endglobals
private struct s_delay
real x
real y
endstruct
private function Spawn takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_delay dat = GetTimerData(t)
local integer i = 0
if ChapterIntermission == false then
loop
exitwhen i > AMOUNT - 1
call SpawnCreeps(SPAWNED_ID,14,dat.x,dat.y)
set i = i + 1
endloop
endif
call ReleaseTimer(t)
call dat.destroy()
endfunction
private function UnitDeath takes nothing returns boolean
local destructable victim = GetDyingDestructable()
local s_delay dat = s_delay.create()
local timer t = NewTimer()
set dat.x = GetDestructableX(victim)
set dat.y = GetDestructableY(victim)
call SetTimerData(t,dat)
call TimerStart(t,WAIT,false,function Spawn)
set victim = null
return false
endfunction
public function init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterDestDeathInRegionEvent(t,gg_rct_TownBuilding )
call TriggerAddCondition(t,Condition(function UnitDeath) )
endfunction
endscope
//TESH.scrollpos=9
//TESH.alwaysfold=0
library EnergeticStructuresDeath needs TimerUtils, AutoIndex
globals
private constant integer DUMMY_ID = 'o000'
private constant real DUR = 2.
private constant string FX = "Units\\NightElf\\Wisp\\WispExplode.mdl"
endglobals
private function UnitDeath takes nothing returns boolean
local unit victim = GetTriggerUnit()
local real x = GetUnitX(victim)
local real y = GetUnitY(victim)
call UnitApplyTimedLife(CreateUnit(Player(PLAYER_NEUTRAL_AGGRESSIVE),DUMMY_ID,x,y,0.),'BTLF',DUR)
set victim = null
return false
endfunction
private struct str
trigger trig
private static method createFilter takes unit u returns boolean
local integer id = GetUnitTypeId(u)
return id=='o02C' or id=='o02B' or id=='o02D'
endmethod
private method onCreate takes nothing returns nothing
set .trig = CreateTrigger()
call TriggerRegisterUnitEvent(.trig,me,EVENT_UNIT_DEATH)
call TriggerAddCondition(.trig,Condition(function UnitDeath))
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
call DisableTrigger(.trig)
call DestroyTrigger(.trig)
set .trig = null
endmethod
implement AutoDestroy
endstruct
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library Reactor needs TimerUtils, AutoIndex,SpawnSystem, GroupUtils, GroupFunction
globals
private constant integer UNIT_ID = 'o02E'
private constant real RADIUS = 2000.
private constant real AOE = 4000.
private constant real DMG = 100000.
private constant integer AMOUNT = 70
private constant integer EXPLOSION_ID = 'o02V'
private constant string FX = "Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl"
private constant string FX_EXPLOSION = "war3mapImported\\SHIVA Nuclear warhead V6.mdl"
endglobals
private function UnitDeath takes nothing returns boolean
local unit victim = GetTriggerUnit()
local real x = GetUnitX(victim)
local real y = GetUnitY(victim)
local integer i = 0
call KillUnit(CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),EXPLOSION_ID,x,y,0.))
loop
exitwhen i > AMOUNT
call DestroyEffect(AddSpecialEffect(FX,x+GetRandomReal(-RADIUS,RADIUS),y+GetRandomReal(-RADIUS,RADIUS)))
call DestroyEffect(AddSpecialEffect(FX_EXPLOSION,x+GetRandomReal(-RADIUS,RADIUS),y+GetRandomReal(-RADIUS,RADIUS)))
set i = i + 1
endloop
call UnitDamageAll(victim,false,AOE,x,y,DMG,DMG_EXPLOSIVE,false,0,0,0)
set victim = null
return false
endfunction
private struct str
trigger trig
private static method createFilter takes unit u returns boolean
return GetUnitTypeId(u)==UNIT_ID
endmethod
private method onCreate takes nothing returns nothing
set .trig = CreateTrigger()
call TriggerRegisterUnitEvent(.trig,me,EVENT_UNIT_DEATH)
call TriggerAddCondition(.trig,Condition(function UnitDeath))
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
call DisableTrigger(.trig)
call DestroyTrigger(.trig)
set .trig = null
endmethod
implement AutoDestroy
endstruct
endlibrary
//TESH.scrollpos=6
//TESH.alwaysfold=0
scope AcidFlask initializer init
globals
private constant integer SPELL = 'A0J7'
private constant integer DUMMY_SPELL = 'A0JI'
private constant real DMG = 100.
private constant integer UP = 'R01J'
private constant real BONUS1_DMG = 100.
private constant integer BONUS1_REQ = 2
private constant real BONUS2_DMG = 100.
private constant integer BONUS2_REQ = 6
endglobals
private function Actions takes nothing returns nothing
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local unit dummy = CreateUnit(owner,DUMMY,GetUnitX(SpellEvent.TargetUnit),GetUnitY(SpellEvent.TargetUnit),0.)
call UnitAddAbility(dummy,DUMMY_SPELL)
call IssueTargetOrder(dummy,"faeriefire",SpellEvent.TargetUnit)
call UnitDamageTarget(SpellEvent.CastingUnit,SpellEvent.TargetUnit,DMG,false,false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
call UnitApplyTimedLife(dummy,'BTLF',2.)
if GetPlayerTechCount(owner,UP,true) >= BONUS1_REQ then
call UnitDamageTarget(SpellEvent.CastingUnit,SpellEvent.TargetUnit,BONUS1_DMG,false,false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
endif
if GetPlayerTechCount(owner,UP,true) >= BONUS2_REQ then
call UnitDamageTarget(SpellEvent.CastingUnit,SpellEvent.TargetUnit,BONUS2_DMG,false,false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
endif
set dummy = null
endfunction
public function init takes nothing returns nothing
call AbilityPreload('A0JI')
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=8
//TESH.alwaysfold=0
scope ActivatePrimaryDefensiveStructure initializer init
globals
private constant integer SPELL = 'A0EX'
private constant integer TURRET_ID = 'o001'
private constant string INFO_ACTIVATED = " Turret Activated"
private constant string INFO_ERROR = " You can only activate Primary Defensive Structures"
private integer DefTurretMax = 0
private integer DefTurretDone = 0
endglobals
private function Actions takes nothing returns nothing
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
if GetOwningPlayer(SpellEvent.TargetUnit)==Player(PLAYER_NEUTRAL_PASSIVE) and GetUnitTypeId(SpellEvent.TargetUnit)==TURRET_ID then
if HostileAllied == false then
call SetUnitOwner(SpellEvent.TargetUnit,Player(ALLIEDID),true)
else
call SetUnitOwner(SpellEvent.TargetUnit,owner,true)
endif
set DefTurretDone = DefTurretDone + 1
set SideQuestEta[3]=INFO_ACTIVATED+I2S(DefTurretDone)+"/"+I2S(DefTurretMax)+" done."
call UpdateSideQuest(3)
if DefTurretDone == DefTurretMax then
call EndSideQuest(3)
endif
else
call ErrorSound(owner)
call DisplayTextToPlayer(owner,0.,0.,INFO_ERROR)
endif
endfunction
public function init takes nothing returns nothing
set DefTurretMax = 14
set DefTurretDone = 0
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=24
//TESH.alwaysfold=0
scope ActivatePrimaryRadarStructure initializer init
globals
private constant integer SPELL = 'A049'
private constant integer TURRET_ID = 'o00O'
private constant integer DUMMY_VISION = 'o006'
private constant string INFO_ACTIVATED = "A Radar Turret has been activated."
private constant string INFO_ERROR = " You can only activate Primary Radar Structures"
private integer SentryMax = 0
private integer SentryDone = 0
endglobals
private function AddVisibility takes real x, real y returns nothing
local integer i = 0
loop
exitwhen i > MAXPLAYER + 1
if GetPlayerSlotState(Player(i))==PLAYER_SLOT_STATE_PLAYING then
call SetUnitPathing(CreateUnit(Player(i),DUMMY_VISION,x,y,0.),false)
endif
set i = i + 1
endloop
endfunction
private function CheckRadars takes nothing returns boolean
if GetUnitTypeId(GetFilterUnit())==TURRET_ID then
call AddVisibility(GetUnitX(GetFilterUnit()),GetUnitY(GetFilterUnit()))
endif
return true
endfunction
private function Actions takes nothing returns nothing
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
if GetOwningPlayer(SpellEvent.TargetUnit)==Player(PLAYER_NEUTRAL_PASSIVE) and GetUnitTypeId(SpellEvent.TargetUnit)==TURRET_ID then
call SetUnitOwner(SpellEvent.TargetUnit,owner,true)
set SentryDone = SentryDone + 1
set SideQuestEta[4]=INFO_ACTIVATED+I2S(SentryDone)+"/"+I2S(SentryMax)+" done."
call UpdateSideQuest(4)
if SentryDone == SentryMax then
call EndSideQuest(4)
call GroupEnumUnitsInRect(ENUM_GROUP,bj_mapInitialPlayableArea, Filter(function CheckRadars))
endif
else
call ErrorSound(owner)
call DisplayTextToPlayer(owner,0.,0.,INFO_ERROR)
endif
endfunction
public function init takes nothing returns nothing
set SentryMax = 7
set SentryDone = 0
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope ActivateTeleporter initializer init
globals
private constant integer SPELL = 'A0AC'
private constant real AOE = 300.00
private constant string INFO_ACTIVATED = "Emergency Teleportation Beacons: "
private constant integer TELEPORTATION_BALISE = 'n00F'
private player Owner
private integer BaliseMax = 0
private integer BaliseDone = 0
endglobals
private function ActivateBalise takes nothing returns boolean
if GetUnitTypeId(GetFilterUnit())==TELEPORTATION_BALISE and GetOwningPlayer(GetFilterUnit())==Player(PLAYER_NEUTRAL_PASSIVE) then
call SetUnitOwner(GetFilterUnit(),Owner,true)
call PingMinimap(GetUnitX(GetFilterUnit()),GetUnitY(GetFilterUnit()),1.)
set BaliseDone = BaliseDone + 1
set SideQuestEta[5]=INFO_ACTIVATED+I2S(BaliseDone)+"/"+I2S(BaliseMax)+" done."
call UpdateSideQuest(5)
if BaliseDone == BaliseMax then
call EndSideQuest(5)
endif
endif
return true
endfunction
private function Actions takes nothing returns nothing
local real x = GetUnitX(SpellEvent.CastingUnit)
local real y = GetUnitY(SpellEvent.CastingUnit)
set Owner = GetOwningPlayer(SpellEvent.CastingUnit)
call GroupEnumUnitsInRange(ENUM_GROUP,x,y,AOE,Filter(function ActivateBalise))
endfunction
public function init takes nothing returns nothing
set BaliseMax = 6
set BaliseDone = 0
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
library AdvancedInfantry needs TextDisplay
globals
private constant integer SPELL = 'A09J'
private constant integer TELEPORTATION_BALISE = 'n00F'
private constant integer TELEPORTATION_REQ = 3
private constant string TELEPORTATION_INFO = "Emergency Teleportation Balises can now be activated"
private player Owner
endglobals
private function Conditions takes nothing returns boolean
local unit caster = GetTriggerUnit()
local player owner = GetOwningPlayer(caster)
local integer ownerId = GetPlayerId(owner)
if GetLearnedSkill() == SPELL then
if GetUnitAbilityLevel(caster,SPELL) == TELEPORTATION_REQ then
call DisplayAll(PlayerColor[ownerId]+GetPlayerName(owner),TELEPORTATION_INFO)
endif
endif
set caster = null
return false
endfunction
function AdvancedInfantry takes unit hero returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterUnitEvent(t,hero,EVENT_UNIT_HERO_SKILL)
call TriggerAddCondition(t,Condition(function Conditions))
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope AdvancedSelfHeal initializer init
globals
private constant integer SPELL = 'A0I4'
private constant real AMOUNT = 300.
private constant string SUCCESS_FRACTURE = "Fracture healed"
private constant string SUCCESS_POISON = "A poison removed"
endglobals
private function Actions takes nothing returns nothing
local unit target = SpellEvent.CastingUnit
local integer i = 0
call SetUnitState(target,UNIT_STATE_LIFE,GetUnitState(target,UNIT_STATE_LIFE)+AMOUNT)
if GetUnitAbilityLevel(target,BUFF_FRACT)>=1 then
call TextTagMessage(SUCCESS_FRACTURE,target,0.,50.,64.,90.,9,5.,4.)
call UnitRemoveAbility(target,BUFF_FRACT)
endif
if GetUnitAbilityLevel(target,BUFF_POISON1)>=1 or GetUnitAbilityLevel(target,BUFF_POISON2)>=1 then
loop
exitwhen i > 2
if GetUnitAbilityLevel(target,BUFF_POISON1)>=1 then
call UnitRemoveAbility(target,BUFF_POISON1)
endif
if GetUnitAbilityLevel(target,BUFF_POISON2)>=1 then
call UnitRemoveAbility(target,BUFF_POISON2)
endif
set i = i + 1
endloop
call TextTagMessage(SUCCESS_POISON,target,0.,50.,64.,90.,9,5.,4.)
endif
set target = null
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL,Actions)
endfunction
endscope
//TESH.scrollpos=45
//TESH.alwaysfold=0
scope AirSupportEF initializer init
globals
private constant integer DRONE_ID = 'n013'
private constant integer SPELL_EF ='A0DC'
private constant integer SPEED = 50
private constant real AOE = 500.
private constant real AOE_FX = 250.
private constant real IMP = 1.
private constant real SPAWN_DISTANCE = 2000.
private constant real SPAWN_Z = 500.
private constant integer COUNT = 30
private constant real DMG = 3000.
private constant integer DUMMY_AOE = 'o00Z'
private constant string FX = "Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl"
endglobals
private function Damage takes unit whichUnit, real x, real y returns nothing
local integer i = 0
loop
exitwhen i > COUNT
call DestroyEffect(AddSpecialEffect(FX,x+GetRandomReal(-AOE_FX,AOE_FX),y+GetRandomReal(-AOE_FX,AOE_FX)))
set i = i + 1
endloop
call UnitDamageAll(whichUnit,false,AOE,x,y,DMG,DMG_EXPLOSIVE,false,0,0,0)
endfunction
private struct str
unit drone
real angle
integer distance
integer firepoint
integer i
real targetX
real targetY
endstruct
private function Update takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
local real newX = GetUnitX(dat.drone) + SPEED*Cos(dat.angle)
local real newY = GetUnitY(dat.drone) + SPEED*Sin(dat.angle)
local real z = GetUnitFlyHeight(dat.drone)
local real newz = 0.
if dat.i < dat.distance then
set dat.i = dat.i + 1
call SetUnitPosition(dat.drone, newX, newY)
if dat.i == dat.firepoint then
call Damage(dat.drone,dat.targetX,dat.targetY)
endif
else
call RemoveUnit(dat.drone)
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function Actions takes nothing returns nothing
local timer t = NewTimer()
local str dat = str.create()
local real x1 = GetUnitX(SpellEvent.CastingUnit)
local real y1 = GetUnitY(SpellEvent.CastingUnit)
local real x2 = SpellEvent.TargetX
local real y2 = SpellEvent.TargetY
local real angle = Atan2((y2 -y1), (x2 - x1))
local real x3 = CheckPointValidity(x1 - SPAWN_DISTANCE*Cos(angle),MapXMin,MapXMax)
local real y3 = CheckPointValidity(y1 - SPAWN_DISTANCE*Sin(angle),MapYMin,MapYMax)
local real x4 = CheckPointValidity(x2 + SPAWN_DISTANCE*Cos(angle),MapXMin,MapXMax)
local real y4 = CheckPointValidity(y2 + SPAWN_DISTANCE*Sin(angle),MapYMin,MapYMax)
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local integer ownerId = GetPlayerId(owner)
call DisplayAll(PlayerColor[ownerId]+GetPlayerName(owner),"Move! Move! Move! Fighters missiles incoming!")
call FlySound()
call WillExplodeSound()
set dat.targetX = x2
set dat.targetY = y2
set dat.angle = angle
set dat.firepoint =R2I(1.25*SquareRoot((x3-x2)*(x3-x2)+(y3-y2)*(y3-y2))/SPEED)
set dat.distance =R2I(SquareRoot((x3-x4)*(x3-x4)+(y3-y4)*(y3-y4))/SPEED)
if dat.firepoint >= dat.distance then
set dat.firepoint = dat.distance
endif
call PingMinimapEx(x2, y2,5., 204, 196, 115, false)
call UnitApplyTimedLife(CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),DUMMY_AOE,x2,y2,0.),'BTLF',2.)
set dat.i = 0
set dat.drone = CreateUnit(GetOwningPlayer(SpellEvent.CastingUnit),DRONE_ID,x3,y3, dat.angle*bj_RADTODEG )
call SetUnitFlyHeight(dat.drone,SPAWN_Z,0.)
call SetTimerData(t, dat)
call TimerStart (t, TIMEOUT, true, function Update)
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL_EF, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope AirSupportTC initializer init
globals
private constant integer DRONE_ID = 'n00J'
private constant integer SPELL_TC ='A04R'
private constant integer SPEED = 50
private constant real AOE = 800.
private constant real AOE_FX = 400.
private constant real IMP = 1.
private constant real SPAWN_DISTANCE = 2000.
private constant real SPAWN_Z = 500.
private constant integer COUNT = 40
private constant real DMG = 5000.
private constant integer DUMMY_AOE = 'o00Z'
private constant string FX = "Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl"
endglobals
private function Damage takes unit whichUnit, real x, real y returns nothing
local integer i = 0
loop
exitwhen i > COUNT
call DestroyEffect(AddSpecialEffect(FX,x+GetRandomReal(-AOE_FX,AOE_FX),y+GetRandomReal(-AOE_FX,AOE_FX)))
set i = i + 1
endloop
call UnitDamageAll(whichUnit,false,AOE,x,y,DMG,DMG_EXPLOSIVE,false,0,0,0)
endfunction
private struct str
unit drone
real angle
integer distance
integer firepoint
integer i
real targetX
real targetY
endstruct
private function Update takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
local real newX = GetUnitX(dat.drone) + SPEED*Cos(dat.angle)
local real newY = GetUnitY(dat.drone) + SPEED*Sin(dat.angle)
local real z = GetUnitFlyHeight(dat.drone)
local real newz = 0.
if dat.i < dat.distance then
set dat.i = dat.i + 1
call SetUnitPosition(dat.drone, newX, newY)
if dat.i == dat.firepoint then
call Damage(dat.drone,dat.targetX,dat.targetY)
endif
else
call RemoveUnit(dat.drone)
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function Actions takes nothing returns nothing
local timer t = NewTimer()
local str dat = str.create()
local real x1 = GetUnitX(SpellEvent.CastingUnit)
local real y1 = GetUnitY(SpellEvent.CastingUnit)
local real x2 = SpellEvent.TargetX
local real y2 = SpellEvent.TargetY
local real angle = Atan2((y2 -y1), (x2 - x1))
local real x3 = CheckPointValidity(x1 - SPAWN_DISTANCE*Cos(angle),MapXMin,MapXMax)
local real y3 = CheckPointValidity(y1 - SPAWN_DISTANCE*Sin(angle),MapYMin,MapYMax)
local real x4 = CheckPointValidity(x2 + SPAWN_DISTANCE*Cos(angle),MapXMin,MapXMax)
local real y4 = CheckPointValidity(y2 + SPAWN_DISTANCE*Sin(angle),MapYMin,MapYMax)
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local integer ownerId = GetPlayerId(owner)
call DisplayAll(PlayerColor[ownerId]+GetPlayerName(owner),"Move! Move! Move! Fighters missiles incoming!")
call FlySound()
call WillExplodeSound()
set dat.targetX = x2
set dat.targetY = y2
set dat.angle = angle
set dat.firepoint =R2I(1.25*SquareRoot((x3-x2)*(x3-x2)+(y3-y2)*(y3-y2))/SPEED)
set dat.distance =R2I(SquareRoot((x3-x4)*(x3-x4)+(y3-y4)*(y3-y4))/SPEED)
if dat.firepoint >= dat.distance then
set dat.firepoint = dat.distance
endif
call PingMinimapEx(x2, y2,5., 204, 196, 115, false)
call UnitApplyTimedLife(CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),DUMMY_AOE,x2,y2,0.),'BTLF',2.)
set dat.i = 0
set dat.drone = CreateUnit(GetOwningPlayer(SpellEvent.CastingUnit),DRONE_ID,x3,y3, dat.angle*bj_RADTODEG )
call SetUnitFlyHeight(dat.drone,SPAWN_Z,0.)
call SetTimerData(t, dat)
call TimerStart (t, TIMEOUT, true, function Update)
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL_TC, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope Anomaly initializer init
globals
private constant integer BUFF_DRUG = 'A086'
private constant integer SPELL = 'A05G'
private constant integer SPELL_NPC = 'A06T'
private constant integer DURATION = 10
private constant real AOE = 800.
private unit Caster
endglobals
private struct str
unit target
endstruct
private function RemoveBuff takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
if GetUnitAbilityLevel(dat.target,BUFF_DRUG)>= 1 then
call UnitRemoveAbility(dat.target,BUFF_DRUG)
endif
call ReleaseTimer(t)
call dat.destroy()
endfunction
private function AddDrug takes unit target returns nothing
local str dat = str.create()
local timer t = NewTimer()
set dat.target = target
call SetTimerData(t,dat)
call UnitAddAbility(dat.target,BUFF_DRUG)
call TimerStart(t,DURATION,false,function RemoveBuff)
endfunction
private function AddBuffToEnemy takes nothing returns boolean
if IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(Caster)) and not(IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE)) and not(IsUnitType(GetFilterUnit(),UNIT_TYPE_DEAD)) then
call AddDrug(GetFilterUnit())
call IssueTargetOrder(GetFilterUnit(),"attack",GroupPickRandomUnit(ENUM_GROUP))
endif
return true
endfunction
private function Actions takes nothing returns nothing
set Caster = SpellEvent.CastingUnit
call GroupEnumUnitsInRange(ENUM_GROUP, GetUnitX(Caster),GetUnitY(Caster), AOE,Filter(function AddBuffToEnemy))
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Actions)
call RegisterSpellFinishResponse(SPELL_NPC, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope AntiMatterStorm initializer init
globals
private constant integer SPELL = 'A058'
private constant integer BALL_ID = 'o007'
private constant real TIMEOUT_SUMMON = 0.1
private constant integer AMOUNT = 20
private constant real DMG = 100.
private constant string FX = "Abilities\\Spells\\Demon\\DemonBoltImpact\\DemonBoltImpact.mdl"
private constant string FX_LIGTHNING = "AFOD"
private constant real AOE = 150.
player Owner = null
unit Dummy = null
endglobals
private function AddEffect takes nothing returns boolean
local unit target = GetFilterUnit()
if IsUnitEnemy(target,Owner) and not(IsUnitType(target,UNIT_TYPE_STRUCTURE)) and not(IsUnitType(target,UNIT_TYPE_DEAD)) then
call DestroyEffect(AddSpecialEffectTarget(FX,target,"origin"))
call Eclair(Dummy,target,FX_LIGTHNING,1.)
endif
set target = null
return true
endfunction
private function UnitDeath takes nothing returns boolean
local unit victim = GetTriggerUnit()
local player owner = GetOwningPlayer(victim)
local integer ownerId = GetPlayerId(owner)
local real dmg = DMG*GetUnitAbilityLevel(Hero[ownerId],SPELL)
local real x = GetUnitX(victim)
local real y = GetUnitY(victim)
set Owner = owner
set Dummy = victim
call GroupEnumUnitsInRange(ENUM_GROUP, x,y,AOE, Filter(function AddEffect))
call UnitDamageEnemies(victim,AOE,x,y,dmg,DMG_ENERGETIC,false,0,0,0)
set victim = null
set owner = null
return false
endfunction
private struct s_death
trigger trig
private static method createFilter takes unit u returns boolean
return GetUnitTypeId(u)==BALL_ID
endmethod
private method onCreate takes nothing returns nothing
set .trig = CreateTrigger()
call TriggerRegisterUnitEvent(.trig,me,EVENT_UNIT_DEATH)
call TriggerAddCondition(.trig,Condition(function UnitDeath))
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
call DisableTrigger(.trig)
call DestroyTrigger(.trig)
set .trig = null
endmethod
implement AutoDestroy
endstruct
private struct str
unit hero
integer i
player owner
real x1
real y1
real x2
real y2
real a
unit dummy
endstruct
private function Update takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
if dat.i < AMOUNT then
set dat.i = dat.i + 1
set dat.dummy = CreateUnit(dat.owner,BALL_ID,dat.x1+dat.i*40*Cos(dat.a),dat.y1+dat.i*40*Sin(dat.a),0.00)
call UnitApplyTimedLife(dat.dummy,'BTLF',2.)
call SetUnitFlyHeight(dat.dummy,400.,200.)
else
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function Cast takes nothing returns nothing
local timer t = NewTimer()
local str dat = str.create()
set dat.hero = SpellEvent.CastingUnit
set dat.owner = GetOwningPlayer(dat.hero)
set dat.x1 = GetUnitX(dat.hero)
set dat.y1 = GetUnitY(dat.hero)
set dat.x2 = SpellEvent.TargetX
set dat.y2 = SpellEvent.TargetY
set dat.a = Atan2(dat.y2-dat.y1, dat.x2 -dat.x1)
set dat.i = 0
call SetTimerData(t, dat)
call TimerStart (t,TIMEOUT_SUMMON, true, function Update )
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Cast)
endfunction
endscope
//TESH.scrollpos=17
//TESH.alwaysfold=0
scope Antivenom initializer init
globals
private constant integer SPELL = 'A07Y'
private constant integer SPELL_NPC = 'A057'
private constant integer ITEMSPELL1 = 'A08U' //Vaccin
private constant integer ITEMSPELL2 = 'A094' //Bandage Pack
private constant integer ITEMSPELL3 = 'A095' //Instant Immunity
private constant string SUCCESS = "A poison removed"
private constant string FX = "Abilities\\Spells\\Human\\DispelMagic\\DispelMagicTarget.mdl"
endglobals
private function Actions takes nothing returns nothing
local unit caster = SpellEvent.CastingUnit
local unit target = SpellEvent.TargetUnit
if SpellEvent.AbilityId == ITEMSPELL1 or SpellEvent.AbilityId == ITEMSPELL2 or SpellEvent.AbilityId == ITEMSPELL3 then
set target = SpellEvent.CastingUnit
endif
if GetUnitAbilityLevel(target,BUFF_POISON1)>=1 or GetUnitAbilityLevel(target,BUFF_POISON2)>=1 then
call DestroyEffect(AddSpecialEffectTarget(FX,target,"origin"))
if GetUnitAbilityLevel(target,BUFF_POISON1)>=1 then
call UnitRemoveAbility(target,BUFF_POISON1)
endif
if GetUnitAbilityLevel(target,BUFF_POISON2)>=1 then
call UnitRemoveAbility(target,BUFF_POISON2)
endif
if SpellEvent.AbilityId == ITEMSPELL1 then
if GetUnitAbilityLevel(target,BUFF_POISON1)>=1 then
call UnitRemoveAbility(target,BUFF_POISON1)
endif
if GetUnitAbilityLevel(target,BUFF_POISON1)>=1 then
call UnitRemoveAbility(target,BUFF_POISON1)
endif
if GetUnitAbilityLevel(target,BUFF_POISON2)>=1 then
call UnitRemoveAbility(target,BUFF_POISON2)
endif
if GetUnitAbilityLevel(target,BUFF_POISON2)>=1 then
call UnitRemoveAbility(target,BUFF_POISON2)
endif
endif
call TextTagMessage(SUCCESS,target,0.,50.,64.,90.,9,5.,4.)
endif
set caster = null
set target = null
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Actions)
call RegisterSpellFinishResponse(SPELL_NPC, Actions)
call RegisterSpellCastResponse(ITEMSPELL1, Actions)
call RegisterSpellCastResponse(ITEMSPELL2, Actions)
call RegisterSpellCastResponse(ITEMSPELL3, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope Antizombification initializer init
globals
private constant real AOE = 500.00
private constant integer SPELL = 'A05E'
private constant integer BLOOD_ZOMBIE = 'A03L'
private constant real DMG_BASE = 400.
private constant real DMG_COEFF = 100.
private constant string FX = "Abilities\\Spells\\Human\\DispelMagic\\DispelMagicTarget.mdl"
private unit Caster
private player Owner
endglobals
private function Damage takes nothing returns boolean
local unit target = GetFilterUnit()
if IsUnitEnemy(target,Owner) and GetUnitAbilityLevel(target,BLOOD_ZOMBIE)>=1 and not(IsUnitType(target,UNIT_TYPE_STRUCTURE)) and not(IsUnitType(target,UNIT_TYPE_DEAD)) then
call DestroyEffect(AddSpecialEffectTarget(FX,target,"origin"))
call UnitDamageTarget(Caster,target, DMG_BASE+DMG_COEFF*GetUnitAbilityLevel(Caster,SPELL),false,false, DMG_ENERGETIC, DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
endif
set target = null
return true
endfunction
private function Actions takes nothing returns nothing
set Caster = SpellEvent.CastingUnit
set Owner = GetOwningPlayer(SpellEvent.CastingUnit)
call GroupEnumUnitsInRange(ENUM_GROUP,SpellEvent.TargetX,SpellEvent.TargetY,AOE,Filter(function Damage))
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope ApacheDrive initializer init
globals
private constant integer SPELL = 'A0E4'
private constant integer UNIT_ID = 'n00Z'
endglobals
private function Actions takes nothing returns nothing
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
if GetUnitTypeId(SpellEvent.TargetUnit)==UNIT_ID then
call SetPilotVehicle(SpellEvent.CastingUnit,SpellEvent.TargetUnit)
else
call ErrorSound(owner)
call DisplayTextToPlayer(owner,0.,0.,"You must target an Apache")
endif
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=54
//TESH.alwaysfold=0
scope ArtilleryDrop initializer init
globals
private constant integer DRONE_ID = 'n00G'
private constant integer UNIT_ID = 'h012'
private constant string INFO = "Pepper Shaker incoming by the aerial way."
private unit array Walker [12]
private constant integer SPELL ='A0AI'
private constant integer SPEED = 25
private constant real SPAWN_DISTANCE = 4000.
private constant real SPAWN_Z = 500.
private constant real WALKER_Z = 50.
private constant real WAIT = 3.
endglobals
private struct s_delay
unit drone
unit walker
endstruct
private function Wait takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_delay dat = GetTimerData(t)
call SetUnitFlyHeight(dat.drone,SPAWN_Z,300.)
call SetUnitFlyHeight(dat.walker, 0., 0.)
call UnitRemoveAbility(dat.walker,GARN)
call SetUnitInvulnerable(dat.walker,false)
call UnitAddAbility(dat.drone,LASTQUESTUNIT_SPELL)
call IssuePointOrder(dat.drone,LASTQUESTUNIT_ORDER,GetRectCenterX(gg_rct_LastQuest),GetRectCenterY(gg_rct_LastQuest))
call ReleaseTimer(t)
call dat.destroy()
endfunction
private function DelayControl takes unit drone, unit walker returns nothing
local timer t = NewTimer()
local s_delay dat = s_delay.create()
set dat.walker = walker
set dat.drone = drone
call SetTimerData(t, dat)
call TimerStart (t, WAIT, false, function Wait)
endfunction
private struct s_drop
player owner
unit drone
unit walker
real angle
integer distance
integer i
endstruct
private function Update takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_drop dat = GetTimerData(t)
local real newX = GetUnitX(dat.drone) + SPEED*Cos(dat.angle)
local real newY = GetUnitY(dat.drone) + SPEED*Sin(dat.angle)
if dat.i < dat.distance then
set dat.i = dat.i + 1
call SetUnitPosition(dat.drone, newX, newY)
call SetUnitPosition(dat.walker, newX, newY)
else
call SetUnitFlyHeight(dat.drone,100.,300.)
call SetUnitFlyHeight(dat.walker, 0., 300.)
call DelayControl(dat.drone,dat.walker)
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function Actions takes nothing returns nothing
local timer t = NewTimer()
local s_drop dat = s_drop.create()
local real x1 = GetUnitX(SpellEvent.CastingUnit)
local real y1 = GetUnitY(SpellEvent.CastingUnit)
local real x2 = SpellEvent.TargetX
local real y2 = SpellEvent.TargetY
local real angle = Atan2((y2 -y1), (x2 - x1))
local real x3 = CheckPointValidity(x1 - SPAWN_DISTANCE*Cos(angle),MapXMin,MapXMax)
local real y3 = CheckPointValidity(y1 - SPAWN_DISTANCE*Sin(angle),MapYMin,MapYMax)
local real x4 = CheckPointValidity(x2 + SPAWN_DISTANCE*Cos(angle),MapXMin,MapXMax)
local real y4 = CheckPointValidity(y2 + SPAWN_DISTANCE*Sin(angle),MapYMin,MapYMax)
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local integer ownerId = GetPlayerId(owner)
if not(IsUnitType(Walker[ownerId],UNIT_TYPE_DEAD)) then
call KillUnit(Walker[ownerId])
endif
call DisplayAll(PlayerColor[ownerId]+GetPlayerName(owner),INFO)
call PingMinimap(x2,y2,1.)
set dat.angle = angle
set dat.distance =R2I(SquareRoot((x3-x2)*(x3-x2)+(y3-y2)*(y3-y2))/SPEED)
set dat.i = 0
set dat.owner = owner
set dat.drone = CreateUnit(dat.owner,DRONE_ID,x3,y3, dat.angle*bj_RADTODEG )
call SetUnitFlyHeight(dat.drone,SPAWN_Z,0.)
set dat.walker = CreateUnit(dat.owner,UNIT_ID,x3,y3,0.)
call SetUnitFlyHeight(dat.walker, SPAWN_Z-WALKER_Z, 0.)
call UnitAddAbility(dat.walker,GARN)
call SetUnitInvulnerable(dat.walker,true)
set Walker[ownerId] = dat.walker
call SetTimerData(t, dat)
call TimerStart (t, TIMEOUT, true, function Update)
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=22
//TESH.alwaysfold=0
library Assistance needs TextDisplay
globals
private constant integer SPELL = 'A0KM'
private constant integer BIO_REQ = 4
private constant string BIO_INFO = "Bio Satellite activated; I hope you guys will appreciate the new datas"
endglobals
private function ShareVision takes nothing returns nothing
local integer i = 0
local integer j = 0
call FogMaskEnable(false)
loop
exitwhen i > MAXPLAYER
set j = 0
if HostileAllied == false then
loop
exitwhen j > MAXPLAYER+1
call SetPlayerAllianceBJ( Player(i), ALLIANCE_SHARED_VISION, true, Player(j) )
set j = j + 1
endloop
else
loop
exitwhen j > MAXPLAYER
call SetPlayerAllianceBJ( Player(i), ALLIANCE_SHARED_VISION, true, Player(j) )
set j = j + 1
endloop
endif
set i = i + 1
endloop
endfunction
private function Conditions takes nothing returns boolean
local unit caster = GetTriggerUnit()
local player owner = GetOwningPlayer(caster)
local integer ownerId = GetPlayerId(owner)
if GetLearnedSkill() == SPELL then
if GetUnitAbilityLevel(caster,SPELL) == BIO_REQ then
call ShareVision()
call DisplayAll(PlayerColor[ownerId]+GetPlayerName(owner),BIO_INFO)
endif
endif
set caster = null
return false
endfunction
function Assistance takes unit hero returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterUnitEvent(t,hero,EVENT_UNIT_HERO_SKILL)
call TriggerAddCondition(t,Condition(function Conditions))
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library AWDrones initializer init needs GroupUtils,SpellEvent
globals
private constant integer GW_ID = 'h021'
private constant integer AW_ID = 'n01J'
private constant string FX_SPAWN= "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportCaster.mdl"
private constant integer SPELL = 'A0HP'
private constant integer COUNT = 2
private constant real AOE = 150.
private constant integer UP = 'R01F'
endglobals
private function CheckDrone takes nothing returns boolean
local unit target = GetFilterUnit()
local integer targetId = GetUnitTypeId(target)
if targetId==AW_ID or targetId==GW_ID then
call KillUnit(target)
endif
set target = null
return true
endfunction
private function Spawn takes nothing returns nothing
local unit spawned = null
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local real x = GetUnitX(SpellEvent.CastingUnit)
local real y = GetUnitY(SpellEvent.CastingUnit)
local integer level = GetUnitAbilityLevel(SpellEvent.CastingUnit,SPELL)
local integer i = 0
call GroupEnumUnitsOfPlayer(ENUM_GROUP,owner,Filter(function CheckDrone))
loop
exitwhen i > COUNT-1
set spawned = CreateUnit(owner, AW_ID,x+GetRandomReal(-AOE,AOE),y+GetRandomReal(-AOE,AOE),0.)
call DestroyEffect(AddSpecialEffectTarget(FX_SPAWN, spawned, "origin") )
call IssueImmediateOrder(spawned,ACTIVATE_AI_ORDER)
set i = i + 1
endloop
set spawned = null
endfunction
private function Conditions takes nothing returns boolean
local unit caster = GetTriggerUnit()
local player owner = GetOwningPlayer(caster)
if GetLearnedSkill() == SPELL then
call SetPlayerTechResearched(owner, UP, GetPlayerTechCount(owner,UP,true)+1)
endif
set caster = null
return false
endfunction
function AWDrones takes unit hero returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterUnitEvent(t,hero,EVENT_UNIT_HERO_SKILL)
call TriggerAddCondition(t,Condition(function Conditions))
endfunction
private function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Spawn)
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope HeavySoldierBattleRoar initializer init
globals
private constant integer SPELL = 'A00Q'
private constant integer SPELL_NPC = 'A0FU'
private constant real AOE = 600.
private unit TmpCaster
endglobals
private function Taunt takes nothing returns boolean
local unit target = GetFilterUnit()
if IsUnitEnemy(target,GetOwningPlayer(TmpCaster)) and not (IsUnitType(target,UNIT_TYPE_FLYING)) and not(IsUnitType(target,UNIT_TYPE_STRUCTURE)) and not (IsUnitType(target,UNIT_TYPE_DEAD)) then
call IssueTargetOrder(target,"attack",TmpCaster)
endif
set target = null
return true
endfunction
private function Actions takes nothing returns nothing
set TmpCaster = SpellEvent.CastingUnit
call GroupEnumUnitsInRange(ENUM_GROUP, GetUnitX(TmpCaster),GetUnitY(TmpCaster),AOE, Condition(function Taunt))
endfunction
public function init takes nothing returns nothing
call RegisterSpellCastResponse(SPELL, Actions)
call RegisterSpellCastResponse(SPELL_NPC, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
library Barrage initializer init needs TimerUtils,TextDisplay,AbilityPreload,AutoIndex,SpellEvent,GroupFunction,GroupUtils
globals
private constant integer UNIT_ID = 'H00R'
private constant string FX_BARRAGE = "war3mapImported\\Barrage.mdx"
private constant string FX_SHELL = "war3mapImported\\Artillery.mdx" //"Units\\Demon\\Infernal\\InfernalBirth.mdl"
private constant string FX_WP = "Units\\Demon\\Infernal\\InfernalBirth.mdl"
private constant string FX_ILLUM = "Abilities\\Spells\\Human\\Flare\\FlareTarget.mdl"
private constant real DMG_BARRAGE = 250.
private constant real AOE_BARRAGE = 200.
private constant real DAMAGE_DELAY = 1.
private constant integer SPELL_FIRESHELL = 'A04P'
private constant integer SPELL_FIREWP = 'A04T'
private constant integer SPELL_ILLUM = 'A0EW'
private constant integer SPELL_ARTILLERY_COMMAND = 'A04S'
private constant integer TOGGLE_SHELLFIRED_REQ = 2
private constant integer TOGGLE_DISPERSION_REQ = 3
private constant integer SPELL_TOGGLE_SHELLFIRED = 'A013'
private constant integer SPELL_TOGGLE_DISPERSION = 'A04O'
private constant integer SPELL_TOGGLE_ATTACKRATE = 'A04N'
private constant string TEXT_SHELLFIRED = "Shells fired set to "
private constant string TEXT_DISPERSION = "Dispersion of Barrage set to "
private constant string TEXT_ATTACKRATE = "Attack Rate set to "
private constant string COM_SHELLFIRED = "-s "
private constant string COM_DISPERSION = "-dp"
private constant integer VISION_ID = 'o01Y'
private constant real ILLUM_DUR = 30.
private integer Com_ShellFired_Lenght = 0
private integer Com_Dispersion_Lenght = 0
private constant string TEXT_STOCK = "Shells remaining: "
private constant integer MODEMAX = 5
integer BarrageShellsStock = 1000
integer BarrageDispersionCurrent = 500
integer BarrageShellsFiredCurrent = 2
real BarrageAttackRateCurrent = 0.8
real BarrageFireDelayCurrent = 10.
private integer BarrageAttackRateLevelCurrent = 2
private integer array BarrageDispersionMode [6]
private integer array BarrageShellsFiredMode [6]
private real array BarrageAttackRateMode [6]
private integer array BarrageDispersionCircleMode [6]
private integer BarrageDispersionCircleCurrent = 'o00N'
private constant integer DUMMY_WPID = 'o01G'
private constant real LIFESPAN_WP = 45.
endglobals
private function SetVariables takes nothing returns nothing
set Com_ShellFired_Lenght = StringLength(COM_SHELLFIRED)
set Com_Dispersion_Lenght = StringLength(COM_DISPERSION)
set BarrageFireDelayCurrent = 11.
set BarrageShellsStock = 1000
set BarrageDispersionCurrent = 300
set BarrageShellsFiredCurrent = 10
set BarrageAttackRateCurrent = 1
set BarrageAttackRateLevelCurrent = 2
set BarrageDispersionCircleCurrent = 'o010'
set BarrageDispersionMode[0] = 100
set BarrageDispersionMode[1] = 200
set BarrageDispersionMode[2] = 300
set BarrageDispersionMode[3] = 400
set BarrageDispersionMode[4] = 500
set BarrageDispersionMode[5] = 510
set BarrageDispersionCircleMode[0]= 'o00N'
set BarrageDispersionCircleMode[1]= 'o012'
set BarrageDispersionCircleMode[2]= 'o010'
set BarrageDispersionCircleMode[3]= 'o01F'
set BarrageDispersionCircleMode[4]= 'o00Z'
set BarrageDispersionCircleMode[5]= 'o00Z'
set BarrageShellsFiredMode[0] = 1
set BarrageShellsFiredMode[1] = 5
set BarrageShellsFiredMode[2] = 10
set BarrageShellsFiredMode[3] = 15
set BarrageShellsFiredMode[4] = 20
set BarrageShellsFiredMode[5] = 21
set BarrageAttackRateMode[0] = 0.25
set BarrageAttackRateMode[1] = 0.5
set BarrageAttackRateMode[2] = 1.
set BarrageAttackRateMode[3] = 1.5
set BarrageAttackRateMode[4] = 2.
set BarrageAttackRateMode[5] = 2.1
endfunction
private struct s_delay
real x
real y
unit caster
real damage
endstruct
private function FireBarrageDealDamage takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_delay dat = GetTimerData(t)
call DestroyEffect(AddSpecialEffect(FX_BARRAGE,dat.x,dat.y))
call UnitDamageAll(dat.caster,true,AOE_BARRAGE,dat.x,dat.y,dat.damage,DMG_EXPLOSIVE,false,0,0,0)
call ReleaseTimer(t)
call dat.destroy()
endfunction
private function FireBarrageDelayDamage takes unit caster,real damage, real x, real y returns nothing
local timer t = NewTimer()
local s_delay dat = s_delay.create()
set dat.caster = caster
set dat.damage = damage
set dat.x = x
set dat.y = y
call SetTimerData(t, dat)
call TimerStart (t, DAMAGE_DELAY,false, function FireBarrageDealDamage )
endfunction
private struct s_illumFx
integer i
real x
real y
endstruct
private function UpdateIlluminFx takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_illumFx dat = GetTimerData(t)
if dat.i < 15 then
set dat.i = dat.i + 1
call DestroyEffect(AddSpecialEffect(FX_ILLUM,dat.x,dat.y))
else
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function IllumFx takes real x, real y returns nothing
local timer t = NewTimer()
local s_illumFx dat = s_illumFx.create()
set dat.i = 0
set dat.x = x
set dat.y = y
call SetTimerData(t, dat)
call TimerStart (t, 2.,true, function UpdateIlluminFx )
endfunction
private struct str
integer i
real damage
unit caster
real targetX
real targetY
real dispersion
integer count
unit dummy
player owner
endstruct
private function IllumDelay takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
local integer i = 0
loop
exitwhen i > MAXPLAYER + 1
if GetPlayerSlotState(Player(i))==PLAYER_SLOT_STATE_PLAYING then
set dat.dummy = CreateUnit(Player(i),VISION_ID,dat.targetX,dat.targetY,0.)
call UnitApplyTimedLife(dat.dummy,'BTLF',ILLUM_DUR)
call SetUnitPathing(dat.dummy,false)
endif
set i = i + 1
endloop
set BarrageShellsStock = BarrageShellsStock - 5
call IllumFx(dat.targetX,dat.targetY)
call ReleaseTimer(t)
call dat.destroy()
endfunction
private function CastIllum takes nothing returns nothing
local timer t = NewTimer()
local str dat = str.create()
set dat.i = 0
set dat.targetX = SpellEvent.TargetX
set dat.targetY = SpellEvent.TargetY
set dat.owner = GetOwningPlayer(SpellEvent.CastingUnit)
call DisplayTextToPlayer(dat.owner,0.,0.,TEXT_STOCK+I2S(BarrageShellsStock-5))
call SetTimerData(t, dat)
call TimerStart (t, BarrageFireDelayCurrent,false, function IllumDelay )
endfunction
private function FireWpDelay takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
call DestroyEffect(AddSpecialEffect(FX_WP,dat.targetX,dat.targetY))
set dat.dummy = CreateUnit(dat.owner,DUMMY_WPID,dat.targetX,dat.targetY,0.)
call UnitApplyTimedLife(dat.dummy,'BTLF',LIFESPAN_WP)
set BarrageShellsStock = BarrageShellsStock - 1
call ReleaseTimer(t)
call dat.destroy()
endfunction
private function CastWp takes nothing returns nothing
local timer t = NewTimer()
local str dat = str.create()
call BombFallSound()
call WillExplodeSound()
set dat.i = 0
set dat.targetX = SpellEvent.TargetX
set dat.targetY = SpellEvent.TargetY
call PingMinimapEx(SpellEvent.TargetX,SpellEvent.TargetY,3., 204, 196, 115, false)
set dat.owner = GetOwningPlayer(SpellEvent.CastingUnit)
call UnitApplyTimedLife(CreateUnit(dat.owner,BarrageDispersionCircleMode[2],dat.targetX,dat.targetY,0.),'BTLF',(BarrageFireDelayCurrent))
call DisplayTextToPlayer(dat.owner,0.,0.,TEXT_STOCK+I2S(BarrageShellsStock-1))
call SetTimerData(t, dat)
call TimerStart (t, BarrageFireDelayCurrent,false, function FireWpDelay )
endfunction
private function FireBarrageLoop takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
local real x = dat.targetX+GetRandomReal(-dat.dispersion,dat.dispersion)
local real y = dat.targetY+GetRandomReal(-dat.dispersion,dat.dispersion)
if dat.i < dat.count then
set dat.i = dat.i + 1
if BarrageShellsStock > 0 then
call DestroyEffect(AddSpecialEffect(FX_SHELL,x,y))
call FireBarrageDelayDamage(dat.caster,dat.damage,x,y)
set BarrageShellsStock = BarrageShellsStock - 1
endif
else
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function FireBarrageDelay takes nothing returns nothing
local timer t1 = GetExpiredTimer()
local timer t2 = NewTimer()
local str dat = GetTimerData(t1)
call BombFallSound()
call SetTimerData(t2,dat)
call ReleaseTimer(t1)
call TimerStart (t2, BarrageAttackRateCurrent,true, function FireBarrageLoop )
endfunction
private function CastBarrage takes nothing returns nothing
local timer t = NewTimer()
local str dat = str.create()
local integer stockUsed = BarrageShellsFiredCurrent
call WillExplodeSound()
set dat.i = 0
set dat.caster = SpellEvent.CastingUnit
set dat.targetX = SpellEvent.TargetX
set dat.targetY = SpellEvent.TargetY
call PingMinimapEx(SpellEvent.TargetX,SpellEvent.TargetY,3., 204, 196, 115, false)
set dat.dispersion = BarrageDispersionCurrent
set dat.count = BarrageShellsFiredCurrent
set dat.owner = GetOwningPlayer(SpellEvent.CastingUnit)
set dat.damage = DMG_BARRAGE*GetUnitAbilityLevel(dat.caster,SPELL_FIRESHELL)
call UnitApplyTimedLife(CreateUnit(dat.owner,BarrageDispersionCircleCurrent,dat.targetX,dat.targetY,0.),'BTLF',(BarrageAttackRateCurrent*dat.count+BarrageFireDelayCurrent))
call DisplayTextToPlayer(dat.owner,0.,0.,TEXT_STOCK+I2S(BarrageShellsStock-stockUsed))
call SetTimerData(t, dat)
call TimerStart (t, BarrageFireDelayCurrent,false, function FireBarrageDelay )
endfunction
private function ToggleAttackRate takes nothing returns nothing
local integer i = 0
loop
exitwhen i > MODEMAX-1
if BarrageAttackRateCurrent == BarrageAttackRateMode[i] and i < MODEMAX - 1 then
set BarrageAttackRateCurrent = BarrageAttackRateMode[i+1]
call DisplayTextToPlayer(GetOwningPlayer(SpellEvent.CastingUnit),0.,0.,TEXT_ATTACKRATE+R2S(BarrageAttackRateCurrent))
return
endif
set i = i + 1
endloop
if BarrageAttackRateCurrent == BarrageAttackRateMode[MODEMAX-1] then
set BarrageAttackRateCurrent = BarrageAttackRateMode[0]
call DisplayTextToPlayer(GetOwningPlayer(SpellEvent.CastingUnit),0.,0.,TEXT_ATTACKRATE+R2S(BarrageAttackRateCurrent))
endif
endfunction
private function ToggleDispersion takes nothing returns nothing
local integer i = 0
loop
exitwhen i > MODEMAX-1
if BarrageDispersionCurrent >=BarrageDispersionMode[i] and BarrageDispersionCurrent < BarrageDispersionMode[i+1] and i < MODEMAX - 1 then
set BarrageDispersionCurrent = BarrageDispersionMode[i+1]
set BarrageDispersionCircleCurrent = BarrageDispersionCircleMode[i+1]
call DisplayTextToPlayer(GetOwningPlayer(SpellEvent.CastingUnit),0.,0.,TEXT_DISPERSION+I2S(BarrageDispersionCurrent))
return
endif
set i = i + 1
endloop
if BarrageDispersionCurrent >= BarrageDispersionMode[MODEMAX-1] then
set BarrageDispersionCurrent = BarrageDispersionMode[0]
set BarrageDispersionCircleCurrent = BarrageDispersionCircleMode[0]
call DisplayTextToPlayer(GetOwningPlayer(SpellEvent.CastingUnit),0.,0.,TEXT_DISPERSION+I2S(BarrageDispersionCurrent))
endif
endfunction
private function ToggleShellFired takes nothing returns nothing
local integer i = 0
loop
exitwhen i > MODEMAX-1
if BarrageShellsFiredCurrent >=BarrageShellsFiredMode[i] and BarrageShellsFiredCurrent < BarrageShellsFiredMode[i+1] and i < MODEMAX - 1 then
set BarrageShellsFiredCurrent = BarrageShellsFiredMode[i+1]
call DisplayTextToPlayer(GetOwningPlayer(SpellEvent.CastingUnit),0.,0.,TEXT_SHELLFIRED+I2S(BarrageShellsFiredCurrent))
return
endif
set i = i + 1
endloop
if BarrageShellsFiredCurrent >= BarrageShellsFiredMode[MODEMAX-1] then
set BarrageShellsFiredCurrent = BarrageShellsFiredMode[0]
call DisplayTextToPlayer(GetOwningPlayer(SpellEvent.CastingUnit),0.,0.,TEXT_SHELLFIRED+I2S(BarrageShellsFiredCurrent))
endif
endfunction
private function CheckComDispersion takes nothing returns boolean
local player owner = GetTriggerPlayer()
local integer ownerId = GetPlayerId(owner)
local string text = GetEventPlayerChatString()
local integer string_length = StringLength(text)
local integer amount = 0
local integer i = 0
if SubString(text,0,Com_Dispersion_Lenght) == COM_DISPERSION then
set text = SubString(text,Com_Dispersion_Lenght+1,string_length)
if text != null then
if GetUnitAbilityLevel(Hero[ownerId],SPELL_TOGGLE_DISPERSION)>=1 then
set amount = S2I(text)
if amount >=BarrageDispersionMode[0] and amount <= BarrageDispersionMode[MODEMAX-1] then
set BarrageDispersionCurrent = amount
call DisplayTextToPlayer(owner,0.,0.,TEXT_DISPERSION+I2S(BarrageDispersionCurrent))
loop
exitwhen i > MODEMAX - 1
if BarrageDispersionCurrent >= BarrageDispersionMode[i] and BarrageDispersionCurrent < BarrageDispersionMode[i+1] then
set BarrageDispersionCircleCurrent = BarrageDispersionCircleMode[i+1]
set text = null
return false
endif
set i = i + 1
endloop
else
call ErrorSound(owner)
call DisplayTextToPlayer(owner,0.,0.,"Please enter an integer between "+I2S(BarrageDispersionMode[0])+" and "+I2S(BarrageDispersionMode[MODEMAX-1]))
endif
else
call ErrorSound(owner)
call DisplayTextToPlayer(owner,0.,0.,"You must be a Tactical Controller with Artillery Command at level "+I2S(TOGGLE_DISPERSION_REQ))
endif
endif
endif
set text = null
return false
endfunction
private function CheckComShellFired takes nothing returns boolean
local player owner = GetTriggerPlayer()
local integer ownerId = GetPlayerId(owner)
local string text = GetEventPlayerChatString()
local integer string_length = StringLength(text)
local integer amount = 0
if SubString(text,0,Com_ShellFired_Lenght) == COM_SHELLFIRED then
set text = SubString(text,Com_ShellFired_Lenght,string_length)
if text != null then
if GetUnitAbilityLevel(Hero[ownerId],SPELL_TOGGLE_SHELLFIRED)>=1 then
set amount = S2I(text)
if amount >=BarrageShellsFiredMode[0] and amount <= BarrageShellsFiredMode[MODEMAX-1] then
set BarrageShellsFiredCurrent = amount
call DisplayTextToPlayer(owner,0.,0.,TEXT_SHELLFIRED+I2S(BarrageShellsFiredCurrent))
else
call ErrorSound(owner)
call DisplayTextToPlayer(owner,0.,0.,"Please enter an integer between "+I2S(BarrageShellsFiredMode[0])+" and "+I2S(BarrageShellsFiredMode[MODEMAX-1]))
endif
else
call ErrorSound(owner)
call DisplayTextToPlayer(owner,0.,0.,"You must be a Tactical Controller with Artillery Command at level "+I2S(TOGGLE_SHELLFIRED_REQ))
endif
endif
endif
set text = null
return false
endfunction
private function LearnBarrage takes nothing returns boolean
local unit caster = GetTriggerUnit()
local player owner = GetOwningPlayer(caster)
if GetLearnedSkill() == SPELL_FIRESHELL then
set BarrageFireDelayCurrent = BarrageFireDelayCurrent - 1.
endif
set caster = null
return false
endfunction
function Barrage takes unit hero returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterUnitEvent(t,hero,EVENT_UNIT_HERO_SKILL)
call TriggerAddCondition(t,Condition(function LearnBarrage))
endfunction
private function init takes nothing returns nothing
local trigger t2 = CreateTrigger()
local trigger t3 = CreateTrigger()
local integer i = 0
call SetVariables()
call RegisterSpellFinishResponse(SPELL_FIRESHELL,CastBarrage)
call RegisterSpellFinishResponse(SPELL_FIREWP,CastWp)
call RegisterSpellFinishResponse(SPELL_ILLUM,CastIllum)
call RegisterSpellCastResponse(SPELL_TOGGLE_SHELLFIRED,ToggleShellFired)
call RegisterSpellCastResponse(SPELL_TOGGLE_DISPERSION,ToggleDispersion)
call RegisterSpellCastResponse(SPELL_TOGGLE_ATTACKRATE,ToggleAttackRate)
loop
exitwhen i > MAXPLAYER
call TriggerRegisterPlayerChatEvent( t2, Player(i), COM_SHELLFIRED, false)
call TriggerRegisterPlayerChatEvent( t3, Player(i), COM_DISPERSION, false)
set i = i + 1
endloop
call TriggerAddCondition(t2, Condition(function CheckComShellFired))
call TriggerAddCondition(t3, Condition(function CheckComDispersion))
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope Barricade initializer init
globals
private constant integer UNIT_ID = 'h014'
private constant real LIFESPAN = 120.
endglobals
private function Conditions takes nothing returns boolean
local unit barricade = GetTriggerUnit()
if GetUnitTypeId(barricade)==UNIT_ID then
call UnitApplyTimedLife(barricade,'BTLF',LIFESPAN)
endif
set barricade = null
return false
endfunction
public function init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterEnterRectSimple(t, bj_mapInitialPlayableArea)
call TriggerAddCondition(t, Condition(function Conditions))
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
library BioChemicalWeapon
globals
private constant integer SPELL = 'A0JB'
private constant integer AMMO_REQ = 5
private constant integer AMMO_SPELL = 'A0JK'
endglobals
private function Conditions takes nothing returns boolean
local unit caster = GetTriggerUnit()
if GetLearnedSkill() == SPELL then
if GetUnitAbilityLevel(caster,SPELL) == AMMO_REQ then
call SetUnitAbilityLevel(caster,AMMO_SPELL,2)
endif
endif
set caster = null
return false
endfunction
function BioChemicalWeapon takes unit hero returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterUnitEvent(t,hero,EVENT_UNIT_HERO_SKILL)
call TriggerAddCondition(t,Condition(function Conditions))
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library BiologicalWeaponTraining
globals
private constant integer SPELL = 'A0K2'
private constant integer UP = 'R01N'
endglobals
private function Conditions takes nothing returns boolean
local unit caster = GetTriggerUnit()
local player owner = GetOwningPlayer(caster)
if GetLearnedSkill() == SPELL then
call SetPlayerTechResearched(owner, UP, GetPlayerTechCount(owner,UP,true)+1)
endif
set caster = null
return false
endfunction
function BiologicalWeaponTraining takes unit hero returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterUnitEvent(t,hero,EVENT_UNIT_HERO_SKILL)
call TriggerAddCondition(t,Condition(function Conditions))
endfunction
endlibrary
//TESH.scrollpos=3
//TESH.alwaysfold=0
scope Biologist initializer init
globals
private constant integer MARINE_ID = 'h00P'
private constant string FX_SPAWN= "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportCaster.mdl"
private constant integer SPELL = 'A0IX'
private constant integer COUNT = 1
private constant real AOE = 100.
endglobals
private function CheckSoldier takes nothing returns boolean
local unit target = GetFilterUnit()
if GetUnitTypeId(target)==MARINE_ID then
if GameMode == 6 then
call KillUnit(target)
else
call SetUnitOwner(target,Player(10),true)
call UnitAddAbility(target,LASTQUESTUNIT_SPELL)
call IssuePointOrder(target,LASTQUESTUNIT_ORDER,GetRectCenterX(gg_rct_LastQuest),GetRectCenterY(gg_rct_LastQuest))
endif
endif
set target = null
return true
endfunction
private function Spawn takes nothing returns nothing
local unit spawned = null
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local real x = GetRectCenterX(gg_rct_Reinforcement)
local real y = GetRectCenterY(gg_rct_Reinforcement)
local integer i = 0
call GroupEnumUnitsOfPlayer(ENUM_GROUP,owner,Filter(function CheckSoldier))
loop
exitwhen i > COUNT-1
set spawned = CreateUnit(owner, MARINE_ID,x+GetRandomReal(-AOE,AOE),y+GetRandomReal(-AOE,AOE),0.)
call DestroyEffect(AddSpecialEffectTarget(FX_SPAWN, spawned, "origin") )
call IssueImmediateOrder(spawned,ACTIVATE_AI_ORDER)
set i = i + 1
endloop
set spawned = null
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Spawn)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
library Biology
globals
private constant integer SPELL = 'A080'
private constant integer ANTIZOMB_SPELL = 'A05E'
private constant integer ANTIZOMB_UPREQ = 5
endglobals
private function Conditions takes nothing returns boolean
local unit caster = GetTriggerUnit()
local player owner = GetOwningPlayer(caster)
if GetLearnedSkill() == SPELL then
if GetUnitAbilityLevel(caster,SPELL) >= ANTIZOMB_UPREQ then
call IncUnitAbilityLevel(caster,ANTIZOMB_SPELL)
endif
endif
set caster = null
return false
endfunction
function Biology takes unit hero returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterUnitEvent(t,hero,EVENT_UNIT_HERO_SKILL)
call TriggerAddCondition(t,Condition(function Conditions))
endfunction
endlibrary
//TESH.scrollpos=66
//TESH.alwaysfold=0
scope Blackhole initializer init
globals
private constant integer SPELL = 'A0BP' //The spell
private constant real TIMEOUT_CHECK = 1. //Interval to check enemy ships and damage the nearest
private constant real DELTA_SPEED = 0.5
private constant integer SPEED = 10 //Speed of pull
private constant integer DUR = 20 //Number of interval for Timeout
private constant real AOEPULL = 800. //Aoe for pull effect
private constant integer BLACKHOLE_ID = 'o022' //The dummy for the blackhole fx
private player CasterOwner = null
private real X = 0.
private real Y = 0.
endglobals
private struct str2
unit target
real angle
integer distance
integer i
endstruct
private function LoopPull takes nothing returns nothing
local timer t = GetExpiredTimer()
local str2 dat = GetTimerData(t)
local real newX = GetUnitX(dat.target) + DELTA_SPEED*SPEED*Cos(dat.angle)
local real newY = GetUnitY(dat.target) + DELTA_SPEED*SPEED*Sin(dat.angle)
if (dat.i < dat.distance) and GetUnitState(dat.target, UNIT_STATE_LIFE) > 0 then
set dat.i = dat.i + 1
call SetUnitX(dat.target, newX)
call SetUnitY(dat.target, newY)
else
call SetUnitPathing( dat.target, true)
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function IniPull takes unit target, real x1, real y1, real x2, real y2 returns nothing
local timer t = NewTimer()
local str2 dat = str2.create()
set dat.target = target
call SetUnitPathing(dat.target, false)
set dat.angle = Atan2((y2 -y1), (x2 - x1))
set dat.distance =R2I(SquareRoot((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1))/SPEED)
set dat.i = 0
call SetTimerData(t, dat)
call TimerStart (t, TIMEOUT, true, function LoopPull)
endfunction
private function FilterNearbyEnemy takes nothing returns boolean
if not(IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE)) and not(IsUnitType(GetFilterUnit(),UNIT_TYPE_DEAD)) then
call IniPull(GetFilterUnit(),GetUnitX(GetFilterUnit()),GetUnitY(GetFilterUnit()),X,Y)
endif
return true
endfunction
private struct str
unit caster
integer i
player owner
real xtarget
real ytarget
endstruct
private function LoopDamageAndIniPull takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
if dat.i < DUR and GetUnitState(dat.caster, UNIT_STATE_LIFE) > 0 then
set dat.i = dat.i + 1
set CasterOwner = dat.owner
set X = dat.xtarget
set Y = dat.ytarget
call GroupEnumUnitsInRange(ENUM_GROUP,dat.xtarget,dat.ytarget,AOEPULL,Filter(function FilterNearbyEnemy))
else
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function IniBlackHole takes unit caster, real x, real y returns nothing
local timer t = NewTimer()
local str dat = str.create()
set dat.caster = caster
set dat.owner = GetOwningPlayer(dat.caster)
set dat.i = 0
set dat.xtarget = x
set dat.ytarget = y
call SetTimerData(t, dat)
call TimerStart (t, TIMEOUT_CHECK, true, function LoopDamageAndIniPull )
endfunction
private function Actions takes nothing returns nothing
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local integer ownerId = GetPlayerId(owner)
call DisplayAll(PlayerColor[ownerId]+GetPlayerName(owner),"Blackhole generated")
call UnitApplyTimedLife(CreateUnit(owner,BLACKHOLE_ID,SpellEvent.TargetX,SpellEvent.TargetY,0.),'BTLF',DUR)
call IniBlackHole(SpellEvent.CastingUnit,SpellEvent.TargetX,SpellEvent.TargetY)
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL,Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope BradleyDrive initializer init
globals
private constant integer SPELL = 'A0E3'
private constant integer UNIT_ID = 'h01E'
endglobals
private function Actions takes nothing returns nothing
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
if GetUnitTypeId(SpellEvent.TargetUnit)==UNIT_ID then
call SetPilotVehicle(SpellEvent.CastingUnit,SpellEvent.TargetUnit)
else
call ErrorSound(owner)
call DisplayTextToPlayer(owner,0.,0.,"You must target a Bradley")
endif
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
library BodyTurret initializer init needs TimerUtils,AbilityPreload,SpellEvent
globals
private constant integer SPELL = 'A09V'
private constant integer ID = 'o01V'
private constant integer SPELLBOOK = 'A0A7'
private constant real LIFESPAN = 30.
private constant real DMG = 0.2
private constant real DISTANCE = 10.
private constant real ANGLE = 60.
private constant integer UP = 'R00K'
private constant integer UNIT_ID = 'H010'
endglobals
private struct str
integer i
unit caster
real angle
unit turret
integer duration
endstruct
private function Update takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
local real x1 = GetUnitX(dat.caster)
local real y1 = GetUnitY(dat.caster)
local real x2 = x1 + DISTANCE*Cos(dat.angle)
local real y2 = y1 + DISTANCE*Sin(dat.angle)
if not (IsUnitType(dat.caster,UNIT_TYPE_DEAD)) and dat.i < dat.duration then
set dat.i = dat.i + 1
call SetUnitX(dat.turret,x2)
call SetUnitY(dat.turret,y2)
call SetUnitFlyHeight(dat.turret,GetUnitFlyHeight(dat.caster)+20.,0.)
else
if GetUnitAbilityLevel(dat.caster,SPELLBOOK)>=1 then
call UnitRemoveAbility(dat.caster,SPELLBOOK)
endif
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function Actions takes nothing returns nothing
local timer t = NewTimer()
local str dat = str.create()
local integer count = GetUnitAbilityLevel(SpellEvent.CastingUnit,SPELL)
local integer i = 0
local real x = GetUnitX(SpellEvent.CastingUnit)
local real y = GetUnitY(SpellEvent.CastingUnit)
set dat.caster = SpellEvent.CastingUnit
if GetUnitAbilityLevel(dat.caster,SPELLBOOK)<=0 then
call UnitAddAbility(dat.caster,SPELLBOOK)
endif
call UnitDamageTarget(dat.caster,dat.caster,DMG*GetUnitState(dat.caster,UNIT_STATE_MAX_LIFE),false,false,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
set dat.angle = i*ANGLE*bj_DEGTORAD
set dat.turret= CreateUnit(GetOwningPlayer(dat.caster),ID,x+DISTANCE*Cos(dat.angle),y+DISTANCE*Sin(dat.angle),0.)
call UnitApplyTimedLife(dat.turret,'BTLF',LIFESPAN)
set dat.i = 0
set dat.duration = R2I(LIFESPAN/TIMEOUT)
call SetTimerData(t,dat)
call TimerStart(t,TIMEOUT,true,function Update)
endfunction
private function Conditions takes nothing returns boolean
local unit caster = GetTriggerUnit()
local player owner = GetOwningPlayer(caster)
if GetLearnedSkill() == SPELL then
call SetPlayerTechResearched(owner, UP, GetPlayerTechCount(owner,UP,true)+1)
endif
set caster = null
return false
endfunction
function BodyTurret takes unit hero returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterUnitEvent(t,hero,EVENT_UNIT_HERO_SKILL)
call TriggerAddCondition(t,Condition(function Conditions))
endfunction
private function init takes nothing returns nothing
local integer i = 0
call AbilityPreload(SPELLBOOK)
loop
exitwhen i > MAXPLAYER
call SetPlayerAbilityAvailable(Player(i),SPELLBOOK,false)
set i = i + 1
endloop
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endlibrary
//TESH.scrollpos=16
//TESH.alwaysfold=0
scope BurningArmor initializer init
globals
private constant integer SPELLBOOK = 'A041'
private constant real DUR = 30.
private constant integer SPELL = 'A02F'
endglobals
private struct str
unit caster
endstruct
private function Wait takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
if GetUnitAbilityLevel(dat.caster,SPELLBOOK)>=1 then
call UnitRemoveAbility(dat.caster,SPELLBOOK)
endif
call ReleaseTimer(t)
call dat.destroy()
endfunction
private function Actions takes nothing returns nothing
local timer t = NewTimer()
local str dat = str.create()
set dat.caster = SpellEvent.CastingUnit
if GetUnitAbilityLevel(dat.caster,SPELLBOOK)<=0 then
call UnitAddAbility(dat.caster, SPELLBOOK)
endif
call SetTimerData(t, dat)
call TimerStart (t,DUR, false, function Wait )
endfunction
public function init takes nothing returns nothing
local integer i = 0
call AbilityPreload(SPELLBOOK)
loop
exitwhen i > MAXPLAYER
call SetPlayerAbilityAvailable(Player(i),SPELLBOOK,false)
set i = i + 1
endloop
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
library BurstMode initializer init
globals
private constant string ON = "magicdefense"
private constant string OFF = "magicundefense"
private constant integer ID = 'H00L'
private constant integer BONUS = 'A010'
private constant integer BUFF = 'B01M'
endglobals
private function UnitOrder takes nothing returns boolean
local unit marine = GetTriggerUnit()
local string order = OrderId2String(GetIssuedOrderId())
if order == ON and GetUnitAbilityLevel(marine,BONUS)<=0 then
call UnitAddAbility(marine,BONUS)
elseif order == OFF then
if GetUnitAbilityLevel(marine,BONUS)>=1 then
call UnitRemoveAbility(marine,BONUS)
endif
if GetUnitAbilityLevel(marine,BUFF)>=1 then
call UnitRemoveAbility(marine,BUFF)
endif
endif
set marine = null
return false
endfunction
function BurstMode takes unit hero returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterUnitEvent(t,hero,EVENT_UNIT_ISSUED_ORDER)
call TriggerAddCondition(t,Condition(function UnitOrder))
endfunction
private function init takes nothing returns nothing
call AbilityPreload(BONUS)
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope CallGuardDog initializer init
globals
private constant integer SPELL = 'A02J'
private constant integer SPELL_ROAR = 'A02L'
private constant string ORDER_ROAR = "roar"
private constant integer CHANCE_ROAR = 25
private constant real LIFESPAN = 60.
private constant string FX = "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportCaster.mdl"
private constant string INFO = "Guard Dog teleportation complete."
integer array GuardDogId [6]
private unit array Dog [12]
endglobals
private function DogAttacked takes nothing returns boolean
local unit dog = GetTriggerUnit()
if GetRandomInt(0,100)<=CHANCE_ROAR and GetUnitAbilityLevel(dog,AI_ENABLED)>=1 then
call IssueImmediateOrder(dog,ORDER_ROAR)
endif
set dog = null
return false
endfunction
private struct str
trigger trig
private static method createFilter takes unit u returns boolean
return GetUnitAbilityLevel(u,SPELL_ROAR)>=1
endmethod
private method onCreate takes nothing returns nothing
set .trig = CreateTrigger()
call TriggerRegisterUnitEvent(.trig,me,EVENT_UNIT_ATTACKED)
call TriggerAddCondition(.trig,Condition(function DogAttacked))
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
call DisableTrigger(.trig)
call DestroyTrigger(.trig)
set .trig = null
endmethod
implement AutoDestroy
endstruct
private function Spawn takes nothing returns nothing
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local integer ownerId = GetPlayerId(owner)
local real x = GetUnitX(SpellEvent.CastingUnit)
local real y = GetUnitY(SpellEvent.CastingUnit)
call DestroyEffect(AddSpecialEffect(FX,x,y) )
if not(IsUnitType(Dog[ownerId],UNIT_TYPE_DEAD)) then
call KillUnit(Dog[ownerId])
endif
set Dog[ownerId] = CreateUnit(owner, GuardDogId[GetUnitAbilityLevel(SpellEvent.CastingUnit,SPELL)-1],x,y,0.)
call DestroyEffect(AddSpecialEffectTarget(FX, SpellEvent.CastingUnit, "origin") )
call IssueImmediateOrder(Dog[ownerId],ACTIVATE_AI_ORDER)
call DisplayAll(PlayerColor[ownerId]+GetPlayerName(owner),INFO)
endfunction
public function init takes nothing returns nothing
set GuardDogId[0] = 'o016'
set GuardDogId[1] = 'o014'
set GuardDogId[2] = 'o017'
set GuardDogId[3] = 'o00J'
set GuardDogId[4] = 'o013'
set GuardDogId[5] = 'o015'
call RegisterSpellFinishResponse(SPELL, Spawn)
endfunction
endscope
//TESH.scrollpos=36
//TESH.alwaysfold=0
scope CallForhelp initializer init
globals
private constant integer DRONE_ID = 'n00G'
private constant real LIFESPAN = 60.
private constant string INFO = "Incoming to your position, hold on! "
private constant integer SPELL ='A0II'
private constant integer SPEED = 25
private constant real SPAWN_DISTANCE = 4000.
private constant real SPAWN_Z = 500.
private constant real WAIT = 3.
private constant integer AMOUNT = 4
endglobals
private struct s_control
unit marine
endstruct
private function RemoveControl takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_control dat = GetTimerData(t)
if not (IsUnitType(dat.marine,UNIT_TYPE_DEAD)) and dat.marine != null then
call UnitAddAbility(dat.marine,LASTQUESTUNIT_SPELL)
call IssuePointOrder(dat.marine,LASTQUESTUNIT_ORDER,GetRectCenterX(gg_rct_LastQuest),GetRectCenterY(gg_rct_LastQuest))
endif
call ReleaseTimer(t)
call dat.destroy()
endfunction
private function StartRemoveControl takes unit marine returns nothing
local timer t = NewTimer()
local s_control dat = s_control.create()
set dat.marine = marine
call SetTimerData(t, dat)
call TimerStart (t, LIFESPAN, false, function RemoveControl)
endfunction
private struct s_delay
unit drone
endstruct
private function Wait takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_delay dat = GetTimerData(t)
local integer i = 0
local real x = GetUnitX(dat.drone)
local real y = GetUnitY(dat.drone)
local player owner = GetOwningPlayer(dat.drone)
call SetUnitFlyHeight(dat.drone,SPAWN_Z,300.)
call UnitAddAbility(dat.drone,LASTQUESTUNIT_SPELL)
call IssuePointOrder(dat.drone,LASTQUESTUNIT_ORDER,GetRectCenterX(gg_rct_LastQuest),GetRectCenterY(gg_rct_LastQuest))
loop
exitwhen i > AMOUNT-1
if GameMode == 6 then
call UnitApplyTimedLife(CreateUnit(owner,AlliedId[GetRandomInt(0,AlliedIdMax)],x,y,0.),'BTLF',LIFESPAN)
else
call StartRemoveControl(CreateUnit(Player(10),AlliedId[GetRandomInt(0,AlliedIdMax)],x,y,0.))
endif
set i = i + 1
endloop
call ReleaseTimer(t)
call dat.destroy()
endfunction
private function DelayControl takes unit drone returns nothing
local timer t = NewTimer()
local s_delay dat = s_delay.create()
set dat.drone = drone
call SetTimerData(t, dat)
call TimerStart (t, WAIT, false, function Wait)
endfunction
private struct s_drop
player owner
unit drone
real angle
integer distance
integer i
endstruct
private function Update takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_drop dat = GetTimerData(t)
local real newX = GetUnitX(dat.drone) + SPEED*Cos(dat.angle)
local real newY = GetUnitY(dat.drone) + SPEED*Sin(dat.angle)
if dat.i < dat.distance then
set dat.i = dat.i + 1
call SetUnitPosition(dat.drone, newX, newY)
else
call SetUnitFlyHeight(dat.drone,100.,300.)
call DelayControl(dat.drone)
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function Actions takes nothing returns nothing
local timer t = NewTimer()
local s_drop dat = s_drop.create()
local real x1 = GetUnitX(SpellEvent.CastingUnit)
local real y1 = GetUnitY(SpellEvent.CastingUnit)
local real x2 = SpellEvent.TargetX
local real y2 = SpellEvent.TargetY
local real angle = Atan2((y2 -y1), (x2 - x1))
local real x3 = CheckPointValidity(x1 - SPAWN_DISTANCE*Cos(angle),MapXMin,MapXMax)
local real y3 = CheckPointValidity(y1 - SPAWN_DISTANCE*Sin(angle),MapYMin,MapYMax)
local real x4 = CheckPointValidity(x2 + SPAWN_DISTANCE*Cos(angle),MapXMin,MapXMax)
local real y4 = CheckPointValidity(y2 + SPAWN_DISTANCE*Sin(angle),MapYMin,MapYMax)
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local integer ownerId = GetPlayerId(owner)
call DisplayAll("Tango Squadron",INFO+PlayerColor[ownerId]+GetPlayerName(owner))
call PingMinimap(x2,y2,1.)
set dat.angle = angle
set dat.distance =R2I(SquareRoot((x3-x2)*(x3-x2)+(y3-y2)*(y3-y2))/SPEED)
set dat.i = 0
set dat.owner = owner
set dat.drone = CreateUnit(dat.owner,DRONE_ID,x3,y3, dat.angle*bj_RADTODEG )
call SetUnitFlyHeight(dat.drone,SPAWN_Z,0.)
call SetTimerData(t, dat)
call TimerStart (t, TIMEOUT, true, function Update)
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=12
//TESH.alwaysfold=0
scope Cancellation initializer init
globals
private constant integer SPELL = 'A059'
private constant integer UNIT_ID = 'H00E'
private constant string FX_LIGTHNING= "AFOD"
private constant string FX = "Abilities\\Spells\\Demon\\DemonBoltImpact\\DemonBoltImpact.mdl"
private constant string FX_CAST = "Abilities\\Spells\\Demon\\ReviveDemon\\ReviveDemon.mdl"
private constant real DMG_BASE = 250.
private constant real DMG_COEFF = 250.
private constant real AOE = 350.
private constant integer DUMMY_ID = 'o004'
private constant real DUR = 4.
private constant integer DUMMY_AMOUNT = 6
private unit Caster
private player Owner
endglobals
private struct s_caster
boolean isCasting = false
private static method createFilter takes unit u returns boolean
return GetUnitTypeId(u)==UNIT_ID
endmethod
private method onCreate takes nothing returns nothing
set .isCasting = false
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
set .isCasting = false
endmethod
implement AutoDestroy
endstruct
private function SetCast takes unit whichUnit, boolean cast returns nothing
local s_caster dat = s_caster[whichUnit]
set dat.isCasting = cast
endfunction
private function GetCast takes unit whichUnit returns boolean
local s_caster dat = s_caster[whichUnit]
return dat.isCasting
endfunction
private struct s_dummy
unit hero
unit target
integer i
real a
integer duration
endstruct
private function UpdateDummy takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_dummy dat = GetTimerData(t)
local real z = GetUnitFlyHeight(dat.target)
local real x1 = GetUnitX(dat.hero)
local real y1 = GetUnitY(dat.hero)
local real x2 = x1+AOE*Cos(dat.a)
local real y2 = y1+AOE*Sin(dat.a)
if dat.i < dat.duration and GetCast(dat.hero)==true then
set dat.i = dat.i + 1
set dat.a = dat.a+(3.*bj_DEGTORAD)
call SetUnitPosition(dat.target,x2,y2)
call SetUnitFlyHeight(dat.target,z+4.,0.)
else
call RemoveUnit(dat.target)
call SetUnitPathing( dat.target, true)
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function StartDummyMovement takes unit hero, unit target,real angle returns nothing
local timer t = NewTimer()
local s_dummy dat = s_dummy.create()
local real x1 = GetUnitX(dat.hero)
local real y1 = GetUnitY(dat.hero)
local real x2 = GetUnitX(dat.target)
local real y2 = GetUnitY(dat.target)
call SetUnitPathing( target, false)
set dat.hero = hero
set dat.target = target
set dat.i = 0
set dat.a = angle*bj_DEGTORAD
set dat.duration = R2I(DUR/TIMEOUT)
call SetTimerData(t, dat)
call TimerStart (t, TIMEOUT, true, function UpdateDummy )
endfunction
private struct s_target
unit hero
unit target
integer i
integer duration
endstruct
private function UpdateTarget takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_target dat = GetTimerData(t)
local real z = GetUnitFlyHeight(dat.target)
if dat.i < dat.duration and GetCast(dat.hero)==true then
set dat.i = dat.i + 1
call SetUnitFlyHeight(dat.target,z+4.,0.)
else
if GetCast(dat.hero)==true then
call DestroyEffect(AddSpecialEffectTarget(FX,dat.target,"origin"))
call UnitDamageTarget(dat.hero, dat.target,DMG_BASE+DMG_COEFF*GetUnitAbilityLevel(dat.hero,SPELL),false,false,DMG_ENERGETIC,DAMAGE_TYPE_NORMAL,null)
endif
call SetUnitFlyHeight(dat.target,0.,0.)
call PauseUnit(dat.target,false)
call SetUnitPathing( dat.target, true)
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function StartTargetMovement takes unit hero, unit target returns nothing
local real x1 = GetUnitX(hero)
local real y1 = GetUnitY(hero)
local timer t = NewTimer()
local s_target dat = s_target.create()
call SetUnitPathing( target, false)
set dat.hero = hero
set dat.target = target
set dat.duration = R2I(DUR/TIMEOUT)
set dat.i = 0
call PauseUnit(dat.target,true)
call SetTimerData(t, dat)
call TimerStart (t, TIMEOUT, true, function UpdateTarget )
endfunction
private function PickEnemy takes nothing returns boolean
local unit target = GetFilterUnit()
if IsUnitEnemy(target,Owner) and not(IsUnitType(target,UNIT_TYPE_STRUCTURE)) and not(IsUnitType(target,UNIT_TYPE_DEAD)) then
call StartTargetMovement(Caster,target)
endif
set target = null
return true
endfunction
private function EndCast takes nothing returns nothing
call SetCast(SpellEvent.CastingUnit,false)
endfunction
private function Cast takes nothing returns nothing
local unit hero = SpellEvent.CastingUnit
local player owner = GetOwningPlayer(hero)
local real x1 = GetUnitX(hero)
local real y1 = GetUnitY(hero)
local unit array dum
local real x2 = 0.
local real y2 = 0.
local integer i = 0
call SetCast(hero,true)
call DestroyEffect(AddSpecialEffectTarget(FX_CAST,hero,"origin"))
loop
exitwhen i > DUMMY_AMOUNT-1
set x2 = x1 + AOE*Cos(i*60.*bj_DEGTORAD)
set y2 = y1 + AOE*Sin(i*60.*bj_DEGTORAD)
set dum[i] = CreateUnit(owner,DUMMY_ID,x2,y2,0.)
call UnitApplyTimedLife(dum[i],'BTLF',DUR)
call StartDummyMovement(hero,dum[i],60*i)
set i = i + 1
endloop
call Eclair(dum[0],dum[0],FX_LIGTHNING,DUR)
call Eclair(dum[1],dum[1],FX_LIGTHNING,DUR)
call Eclair(dum[2],dum[2],FX_LIGTHNING,DUR)
call Eclair(dum[3],dum[3],FX_LIGTHNING,DUR)
call Eclair(dum[4],dum[4],FX_LIGTHNING,DUR)
call Eclair(dum[5],dum[5],FX_LIGTHNING,DUR)
set Caster = hero
set Owner = owner
call GroupEnumUnitsInRange(ENUM_GROUP,x1,y1,AOE,Filter(function PickEnemy))
set i = 0
loop
set i = i + 1
exitwhen i > 6
set dum[i]= null
endloop
set hero = null
endfunction
public function init takes nothing returns nothing
call RegisterSpellCastResponse(SPELL, Cast)
call RegisterSpellEndCastResponse(SPELL, EndCast)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
library CEBuildingMax
function CEBuildingMax takes unit hero returns nothing
local player owner = GetOwningPlayer(hero)
call SetPlayerTechMaxAllowed(owner,'o02U',1)//turret base
call SetPlayerTechMaxAllowed(owner,'h01H',8)//barricade
call SetPlayerTechMaxAllowed(owner,'h01K',4)//observatory tower
call SetPlayerTechMaxAllowed(owner,'o02P',1)//medical post
call SetPlayerTechMaxAllowed(owner,'o02Q',1)//repair bay
call SetPlayerTechMaxAllowed(owner,'o02S',1)//field teleporter
call SetPlayerTechMaxAllowed(owner,'o02R',1)//command center
call SetPlayerTechMaxAllowed(owner,'o02O',4)//mine thrower
call SetPlayerTechMaxAllowed(owner,'o02K',2)//machinegun turret
call SetPlayerTechMaxAllowed(owner,'o02L',2)//heavy gun turret
call SetPlayerTechMaxAllowed(owner,'o02N',2)//laser designator
call SetPlayerTechMaxAllowed(owner,'o02M',4)//detection turret
call SetPlayerTechMaxAllowed(owner,'o02T',4)//artillery turret
call SetPlayerTechMaxAllowed(owner,'o02Y',1)//rocket pod
call SetPlayerTechMaxAllowed(owner,'o02Z',1)//tesla turret
call SetPlayerTechMaxAllowed(owner,'o030',1)//medical turret
call SetPlayerTechMaxAllowed(owner,'o031',1)//energetic turret
call SetPlayerTechMaxAllowed(owner,'o034',1)//supply structure
endfunction
endlibrary
//TESH.scrollpos=15
//TESH.alwaysfold=0
scope ChainExplosive initializer init
globals
private constant integer CHAIN_ID = 'n00S'
private constant integer SPELL = 'A01O'
private constant integer SPELL_ITEM = 'A070'
private constant real AOE = 400.
private constant real DMG = 3000.
private constant string FX1 = "FlameStrike1.mdx"
private constant string FX2 = "Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl"
endglobals
private function UnitDeath takes nothing returns boolean
local unit victim = GetTriggerUnit()
local real x = GetUnitX(victim)
local real y = GetUnitY(victim)
call DestroyEffect(AddSpecialEffect(FX1,x,y))
call DestroyEffect(AddSpecialEffect(FX2,x,y))
call UnitDamageAll(victim,false,AOE,x,y,DMG,DMG_EXPLOSIVE,false,0,0,0)
set victim = null
return false
endfunction
private struct str
trigger trig
private static method createFilter takes unit u returns boolean
return GetUnitTypeId(u)==CHAIN_ID
endmethod
private method onCreate takes nothing returns nothing
set .trig = CreateTrigger()
call TriggerRegisterUnitEvent(.trig,me,EVENT_UNIT_DEATH)
call TriggerAddCondition(.trig,Condition(function UnitDeath))
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
call DisableTrigger(.trig)
call DestroyTrigger(.trig)
set .trig = null
endmethod
implement AutoDestroy
endstruct
private function Spawn takes nothing returns nothing
call CreateUnit(GetOwningPlayer(SpellEvent.CastingUnit),CHAIN_ID,SpellEvent.TargetX,SpellEvent.TargetY,0.)
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Spawn)
call RegisterSpellFinishResponse(SPELL_ITEM, Spawn)
endfunction
endscope
//TESH.scrollpos=1
//TESH.alwaysfold=0
scope ChainLightning initializer init
globals
private constant integer SPELL = 'A02Q'
private constant integer DUMMY_SPELL = 'A03T'
private constant real AOE = 500.
private unit Caster
private player Owner
endglobals
private function Damage takes nothing returns boolean
local unit target = GetFilterUnit()
local unit dummy = null
if IsUnitEnemy(target,Owner) and not(IsUnitType(target,UNIT_TYPE_STRUCTURE)) and not(IsUnitType(target,UNIT_TYPE_DEAD)) then
set dummy = CreateUnit(Owner,DUMMY,GetUnitX(target),GetUnitY(target),0. )
call UnitAddAbility(dummy,DUMMY_SPELL)
call UnitApplyTimedLife(dummy,'BTLF',1. )
call IssueTargetOrder( dummy, "chainlightning", target )
endif
set dummy = null
set target = null
return true
endfunction
private function Actions takes nothing returns nothing
set Caster = SpellEvent.CastingUnit
set Owner = GetOwningPlayer(Caster)
call GroupEnumUnitsInRange(ENUM_GROUP, GetUnitX(SpellEvent.TargetUnit),GetUnitY(SpellEvent.TargetUnit),AOE, Filter(function Damage))
endfunction
public function init takes nothing returns nothing
call AbilityPreload(DUMMY_SPELL)
call RegisterSpellCastResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=12
//TESH.alwaysfold=0
scope Charge initializer init
globals
private constant integer SPEED = 45
private constant string FX = "Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile_mini.mdl"
private constant integer SPELL = 'A05H'
private constant integer SPELL_NPC = 'A0G4'
private constant real DMG_BASE = 500.
private constant real DMG_COEFF = 250.
endglobals
private struct str
unit target
unit caster
real angle
integer distance
integer i
effect e
integer deltaZ
real dmg
endstruct
private function Update takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
local real angle = Atan2((GetUnitY(dat.target) -GetUnitY(dat.caster)), (GetUnitX(dat.target) - GetUnitX(dat.caster)))
local real x = GetUnitX(dat.caster)+SPEED*Cos(angle)
local real y = GetUnitY(dat.caster)+SPEED*Sin(angle)
if dat.i < dat.distance and GetUnitState(dat.caster,UNIT_STATE_LIFE)>0 and GetUnitState(dat.target,UNIT_STATE_LIFE)>0 then
set dat.i = dat.i + 1
call SetUnitX(dat.caster, x)
call SetUnitY(dat.caster, y)
call SetUnitAnimation(dat.caster, "walk")
else
call SetUnitPathing( dat.caster, true)
call DestroyEffect(dat.e)
call SetUnitTimeScale(dat.caster,1.00)
call SetUnitAnimation(dat.caster, "attack slam")
call UnitDamageTarget(dat.caster, dat.target,dat.dmg,false,false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
call Push(x, y, dat.target, 400, 20, 0.10)
if dat.deltaZ > 1 then
call UnitAddBuffFract(dat.caster)
endif
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function Actions takes nothing returns nothing
local timer t = NewTimer()
local str dat = str.create()
local real x1 = GetUnitX(SpellEvent.CastingUnit)
local real y1 = GetUnitY(SpellEvent.CastingUnit)
local real x2 = GetUnitX(SpellEvent.TargetUnit)
local real y2 = GetUnitY(SpellEvent.TargetUnit)
set dat.deltaZ = GetTerrainCliffLevel(x1,y1)-GetTerrainCliffLevel(x2,y2)
if dat.deltaZ >= 0 then
set dat.caster = SpellEvent.CastingUnit
set dat.target = SpellEvent.TargetUnit
set dat.angle = Atan2((y2 -y1), (x2 - x1))
set dat.distance = R2I(SquareRoot((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)))/SPEED
set dat.i = 0
if SpellEvent.AbilityId == SPELL then
set dat.dmg = DMG_BASE+DMG_COEFF*GetUnitAbilityLevel(dat.caster,SPELL)
elseif SpellEvent.AbilityId == SPELL_NPC then
set dat.dmg = DMG_BASE+DMG_COEFF*2
endif
set dat.e = AddSpecialEffectTarget(FX,dat.caster,"origin")
call SetUnitPathing( dat.caster, false)
call SetUnitTimeScale(dat.caster,4.00)
call SetTimerData(t, dat)
call TimerStart (t, TIMEOUT, true, function Update )
else
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Actions)
call RegisterSpellFinishResponse(SPELL_NPC, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope ChargeSecondaryGenerator initializer init
globals
private constant integer SPELL = 'A0BF'
private constant real AOE = 300.00
private constant string INFO_ACTIVATED = "Secondary Generator: "
private constant integer GENERATOR = 'n00U'
private constant integer SPELLBOOK = 'A0BT'
private player Owner
private integer GeneratorMax = 0
private integer GeneratorDone = 0
endglobals
private function GiveManaReg takes nothing returns boolean
if GetUnitTypeId(GetFilterUnit())==GENERATOR then
call UnitAddAbility(GetFilterUnit(),SPELLBOOK)
endif
return true
endfunction
private function ActivateGenerator takes nothing returns boolean
if GetUnitTypeId(GetFilterUnit())==GENERATOR and GetOwningPlayer(GetFilterUnit())==Player(PLAYER_NEUTRAL_PASSIVE) then
call SetUnitOwner(GetFilterUnit(),Owner,true)
call PingMinimap(GetUnitX(GetFilterUnit()),GetUnitY(GetFilterUnit()),1.)
set GeneratorDone = GeneratorDone + 1
set SideQuestEta[6]=INFO_ACTIVATED+I2S(GeneratorDone)+"/"+I2S(GeneratorMax)+" done."
call UpdateSideQuest(6)
if GeneratorDone == GeneratorMax then
call EndSideQuest(6)
call GroupEnumUnitsInRect(ENUM_GROUP,bj_mapInitialPlayableArea, Filter(function GiveManaReg))
endif
endif
return true
endfunction
private function Actions takes nothing returns nothing
local real x = GetUnitX(SpellEvent.CastingUnit)
local real y = GetUnitY(SpellEvent.CastingUnit)
set Owner = GetOwningPlayer(SpellEvent.CastingUnit)
call GroupEnumUnitsInRange(ENUM_GROUP,x,y,AOE,Filter(function ActivateGenerator))
endfunction
public function init takes nothing returns nothing
set GeneratorMax = 6
set GeneratorDone = 0
call AbilityPreload(SPELLBOOK)
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope ChemicalBomb initializer init
globals
private constant integer SPELL = 'A0J9'
private constant integer UP = 'R01J'
private constant real AOE = 300.
private constant real BONUS1_DMG = 100.
private constant integer BONUS1_REQ = 2
private constant real BONUS2_DMG = 100.
private constant integer BONUS2_REQ = 6
endglobals
private function Actions takes nothing returns nothing
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
if GetPlayerTechCount(owner,UP,true) >= BONUS1_REQ then
call UnitDamageAll(SpellEvent.CastingUnit,false,AOE,SpellEvent.TargetX,SpellEvent.TargetY,BONUS1_DMG,DMG_PHYSIC,false,0,0,0)
endif
if GetPlayerTechCount(owner,UP,true) >= BONUS2_REQ then
call UnitDamageAll(SpellEvent.CastingUnit,false,AOE,SpellEvent.TargetX,SpellEvent.TargetY,BONUS1_DMG,DMG_PHYSIC,false,0,0,0)
endif
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope ChopperSupport initializer init
globals
private constant integer SPELL = 'A091'
private constant string FX = "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportCaster.mdl"
private constant integer MECH_ID = 'n00C'
private constant string INFO = "Raising Sun incoming on our position."
private unit array Chopper [12]
endglobals
private function Spawn takes nothing returns nothing
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local integer ownerId = GetPlayerId(owner)
local real x = GetRectCenterX(gg_rct_ChopperStart)
local real y = GetRectCenterY(gg_rct_ChopperStart)
call DestroyEffect(AddSpecialEffect(FX,x,y) )
if not(IsUnitType(Chopper[ownerId],UNIT_TYPE_DEAD)) then
call KillUnit(Chopper[ownerId])
endif
set Chopper[ownerId] = CreateUnit(owner, MECH_ID,x,y,0.)
call IssueImmediateOrder(Chopper[ownerId],ACTIVATE_AI_ORDER)
call DisplayAll(PlayerColor[ownerId]+GetPlayerName(owner),INFO)
call PingMinimap(x,y,1.)
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Spawn)
endfunction
endscope
//TESH.scrollpos=84
//TESH.alwaysfold=0
scope ChopperRush initializer init
globals
private constant integer DRONE_ID = 'n00C'
private constant integer DRONE_LORDOFWAR = 'n01L'
private constant real LIFESPAN = 60.
private constant string INFO = "Chopper Support called."
private constant integer SPELL ='A0DB'
private constant integer SPELL_LORDOFWAR ='A08N'
private constant real SPAWN_DISTANCE = 4000.
private constant integer AMOUNT = 4
private constant integer SPEED = 30
endglobals
private struct s_move
unit drone
real angle
integer distance
integer i
endstruct
private function Update takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_move dat = GetTimerData(t)
local real newX = GetUnitX(dat.drone) + SPEED*Cos(dat.angle)
local real newY = GetUnitY(dat.drone) + SPEED*Sin(dat.angle)
if dat.i < dat.distance then
set dat.i = dat.i + 1
call SetUnitPosition(dat.drone, newX,newY)
else
call EraseUnit(dat.drone)
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function StartMove takes unit drone returns nothing
local timer t = NewTimer()
local s_move dat = s_move.create()
local real x1 = GetUnitX(drone)
local real y1 = GetUnitY(drone)
local real x2 = GetRectCenterX(gg_rct_LastQuest)
local real y2 = GetRectCenterY(gg_rct_LastQuest)
set dat.drone = drone
set dat.angle = Atan2((y2 -y1), (x2 - x1))
set dat.distance = R2I(SquareRoot((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1))/SPEED )
set dat.i = 0
call SetUnitPathing( dat.drone, false)
call SetUnitFacing(dat.drone,dat.angle*bj_RADTODEG)
call SetTimerData(t, dat)
call TimerStart (t, TIMEOUT, true, function Update )
endfunction
private struct s_control
unit drone
endstruct
private function RemoveControl takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_control dat = GetTimerData(t)
if not (IsUnitType(dat.drone,UNIT_TYPE_DEAD)) and dat.drone != null then
call SetUnitOwner(dat.drone,Player(10),true)
call UnitApplyTimedLife(dat.drone,'BTLF',30.)
call StartMove(dat.drone)
endif
call ReleaseTimer(t)
call dat.destroy()
endfunction
private function StartRemoveControl takes unit drone returns nothing
local timer t = NewTimer()
local s_control dat = s_control.create()
set dat.drone = drone
call SetTimerData(t, dat)
call TimerStart (t, LIFESPAN, false, function RemoveControl)
endfunction
private function Actions takes nothing returns nothing
local real x1 = GetUnitX(SpellEvent.CastingUnit)
local real y1 = GetUnitY(SpellEvent.CastingUnit)
local real x2 = SpellEvent.TargetX
local real y2 = SpellEvent.TargetY
local real angle = Atan2((y2 -y1), (x2 - x1))
local real x3 = CheckPointValidity(x1 - SPAWN_DISTANCE*Cos(angle),MapXMin,MapXMax)
local real y3 = CheckPointValidity(y1 - SPAWN_DISTANCE*Sin(angle),MapYMin,MapYMax)
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local integer ownerId = GetPlayerId(owner)
local unit drone = null
local integer i = 0
call DisplayAll(PlayerColor[ownerId]+GetPlayerName(owner),INFO)
call PingMinimapEx(x2, y2,1., 0, 0, 200, false)
if SpellEvent.AbilityId == SPELL then
loop
exitwhen i > AMOUNT - 1
set drone = CreateUnit(owner,DRONE_ID,x3,y3, 0.)
call IssuePointOrder(drone,"attack",x2,y2)
call StartRemoveControl(drone)
set i = i + 1
endloop
elseif SpellEvent.AbilityId == SPELL_LORDOFWAR then
set drone = CreateUnit(owner,DRONE_LORDOFWAR,x3,y3, 0.)
call IssuePointOrder(drone,"attack",x2,y2)
call StartRemoveControl(drone)
endif
set drone = null
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Actions)
call RegisterSpellFinishResponse(SPELL_LORDOFWAR, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope CleaningForce initializer init
globals
private constant integer MARINE_ID = 'h00V'
private constant string FX_SPAWN= "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportCaster.mdl"
private constant integer SPELL = 'A0IY'
private constant integer COUNT = 1
private constant real AOE = 100.
endglobals
private function CheckSoldier takes nothing returns boolean
local unit target = GetFilterUnit()
if GetUnitTypeId(target)==MARINE_ID then
if GameMode == 6 then
call KillUnit(target)
else
call SetUnitOwner(target,Player(10),true)
call UnitAddAbility(target,LASTQUESTUNIT_SPELL)
call IssuePointOrder(target,LASTQUESTUNIT_ORDER,GetRectCenterX(gg_rct_LastQuest),GetRectCenterY(gg_rct_LastQuest))
endif
endif
set target = null
return true
endfunction
private function Spawn takes nothing returns nothing
local unit spawned = null
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local real x = GetRectCenterX(gg_rct_Reinforcement)
local real y = GetRectCenterY(gg_rct_Reinforcement)
local integer i = 0
call GroupEnumUnitsOfPlayer(ENUM_GROUP,owner,Filter(function CheckSoldier))
loop
exitwhen i > COUNT-1
set spawned = CreateUnit(owner, MARINE_ID,x+GetRandomReal(-AOE,AOE),y+GetRandomReal(-AOE,AOE),0.)
call DestroyEffect(AddSpecialEffectTarget(FX_SPAWN, spawned, "origin") )
call IssueImmediateOrder(spawned,ACTIVATE_AI_ORDER)
set i = i + 1
endloop
set spawned = null
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Spawn)
endfunction
endscope
//TESH.scrollpos=91
//TESH.alwaysfold=0
library CommandCenter needs AutoIndex, TextDisplay, AlliedSpawnSystem,TimerUtils,GroupFunction,GroupUtils
globals
private constant integer CENTER_ID = 'o02R'
private constant integer UNIT_ID = 'H01C'
private constant string INFO = "Command Center operationnal. Artillery shells stock updated"
private boolean CenterOk = false
private constant integer SHELL_AMOUNT = 500
private constant integer GROUPID = 7
private unit CommandCenter = null
private constant real TIMEOUT_UPDATE = 30.
private unit array Tower [4]
private constant integer TOWER_ID = 'h01K'
endglobals
private function CheckTower takes nothing returns boolean
return GetUnitTypeId(GetFilterUnit())==TOWER_ID
endfunction
private function InstantUpdate takes nothing returns nothing
local group g = NewGroup()
local unit tower = null
local integer i = 0
call MoveRectTo(gg_rct_CommandCenter,GetUnitX(CommandCenter),GetUnitY(CommandCenter))
call MoveRectTo(gg_rct_CommandCenterSpawn,GetUnitX(CommandCenter),GetUnitY(CommandCenter))
call MoveRectTo(gg_rct_CommandCenterPatrol1,GetUnitX(CommandCenter)+500.,GetUnitY(CommandCenter))
call MoveRectTo(gg_rct_CommandCenterPatrol2,GetUnitX(CommandCenter)-500.,GetUnitY(CommandCenter))
call MoveRectTo(gg_rct_CommandCenterPatrol3,GetUnitX(CommandCenter),GetUnitY(CommandCenter)+500.)
call MoveRectTo(gg_rct_CommandCenterPatrol4,GetUnitX(CommandCenter),GetUnitY(CommandCenter)-500.)
call UpdateBaseRect(GROUPID,gg_rct_CommandCenter)
call UpdateSpawnRect(GROUPID,gg_rct_CommandCenterSpawn)
call UpdatePatrolRect(GROUPID,1,gg_rct_CommandCenterPatrol1)
call UpdatePatrolRect(GROUPID,2,gg_rct_CommandCenterPatrol2)
call UpdatePatrolRect(GROUPID,3,gg_rct_CommandCenterPatrol3)
call UpdatePatrolRect(GROUPID,4,gg_rct_CommandCenterPatrol4)
call GroupEnumUnitsOfPlayer(g,GetOwningPlayer(CommandCenter),Filter(function CheckTower))
set i = 0
loop
exitwhen i > 3
set Tower[i]=null
set i = i + 1
endloop
set tower = FirstOfGroup(g)
call GroupRemoveUnit(g,tower)
if not (IsUnitType(tower,UNIT_TYPE_DEAD)) then
set Tower[0]=tower
call MoveRectTo(gg_rct_CommandCenterTower1,GetUnitX(tower),GetUnitY(tower))
elseif Tower[0]==null then
call MoveRectTo(gg_rct_CommandCenterTower1,GetUnitX(CommandCenter),GetUnitY(CommandCenter))
endif
call UpdateTowerRect(GROUPID,1,gg_rct_CommandCenterTower1)
set tower = FirstOfGroup(g)
call GroupRemoveUnit(g,tower)
if not (IsUnitType(tower,UNIT_TYPE_DEAD)) then
set Tower[1]=tower
call MoveRectTo(gg_rct_CommandCenterTower2,GetUnitX(tower),GetUnitY(tower))
elseif Tower[1]==null then
call MoveRectTo(gg_rct_CommandCenterTower2,GetUnitX(CommandCenter),GetUnitY(CommandCenter))
endif
call UpdateTowerRect(GROUPID,2,gg_rct_CommandCenterTower2)
set tower = FirstOfGroup(g)
call GroupRemoveUnit(g,tower)
if not (IsUnitType(tower,UNIT_TYPE_DEAD)) then
set Tower[2]=tower
call MoveRectTo(gg_rct_CommandCenterTower3,GetUnitX(tower),GetUnitY(tower))
elseif Tower[2]==null then
call MoveRectTo(gg_rct_CommandCenterTower3,GetUnitX(CommandCenter),GetUnitY(CommandCenter))
endif
call UpdateTowerRect(GROUPID,3,gg_rct_CommandCenterTower3)
set tower = FirstOfGroup(g)
call GroupRemoveUnit(g,tower)
if not (IsUnitType(tower,UNIT_TYPE_DEAD)) then
set Tower[3]=tower
call MoveRectTo(gg_rct_CommandCenterTower4,GetUnitX(tower),GetUnitY(tower))
elseif Tower[3]==null then
call MoveRectTo(gg_rct_CommandCenterTower4,GetUnitX(CommandCenter),GetUnitY(CommandCenter))
endif
call UpdateTowerRect(GROUPID,4,gg_rct_CommandCenterTower4)
call BaseUpdateGroup(GROUPID)
call ReleaseGroup(g)
set g = null
set tower = null
endfunction
private function UpdateCommandCenter takes nothing returns nothing
local timer t = GetExpiredTimer()
if not (IsUnitType(CommandCenter,UNIT_TYPE_DEAD)) and CommandCenter != null then
call InstantUpdate()
else
call ReleaseTimer(t)
endif
endfunction
private function ActivateGroup takes nothing returns nothing
if AlliedPop <= ALLIED_TOTALMAX then
call AlliedAddUnitToPatrolGroup(AlliedId[GetRandomInt(0,AlliedIdMax)],GROUPID)
endif
if AlliedPop <= ALLIED_TOTALMAX then
call AlliedAddUnitToPatrolGroup(AlliedId[GetRandomInt(0,AlliedIdMax)],GROUPID)
endif
if AlliedPop <= ALLIED_TOTALMAX then
call AlliedAddUnitToPatrolGroup(AlliedId[GetRandomInt(0,AlliedIdMax)],GROUPID)
endif
if AlliedPop <= ALLIED_TOTALMAX then
call AlliedAddUnitToPatrolGroup(AlliedId[GetRandomInt(0,AlliedIdMax)],GROUPID)
endif
if AlliedPop <= ALLIED_TOTALMAX then
call AlliedAddUnitToTowerGroup(AlliedId[GetRandomInt(0,AlliedIdMax)],GROUPID)
endif
if AlliedPop <= ALLIED_TOTALMAX then
call AlliedAddUnitToTowerGroup(AlliedId[GetRandomInt(0,AlliedIdMax)],GROUPID)
endif
if AlliedPop <= ALLIED_TOTALMAX then
call AlliedAddUnitToTowerGroup(AlliedId[GetRandomInt(0,AlliedIdMax)],GROUPID)
endif
if AlliedPop <= ALLIED_TOTALMAX then
call AlliedAddUnitToTowerGroup(AlliedId[GetRandomInt(0,AlliedIdMax)],GROUPID)
endif
endfunction
private function StartCommandCenter takes nothing returns nothing
local timer t = NewTimer()
call InstantUpdate()
call ActivateGroup()
call TimerStart(t,TIMEOUT_UPDATE,true,function UpdateCommandCenter)
endfunction
private struct str
private static method createFilter takes unit u returns boolean
return GetUnitTypeId(u)==CENTER_ID
endmethod
private method onCreate takes nothing returns nothing
local player owner = GetOwningPlayer(me)
local integer ownerId = GetPlayerId(owner)
set CommandCenter = me
if CenterOk == false then
set CenterOk = true
set BarrageShellsStock = BarrageShellsStock + SHELL_AMOUNT
call DisplayAll(PlayerColor[ownerId]+GetPlayerName(owner),INFO)
endif
call StartCommandCenter()
set owner = null
endmethod
implement AutoCreate
implement AutoDestroy
endstruct
endlibrary
//TESH.scrollpos=39
//TESH.alwaysfold=0
scope Commando initializer init
globals
private constant integer SPELL = 'A06W'
private constant string INFO = "Commando arrived."
private integer array MarineId [3]
private integer array Amount [6]
private integer array MarineMax [6]
endglobals
private function SwitchOldUnits takes nothing returns boolean
local integer i = 0
local unit marine = GetFilterUnit()
local integer marineId = GetUnitTypeId(marine)
loop
exitwhen i > 2
if marineId == MarineId[i] and marine!= null and not(IsUnitType(marine,UNIT_TYPE_DEAD)) then
if GameMode == 6 then
call KillUnit(marine)
else
call SetUnitOwner(marine,Player(10),true)
call UnitAddAbility(marine,LASTQUESTUNIT_SPELL)
call IssuePointOrder(marine,LASTQUESTUNIT_ORDER,GetRectCenterX(gg_rct_LastQuest),GetRectCenterY(gg_rct_LastQuest))
endif
set marine = null
return true
endif
set i = i + 1
endloop
set marine = null
return true
endfunction
private function Spawn takes nothing returns nothing
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local integer ownerId = GetPlayerId(owner)
local real x = GetRectCenterX(gg_rct_Reinforcement)
local real y = GetRectCenterY(gg_rct_Reinforcement)
local integer i = 0
local unit spawned = null
local integer level = GetUnitAbilityLevel(SpellEvent.CastingUnit,SPELL)-1
call GroupEnumUnitsOfPlayer(ENUM_GROUP,owner,Filter(function SwitchOldUnits))
loop
exitwhen i > Amount[level]
set spawned = CreateUnit(owner, MarineId[GetRandomInt(0,MarineMax[level])],x,y,0.)
call IssueImmediateOrder(spawned,ACTIVATE_AI_ORDER)
set i = i + 1
endloop
call DisplayAll(PlayerColor[ownerId]+GetPlayerName(owner),INFO)
call PingMinimap(x,y,1.)
set spawned = null
endfunction
public function init takes nothing returns nothing
set MarineId[0] = 'h00N'
set MarineId[1] = 'h02D'
set MarineId[2] = 'h02E'
set Amount[0] = 1
set Amount[1] = 1
set Amount[2] = 2
set Amount[3] = 2
set Amount[4] = 3
set Amount[5] = 4
set MarineMax[0] = 0
set MarineMax[1] = 1
set MarineMax[2] = 1
set MarineMax[3] = 2
set MarineMax[4] = 2
set MarineMax[5] = 2
call RegisterSpellFinishResponse(SPELL, Spawn)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope Concentration initializer init
globals
private constant integer SPELLBOOK = 'A0I8'
private constant integer BONUS_CRIT = 'A0I7'
private constant integer BUFF = 'B028'
private constant real DUR = 10.
private constant integer SPELL = 'A0HJ'
endglobals
private struct str
unit caster
endstruct
private function Wait takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
if GetUnitAbilityLevel(dat.caster,SPELLBOOK)>=1 then
call UnitRemoveAbility(dat.caster,SPELLBOOK)
endif
if GetUnitAbilityLevel(dat.caster,BUFF)>=1 then
call UnitRemoveAbility(dat.caster,BUFF)
endif
call ReleaseTimer(t)
call dat.destroy()
endfunction
private function Actions takes nothing returns nothing
local timer t = NewTimer()
local str dat = str.create()
local integer level = GetUnitAbilityLevel(SpellEvent.CastingUnit,SPELL)
set dat.caster = SpellEvent.CastingUnit
if GetUnitAbilityLevel(dat.caster,SPELLBOOK)<=0 then
call UnitAddAbility(dat.caster, SPELLBOOK)
call SetUnitAbilityLevel(dat.caster,BONUS_CRIT,level)
endif
call SetTimerData(t, dat)
call TimerStart (t,DUR, false, function Wait )
endfunction
public function init takes nothing returns nothing
local integer i = 0
call AbilityPreload(SPELLBOOK)
loop
exitwhen i > MAXPLAYER
call SetPlayerAbilityAvailable(Player(i),SPELLBOOK,false)
set i = i + 1
endloop
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope ConcussionGrenade initializer init
globals
private constant integer SPELL = 'A0IB'
private constant integer SPELL_ITEM = 'A006'
private constant string BURN = "Abilities\\Weapons\\Mortar\\MortarMissile.mdl"
private constant string DUST = "Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl"
private constant string FRAG = "Abilities\\Weapons\\FragDriller\\FragDriller.mdl"
private constant real DMG = 2000.
private constant real AOE = 200.
private constant integer FX_AMOUNT = 8
private constant real FX_ANGLE = 45.
private constant real FX_RADIUS1 = 100.
private constant real FX_RADIUS2 = 150.
endglobals
private struct str2
unit caster
real x
real y
integer i
endstruct
private function RadialExplosion takes nothing returns nothing
local timer t = GetExpiredTimer()
local str2 dat = GetTimerData(t)
local integer i = 0
local real x = 0.
local real y = 0.
if dat.i < 3 then
set dat.i = dat.i+1
if dat.i == 1 then
call DestroyEffect(AddSpecialEffect(BURN, dat.x,dat.y))
call DestroyEffect(AddSpecialEffect(FRAG, dat.x,dat.y))
loop
set i = i + 1
exitwhen ( i > FX_AMOUNT-1 )
set x = dat.x + FX_RADIUS1*Cos(dat.i*FX_ANGLE*bj_DEGTORAD)
set y = dat.y + FX_RADIUS1*Sin(dat.i*FX_ANGLE*bj_DEGTORAD)
call DestroyEffect(AddSpecialEffect(BURN,x,y))
endloop
call UnitDamageAll(dat.caster,true,AOE,dat.x,dat.y,DMG,DMG_EXPLOSIVE,true,100,15,20)
endif
if dat.i == 2 then
set i = 0
loop
set i = i + 1
exitwhen ( i > FX_AMOUNT-1 )
set x = dat.x + FX_RADIUS2*Cos(dat.i*FX_ANGLE*bj_DEGTORAD)
set y = dat.y + FX_RADIUS2*Sin(dat.i*FX_ANGLE*bj_DEGTORAD)
call DestroyEffect(AddSpecialEffect(DUST,x,y))
endloop
endif
else
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function Boom takes unit caster, real x, real y returns nothing
local timer t = NewTimer()
local str2 dat = str2.create()
set dat.x = x
set dat.y = y
set dat.i = 0
set dat.caster = caster
call SetTimerData(t, dat)
call TimerStart (t, 0.5, true, function RadialExplosion )
endfunction
private struct str1
unit caster
real x
real y
endstruct
private function WaitBeforeBoom takes nothing returns nothing
local timer t = GetExpiredTimer()
local str1 dat = GetTimerData(t)
call Boom(dat.caster,dat.x,dat.y)
call ReleaseTimer(t)
call dat.destroy()
endfunction
private function Actions takes nothing returns nothing
local timer t = NewTimer()
local str1 dat = str1.create()
set dat.x = SpellEvent.TargetX
set dat.y = SpellEvent.TargetY
set dat.caster = SpellEvent.CastingUnit
if GetUnitTypeId(dat.caster)==DUMMY then
call TextTagMessage("Grenade!", Hero[GetPlayerId(GetOwningPlayer(dat.caster))], 0., 50., 64., 90., 9, 5., 2.00 )
call SetUnitAnimation(Hero[GetPlayerId(GetOwningPlayer(dat.caster))], "spell throw" )
else
call TextTagMessage("Grenade!", dat.caster, 0., 50., 64., 90., 9, 5., 2.00 )
call SetUnitAnimation( dat.caster, "spell throw" )
endif
call GrenadeSound(dat.x,dat.y)
call SetTimerData(t, dat)
call TimerStart (t,1., false, function WaitBeforeBoom )
endfunction
private function SpawnDummy takes nothing returns nothing
local unit dummy = CreateUnit(GetOwningPlayer(SpellEvent.CastingUnit),DUMMY,GetUnitX(SpellEvent.CastingUnit),GetUnitY(SpellEvent.CastingUnit),0.)
call UnitAddAbility(dummy,SPELL_ITEM)
call IssuePointOrder(dummy,"clusterrockets",SpellEvent.TargetX,SpellEvent.TargetY)
call UnitApplyTimedLife(dummy,'BTLF',2.)
set dummy = null
endfunction
public function init takes nothing returns nothing
call AbilityPreload(SPELL_ITEM)
call RegisterSpellCastResponse(SPELL, SpawnDummy)
call RegisterSpellCastResponse(SPELL_ITEM, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope ConstructFragGrenade initializer init
globals
private constant integer SPELL = 'A02Z'
private constant integer ITEM_ID = 'I00U'
endglobals
private function Actions takes nothing returns nothing
call UnitAddItemById(SpellEvent.CastingUnit,ITEM_ID)
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=42
//TESH.alwaysfold=0
scope Counterstrike initializer init
globals
private constant integer SPELL = 'A089'
private constant real AOE = 600.
private constant real AOE_FX = 300.
private constant real DMG = 5000.
private constant real WAIT = 5.
private constant integer DUMMY_AOE = 'o00Z'
private constant string FX_AOE = "Abilities\\Spells\\Human\\Flare\\FlareCaster.mdx"
private constant string FX = "Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl"
private constant integer COUNT = 10
private unit Caster
private unit Target
private integer Count
endglobals
private struct s_wait
unit caster
real x
real y
endstruct
private function Damage takes unit whichUnit, real x, real y returns nothing
local integer i = 0
loop
exitwhen i > COUNT
call DestroyEffect(AddSpecialEffect(FX,x+GetRandomReal(-AOE_FX,AOE_FX),y+GetRandomReal(-AOE_FX,AOE_FX)))
set i = i + 1
endloop
call UnitDamageAll(whichUnit,false,AOE,x,y,DMG,DMG_EXPLOSIVE,false,0,0,0)
endfunction
private function Wait takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_wait dat = GetTimerData(t)
call Damage(dat.caster,dat.x,dat.y)
call ReleaseTimer(t)
call dat.destroy()
endfunction
private function Cast takes nothing returns nothing
local timer t = NewTimer()
local s_wait dat = s_wait.create()
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local integer ownerId = GetPlayerId(owner)
local integer i = 0
local real x = 0.
local real y = 0.
set dat.x = SpellEvent.TargetX
set dat.y = SpellEvent.TargetY
set dat.caster = SpellEvent.CastingUnit
call DisplayAll(PlayerColor[ownerId]+GetPlayerName(owner),"Counterstrike in 5 seconds!")
call WillExplodeSound()
call PingMinimapEx(dat.x,dat.y,5., 204, 196, 115, false)
call UnitApplyTimedLife(CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),DUMMY_AOE,dat.x,dat.y,0.),'BTLF',5.)
loop
exitwhen i > 5
set x = dat.x + AOE_FX*Cos(i*60.*bj_DEGTORAD)
set y = dat.y + AOE_FX*Sin(i*60.*bj_DEGTORAD)
call DestroyEffect(AddSpecialEffect(FX_AOE,x,y))
set i = i + 1
endloop
call SetTimerData(t, dat)
call TimerStart (t,WAIT, false, function Wait )
endfunction
public function init takes nothing returns nothing
call RegisterSpellCastResponse(SPELL, Cast)
endfunction
endscope
//TESH.scrollpos=2
//TESH.alwaysfold=0
scope Crawl initializer init
globals
private constant string ON = "defend"
private constant string OFF = "undefend"
private constant integer SPELL = 'A005'
private constant integer BONUS = 'A00U'
private constant integer BUFF = 'B01L'
endglobals
private function UnitOrder takes nothing returns boolean
local unit marine = GetTriggerUnit()
local string order = OrderId2String(GetIssuedOrderId())
if order == ON and GetUnitAbilityLevel(marine,BONUS)<=0 then
call UnitAddAbility(marine,BONUS)
elseif order == OFF then
if GetUnitAbilityLevel(marine,BONUS)>=1 then
call UnitRemoveAbility(marine,BONUS)
endif
if GetUnitAbilityLevel(marine,BUFF)>=1 then
call UnitRemoveAbility(marine,BUFF)
endif
endif
set marine = null
return false
endfunction
private struct str
trigger trig
private static method createFilter takes unit u returns boolean
return GetUnitAbilityLevel(u,SPELL)>=1
endmethod
private method onCreate takes nothing returns nothing
set .trig = CreateTrigger()
call TriggerRegisterUnitEvent(.trig,me,EVENT_UNIT_ISSUED_ORDER)
call TriggerAddCondition(.trig,Condition(function UnitOrder))
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
call DisableTrigger(.trig)
call DestroyTrigger(.trig)
set .trig = null
endmethod
implement AutoDestroy
endstruct
public function init takes nothing returns nothing
local integer i = 0
loop
exitwhen i > MAXPLAYER
call SetPlayerAbilityAvailable(Player(i),BONUS,false)
set i = i + 1
endloop
call AbilityPreload(BONUS)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope CureFracture initializer init
globals
private constant integer SPELL = 'A01Z'
private constant integer SPELL_NPC = 'A05S'
private constant string FAIL = "Curse failed"
private constant string SUCCESS = "Fracture healed"
private constant integer CHANCE = 15
private constant string FX = "Abilities\\Spells\\Orc\\FeralSpirit\\feralspiritdone.mdl"
endglobals
private function Actions takes nothing returns nothing
local unit caster = SpellEvent.CastingUnit
local unit target = SpellEvent.TargetUnit
if GetUnitAbilityLevel(target,BUFF_FRACT)>=1 then
if GetRandomInt(0,100)>= CHANCE then
call DestroyEffect(AddSpecialEffectTarget(FX,target,"origin"))
call UnitRemoveAbility(target,BUFF_FRACT)
call TextTagMessage(SUCCESS,caster,0.,50.,64.,90.,9,5.,4.)
else
call TextTagMessage(FAIL,caster,0.,50.,64.,90., 9,5.,4.)
endif
endif
set caster = null
set target = null
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Actions)
call RegisterSpellFinishResponse(SPELL_NPC, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope CyberneticPunch initializer init
globals
private constant integer SPELL = 'A0A1'
endglobals
private function Actions takes nothing returns nothing
local real x = GetUnitX(SpellEvent.CastingUnit)
local real y = GetUnitY(SpellEvent.CastingUnit)
if not (IsUnitType(SpellEvent.TargetUnit,UNIT_TYPE_STRUCTURE)) then
call Push(x,y,SpellEvent.TargetUnit,400,20,0.3)
endif
endfunction
public function init takes nothing returns nothing
call RegisterSpellCastResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
library CyborgSkills initializer init needs RegisterAnyUnitEvent, AbilityPreload,Push
globals
private constant integer SPELL = 'A09X'
private constant integer SPELL_VISION = 'A0C0'
private constant integer BUFF_VISION = 'A0AB'
private constant integer BULLET_CHANCE = 5
private constant string DEF_ON = "magicdefense"
private constant string DEF_OFF = "magicundefense"
private constant integer UNIT_ID = 'H010'
endglobals
private struct s_def
boolean isDefending = false
private static method createFilter takes unit u returns boolean
return GetUnitTypeId(u)==UNIT_ID
endmethod
private method onCreate takes nothing returns nothing
set .isDefending = false
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
set .isDefending = false
endmethod
implement AutoDestroy
endstruct
private function GetDefending takes unit marine returns boolean
local s_def dat = s_def[marine]
return dat.isDefending
endfunction
private function SetDefending takes unit marine, boolean whichBoolean returns nothing
local s_def dat = s_def[marine]
set dat.isDefending = whichBoolean
endfunction
private function CheckOrder takes nothing returns boolean
local unit marine = GetTriggerUnit()
local string order = OrderId2String(GetIssuedOrderId())
if order == DEF_ON then
call SetDefending(marine,true)
elseif order == DEF_OFF then
call SetDefending(marine,false)
endif
set marine = null
return false
endfunction
private function UnitAttacked takes nothing returns boolean
local unit marine = GetAttacker()
local unit victim = GetTriggerUnit()
if GetRandomInt(0,100)<=BULLET_CHANCE and GetUnitAbilityLevel(marine,SPELL)>=3 then
if not (IsUnitType(victim,UNIT_TYPE_STRUCTURE)) and not (IsUnitType(victim,UNIT_TYPE_MECHANICAL)) then
call Push(GetUnitX(marine),GetUnitY(marine),victim,50,10,0.)
endif
if GetDefending(marine) == false then
call Push(GetUnitX(victim),GetUnitY(victim),marine,30,10,0.)
endif
endif
set marine = null
set victim = null
return false
endfunction
private function Conditions takes nothing returns boolean
local unit caster = GetTriggerUnit()
if GetLearnedSkill() == SPELL then
if GetUnitAbilityLevel(caster,SPELL)==1 then
call UnitAddAbility(caster,SPELL_VISION)
endif
call SetUnitAbilityLevel(caster,SPELL_VISION,GetUnitAbilityLevel(caster,SPELL))
call SetUnitAbilityLevel(caster,BUFF_VISION,GetUnitAbilityLevel(caster,SPELL))
endif
set caster = null
return false
endfunction
function CyborgSkills takes unit hero returns nothing
local trigger t1 = CreateTrigger()
local trigger t2 = CreateTrigger()
call TriggerRegisterUnitEvent(t1,hero,EVENT_UNIT_HERO_SKILL)
call TriggerAddCondition(t1,Condition(function Conditions))
call TriggerRegisterUnitEvent(t2,hero,EVENT_UNIT_ISSUED_ORDER)
call TriggerAddCondition(t2,Condition(function CheckOrder))
call RegisterAnyUnitEvent(EVENT_PLAYER_UNIT_ATTACKED,function UnitAttacked)
endfunction
private function init takes nothing returns nothing
local integer i = 0
call AbilityPreload(SPELL_VISION)
loop
exitwhen i > MAXPLAYER
call SetPlayerAbilityAvailable(Player(i),SPELL_VISION,false)
set i = i + 1
endloop
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope DeconstructionNanites initializer init
globals
private constant integer SPELL = 'A01W'
private constant integer DUMMY_SPELL = 'A029'
endglobals
private function Actions takes nothing returns nothing
local unit dummy = CreateUnit(GetOwningPlayer(SpellEvent.CastingUnit),DUMMY,GetUnitX(SpellEvent.TargetUnit),GetUnitY(SpellEvent.TargetUnit),0.)
call UnitAddAbility(dummy,DUMMY_SPELL)
call SetUnitAbilityLevel(dummy,DUMMY_SPELL,GetUnitAbilityLevel(SpellEvent.CastingUnit,SPELL))
call IssueTargetOrder(dummy,"rejuvination",SpellEvent.TargetUnit)
call UnitApplyTimedLife(dummy,'BTLF',5.)
call UnitAddBuffResidualNanites(SpellEvent.CastingUnit,SpellEvent.TargetUnit)
endfunction
public function init takes nothing returns nothing
call AbilityPreload(DUMMY_SPELL)
call RegisterSpellCastResponse(SPELL,Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope DebugUnit initializer init
globals
private constant integer SPELL = 'A0C1'
private constant integer ID = 'o025'
endglobals
private function Actions takes nothing returns nothing
local unit dummy = CreateUnit(GetOwningPlayer(SpellEvent.CastingUnit),ID,GetUnitX(SpellEvent.TargetUnit),GetUnitY(SpellEvent.TargetUnit),0.)
call IssueTargetOrder(dummy,"attack",SpellEvent.TargetUnit)
call UnitApplyTimedLife(dummy,'BTLF',2.)
call IssuePointOrder(SpellEvent.TargetUnit,"patrol",GetUnitX(SpellEvent.TargetUnit),GetUnitY(SpellEvent.TargetUnit))
set dummy = null
endfunction
public function init takes nothing returns nothing
call RegisterSpellCastResponse(SPELL,Actions)
endfunction
endscope
//TESH.scrollpos=2
//TESH.alwaysfold=0
scope Decontamination initializer init
globals
private constant integer SPELL = 'A0KB'
private constant real AOE = 400
private constant integer BUFF_CONTAMINATION = 'B02O'
private constant integer DUMMY_ANTHRAX = 'o03M'
private constant string FX = "Units\\NightElf\\Wisp\\WispExplode.mdl"
endglobals
private function CheckBuff takes nothing returns boolean
local unit target = GetFilterUnit()
if GetUnitAbilityLevel(target,BUFF_CONTAMINATION)>=1 then
call UnitRemoveAbility(target,BUFF_CONTAMINATION)
endif
if GetUnitTypeId(target)==DUMMY_ANTHRAX then
call KillUnit(target)
endif
set target = null
return true
endfunction
private function Actions takes nothing returns nothing
call DestroyEffect(AddSpecialEffect(FX,SpellEvent.TargetX,SpellEvent.TargetY))
call GroupEnumUnitsInRange(ENUM_GROUP,SpellEvent.TargetX,SpellEvent.TargetY,AOE,Filter(function CheckBuff))
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
library DefensiveBuildings
globals
private constant integer SPELL = 'A0DF'
private constant integer UP = 'R012'
private constant integer UNIT_ID = 'H01C'
endglobals
private function Conditions takes nothing returns boolean
local unit caster = GetTriggerUnit()
local player owner = GetOwningPlayer(caster)
if GetLearnedSkill() == SPELL then
call SetPlayerTechResearched(owner, UP, GetPlayerTechCount(owner,UP,true)+1)
endif
set caster = null
return false
endfunction
function DefensiveBuildings takes unit hero returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterUnitEvent(t,hero,EVENT_UNIT_HERO_SKILL)
call TriggerAddCondition(t,Condition(function Conditions))
endfunction
endlibrary
//TESH.scrollpos=30
//TESH.alwaysfold=0
scope DefensiveStance initializer init
globals
private constant integer SPELLBOOK = 'A0F5'
private constant integer BONUS_DMG = 'A0F3'
private constant integer BONUS_DEF = 'A0F4'
private constant integer BUFF = 'B020'
private constant real DUR = 20.
private constant integer SPELL = 'A0F2'
private constant integer SPELL_NPC = 'A0G6'
endglobals
private struct str
unit caster
endstruct
private function Wait takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
if GetUnitAbilityLevel(dat.caster,SPELLBOOK)>=1 then
call UnitRemoveAbility(dat.caster,SPELLBOOK)
endif
if GetUnitAbilityLevel(dat.caster,BUFF)>=1 then
call UnitRemoveAbility(dat.caster,BUFF)
endif
call ReleaseTimer(t)
call dat.destroy()
endfunction
private function Actions takes nothing returns nothing
local timer t = NewTimer()
local str dat = str.create()
local integer level = GetUnitAbilityLevel(SpellEvent.CastingUnit,SpellEvent.AbilityId)
set dat.caster = SpellEvent.CastingUnit
if GetUnitAbilityLevel(dat.caster,SPELLBOOK)<=0 then
call UnitAddAbility(dat.caster, SPELLBOOK)
if SpellEvent.AbilityId == SPELL_NPC then
set level = 1
endif
call SetUnitAbilityLevel(dat.caster,BONUS_DMG,level)
call SetUnitAbilityLevel(dat.caster,BONUS_DEF,level)
endif
call SetTimerData(t, dat)
call TimerStart (t,DUR, false, function Wait )
endfunction
public function init takes nothing returns nothing
local integer i = 0
call AbilityPreload(SPELLBOOK)
loop
exitwhen i > MAXPLAYER
call SetPlayerAbilityAvailable(Player(i),SPELLBOOK,false)
set i = i + 1
endloop
call RegisterSpellFinishResponse(SPELL, Actions)
call RegisterSpellFinishResponse(SPELL_NPC, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope DefibrillationBioandMLandEnergyGlovesandTimeManipulation initializer init
globals
private constant integer SPELL_BIO = 'A08V'
private constant integer SPELL_ML = 'A09K'
private constant integer SPELL_LS = 'A0FH'
private constant integer SPELL_TM = 'A04L'
endglobals
private function Actions takes nothing returns nothing
if GetUnitTypeId(SpellEvent.TargetUnit)==HERO_CORPSE then
call CheckCorpseStatus(GetPlayerId(GetOwningPlayer(SpellEvent.CastingUnit)),SpellEvent.TargetUnit)
endif
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL_BIO,Actions)
call RegisterSpellFinishResponse(SPELL_ML,Actions)
call RegisterSpellFinishResponse(SPELL_LS,Actions)
call RegisterSpellFinishResponse(SPELL_TM,Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope DeployDrone initializer init
globals
private constant integer DRONE_ID = 'n00V'
private constant string FX_SPAWN= "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportCaster.mdl"
private constant integer SPELL = 'A0BQ'
private constant integer COUNT = 2
private constant real AOE = 150.
private constant real LIFESPAN = 60.
endglobals
private function Spawn takes nothing returns nothing
local unit spawned = null
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local real x = GetUnitX(SpellEvent.CastingUnit)
local real y = GetUnitY(SpellEvent.CastingUnit)
local integer level = GetUnitAbilityLevel(SpellEvent.CastingUnit,SPELL)
local integer i = 0
loop
exitwhen i > COUNT-1
set spawned = CreateUnit(owner, DRONE_ID,x+GetRandomReal(-AOE,AOE),y+GetRandomReal(-AOE,AOE),0.)
call DestroyEffect(AddSpecialEffectTarget(FX_SPAWN, spawned, "origin") )
call IssueImmediateOrder(spawned,ACTIVATE_AI_ORDER)
call UnitApplyTimedLife(spawned,'BTLF',LIFESPAN)
set i = i + 1
endloop
set spawned = null
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Spawn)
endfunction
endscope
//TESH.scrollpos=35
//TESH.alwaysfold=0
scope Designate initializer init
globals
private constant integer SPELL_HERO = 'A088'
private constant integer SPELL = 'A0AX'
private constant real AOE = 800.
private unit Target = null
private player Owner = null
private constant integer DUR = 20
endglobals
private struct str
integer i
unit target
endstruct
private function Loop takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
if dat.i < DUR and not(IsUnitType(dat.target,UNIT_TYPE_DEAD))then
set dat.i = dat.i + 1
call PingMinimapEx(GetUnitX(dat.target),GetUnitY(dat.target),0.50,100,100,100,false)
else
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function Start takes unit target, unit source returns nothing
local timer t = NewTimer()
local str dat = str.create()
set dat.target = target
set dat.i = 0
call SetTimerData(t,dat)
call TimerStart(t,1.,true,function Loop)
endfunction
private function FilterAllied takes nothing returns boolean
local unit allied = GetFilterUnit()
if IsUnitAlly(allied,Owner) and GetUnitAbilityLevel(allied,ALLIED_CAN_BE_ORDERED)>=1 then
call IssueTargetOrder(allied,"attack",Target)
endif
set allied = null
return true
endfunction
private function Actions takes nothing returns nothing
local unit caster = SpellEvent.CastingUnit
local unit target = SpellEvent.TargetUnit
local real x = GetUnitX(target)
local real y = GetUnitY(target)
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local integer ownerId = GetPlayerId(owner)
if owner != Player(ALLIEDID) then
set Target = target
set Owner = GetOwningPlayer(caster)
call GroupEnumUnitsInRange(ENUM_GROUP,x,y,AOE,Filter(function FilterAllied))
call DisplayAll(PlayerColor[ownerId]+GetPlayerName(owner),GetUnitName(target)+" has been designated")
call Start(target,caster)
endif
set caster = null
set target = null
endfunction
public function init takes nothing returns nothing
call RegisterSpellCastResponse(SPELL_HERO, Actions)
call RegisterSpellCastResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope DirectionalMine initializer init
globals
private constant integer MINE_ID = 'n00Q'
private constant integer SPELL = 'A01C'
private constant integer SPELL_ITEM = 'A071'
private constant integer SPELL_DETONATE = 'A025'
private constant real AOE = 200.
private constant string FX = "Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl"
private constant real TIMEOUT_SPAWN = 0.10
private constant real DIS = 1000.
private constant real DMG = 1000.
private constant integer SPEED = 100
endglobals
private struct str
unit caster
real x1
real y1
real x2
real y2
real angle
integer distance
integer i
endstruct
private function Update takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
local real newX = dat.x1 + dat.i*SPEED*Cos(dat.angle)
local real newY = dat.y1 + dat.i*SPEED*Sin(dat.angle)
if dat.i < dat.distance then
set dat.i = dat.i + 1
call DestroyEffect(AddSpecialEffect(FX,newX,newY))
call UnitDamageAll(dat.caster,true,AOE,newX,newY,DMG,DMG_EXPLOSIVE,false,0,0,0)
else
call KillUnit(dat.caster)
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function Detonate takes nothing returns nothing
local timer t = NewTimer()
local str dat = str.create()
set dat.caster = SpellEvent.CastingUnit
set dat.x1 = GetUnitX(dat.caster)
set dat.y1 = GetUnitY(dat.caster)
set dat.x2 = SpellEvent.TargetX
set dat.y2 = SpellEvent.TargetY
set dat.angle = Atan2((dat.y2 -dat.y1), (dat.x2 - dat.x1))
set dat.x2 = dat.x1 + DIS*Cos(dat.angle)
set dat.y2 = dat.y1 + DIS*Sin(dat.angle)
set dat.distance = R2I(SquareRoot((dat.x2-dat.x1)*(dat.x2-dat.x1)+(dat.y2-dat.y1)*(dat.y2-dat.y1))/SPEED)
set dat.i = 0
call SetTimerData(t, dat)
call TimerStart (t, TIMEOUT_SPAWN, true, function Update )
endfunction
private function Spawn takes nothing returns nothing
call CreateUnit(GetOwningPlayer(SpellEvent.CastingUnit),MINE_ID,SpellEvent.TargetX,SpellEvent.TargetY,0.)
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Spawn)
call RegisterSpellFinishResponse(SPELL_ITEM, Spawn)
call RegisterSpellFinishResponse(SPELL_DETONATE, Detonate)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope Disarm initializer init
globals
private constant integer SPELL = 'A0AY'
private key ITEM_INDEX
private hashtable HashT
endglobals
//! textmacro t__Explo_Init takes EXPLO_TYPE , ITEM_ID
call SaveInteger(HashT,$EXPLO_TYPE$,ITEM_INDEX,$ITEM_ID$)
//! endtextmacro
private function SetExplosiveVariables takes nothing returns nothing
//Chain
//! runtextmacro t__Explo_Init("'n00S'","'I00E'")
//Mine
//! runtextmacro t__Explo_Init("'n002'","'I00G'")
//Directional Mine
//! runtextmacro t__Explo_Init("'n00Q'","'I00F'")
//Remote Bomb
//! runtextmacro t__Explo_Init("'n00R'","'I00O'")
//Satchel
//! runtextmacro t__Explo_Init("'n005'","'I00P'")
//EM Mine
//! runtextmacro t__Explo_Init("'n018'","'I00C'")
endfunction
private function Cast takes nothing returns nothing
local integer targetId = GetUnitTypeId(SpellEvent.TargetUnit)
local integer itemId = LoadInteger(HashT,targetId,ITEM_INDEX)
if itemId != 0 then
call RemoveUnit(SpellEvent.TargetUnit)
call UnitAddItemById(SpellEvent.CastingUnit,itemId)
endif
endfunction
public function init takes nothing returns nothing
set HashT = InitHashtable()
call SetExplosiveVariables()
call RegisterSpellFinishResponse(SPELL, Cast)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope DiscFlush initializer init
globals
private constant integer SPELL = 'A05A'
private constant integer SPELL_NPC = 'A0FV'
private constant integer ID = 'o01Q'
endglobals
private function Actions takes nothing returns nothing
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local real x = GetUnitX(SpellEvent.CastingUnit)
local real y = GetUnitY(SpellEvent.CastingUnit)
local unit dummy = CreateUnit(owner,ID,x,y,0.)
call IssueTargetOrder(dummy,"attack",SpellEvent.TargetUnit)
call UnitApplyTimedLife(dummy,'BTLF',1.)
set dummy = null
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Actions)
call RegisterSpellFinishResponse(SPELL_NPC, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope Distorsion initializer init
globals
private constant integer SPELL = 'A01M'
constant integer ENBALLLARGE = 'h00C'
constant integer ENBALLSMALL = 'h00B'
private constant real AOESPAWN = 500.
private constant real HEIGHTSPEEDMIN = 250.
private constant real HEIGHTSPEEDMAX = 450.
private constant real HEIGHT = 600.
private constant integer COUNT = 20
private constant real LIFESPAN = 6.
private constant string FX = "Abilities\\Spells\\Human\\Thunderclap\\ThunderClapCaster.mdl"
private constant real AOE = 200.
private constant real DMG = 100.
private constant integer DUMMY_SPELL = 'S002'
endglobals
private function UnitDeath takes nothing returns boolean
local unit victim = GetTriggerUnit()
local integer victimId = GetUnitTypeId(victim)
local real x = GetUnitX(victim)
local real y = GetUnitY(victim)
local unit dummy = null
if victimId == ENBALLLARGE or victimId == ENBALLSMALL then
call DestroyEffect(AddSpecialEffect(FX,x,y))
set dummy = CreateUnit(GetOwningPlayer(victim),DUMMY, x,y, 0.)
call UnitAddAbility(dummy,DUMMY_SPELL)
call UnitApplyTimedLife( dummy, 'BTLF', 3. )
endif
set dummy = null
set victim = null
return false
endfunction
private struct str
trigger trig
private static method createFilter takes unit u returns boolean
return GetUnitTypeId(u)==ENBALLLARGE or GetUnitTypeId(u)==ENBALLSMALL
endmethod
private method onCreate takes nothing returns nothing
set .trig = CreateTrigger()
call TriggerRegisterUnitEvent(.trig,me,EVENT_UNIT_DEATH)
call TriggerAddCondition(.trig,Condition(function UnitDeath))
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
call DisableTrigger(.trig)
call DestroyTrigger(.trig)
set .trig = null
endmethod
implement AutoDestroy
endstruct
private function SpellCast takes nothing returns nothing
local integer i = 0
local unit caster = SpellEvent.CastingUnit
local player owner = GetOwningPlayer(caster)
local real x1 = SpellEvent.TargetX
local real y1 = SpellEvent.TargetY
local real x2 = 0.
local real y2 = 0.
local unit dummy = CreateUnit( owner, ENBALLLARGE, x1,y1, bj_UNIT_FACING )
call UnitApplyTimedLife( dummy, 'BTLF',LIFESPAN+COUNT )
call SetUnitFlyHeight( dummy,HEIGHT,HEIGHTSPEEDMAX)
loop
set i = i + 1
exitwhen i > COUNT
set x2 = x1 + GetRandomReal(-AOESPAWN,AOESPAWN)
set y2 = y1 + GetRandomReal(-AOESPAWN,AOESPAWN)
set dummy = CreateUnit(owner, ENBALLSMALL, x2,y2, bj_UNIT_FACING )
call UnitApplyTimedLife( dummy, 'BTLF', LIFESPAN+i )
call SetUnitFlyHeight( dummy,HEIGHT,GetRandomReal(HEIGHTSPEEDMIN,HEIGHTSPEEDMAX))
call IssuePointOrder(dummy,"move",x1,y1)
endloop
set caster = null
set dummy = null
endfunction
public function init takes nothing returns nothing
call AbilityPreload(DUMMY_SPELL)
call RegisterSpellFinishResponse(SPELL,SpellCast)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
library DownloadTargetAcquisitionUpgrade
globals
private constant integer SPELL = 'A0KK'
private constant integer UP = 'R01P'
endglobals
private function Conditions takes nothing returns boolean
local unit caster = GetTriggerUnit()
local player owner = GetOwningPlayer(caster)
if GetLearnedSkill() == SPELL then
call SetPlayerTechResearched(owner, UP, GetPlayerTechCount(owner,UP,true)+1)
endif
set caster = null
return false
endfunction
function DownloadTargetAcquisitionUpgrade takes unit hero returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterUnitEvent(t,hero,EVENT_UNIT_HERO_SKILL)
call TriggerAddCondition(t,Condition(function Conditions))
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope Duplication initializer init
globals
private constant integer SPELL = 'A0BO'
private constant integer LEVEL_REQ = 1
private constant integer FAIL_CHANCE = 33
private constant string INFO_ERROR = "You can duplicate only non-charged items of level I"
private constant string INFO_FAIL = "Duplication failed"
private integer ItemMax
private integer array ItemId [30]
endglobals
private function Actions takes nothing returns nothing
local item whichItem = SpellEvent.TargetItem
local integer whichItemId = GetItemTypeId(whichItem)
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local integer i = 0
loop
exitwhen i > ItemMax
if whichItemId == ItemId[i] then
if GetRandomInt(0,100)<= FAIL_CHANCE then
call UnitDamageTarget(SpellEvent.CastingUnit,whichItem,5000.,false,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
call ErrorSound(owner)
call TextTagMessage(INFO_FAIL,SpellEvent.CastingUnit,0.,50.,64.,90., 9,5.,4.)
set whichItem = null
set owner = null
return
else
call UnitAddItemById(SpellEvent.CastingUnit,whichItemId)
set whichItem = null
set owner = null
return
endif
endif
set i = i + 1
endloop
call ErrorSound(owner)
call DisplayTextToPlayer(owner,0.,0.,INFO_ERROR)
set whichItem = null
endfunction
public function init takes nothing returns nothing
local integer i = 0
set ItemId[i] = 'I01N'//Ernegy drink injector
set i = i + 1
set ItemId[i] = 'I00U'//Armored plate mkI
set i = i + 1
set ItemId[i] = 'I02V'// Head Mounted Dsiplay
set i = i + 1
set ItemId[i] = 'I00B'// Energy Cell
set i = i + 1
set ItemId[i] = 'I02O'//Improved Stocks
set i = i + 1
set ItemId[i] = 'I02C'//athletic training
set i = i + 1
set ItemId[i] = 'I027'//deflection suit
set i = i + 1
set ItemId[i] = 'I01X'//First Aid Kit
set i = i + 1
set ItemId[i] = 'I009'//Solar Energy
set i = i + 1
set ItemId[i] = 'I02K'//Kevlar Suit
set i = i + 1
set ItemId[i] = 'I00Y'//Dynamo
set i = i + 1
set ItemId[i] = 'I016'//NanoRobot Drip
set i = i + 1
set ItemId[i] = 'I013'//Gazoline Motor
set i = i + 1
set ItemId[i] = 'I02G'//Spaulder Mark I
set ItemMax = i
call RegisterSpellCastResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
library EliteTraining initializer init needs AbilityPreload,AmmoSystem
globals
private constant integer SPELL = 'A0HX'
private constant integer PRESENCE_SPELLBOOK = 'A0IO'
private constant integer PRESENCE_REQ = 1
private constant integer AMMO_REQ = 4
private constant integer RELOAD_BONUS = 10
private constant integer RANGE_UP = 'R01I'
private constant real RANGE_BONUS = 100.
endglobals
private function Conditions takes nothing returns boolean
local unit caster = GetTriggerUnit()
local player owner = GetOwningPlayer(caster)
if GetLearnedSkill() == SPELL then
if GetUnitAbilityLevel(caster,SPELL) == PRESENCE_REQ then
call UnitAddAbility(caster,PRESENCE_SPELLBOOK)
elseif GetUnitAbilityLevel(caster,SPELL) == AMMO_REQ then
call UpgradeMaxWeapon(caster,RELOAD_BONUS)
call SetPlayerTechResearched(owner, RANGE_UP,1)
call SetUnitAcquireRange(caster,GetUnitAcquireRange(caster)+RANGE_BONUS)
endif
endif
set caster = null
return false
endfunction
function EliteTraining takes unit hero returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterUnitEvent(t,hero,EVENT_UNIT_HERO_SKILL)
call TriggerAddCondition(t,Condition(function Conditions))
endfunction
private function init takes nothing returns nothing
local integer i = 0
call AbilityPreload(PRESENCE_SPELLBOOK)
loop
exitwhen i > MAXPLAYER
call SetPlayerAbilityAvailable(Player(i),PRESENCE_SPELLBOOK,false)
set i = i + 1
endloop
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope EMMine initializer init
globals
private constant integer MINE_ID = 'n018'
private constant integer SPELL = 'A0GD'
private constant integer DUMMY_SPELL = 'S005'
private constant real DUR_BASE = 4.
private constant real AOE = 300
private constant real DMG = 1000.
private constant string FX = "Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl"
endglobals
private function UnitDeath takes nothing returns boolean
local unit victim = GetTriggerUnit()
local real x = GetUnitX(victim)
local real y = GetUnitY(victim)
local player owner = GetOwningPlayer(victim)
local integer ownerId = GetPlayerId(owner)
local unit dummy = CreateUnit(owner,DUMMY,x,y,0.)
local integer level = GetUnitAbilityLevel(Hero[ownerId],SPELL)
if GetUnitAbilityLevel(Hero[ownerId],SPELL)<=0 then
set level = 1
endif
call UnitAddAbility(dummy,DUMMY_SPELL)
call DestroyEffect(AddSpecialEffect(FX,x,y))
call UnitDamageAll(victim,false,AOE,x,y,DMG,DMG_ENERGETIC,false,0,0,0)
call UnitApplyTimedLife(dummy,'BTLF',DUR_BASE+level)
call SetUnitAbilityLevel(dummy,DUMMY_SPELL,level)
set victim = null
set dummy = null
return false
endfunction
private struct str
trigger trig
private static method createFilter takes unit u returns boolean
return GetUnitTypeId(u)==MINE_ID
endmethod
private method onCreate takes nothing returns nothing
set .trig = CreateTrigger()
call TriggerRegisterUnitEvent(.trig,me,EVENT_UNIT_DEATH)
call TriggerAddCondition(.trig,Condition(function UnitDeath))
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
call DisableTrigger(.trig)
call DestroyTrigger(.trig)
set .trig = null
endmethod
implement AutoDestroy
endstruct
public function init takes nothing returns nothing
call AbilityPreload(DUMMY_SPELL)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope EMP initializer init
globals
private constant integer SPELL = 'A0CB'
private constant real DMG_BASE = 500.
private constant real AOE = 300.
private unit Caster
private real Dmg
endglobals
private function CheckEnemies takes nothing returns boolean
local unit target = GetFilterUnit()
if GetUnitAbilityLevel(target,BUFF_RESIDUAL_NANITES)>=1 then
call UnitRemoveAbility(target,BUFF_RESIDUAL_NANITES)
call UnitDamageTarget(Caster,target,Dmg,false,false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
endif
set target = null
return true
endfunction
private struct s_wait
unit caster
real x
real y
endstruct
private function Wait takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_wait dat = GetTimerData(t)
set Caster = dat.caster
set Dmg = DMG_BASE*GetUnitAbilityLevel(dat.caster,SPELL)
call GroupEnumUnitsInRange(ENUM_GROUP,dat.x,dat.y,AOE,Filter(function CheckEnemies))
call ReleaseTimer(t)
call dat.destroy()
endfunction
private function Cast takes nothing returns nothing
local timer t = NewTimer()
local s_wait dat = s_wait.create()
set dat.x = SpellEvent.TargetX
set dat.y = SpellEvent.TargetY
set dat.caster = SpellEvent.CastingUnit
call TextTagMessage("EMP!", dat.caster, 0., 50., 64., 90., 9, 5., 2.00 )
call SetTimerData(t, dat)
call TimerStart (t,0.95, false, function Wait )
endfunction
public function init takes nothing returns nothing
call RegisterSpellCastResponse(SPELL, Cast)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
library Endurance
globals
private constant integer SPELL = 'A0F6'
private constant integer UP = 'R015'
endglobals
private function Conditions takes nothing returns boolean
local unit caster = GetTriggerUnit()
local player owner = GetOwningPlayer(caster)
if GetLearnedSkill() == SPELL then
call SetPlayerTechResearched(owner, UP, GetPlayerTechCount(owner,UP,true)+1)
endif
set caster = null
return false
endfunction
function Endurance takes unit hero returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterUnitEvent(t,hero,EVENT_UNIT_HERO_SKILL)
call TriggerAddCondition(t,Condition(function Conditions))
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope EnergizedBlade initializer init
globals
private constant integer SPELL = 'A0FP'
private constant real DUR = 30.
private constant string FX = "CLPB"
private constant integer TRAP_BEACON = 'o00P'
private constant integer DUMMY_SPELL = 'A0FQ'
private constant real INTERVAL = 50.
private constant real MAXRANGE = 600.
private constant string MESSAGE = "You must be at maximum far from 600. from the current beacon. Current distance: "
endglobals
private struct s_caster
unit tmpBeacon1
unit tmpBeacon2
private static method createFilter takes unit u returns boolean
return GetUnitAbilityLevel(u,SPELL)>=1
endmethod
private method onCreate takes nothing returns nothing
set .tmpBeacon1 = null
set .tmpBeacon2 = null
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
set .tmpBeacon1 = null
set .tmpBeacon2 = null
endmethod
implement AutoDestroy
endstruct
private function FinishTrapGroup takes unit beacon1, unit beacon2, real distance returns nothing
local player owner = GetOwningPlayer(beacon1)
local real x1 = GetUnitX(beacon1)
local real y1 = GetUnitY(beacon1)
local real x2 = GetUnitX(beacon2)
local real y2 = GetUnitY(beacon2)
local real x3 = 0.
local real y3 = 0.
local real angle = Atan2((y2 -y1), (x2 - x1))
local integer i = 0
local unit dummyTrap = null
local integer amount = R2I(distance/INTERVAL)
loop
exitwhen i > amount-1
set x3 = x1+(i*INTERVAL)*Cos(angle)
set y3 = y1+(i*INTERVAL)*Sin(angle)
set dummyTrap = CreateUnit(owner,DUMMY,x3,y3,0.)
call UnitAddAbility(dummyTrap,DUMMY_SPELL)
call UnitApplyTimedLife(dummyTrap,'BTLF',DUR)
set i = i + 1
endloop
call UnitApplyTimedLife(beacon1,'BTLF',DUR)
call UnitApplyTimedLife(beacon2,'BTLF',DUR)
call Eclair(beacon1,beacon2,FX,DUR)
call Eclair(beacon2,beacon1,FX,DUR)
set dummyTrap = null
endfunction
private function BeaconDistance takes unit u1, unit u2 returns real
local real x1 = GetUnitX(u1)
local real y1 = GetUnitY(u1)
local real x2 = GetUnitX(u2)
local real y2 = GetUnitY(u2)
return SquareRoot( (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1) )
endfunction
private function SetUpTrap takes nothing returns nothing
local real x = SpellEvent.TargetX
local real y = SpellEvent.TargetY
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local s_caster dat = s_caster[SpellEvent.CastingUnit]
local unit trap = CreateUnit(owner,TRAP_BEACON,x,y,GetUnitFacing(SpellEvent.CastingUnit))
local real distance = BeaconDistance(dat.tmpBeacon1,trap)
if dat.tmpBeacon1 == null then
set dat.tmpBeacon1 = trap
else
if dat.tmpBeacon2 == null then
if distance < MAXRANGE then
set dat.tmpBeacon2 = trap
call FinishTrapGroup(dat.tmpBeacon1,dat.tmpBeacon2,distance)
set dat.tmpBeacon1 = null
set dat.tmpBeacon2 = null
else
call RemoveUnit(trap)
call ErrorSound(owner)
call DisplayTextToPlayer(owner,0,0,MESSAGE+I2S(R2I(distance)))
endif
else
set dat.tmpBeacon1 = trap
set dat.tmpBeacon2 = null
endif
endif
set trap = null
endfunction
public function init takes nothing returns nothing
call AbilityPreload(DUMMY_SPELL)
call RegisterSpellCastResponse(SPELL, SetUpTrap)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope EnergyDrain initializer init
globals
private constant integer SPELL = 'A0GY'
private constant real AMOUNT = 100.
endglobals
private function Actions takes nothing returns nothing
local real mp = GetUnitState(SpellEvent.TargetUnit,UNIT_STATE_MANA)
if mp < AMOUNT then
call SetUnitState(SpellEvent.CastingUnit,UNIT_STATE_MANA,GetUnitState(SpellEvent.CastingUnit,UNIT_STATE_MANA)+mp)
call SetUnitState(SpellEvent.TargetUnit,UNIT_STATE_MANA,0.)
else
call SetUnitState(SpellEvent.CastingUnit,UNIT_STATE_MANA,GetUnitState(SpellEvent.CastingUnit,UNIT_STATE_MANA)+AMOUNT)
call SetUnitState(SpellEvent.TargetUnit,UNIT_STATE_MANA,GetUnitState(SpellEvent.TargetUnit,UNIT_STATE_MANA)-AMOUNT)
endif
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope EnergyField initializer init
globals
private constant integer SPELLBOOK = 'A02U'
private constant integer SPELL = 'A02N'
private constant integer DURATION = 30
endglobals
private struct str
unit caster
integer i
endstruct
private function Wait takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
if dat.i < DURATION and not (IsUnitType(dat.caster,UNIT_TYPE_DEAD)) then
set dat.i = dat.i + 1
else
if GetUnitAbilityLevel(dat.caster,SPELLBOOK)>=1 then
call UnitRemoveAbility(dat.caster,SPELLBOOK)
endif
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function Cast takes nothing returns nothing
local timer t = NewTimer()
local str dat = str.create()
set dat.caster = SpellEvent.CastingUnit
set dat.i = 0
if GetUnitAbilityLevel(dat.caster,SPELLBOOK)<=0 then
call UnitAddAbility(dat.caster, SPELLBOOK)
endif
call SetUnitAbilityLevel(dat.caster,SPELLBOOK,GetUnitAbilityLevel(dat.caster,SPELL))
call SetTimerData(t, dat)
call TimerStart (t,1., true, function Wait )
endfunction
public function init takes nothing returns nothing
local integer i = 0
call AbilityPreload(SPELLBOOK)
loop
exitwhen i > MAXPLAYER
call SetPlayerAbilityAvailable(Player(i),SPELLBOOK,false)
set i = i + 1
endloop
call RegisterSpellFinishResponse(SPELL, Cast)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope EnergyTransfert initializer init
globals
private constant integer SPELL = 'A0HZ'
private constant real AMOUNT = 200.
endglobals
private function Actions takes nothing returns nothing
local real mp = GetUnitState(SpellEvent.CastingUnit,UNIT_STATE_MANA)
if mp < AMOUNT then
call SetUnitState(SpellEvent.TargetUnit,UNIT_STATE_MANA,GetUnitState(SpellEvent.TargetUnit,UNIT_STATE_MANA)+mp)
call SetUnitState(SpellEvent.CastingUnit,UNIT_STATE_MANA,0.)
else
call SetUnitState(SpellEvent.TargetUnit,UNIT_STATE_MANA,GetUnitState(SpellEvent.TargetUnit,UNIT_STATE_MANA)+AMOUNT)
call SetUnitState(SpellEvent.CastingUnit,UNIT_STATE_MANA,GetUnitState(SpellEvent.CastingUnit,UNIT_STATE_MANA)-AMOUNT)
endif
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope EquipementBeacon initializer init
globals
private constant integer SPELL = 'A02S'
private constant string INFO = " Downloading coordonates of the nearby beacons..."
private constant real AOE = 4000.
endglobals
private function PingBox takes nothing returns boolean
if GetUnitTypeId(GetFilterUnit())==BOX_ID then
call PingMinimapEx(GetUnitX(GetFilterUnit()),GetUnitY(GetFilterUnit()),3., 176, 0, 96, false)
endif
return true
endfunction
private function Actions takes nothing returns nothing
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local integer ownerId = GetPlayerId(owner)
call DisplayAll(PlayerColor[ownerId]+GetPlayerName(owner),INFO)
call GroupEnumUnitsInRange(ENUM_GROUP,GetUnitX(SpellEvent.CastingUnit),GetUnitY(SpellEvent.CastingUnit),AOE,Filter(function PingBox))
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=55
//TESH.alwaysfold=0
scope EquipmentDrop initializer init
globals
private constant integer DRONE_ID = 'n00J'
private constant integer DUMMY_ID = 'o01L'
private constant integer SPELL ='A05C'
private constant integer SPEED = 50
private constant real AOE = 500.
private constant real IMP = 1.
private constant real SPAWN_DISTANCE = 4000.
private constant real SPAWN_Z = 400.
endglobals
private function Drop takes real x, real y returns nothing
local unit dummy = null
set dummy = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),DUMMY_ID,x,y,0.)
call SetUnitFlyHeight(dummy, SPAWN_Z, 0.)
call SetUnitFlyHeight(dummy, 0.,400.)
set dummy = null
endfunction
private struct str
unit drone
real angle
integer distance
integer firepoint
integer i
real targetX
real targetY
endstruct
private function Update takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
local real newX = GetUnitX(dat.drone) + SPEED*Cos(dat.angle)
local real newY = GetUnitY(dat.drone) + SPEED*Sin(dat.angle)
local real z = GetUnitFlyHeight(dat.drone)
local real newz = 0.
if dat.i < dat.distance then
set dat.i = dat.i + 1
call SetUnitPosition(dat.drone, newX, newY)
if dat.i == dat.firepoint then
call Drop(newX,newY)
endif
else
call RemoveUnit(dat.drone)
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function Actions takes nothing returns nothing
local timer t = NewTimer()
local str dat = str.create()
local real x1 = GetUnitX(SpellEvent.CastingUnit)
local real y1 = GetUnitY(SpellEvent.CastingUnit)
local real x2 = SpellEvent.TargetX
local real y2 = SpellEvent.TargetY
local real angle = Atan2((y2 -y1), (x2 - x1))
local real x3 = CheckPointValidity(x1 - SPAWN_DISTANCE*Cos(angle),MapXMin,MapXMax)
local real y3 = CheckPointValidity(y1 - SPAWN_DISTANCE*Sin(angle),MapYMin,MapYMax)
local real x4 = CheckPointValidity(x2 + SPAWN_DISTANCE*Cos(angle),MapXMin,MapXMax)
local real y4 = CheckPointValidity(y2 + SPAWN_DISTANCE*Sin(angle),MapYMin,MapYMax)
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local integer ownerId = GetPlayerId(owner)
call DisplayAll(PlayerColor[ownerId]+GetPlayerName(GetOwningPlayer(SpellEvent.CastingUnit)),"Equipment requested")
call FlySound()
set dat.targetX = x2
set dat.targetY = y2
set dat.angle = angle
set dat.distance =R2I(SquareRoot((x3-x4)*(x3-x4)+(y3-y4)*(y3-y4))/SPEED)
set dat.firepoint = R2I(GetRandomReal(0.40*dat.distance,0.60*dat.distance))
set dat.i = 0
set dat.drone = CreateUnit(GetOwningPlayer(SpellEvent.CastingUnit),DRONE_ID,x3,y3, dat.angle*bj_RADTODEG )
call SetUnitFlyHeight(dat.drone,SPAWN_Z,0.)
call SetTimerData(t, dat)
call TimerStart (t, TIMEOUT, true, function Update)
set owner = null
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
library Experience needs AmmoSystem
globals
private constant integer SPELL = 'A0HK'
private constant real RELOAD_BONUS = 0.5
endglobals
private function Conditions takes nothing returns boolean
local unit caster = GetTriggerUnit()
if GetLearnedSkill() == SPELL then
call UpgradeReloadWeapon(caster,RELOAD_BONUS)
endif
set caster = null
return false
endfunction
function Experience takes unit hero returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterUnitEvent(t,hero,EVENT_UNIT_HERO_SKILL)
call TriggerAddCondition(t,Condition(function Conditions))
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library EyeOfTheEagle
globals
private constant integer SPELL = 'A0HL'
private constant integer UP = 'R01B'
private constant real RANGE = 50.
endglobals
private function Conditions takes nothing returns boolean
local unit caster = GetTriggerUnit()
local player owner = GetOwningPlayer(caster)
if GetLearnedSkill() == SPELL then
call SetPlayerTechResearched(owner, UP, GetPlayerTechCount(owner,UP,true)+1)
call SetUnitAcquireRange(caster,GetUnitAcquireRange(caster)+RANGE)
endif
set caster = null
return false
endfunction
function EyeOfTheEagle takes unit hero returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterUnitEvent(t,hero,EVENT_UNIT_HERO_SKILL)
call TriggerAddCondition(t,Condition(function Conditions))
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope Firebat initializer init
globals
private constant integer MARINE_ID = 'h004'
private constant string FX_SPAWN= "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportCaster.mdl"
private constant integer SPELL = 'A0IW'
private constant integer COUNT = 2
private constant real AOE = 100.
endglobals
private function CheckSoldier takes nothing returns boolean
local unit target = GetFilterUnit()
if GetUnitTypeId(target)==MARINE_ID then
if GameMode == 6 then
call KillUnit(target)
else
call SetUnitOwner(target,Player(10),true)
call UnitAddAbility(target,LASTQUESTUNIT_SPELL)
call IssuePointOrder(target,LASTQUESTUNIT_ORDER,GetRectCenterX(gg_rct_LastQuest),GetRectCenterY(gg_rct_LastQuest))
endif
endif
set target = null
return true
endfunction
private function Spawn takes nothing returns nothing
local unit spawned = null
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local real x = GetRectCenterX(gg_rct_Reinforcement)
local real y = GetRectCenterY(gg_rct_Reinforcement)
local integer i = 0
call GroupEnumUnitsOfPlayer(ENUM_GROUP,owner,Filter(function CheckSoldier))
loop
exitwhen i > COUNT-1
set spawned = CreateUnit(owner, MARINE_ID,x+GetRandomReal(-AOE,AOE),y+GetRandomReal(-AOE,AOE),0.)
call DestroyEffect(AddSpecialEffectTarget(FX_SPAWN, spawned, "origin") )
call IssueImmediateOrder(spawned,ACTIVATE_AI_ORDER)
set i = i + 1
endloop
set spawned = null
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Spawn)
endfunction
endscope
//TESH.scrollpos=78
//TESH.alwaysfold=0
library FireMastery needs TimerUtils,GroupFunction,AutoIndex
globals
private constant integer UNIT_ID = 'H00J'
private constant integer SPELL = 'A056'
private constant integer SPELL_NPC = 'A0G2'
private constant integer FIRELINE_REQ = 5
private constant integer FIRELINE_CHANCE = 40
private constant integer FUELSYNTH_REQ = 6
private constant integer FUELSYNTH_UP = 'R008'
private constant real TIMEOUT_WAVE = 0.10
private constant string FX = "FlameStrike1.mdx"
private constant real DIS = 500.00
private constant integer SPEED = 60
private constant real FIRELINE_AOE = 250.00
private constant real FIRELINE_DMG = 300
endglobals
private struct s_FireLine
unit caster
unit target
real x1
real y1
real x2
real y2
real angle
integer distance
integer i
player pl
endstruct
private function Update takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_FireLine dat = GetTimerData(t)
local real newX = dat.x1 + dat.i*SPEED*Cos(dat.angle)
local real newY = dat.y1 + dat.i*SPEED*Sin(dat.angle)
if dat.i < dat.distance then
set dat.i = dat.i + 1
call DestroyEffect(AddSpecialEffect(FX,newX,newY))
call UnitDamageEnemies(dat.caster,FIRELINE_AOE,newX,newY,FIRELINE_DMG,DMG_EXPLOSIVE,false,0,0,0)
else
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function FireLine takes unit marine, unit target returns nothing
local timer t = NewTimer()
local s_FireLine dat = s_FireLine.create()
set dat.caster = marine
set dat.pl = GetOwningPlayer(dat.caster)
set dat.target = target
set dat.x1 = GetUnitX(dat.caster)
set dat.y1 = GetUnitY(dat.caster)
set dat.x2 = GetUnitX(dat.target)
set dat.y2 = GetUnitY(dat.target)
set dat.angle = Atan2((dat.y2 -dat.y1), (dat.x2 - dat.x1))
set dat.x2 = dat.x1 + DIS*Cos(dat.angle*bj_DEGTORAD)
set dat.y2 = dat.y1 + DIS*Sin(dat.angle*bj_DEGTORAD)
set dat.distance = R2I(SquareRoot((dat.x2-dat.x1)*(dat.x2-dat.x1)+(dat.y2-dat.y1)*(dat.y2-dat.y1))/SPEED)
set dat.i = 0
call SetTimerData(t, dat)
call TimerStart (t, TIMEOUT_WAVE, true, function Update )
endfunction
private function MarineAttacked takes nothing returns boolean
local unit marine = GetTriggerUnit()
if (GetUnitAbilityLevel(marine,SPELL)>=FIRELINE_REQ and GetRandomInt(0,100)<=FIRELINE_CHANCE) or GetUnitAbilityLevel(marine,SPELL_NPC)>=1 then
call FireLine(marine,GetAttacker())
endif
set marine = null
return false
endfunction
private struct str
trigger trig
private static method createFilter takes unit u returns boolean
return GetUnitTypeId(u)==UNIT_ID or GetUnitAbilityLevel(u,SPELL_NPC)>=1
endmethod
private method onCreate takes nothing returns nothing
set .trig = CreateTrigger()
call TriggerRegisterUnitEvent(.trig,me,EVENT_UNIT_ATTACKED)
call TriggerAddCondition(.trig,Condition(function MarineAttacked))
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
call DisableTrigger(.trig)
call DestroyTrigger(.trig)
set .trig = null
endmethod
implement AutoDestroy
endstruct
private function Conditions takes nothing returns boolean
local unit caster = GetTriggerUnit()
local player owner = GetOwningPlayer(caster)
if GetLearnedSkill() == SPELL then
if GetUnitAbilityLevel(caster,SPELL) == FUELSYNTH_REQ then
call SetPlayerTechResearched(owner, FUELSYNTH_UP, 1)
endif
endif
set caster = null
return false
endfunction
function FireMastery takes unit hero returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterUnitEvent(t,hero,EVENT_UNIT_HERO_SKILL)
call TriggerAddCondition(t,Condition(function Conditions))
endfunction
endlibrary
//TESH.scrollpos=5
//TESH.alwaysfold=0
scope FirstAid initializer init
globals
private constant integer SPELL = 'A0K7'
private constant real AMOUNT = 150.
private constant string SUCCESS_FRACTURE = "Fracture healed"
private constant string SUCCESS_POISON = "A poison removed"
endglobals
private function Actions takes nothing returns nothing
local unit target = SpellEvent.TargetUnit
call SetUnitState(target,UNIT_STATE_LIFE,GetUnitState(target,UNIT_STATE_LIFE)+AMOUNT)
if GetUnitAbilityLevel(target,BUFF_FRACT)>=1 then
call TextTagMessage(SUCCESS_FRACTURE,target,0.,50.,64.,90.,9,5.,4.)
call UnitRemoveAbility(target,BUFF_FRACT)
endif
if GetUnitAbilityLevel(target,BUFF_POISON1)>=1 or GetUnitAbilityLevel(target,BUFF_POISON2)>=1 then
if GetUnitAbilityLevel(target,BUFF_POISON1)>=1 then
call UnitRemoveAbility(target,BUFF_POISON1)
endif
if GetUnitAbilityLevel(target,BUFF_POISON2)>=1 then
call UnitRemoveAbility(target,BUFF_POISON2)
endif
call TextTagMessage(SUCCESS_POISON,target,0.,50.,64.,90.,9,5.,4.)
endif
set target = null
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL,Actions)
endfunction
endscope
//TESH.scrollpos=3
//TESH.alwaysfold=0
scope firewall initializer init
globals
private constant real TIMEOUT_SPAWN = 0.25
private constant integer DUR = 20
private constant integer DUMMY_ID = 'o01H'
private constant integer SPELL ='A05R'
private constant integer SPELL_NPC ='A0G1'
private constant real LIFESPAN = 40.
endglobals
private struct str
unit caster
integer i
player owner
real x
real y
endstruct
private function Update takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
local real x = GetUnitX(dat.caster)
local real y = GetUnitY(dat.caster)
if dat.i < DUR and not (IsUnitType(dat.caster,UNIT_TYPE_DEAD)) then
set dat.i = dat.i + 1
if dat.x != x and dat.y!= y then
call UnitApplyTimedLife(CreateUnit(dat.owner,DUMMY_ID,x,y,0.),'BTLF',LIFESPAN)
endif
set dat.x = x
set dat.y = y
else
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function Actions takes nothing returns nothing
local timer t = NewTimer()
local str dat = str.create()
set dat.caster = SpellEvent.CastingUnit
set dat.owner = GetOwningPlayer(dat.caster)
set dat.i = 0
set dat.x = GetUnitX(dat.caster)
set dat.y = GetUnitY(dat.caster)
call SetTimerData(t, dat)
call TimerStart (t, TIMEOUT_SPAWN, true, function Update )
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Actions)
call RegisterSpellFinishResponse(SPELL_NPC, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope FlameRelease initializer init
globals
private constant real IMP = 0.60
private constant integer SPEED = 20
private constant integer SPELL = 'A037'
private constant integer SPELL_NPC = 'A0FL'
private constant string ANIM = "spell fourth"
private constant real AOE = 300.
private constant real DMG = 500.
private constant string FX = "Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl"
endglobals
private struct str
unit caster
real angle
integer distance
integer i
integer deltaZ
endstruct
private function Update takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
local real newX = GetUnitX(dat.caster) + SPEED*Cos(dat.angle)
local real newY = GetUnitY(dat.caster) + SPEED*Sin(dat.angle)
local real z = GetUnitFlyHeight(dat.caster)
local real newz = 0.
if dat.i < dat.distance then
set dat.i = dat.i + 1
call SetUnitX(dat.caster, newX)
call SetUnitY(dat.caster, newY)
if dat.i < (dat.distance * 0.5) then
set newz = z + (dat.distance * IMP)
else
set newz = z - (dat.distance * IMP)
endif
call SetUnitFlyHeight(dat.caster, newz, 0.00)
else
call SetUnitPathing( dat.caster, true)
call SetUnitAnimation(dat.caster, "Stand")
call SetUnitTimeScale(dat.caster,1.)
if dat.deltaZ > 1 then
call UnitAddBuffFract(dat.caster)
endif
call DestroyEffect(AddSpecialEffect(FX,newX,newY))
call UnitDamageEnemies(dat.caster,AOE,newX,newY,DMG,DMG_EXPLOSIVE,false,0,0,0)
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function Actions takes nothing returns nothing
local timer t = NewTimer()
local str dat = str.create()
local real x1 = GetUnitX(SpellEvent.CastingUnit)
local real y1 = GetUnitY(SpellEvent.CastingUnit)
local real x2 = SpellEvent.TargetX
local real y2 = SpellEvent.TargetY
set dat.deltaZ = GetTerrainCliffLevel(x1,y1)-GetTerrainCliffLevel(x2,y2)
if dat.deltaZ >= 0 then
set dat.caster = SpellEvent.CastingUnit
set dat.angle = Atan2((y2 -y1), (x2 - x1))
set dat.distance = R2I(SquareRoot((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)))/SPEED
set dat.i = 0
call SetUnitPathing( dat.caster, false)
call SetUnitTimeScale(dat.caster,4.)
call SetUnitAnimation(dat.caster,ANIM)
call SetTimerData(t, dat)
call TimerStart (t, TIMEOUT, true, function Update )
else
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Actions)
call RegisterSpellFinishResponse(SPELL_NPC, Actions)
endfunction
endscope
//TESH.scrollpos=14
//TESH.alwaysfold=0
scope Flare initializer init
globals
private constant integer SPELL = 'A0DL'
private constant integer SPELL_HERO = 'A0DY'
private constant integer SPELL_NPC = 'A09W'
private constant integer DUMMY_SPELL = 'S001'
private constant integer VISION_ID = 'o01Y'
private constant real DUR_2 = 10.
private constant real DUR_3 = 3.
endglobals
private function Actions takes nothing returns nothing
local integer i = 0
local real x = SpellEvent.TargetX
local real y = SpellEvent.TargetY
local integer id = SpellEvent.AbilityId
local real dur = 0.
local unit dummy = CreateUnit(GetOwningPlayer(SpellEvent.CastingUnit),DUMMY,x,y,0.)
if id == SPELL then
set dur = DUR_2
elseif id == SPELL_HERO then
set dur = DUR_3+2*GetUnitAbilityLevel(SpellEvent.CastingUnit,id)
endif
call UnitAddAbility(dummy,DUMMY_SPELL)
call UnitApplyTimedLife(dummy,'BTLF',dur)
loop
exitwhen i > MAXPLAYER + 1
if GetPlayerSlotState(Player(i))==PLAYER_SLOT_STATE_PLAYING then
set dummy = CreateUnit(Player(i),VISION_ID,x,y,0.)
call UnitApplyTimedLife(dummy,'BTLF',dur)
call SetUnitPathing(dummy,false)
endif
set i = i + 1
endloop
set dummy = null
endfunction
public function init takes nothing returns nothing
call AbilityPreload(DUMMY_SPELL)
call RegisterSpellCastResponse(SPELL, Actions)
call RegisterSpellCastResponse(SPELL_NPC, Actions)
call RegisterSpellCastResponse(SPELL_HERO, Actions)
endfunction
endscope
//TESH.scrollpos=6
//TESH.alwaysfold=0
scope FlashGrenade initializer init
globals
private constant integer SPELL = 'A0JF'
private constant integer SPELL_ITEM = 'A01K'
private constant string FX = "war3mapImported\\FlashBang.mdx"
private constant real AOE = 600.
endglobals
private struct str
unit caster
real x
real y
endstruct
private function Wait takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
call FlashSound(dat.x,dat.y)
call DestroyEffect(AddSpecialEffect(FX,dat.x,dat.y))
call ReleaseTimer(t)
call dat.destroy()
endfunction
private function Cast takes nothing returns nothing
local timer t = NewTimer()
local str dat = str.create()
set dat.x = SpellEvent.TargetX
set dat.y = SpellEvent.TargetY
set dat.caster = SpellEvent.CastingUnit
call SetUnitAnimation( dat.caster, "spell throw" )
call GrenadeSound(dat.x,dat.y)
call TextTagMessage("Flash!", dat.caster, 0., 50., 64., 90., 9, 5., 2.00 )
call SetTimerData(t, dat)
call TimerStart (t,0.1, false, function Wait )
endfunction
public function init takes nothing returns nothing
call RegisterSpellCastResponse(SPELL, Cast)
call RegisterSpellCastResponse(SPELL_ITEM, Cast)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope FlyingDroneProgram initializer init
globals
private constant integer DRONE_ID = 'n00A'
private constant integer DUMMY_ID = 'e001'
private constant integer SPELL ='A05U'
private constant integer SPEED = 50
private constant real AOE = 200.
private constant real IMP = 0.5
private constant real SPAWN_DISTANCE = 2000.
private constant real SPAWN_Z = 500.
private constant integer COUNT = 8
endglobals
private function Damage takes unit whichUnit, real x1, real y1, real x2, real y2 returns nothing
local integer i = 0
local player owner = GetOwningPlayer(whichUnit)
local unit dummy = null
loop
exitwhen i > COUNT - 1
set dummy = CreateUnit(owner,DUMMY_ID,x1,y1,0.)
call IssuePointOrder(dummy,"attackground",x2+GetRandomReal(-AOE,AOE),y2+GetRandomReal(-AOE,AOE))
call UnitApplyTimedLife(dummy, 'BTLF', 0.5 )
set i = i + 1
endloop
set dummy = null
endfunction
private struct str
unit drone
real angle
integer distance
integer firepoint
integer i
real targetX
real targetY
endstruct
private function Update takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
local real newX = GetUnitX(dat.drone) + SPEED*Cos(dat.angle)
local real newY = GetUnitY(dat.drone) + SPEED*Sin(dat.angle)
local real z = GetUnitFlyHeight(dat.drone)
local real newz = 0.
if dat.i < dat.distance then
set dat.i = dat.i + 1
call SetUnitPosition(dat.drone, newX, newY)
if dat.i < dat.distance*0.5 then
set newz = z - (dat.distance * IMP)
else
set newz = z + (dat.distance * IMP)
endif
call SetUnitFlyHeight(dat.drone, newz, 0.)
if dat.i == dat.firepoint then
call Damage(dat.drone,newX,newY,dat.targetX,dat.targetY)
endif
else
call RemoveUnit(dat.drone)
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function Actions takes nothing returns nothing
local timer t = NewTimer()
local str dat = str.create()
local real x1 = GetUnitX(SpellEvent.CastingUnit)
local real y1 = GetUnitY(SpellEvent.CastingUnit)
local real x2 = SpellEvent.TargetX
local real y2 = SpellEvent.TargetY
local real angle = Atan2((y2 -y1), (x2 - x1))
local real x3 = CheckPointValidity(x1 - SPAWN_DISTANCE*Cos(angle),MapXMin,MapXMax)
local real y3 = CheckPointValidity(y1 - SPAWN_DISTANCE*Sin(angle),MapYMin,MapYMax)
local real x4 = CheckPointValidity(x2 + SPAWN_DISTANCE*Cos(angle),MapXMin,MapXMax)
local real y4 = CheckPointValidity(y2 + SPAWN_DISTANCE*Sin(angle),MapYMin,MapYMax)
call FlySound()
set dat.targetX = x2
set dat.targetY = y2
set dat.angle = angle
set dat.firepoint =R2I(0.5*SquareRoot((x3-x2)*(x3-x2)+(y3-y2)*(y3-y2))/SPEED)
set dat.distance =R2I(SquareRoot((x3-x4)*(x3-x4)+(y3-y4)*(y3-y4))/SPEED)
set dat.i = 0
set dat.drone = CreateUnit(GetOwningPlayer(SpellEvent.CastingUnit),DRONE_ID,x3,y3, dat.angle*bj_RADTODEG )
call SetUnitFlyHeight(dat.drone,SPAWN_Z,0.)
call SetTimerData(t, dat)
call TimerStart (t, TIMEOUT, true, function Update)
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=30
//TESH.alwaysfold=0
scope ForceJump initializer init
globals
private constant real IMP = 0.40
private constant integer SPEED = 20
private constant integer SPELL = 'A01Q'
private constant string ANIM = "Spell Fourth"
endglobals
private struct str
unit caster
real angle
integer distance
integer i
endstruct
private function Update takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
local real newX = GetUnitX(dat.caster) + SPEED*Cos(dat.angle)
local real newY = GetUnitY(dat.caster) + SPEED*Sin(dat.angle)
local real z = GetUnitFlyHeight(dat.caster)
local real newz = 0.
if dat.i < dat.distance then
set dat.i = dat.i + 1
call SetUnitX(dat.caster, newX)
call SetUnitY(dat.caster, newY)
if dat.i < (dat.distance * 0.5) then
set newz = z + (dat.distance * IMP)
else
set newz = z - (dat.distance * IMP)
endif
call SetUnitFlyHeight(dat.caster, newz, 0.00)
else
call SetUnitPathing( dat.caster, true)
call SetUnitAnimation(dat.caster, "Stand")
call SetUnitTimeScale(dat.caster,1.)
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function Actions takes nothing returns nothing
local timer t = NewTimer()
local str dat = str.create()
local real x1 = GetUnitX(SpellEvent.CastingUnit)
local real y1 = GetUnitY(SpellEvent.CastingUnit)
local real x2 = SpellEvent.TargetX
local real y2 = SpellEvent.TargetY
set dat.caster = SpellEvent.CastingUnit
set dat.angle = Atan2((y2 -y1), (x2 - x1))
set dat.distance = R2I(SquareRoot((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)))/SPEED
set dat.i = 0
call SetUnitPathing( dat.caster, false)
call SetUnitTimeScale(dat.caster,1.)
call SetUnitAnimation(dat.caster,ANIM)
call SetTimerData(t, dat)
call TimerStart (t, TIMEOUT, true, function Update )
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope Foresight initializer init
globals
private constant integer SPELL_AF = 'A0BA'
private constant integer SPELL_SA = 'A0GU'
private constant integer DUMMY_SPELL = 'A0BS'
private constant real AOE_AF = 5000.00
private constant real AOE_SA = 3000.00
private player Owner
endglobals
private function AddVisibility takes nothing returns boolean
local unit target = GetFilterUnit()
local unit dummy = null
if IsUnitEnemy(target,Owner)==true and not (IsUnitType(target,UNIT_TYPE_DEAD)) then
set dummy = CreateUnit(Owner,DUMMY,GetUnitX(target),GetUnitY(target),0.)
call UnitAddAbility(dummy,DUMMY_SPELL)
call IssueTargetOrder(dummy,"faeriefire",target)
call UnitApplyTimedLife(dummy,'BTLF',1.)
endif
set dummy = null
set target = null
return true
endfunction
private function Actions takes nothing returns nothing
local real x = GetUnitX(SpellEvent.CastingUnit)
local real y = GetUnitY(SpellEvent.CastingUnit)
local real aoe = 0.
if SpellEvent.AbilityId == SPELL_AF then
set aoe = AOE_AF
elseif SpellEvent.AbilityId == SPELL_SA then
set aoe = AOE_SA
endif
set Owner = GetOwningPlayer(SpellEvent.CastingUnit)
call GroupEnumUnitsInRange(ENUM_GROUP,x,y,aoe,Filter(function AddVisibility))
endfunction
public function init takes nothing returns nothing
call AbilityPreload(DUMMY_SPELL)
call RegisterSpellFinishResponse(SPELL_AF, Actions)
call RegisterSpellFinishResponse(SPELL_SA, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope FragmentationDisc initializer init
globals
private constant integer SPELL = 'A09B'
private constant real AOE = 300.00
private constant integer AMOUNT = 5
private constant integer DUMMY_SPELL = 'A09C'
endglobals
private function Actions takes nothing returns nothing
local real x1 = GetUnitX(SpellEvent.CastingUnit)
local real y1 = GetUnitY(SpellEvent.CastingUnit)
local real x2 = SpellEvent.TargetX
local real y2 = SpellEvent.TargetY
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local integer i = 0
local unit dummy = null
loop
exitwhen i > AMOUNT -1
set dummy = CreateUnit(owner,DUMMY,x1,y1,0.)
call UnitAddAbility(dummy,DUMMY_SPELL)
call IssuePointOrder(dummy,"carrionswarm",x2+GetRandomReal(-AOE,AOE),y2+GetRandomReal(-AOE,AOE))
call UnitApplyTimedLife(dummy,'BTLF',1.)
set i = i + 1
endloop
set dummy = null
endfunction
public function init takes nothing returns nothing
call AbilityPreload(DUMMY_SPELL)
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope FragmentationGrenade initializer init
globals
private constant integer SPELL_ITEM = 'A01J'
private constant integer SPELL = 'A0I0'
private constant string DISP = "Abilities\\Weapons\\GyroCopter\\GyroCopterImpact.mdl"
private constant string FIRE = "Abilities\\Weapons\\Mortar\\ScatterShotTarget.mdl"
private constant string FRAG = "Abilities\\Weapons\\FragDriller\\FragDriller.mdl"
private constant real RADIUS = 200.
private constant real AOE = 300.
private constant real DMG = 50.
private constant integer DUMMY_SPELL = 'A01J'
endglobals
private struct str2
unit caster
integer i
real x
real y
endstruct
private function RadialExplosion takes nothing returns nothing
local timer t = GetExpiredTimer()
local str2 dat = GetTimerData(t)
local integer i = 0
local real x = 0.
local real y = 0.
if dat.i < 20 then
set dat.i = dat.i + 1
loop
set i = i + 1
exitwhen i > 10
set x = dat.x + GetRandomReal(-RADIUS,RADIUS)
set y = dat.y + GetRandomReal(-RADIUS,RADIUS)
call DestroyEffect(AddSpecialEffect(DISP,x,y))
endloop
call UnitDamageAll(dat.caster,true,AOE,dat.x,dat.y,DMG,DMG_EXPLOSIVE,false,0,0,0)
else
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function Boom takes unit caster, real x, real y returns nothing
local timer t = NewTimer()
local str2 dat = str2.create()
set dat.x = x
set dat.y = y
set dat.i = 0
set dat.caster = caster
call DestroyEffect(AddSpecialEffect(FRAG, dat.x, dat.y))
call DestroyEffect(AddSpecialEffect(FIRE, dat.x, dat.y))
call SetTimerData(t, dat)
call TimerStart (t, 0.10, true, function RadialExplosion )
endfunction
private struct str
unit caster
real x
real y
endstruct
private function WaitBeforeBoom takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
call Boom(dat.caster,dat.x,dat.y)
call ReleaseTimer(t)
call dat.destroy()
endfunction
private function Actions takes nothing returns nothing
local timer t = NewTimer()
local str dat = str.create()
set dat.x = SpellEvent.TargetX
set dat.y = SpellEvent.TargetY
set dat.caster = SpellEvent.CastingUnit
call GrenadeSound(dat.x,dat.y)
if GetUnitTypeId(dat.caster)==DUMMY then
call TextTagMessage("Grenade!", Hero[GetPlayerId(GetOwningPlayer(dat.caster))], 0., 50., 64., 90., 9, 5., 2.00 )
call SetUnitAnimation(Hero[GetPlayerId(GetOwningPlayer(dat.caster))], "spell throw" )
else
call SetUnitAnimation( dat.caster, "spell throw" )
call TextTagMessage("Grenade!", dat.caster, 0., 50., 64., 90., 9, 5., 2.00 )
endif
call SetTimerData(t, dat)
call TimerStart (t,1., false, function WaitBeforeBoom )
endfunction
private function SpawnDummy takes nothing returns nothing
local unit dummy = CreateUnit(GetOwningPlayer(SpellEvent.CastingUnit),DUMMY,GetUnitX(SpellEvent.CastingUnit),GetUnitY(SpellEvent.CastingUnit),0.)
call UnitAddAbility(dummy,DUMMY_SPELL)
call IssuePointOrder(dummy,"clusterrockets",SpellEvent.TargetX,SpellEvent.TargetY)
call UnitApplyTimedLife(dummy,'BTLF',2.)
set dummy = null
endfunction
public function init takes nothing returns nothing
call AbilityPreload(DUMMY_SPELL)
call RegisterSpellCastResponse(SPELL, SpawnDummy)
call RegisterSpellCastResponse(SPELL_ITEM, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope FuelSynth initializer init
globals
private constant integer SPELL = 'A055'
endglobals
private function Actions takes nothing returns nothing
call UnitAddItemById(SpellEvent.CastingUnit,GetAmmoNeeded(SpellEvent.CastingUnit))
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope GazRayCube initializer init
globals
private constant string LIGHTNING_ART = "DRAM"
private constant integer SPELL = 'A05L'
private constant real AOE = 200.
private constant integer DUMMY_ID = 'h00G'
private constant integer DUR = 4
private constant integer SPELLBOOK = 'A02T'
private constant integer DUMMY_COUNT = 8
endglobals
private struct s_lightning
unit caster
unit target
lightning fx
integer duration
integer i
endstruct
private function UpdateLightning takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_lightning dat = GetTimerData(t)
local real x1 = GetUnitX(dat.caster)
local real y1 = GetUnitY(dat.caster)
local real z1 = GetUnitFlyHeight(dat.caster)
local real x2 = GetUnitX(dat.target)
local real y2 = GetUnitY(dat.target)
local real z2 = GetUnitFlyHeight(dat.target)
if dat.i < dat.duration and not (IsUnitType(dat.caster,UNIT_TYPE_DEAD)) and not (IsUnitType(dat.target,UNIT_TYPE_DEAD)) then
set dat.i = dat.i + 1
call MoveLightningEx(dat.fx,true,x1,y1,z1,x2,y2,z2)
else
call DestroyLightning(dat.fx)
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function LinkWithLightning takes unit caster, unit target returns nothing
local timer t = NewTimer()
local s_lightning dat = s_lightning.create()
local real x1 = GetUnitX(caster)
local real y1 = GetUnitY(caster)
local real z1 = GetUnitFlyHeight(caster)
local real x2 = GetUnitX(target)
local real y2 = GetUnitY(target)
local real z2 = GetUnitFlyHeight(target)
set dat.caster = caster
set dat.target = target
set dat.duration = R2I(DUR/TIMEOUT)
set dat.fx = AddLightningEx(LIGHTNING_ART, true,x1,y1,z1,x2,y2,z2)
set dat.i = 0
call SetTimerData(t, dat)
call TimerStart (t, TIMEOUT, true, function UpdateLightning )
endfunction
private struct s_move
unit hero
unit target
integer i
real angle
real duration
endstruct
private function UpdateMove takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_move dat = GetTimerData(t)
local real z = GetUnitFlyHeight(dat.target)
local real x1 = GetUnitX(dat.hero)
local real y1 = GetUnitY(dat.hero)
local real x2 = x1+AOE*Cos(dat.angle)
local real y2 = y1+AOE*Sin(dat.angle)
if dat.i < dat.duration then
set dat.i = dat.i + 1
set dat.angle = dat.angle+(2*bj_DEGTORAD)
call SetUnitPosition(dat.target,x2,y2)
call SetUnitFlyHeight(dat.target,z+1.5,0.)
else
call RemoveUnit(dat.target)
call SetUnitPathing( dat.target, true)
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function StartMove takes unit hero, unit target,real angle returns nothing
local timer t = NewTimer()
local s_move dat = s_move.create()
local real x1 = GetUnitX(dat.hero)
local real y1 = GetUnitY(dat.hero)
local real x2 = GetUnitX(dat.target)
local real y2 = GetUnitY(dat.target)
call SetUnitPathing(target,false)
set dat.hero = hero
set dat.target = target
set dat.i = 0
set dat.angle = angle*bj_DEGTORAD
set dat.duration = R2I(DUR/TIMEOUT)
call SetTimerData(t, dat)
call TimerStart (t,TIMEOUT, true, function UpdateMove )
endfunction
private struct s_time
unit caster
integer i
endstruct
private function UpdateElapsedTime takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_time dat = GetTimerData(t)
if dat.i < DUR and not (IsUnitType(dat.caster,UNIT_TYPE_DEAD)) then
set dat.i = dat.i + 1
else
if GetUnitAbilityLevel(dat.caster,SPELLBOOK)>=1 then
call UnitRemoveAbility(dat.caster,SPELLBOOK)
endif
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function Cast takes nothing returns nothing
local unit marine = SpellEvent.CastingUnit
local player owner = GetOwningPlayer(marine)
local unit array dummy
local real x1 = GetUnitX(marine)
local real y1 = GetUnitY(marine)
local real x2 = 0.
local real y2 = 0.
local integer i = 0
local real distance = AOE*0.5
local timer t = NewTimer()
local s_time dat = s_time.create()
loop
exitwhen i > 0.5*(DUMMY_COUNT-1)
set x2 = x1 + distance*Cos(i*90.*bj_DEGTORAD)
set y2 = y1 + distance*Sin(i*90.*bj_DEGTORAD)
set dummy[i] = CreateUnit(owner,DUMMY_ID,x2,y2,0.)
call SetUnitFlyHeight(dummy[i],0.,0.)
call StartMove(marine,dummy[i],90*i)
set i = i + 1
endloop
loop
exitwhen i > DUMMY_COUNT-1
set x2 = x1 + distance*Cos(i*90.*bj_DEGTORAD)
set y2 = y1 + distance*Sin(i*90.*bj_DEGTORAD)
set dummy[i] = CreateUnit(owner,DUMMY_ID,x2,y2,0.)
call SetUnitFlyHeight(dummy[i],100.,0.)
call StartMove(marine,dummy[i],90*i)
set i = i + 1
endloop
call LinkWithLightning(dummy[0],dummy[1])
call LinkWithLightning(dummy[1],dummy[2])
call LinkWithLightning(dummy[2],dummy[3])
call LinkWithLightning(dummy[3],dummy[0])
call LinkWithLightning(dummy[4],dummy[5])
call LinkWithLightning(dummy[5],dummy[6])
call LinkWithLightning(dummy[6],dummy[7])
call LinkWithLightning(dummy[7],dummy[4])
call LinkWithLightning(dummy[0],dummy[3])
call LinkWithLightning(dummy[1],dummy[5])
call LinkWithLightning(dummy[2],dummy[6])
call LinkWithLightning(dummy[3],dummy[7])
set dat.caster = marine
set dat.i = 0
if GetUnitAbilityLevel(dat.caster,SPELLBOOK)<=0 then
call UnitAddAbility(dat.caster,SPELLBOOK)
endif
call SetTimerData(t, dat)
call TimerStart (t, 1., true, function UpdateElapsedTime )
set marine = null
set i = 0
loop
exitwhen i > DUMMY_COUNT-1
set dummy[i] = null
set i = i + 1
endloop
endfunction
public function init takes nothing returns nothing
local integer i = 0
call AbilityPreload(SPELLBOOK)
loop
exitwhen i > MAXPLAYER
call SetPlayerAbilityAvailable(Player(i),SPELLBOOK,false)
set i = i + 1
endloop
call RegisterSpellFinishResponse(SPELL, Cast)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope GravityGun initializer init
globals
private constant integer UNIT_ID = 'H00E'
private constant string INFO_NOTARGET = "Your gravity gun does not carry an object"
private constant string FX_BLAST = "Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl"
private constant string FX_TELEPORTATION = "Abilities\\Spells\\Items\\StaffOfPurification\\PurificationCaster.mdl"
private constant string FRACTURE_FAIL = "Repair failed"
private constant string FRACTURE_SUCCESS = "Fracture healed"
private constant string POISON_FAIL = "Purge failed"
private constant string POISON_SUCCESS = "Poisons removed"
private constant string FX_POISON = "Abilities\\Spells\\Human\\DispelMagic\\DispelMagicTarget.mdl"
private constant string FX_FRACTURE = "Abilities\\Spells\\Orc\\FeralSpirit\\feralspiritdone.mdl"
private constant string INFO_NOALLIEDTARGET = "The current grabbed object is not an allied"
private constant real LIGHTNING_Z = 50.
private constant integer SPEED_RELEASE = 25
private constant integer SPEED_BLAST = 75
private constant real IMP = 0.25
private constant real DMG = 500.
private constant real AOE = 250.
private constant integer SPELL_CONTROL = 'A07M'
private constant integer SPELL_POISON = 'A0EM'
private constant integer SPELL_FRACTURE = 'A0EL'
private constant integer CHANCE_POISON = 60
private constant integer CHANCE_FRACTURE = 60
private constant integer SPELL_RELEASE = 'A07N'
private constant integer SPELL_TELEPORTATION = 'A07O'
private constant integer SPELL_BLAST = 'A07X'
endglobals
private struct str
unit caster = null
timer tiOrbit = null
unit target = null
lightning bolt = null
real angle = 0.
integer distance = 0
integer i = 0
boolean withBlast = false
player owner = null
integer speed = 0
private static method createFilter takes unit u returns boolean
return GetUnitTypeId(u)==UNIT_ID
endmethod
private method onCreate takes nothing returns nothing
set .tiOrbit = null
set .target = null
set .caster = me
set .bolt = null
set .angle = 0.
set .distance = 0
set .i = 0
set .withBlast = false
set .speed = 0
set .owner = GetOwningPlayer(me)
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
set .tiOrbit = null
set .target = null
set .caster = null
set .bolt = null
endmethod
implement AutoDestroy
endstruct
private function AddBlast takes unit caster, unit target returns nothing
call DestroyEffect(AddSpecialEffect(FX_BLAST,GetUnitX(target),GetUnitY(target)))
call UnitDamageEnemies(caster,AOE,GetUnitX(target),GetUnitY(target),DMG,DMG_ENERGETIC,true,100,20,0.5)
endfunction
private function UpdateRelease takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
local real newX = GetUnitX(dat.target) + dat.speed*Cos(dat.angle)
local real newY = GetUnitY(dat.target) + dat.speed*Sin(dat.angle)
local real z = GetUnitFlyHeight(dat.target)
local real newz = 0.
if dat.i < dat.distance then
set dat.i = dat.i + 1
call SetUnitPosition(dat.target,newX,newY)
if dat.i < (dat.distance * 0.5) then
set newz = z + (dat.distance * IMP)
else
set newz = z - (dat.distance * IMP)
endif
call SetUnitFlyHeight(dat.target, newz, 0.)
call MoveLightningEx(dat.bolt,true,GetUnitX(dat.caster),GetUnitY(dat.caster),GetUnitFlyHeight(dat.caster)+LIGHTNING_Z,GetUnitX(dat.target),GetUnitY(dat.target),GetUnitFlyHeight(dat.target)+LIGHTNING_Z)
else
call SetUnitPathing( dat.target, true)
if GetUnitAbilityLevel(dat.target,GARN)>=1 then
call UnitRemoveAbility(dat.target, GARN)
endif
call SetUnitInvulnerable(dat.target,false)
call DestroyLightning(dat.bolt)
call SetUnitFlyHeight(dat.target,0.,0.)
if dat.withBlast == true then
call AddBlast(dat.caster,dat.target)
endif
set dat.target = null
call ReleaseTimer(t)
set dat.tiOrbit = null
endif
endfunction
private function CastBlast takes nothing returns nothing
local str dat = str[SpellEvent.CastingUnit]
local real x1 = GetUnitX(dat.target)
local real y1 = GetUnitY(dat.target)
local real x2 = SpellEvent.TargetX
local real y2 = SpellEvent.TargetY
if dat.target != null then
set dat.withBlast = true
call ReleaseTimer(dat.tiOrbit)
set dat.tiOrbit = null
set dat.angle = Atan2((y2 -y1), (x2 - x1))
set dat.distance = R2I(SquareRoot((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)))/SPEED_BLAST
set dat.i = 0
set dat.speed = SPEED_BLAST
set dat.tiOrbit = NewTimer()
call SetTimerData(dat.tiOrbit, dat)
call TimerStart (dat.tiOrbit, TIMEOUT, true, function UpdateRelease )
else
call ErrorSound(dat.owner)
call DisplayTextToPlayer(dat.owner,0.,0.,INFO_NOTARGET)
endif
endfunction
private function CastRelease takes nothing returns nothing
local str dat = str[SpellEvent.CastingUnit]
local real x1 = GetUnitX(dat.target)
local real y1 = GetUnitY(dat.target)
local real x2 = SpellEvent.TargetX
local real y2 = SpellEvent.TargetY
if dat.target != null then
set dat.withBlast = false
call ReleaseTimer(dat.tiOrbit)
set dat.tiOrbit = null
set dat.angle = Atan2((y2 -y1), (x2 - x1))
set dat.distance = R2I(SquareRoot((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)))/SPEED_RELEASE
set dat.i = 0
set dat.speed = SPEED_RELEASE
set dat.tiOrbit = NewTimer()
call SetTimerData(dat.tiOrbit, dat)
call TimerStart (dat.tiOrbit, TIMEOUT, true, function UpdateRelease )
else
call ErrorSound(dat.owner)
call DisplayTextToPlayer(dat.owner,0.,0.,INFO_NOTARGET)
endif
endfunction
private function CastTeleportation takes nothing returns nothing
local str dat = str[SpellEvent.CastingUnit]
if dat.target != null then
call ReleaseTimer(dat.tiOrbit)
set dat.tiOrbit = null
call DestroyEffect(AddSpecialEffect(FX_TELEPORTATION,SpellEvent.TargetX,SpellEvent.TargetY))
call SetUnitPosition(dat.target,SpellEvent.TargetX,SpellEvent.TargetY)
call SetUnitPathing( dat.target, true)
if GetUnitAbilityLevel(dat.target,GARN)>=1 then
call UnitRemoveAbility(dat.target, GARN)
endif
call SetUnitInvulnerable(dat.target,false)
call DestroyLightning(dat.bolt)
call SetUnitFlyHeight(dat.target,0.,0.)
set dat.target = null
else
call ErrorSound(dat.owner)
call DisplayTextToPlayer(dat.owner,0.,0.,INFO_NOTARGET)
endif
endfunction
private function CastPoison takes nothing returns nothing
local str dat = str[SpellEvent.CastingUnit]
local integer i = 0
if dat.target != null then
if IsUnitAlly(dat.target,dat.owner) then
if GetRandomInt(0,100)<=CHANCE_POISON then
if GetUnitAbilityLevel(dat.target,BUFF_POISON1)>=1 or GetUnitAbilityLevel(dat.target,BUFF_POISON2)>=1 then
loop
exitwhen i > 20
if GetUnitAbilityLevel(dat.target,BUFF_POISON1)>=1 then
call UnitRemoveAbility(dat.target,BUFF_POISON1)
endif
if GetUnitAbilityLevel(dat.target,BUFF_POISON2)>=1 then
call UnitRemoveAbility(dat.target,BUFF_POISON2)
endif
set i = i + 1
endloop
call DestroyEffect(AddSpecialEffectTarget(FX_POISON,dat.target,"origin"))
call TextTagMessage(POISON_SUCCESS,SpellEvent.CastingUnit,0.,50.,64.,90.,9,5.,4.)
endif
else
call TextTagMessage(POISON_FAIL,SpellEvent.CastingUnit,0.,50.,64.,90.,9,5.,4.)
endif
else
call ErrorSound(dat.owner)
call DisplayTextToPlayer(dat.owner,0.,0.,INFO_NOALLIEDTARGET)
endif
else
call ErrorSound(dat.owner)
call DisplayTextToPlayer(dat.owner,0.,0.,INFO_NOTARGET)
endif
endfunction
private function CastFracture takes nothing returns nothing
local str dat = str[SpellEvent.CastingUnit]
if dat.target != null then
if IsUnitAlly(dat.target,dat.owner) then
if GetRandomInt(0,100)<=CHANCE_FRACTURE and GetUnitAbilityLevel(dat.target,BUFF_FRACT)>=1 then
call DestroyEffect(AddSpecialEffectTarget(FX_FRACTURE,dat.target,"origin"))
call UnitRemoveAbility(dat.target,BUFF_FRACT)
call TextTagMessage(FRACTURE_SUCCESS,SpellEvent.CastingUnit,0.,50.,64.,90.,9,5.,4.)
else
call TextTagMessage(FRACTURE_FAIL,SpellEvent.CastingUnit,0.,50.,64.,90.,9,5.,4.)
endif
else
call ErrorSound(dat.owner)
call DisplayTextToPlayer(dat.owner,0.,0.,INFO_NOALLIEDTARGET)
endif
else
call ErrorSound(dat.owner)
call DisplayTextToPlayer(dat.owner,0.,0.,INFO_NOTARGET)
endif
endfunction
private function UpdateControl takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
local real x1 = GetUnitX(dat.caster)
local real y1 = GetUnitY(dat.caster)
local real x2 = GetUnitX(dat.target)
local real y2 = GetUnitY(dat.target)
local real angle = Atan2((y1-y2),(x1-x2))
if dat.target!=null and dat.caster != null and not(IsUnitType(dat.caster,UNIT_TYPE_DEAD)) then
set x2 = x1 - 150.*Cos(angle)
set y2 = y1 - 150.*Sin(angle)
call SetUnitPosition(dat.target,x2,y2)
call MoveLightningEx(dat.bolt,true,x1,y1,GetUnitFlyHeight(dat.caster)+LIGHTNING_Z,x2,y2,GetUnitFlyHeight(dat.target)+LIGHTNING_Z)
else
call SetUnitPathing( dat.target, true)
call SetUnitFlyHeight(dat.target,0.,0.)
if GetUnitAbilityLevel(dat.target,GARN)>=1 then
call UnitRemoveAbility(dat.target, GARN)
endif
call SetUnitInvulnerable(dat.target,false)
call DestroyLightning(dat.bolt)
call ReleaseTimer(t)
set dat.tiOrbit = null
endif
endfunction
private function CastControl takes nothing returns nothing
local str dat = str[SpellEvent.CastingUnit]
if dat.target!=null then
if dat.tiOrbit!= null then
call ReleaseTimer(dat.tiOrbit)
endif
call SetUnitPathing( dat.target, true)
if GetUnitAbilityLevel(dat.target,GARN)>=1 then
call UnitRemoveAbility(dat.target, GARN)
endif
call SetUnitInvulnerable(dat.target,false)
call DestroyLightning(dat.bolt)
call SetUnitFlyHeight(dat.target,0.,0.)
endif
set dat.target = SpellEvent.TargetUnit
if GetUnitAbilityLevel(dat.target,GARN)<=0 then
call UnitAddAbility(dat.target, GARN)
endif
call SetUnitInvulnerable(dat.target,true)
set dat.bolt = AddLightningEx( "LEAS", true, GetUnitX(dat.caster), GetUnitY(dat.caster), GetUnitFlyHeight(dat.caster)+LIGHTNING_Z, GetUnitX(dat.target), GetUnitY(dat.target), GetUnitFlyHeight(dat.target)+LIGHTNING_Z )
call SetUnitFlyHeight(dat.target,150.,0.)
call SetUnitPathing(dat.target,false)
set dat.tiOrbit = NewTimer()
call SetTimerData(dat.tiOrbit, dat )
call TimerStart(dat.tiOrbit, TIMEOUT, true, function UpdateControl )
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL_CONTROL, CastControl)
call RegisterSpellFinishResponse(SPELL_RELEASE, CastRelease)
call RegisterSpellFinishResponse(SPELL_TELEPORTATION, CastTeleportation)
call RegisterSpellFinishResponse(SPELL_BLAST, CastBlast)
call RegisterSpellFinishResponse(SPELL_POISON, CastPoison)
call RegisterSpellFinishResponse(SPELL_FRACTURE, CastFracture)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
library GreaterMagazineOT needs AmmoSystem
globals
private constant integer SPELL = 'A0HV'
private constant integer AMMO_BONUS = 5
private constant real RELOAD_BONUS = 0.5
endglobals
private function Conditions takes nothing returns boolean
local unit caster = GetTriggerUnit()
if GetLearnedSkill() == SPELL then
call UpgradeMaxWeapon(caster,AMMO_BONUS)
call UpgradeReloadWeapon(caster,RELOAD_BONUS)
endif
set caster = null
return false
endfunction
function GreaterMagazineOT takes unit hero returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterUnitEvent(t,hero,EVENT_UNIT_HERO_SKILL)
call TriggerAddCondition(t,Condition(function Conditions))
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library GreaterMagazineSA needs AmmoSystem
globals
private constant integer SPELL = 'A0GR'
private constant integer AMMO_BONUS = 1
private constant real RELOAD_BONUS = 0.5
endglobals
private function Conditions takes nothing returns boolean
local unit caster = GetTriggerUnit()
if GetLearnedSkill() == SPELL then
call UpgradeMaxWeapon(caster,AMMO_BONUS)
call UpgradeReloadWeapon(caster,RELOAD_BONUS)
endif
set caster = null
return false
endfunction
function GreaterMagazineSA takes unit hero returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterUnitEvent(t,hero,EVENT_UNIT_HERO_SKILL)
call TriggerAddCondition(t,Condition(function Conditions))
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library GreaterMagazineST needs AmmoSystem
globals
private constant integer SPELL = 'A0F7'
private constant integer AMMO_BONUS = 5
endglobals
private function Conditions takes nothing returns boolean
local unit caster = GetTriggerUnit()
if GetLearnedSkill() == SPELL then
call UpgradeMaxWeapon(caster,AMMO_BONUS)
endif
set caster = null
return false
endfunction
function GreaterMagazineST takes unit hero returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterUnitEvent(t,hero,EVENT_UNIT_HERO_SKILL)
call TriggerAddCondition(t,Condition(function Conditions))
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope GroundIlluminatingFlare initializer init
globals
private constant integer SPELL = 'A093'
private constant integer DUMMY_ID = 'o01M'
private constant real DUR = 120.
endglobals
private struct str
unit caster
real x
real y
endstruct
private function Wait takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
local integer i = 0
local unit dummy = null
loop
exitwhen i > MAXPLAYER + 1
if GetPlayerSlotState(Player(i))==PLAYER_SLOT_STATE_PLAYING then
set dummy = CreateUnit(Player(i),DUMMY_ID,dat.x,dat.y,0.)
call UnitApplyTimedLife(dummy,'BTLF',DUR)
call SetUnitPathing(dummy,false)
endif
set i = i + 1
endloop
call ReleaseTimer(t)
call dat.destroy()
set dummy = null
endfunction
private function Cast takes nothing returns nothing
local timer t = NewTimer()
local str dat = str.create()
set dat.x = SpellEvent.TargetX
set dat.y = SpellEvent.TargetY
set dat.caster = SpellEvent.CastingUnit
call SetUnitAnimation( dat.caster, "spell throw" )
call SetTimerData(t, dat)
call TimerStart (t,1., false, function Wait )
endfunction
public function init takes nothing returns nothing
call RegisterSpellCastResponse(SPELL, Cast)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
library GWDrones initializer init needs AutoIndex, GroupFunction,SpellEvent
globals
private constant integer GW_ID = 'h021'
private constant integer AW_ID = 'n01J'
private constant string FX_SPAWN= "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportCaster.mdl"
private constant integer SPELL = 'A0HO'
private constant integer COUNT = 2
private constant real AOE = 150.
private constant integer UP = 'R01E'
endglobals
private function CheckDrone takes nothing returns boolean
local unit target = GetFilterUnit()
local integer targetId = GetUnitTypeId(target)
if targetId==AW_ID or targetId==GW_ID then
call KillUnit(target)
endif
set target = null
return true
endfunction
private function Spawn takes nothing returns nothing
local unit spawned = null
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local real x = GetUnitX(SpellEvent.CastingUnit)
local real y = GetUnitY(SpellEvent.CastingUnit)
local integer level = GetUnitAbilityLevel(SpellEvent.CastingUnit,SPELL)
local integer i = 0
call GroupEnumUnitsOfPlayer(ENUM_GROUP,owner,Filter(function CheckDrone))
loop
exitwhen i > COUNT-1
set spawned = CreateUnit(owner, GW_ID,x+GetRandomReal(-AOE,AOE),y+GetRandomReal(-AOE,AOE),0.)
call DestroyEffect(AddSpecialEffectTarget(FX_SPAWN, spawned, "origin") )
call IssueImmediateOrder(spawned,ACTIVATE_AI_ORDER)
set i = i + 1
endloop
set spawned = null
endfunction
private function Conditions takes nothing returns boolean
local unit caster = GetTriggerUnit()
local player owner = GetOwningPlayer(caster)
if GetLearnedSkill() == SPELL then
call SetPlayerTechResearched(owner, UP, GetPlayerTechCount(owner,UP,true)+1)
endif
set caster = null
return false
endfunction
function GWDrones takes unit hero returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterUnitEvent(t,hero,EVENT_UNIT_HERO_SKILL)
call TriggerAddCondition(t,Condition(function Conditions))
endfunction
private function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Spawn)
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library HeavenWrath needs AmmoSystem
globals
private constant integer SPELL = 'A0FK'
private constant integer PARTS_REQ = 1
private constant integer DESIGNED_REQ = 4
private constant integer DESIGNED_BONUS = 5
private constant integer PARTS_UP = 'R017'
endglobals
private function Conditions takes nothing returns boolean
local unit caster = GetTriggerUnit()
local player owner = GetOwningPlayer(caster)
if GetLearnedSkill() == SPELL then
if GetUnitAbilityLevel(caster,SPELL) == PARTS_REQ then
call SetPlayerTechResearched(owner, PARTS_UP,1)
elseif GetUnitAbilityLevel(caster,SPELL) == DESIGNED_REQ then
call UpgradeMaxWeapon(caster,DESIGNED_BONUS)
endif
endif
set caster = null
return false
endfunction
function HeavenWrath takes unit hero returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterUnitEvent(t,hero,EVENT_UNIT_HERO_SKILL)
call TriggerAddCondition(t,Condition(function Conditions))
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope HeavyResponse initializer init
globals
private constant integer DRONE_ID = 'n00G'
private constant integer UNIT_ID = 'h019'
private constant string INFO = "Ground Walker GW-Beef incoming by the aerial way."
private unit array Walker [12]
private constant integer SPELL ='A0CD'
private constant integer SPEED = 25
private constant real SPAWN_DISTANCE = 4000.
private constant real SPAWN_Z = 500.
private constant real WALKER_Z = 50.
private constant real WAIT = 3.
endglobals
private struct s_delay
unit drone
unit walker
endstruct
private function Wait takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_delay dat = GetTimerData(t)
call SetUnitFlyHeight(dat.drone,SPAWN_Z,300.)
call SetUnitFlyHeight(dat.walker, 0., 0.)
call UnitRemoveAbility(dat.walker,GARN)
call SetUnitInvulnerable(dat.walker,false)
call UnitAddAbility(dat.drone,LASTQUESTUNIT_SPELL)
call IssuePointOrder(dat.drone,LASTQUESTUNIT_ORDER,GetRectCenterX(gg_rct_LastQuest),GetRectCenterY(gg_rct_LastQuest))
call ReleaseTimer(t)
call dat.destroy()
endfunction
private function DelayControl takes unit drone, unit walker returns nothing
local timer t = NewTimer()
local s_delay dat = s_delay.create()
set dat.walker = walker
set dat.drone = drone
call SetTimerData(t, dat)
call TimerStart (t, WAIT, false, function Wait)
endfunction
private struct s_drop
player owner
unit drone
unit walker
real angle
integer distance
integer i
endstruct
private function Update takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_drop dat = GetTimerData(t)
local real newX = GetUnitX(dat.drone) + SPEED*Cos(dat.angle)
local real newY = GetUnitY(dat.drone) + SPEED*Sin(dat.angle)
if dat.i < dat.distance then
set dat.i = dat.i + 1
call SetUnitPosition(dat.drone, newX, newY)
call SetUnitPosition(dat.walker, newX, newY)
else
call SetUnitFlyHeight(dat.drone,100.,300.)
call SetUnitFlyHeight(dat.walker, 0., 300.)
call DelayControl(dat.drone,dat.walker)
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function Actions takes nothing returns nothing
local timer t = NewTimer()
local s_drop dat = s_drop.create()
local real x1 = GetUnitX(SpellEvent.CastingUnit)
local real y1 = GetUnitY(SpellEvent.CastingUnit)
local real x2 = SpellEvent.TargetX
local real y2 = SpellEvent.TargetY
local real angle = Atan2((y2 -y1), (x2 - x1))
local real x3 = CheckPointValidity(x1 - SPAWN_DISTANCE*Cos(angle),MapXMin,MapXMax)
local real y3 = CheckPointValidity(y1 - SPAWN_DISTANCE*Sin(angle),MapYMin,MapYMax)
local real x4 = CheckPointValidity(x2 + SPAWN_DISTANCE*Cos(angle),MapXMin,MapXMax)
local real y4 = CheckPointValidity(y2 + SPAWN_DISTANCE*Sin(angle),MapYMin,MapYMax)
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local integer ownerId = GetPlayerId(owner)
if not(IsUnitType(Walker[ownerId],UNIT_TYPE_DEAD)) then
call KillUnit(Walker[ownerId])
endif
call DisplayAll(PlayerColor[ownerId]+GetPlayerName(owner),INFO)
call PingMinimap(x2,y2,1.)
set dat.angle = angle
set dat.distance =R2I(SquareRoot((x3-x2)*(x3-x2)+(y3-y2)*(y3-y2))/SPEED)
set dat.i = 0
set dat.owner = owner
set dat.drone = CreateUnit(dat.owner,DRONE_ID,x3,y3, dat.angle*bj_RADTODEG )
call SetUnitFlyHeight(dat.drone,SPAWN_Z,0.)
set dat.walker = CreateUnit(dat.owner,UNIT_ID,x3,y3,0.)
call SetUnitFlyHeight(dat.walker, SPAWN_Z-WALKER_Z, 0.)
call UnitAddAbility(dat.walker,GARN)
call SetUnitInvulnerable(dat.walker,true)
set Walker[ownerId] = dat.walker
call SetTimerData(t, dat)
call TimerStart (t, TIMEOUT, true, function Update)
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=1
//TESH.alwaysfold=0
scope HeavySoldier initializer init
globals
private constant integer MARINE_ID = 'h00O'
private constant string FX_SPAWN= "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportCaster.mdl"
private constant integer SPELL = 'A0IZ'
private constant integer COUNT = 1
private constant real AOE = 100.
endglobals
private function CheckSoldier takes nothing returns boolean
local unit target = GetFilterUnit()
if GetUnitTypeId(target)==MARINE_ID then
if GameMode == 6 then
call KillUnit(target)
else
call SetUnitOwner(target,Player(10),true)
call UnitAddAbility(target,LASTQUESTUNIT_SPELL)
call IssuePointOrder(target,LASTQUESTUNIT_ORDER,GetRectCenterX(gg_rct_LastQuest),GetRectCenterY(gg_rct_LastQuest))
endif
endif
set target = null
return true
endfunction
private function Spawn takes nothing returns nothing
local unit spawned = null
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local real x = GetRectCenterX(gg_rct_Reinforcement)
local real y = GetRectCenterY(gg_rct_Reinforcement)
local integer i = 0
call GroupEnumUnitsOfPlayer(ENUM_GROUP,owner,Filter(function CheckSoldier))
loop
exitwhen i > COUNT-1
set spawned = CreateUnit(owner, MARINE_ID,x+GetRandomReal(-AOE,AOE),y+GetRandomReal(-AOE,AOE),0.)
call DestroyEffect(AddSpecialEffectTarget(FX_SPAWN, spawned, "origin") )
call IssueImmediateOrder(spawned,ACTIVATE_AI_ORDER)
set i = i + 1
endloop
set spawned = null
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Spawn)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope HeavyWeapon initializer init
globals
private constant integer DRONE_ID = 'n00G'
private constant integer UNIT_ID = 'h02L'
private constant string INFO = "GW-Goliath incoming by the aerial way."
private unit array Walker [12]
private constant integer SPELL ='A08G'
private constant integer SPEED = 25
private constant real SPAWN_DISTANCE = 4000.
private constant real SPAWN_Z = 500.
private constant real WALKER_Z = 50.
private constant real WAIT = 3.
endglobals
private struct s_delay
unit drone
unit walker
endstruct
private function Wait takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_delay dat = GetTimerData(t)
call SetUnitFlyHeight(dat.drone,SPAWN_Z,300.)
call SetUnitFlyHeight(dat.walker, 0., 0.)
call UnitRemoveAbility(dat.walker,GARN)
call SetUnitInvulnerable(dat.walker,false)
call UnitAddAbility(dat.drone,LASTQUESTUNIT_SPELL)
call IssuePointOrder(dat.drone,LASTQUESTUNIT_ORDER,GetRectCenterX(gg_rct_LastQuest),GetRectCenterY(gg_rct_LastQuest))
call ReleaseTimer(t)
call dat.destroy()
endfunction
private function DelayControl takes unit drone, unit walker returns nothing
local timer t = NewTimer()
local s_delay dat = s_delay.create()
set dat.walker = walker
set dat.drone = drone
call SetTimerData(t, dat)
call TimerStart (t, WAIT, false, function Wait)
endfunction
private struct s_drop
player owner
unit drone
unit walker
real angle
integer distance
integer i
endstruct
private function Update takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_drop dat = GetTimerData(t)
local real newX = GetUnitX(dat.drone) + SPEED*Cos(dat.angle)
local real newY = GetUnitY(dat.drone) + SPEED*Sin(dat.angle)
if dat.i < dat.distance then
set dat.i = dat.i + 1
call SetUnitPosition(dat.drone, newX, newY)
call SetUnitPosition(dat.walker, newX, newY)
else
call SetUnitFlyHeight(dat.drone,100.,300.)
call SetUnitFlyHeight(dat.walker, 0., 300.)
call DelayControl(dat.drone,dat.walker)
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function Actions takes nothing returns nothing
local timer t = NewTimer()
local s_drop dat = s_drop.create()
local real x1 = GetUnitX(SpellEvent.CastingUnit)
local real y1 = GetUnitY(SpellEvent.CastingUnit)
local real x2 = SpellEvent.TargetX
local real y2 = SpellEvent.TargetY
local real angle = Atan2((y2 -y1), (x2 - x1))
local real x3 = CheckPointValidity(x1 - SPAWN_DISTANCE*Cos(angle),MapXMin,MapXMax)
local real y3 = CheckPointValidity(y1 - SPAWN_DISTANCE*Sin(angle),MapYMin,MapYMax)
local real x4 = CheckPointValidity(x2 + SPAWN_DISTANCE*Cos(angle),MapXMin,MapXMax)
local real y4 = CheckPointValidity(y2 + SPAWN_DISTANCE*Sin(angle),MapYMin,MapYMax)
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local integer ownerId = GetPlayerId(owner)
if not(IsUnitType(Walker[ownerId],UNIT_TYPE_DEAD)) then
call KillUnit(Walker[ownerId])
endif
call DisplayAll(PlayerColor[ownerId]+GetPlayerName(owner),INFO)
call PingMinimap(x2,y2,1.)
set dat.angle = angle
set dat.distance =R2I(SquareRoot((x3-x2)*(x3-x2)+(y3-y2)*(y3-y2))/SPEED)
set dat.i = 0
set dat.owner = owner
set dat.drone = CreateUnit(dat.owner,DRONE_ID,x3,y3, dat.angle*bj_RADTODEG )
call SetUnitFlyHeight(dat.drone,SPAWN_Z,0.)
set dat.walker = CreateUnit(dat.owner,UNIT_ID,x3,y3,0.)
call SetUnitFlyHeight(dat.walker, SPAWN_Z-WALKER_Z, 0.)
call UnitAddAbility(dat.walker,GARN)
call SetUnitInvulnerable(dat.walker,true)
set Walker[ownerId] = dat.walker
call SetTimerData(t, dat)
call TimerStart (t, TIMEOUT, true, function Update)
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope HellSpice initializer init
globals
private constant integer GW_1 = 'h02M'
private constant integer GW_2 = 'h02N'
private constant string FX_SPAWN= "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportCaster.mdl"
private constant integer SPELL = 'A0AM'
endglobals
private function CheckDrone takes nothing returns boolean
local unit target = GetFilterUnit()
local integer targetId = GetUnitTypeId(target)
if targetId==GW_2 or targetId==GW_1 then
call KillUnit(target)
endif
set target = null
return true
endfunction
private function Spawn takes nothing returns nothing
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local real x = GetRectCenterX(gg_rct_Reinforcement)
local real y = GetRectCenterY(gg_rct_Reinforcement)
local unit spawned = null
call GroupEnumUnitsOfPlayer(ENUM_GROUP,owner,Filter(function CheckDrone))
set spawned = CreateUnit(owner, GW_2,x,y,0.)
call DestroyEffect(AddSpecialEffectTarget(FX_SPAWN, spawned, "origin") )
set spawned = null
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Spawn)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope hormd initializer init
globals
private constant integer SPELL = 'A05F'
private constant string FX = "Abilities\\Spells\\Items\\StaffOfPurification\\PurificationTarget.mdl"
private constant string C = "The target must have a leve less than or equal to "
private constant integer LEVEL_REQ = 5
private constant real LIFESPAN = 60.
endglobals
private function Actions takes nothing returns nothing
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
if GetUnitLevel(SpellEvent.TargetUnit)<=LEVEL_REQ then
call CreepsRemoveUnitFromGroup(SpellEvent.TargetUnit)
call DestroyEffect(AddSpecialEffectTarget(FX, SpellEvent.CastingUnit, "origin"))
call SetUnitOwner(SpellEvent.TargetUnit,owner,true)
call UnitAddType(SpellEvent.TargetUnit,UNIT_TYPE_SUMMONED)
call IssueImmediateOrder(SpellEvent.TargetUnit,ACTIVATE_AI_ORDER)
call UnitApplyTimedLife(SpellEvent.TargetUnit,'BTLF',LIFESPAN)
else
call ErrorSound(owner)
call DisplayTextToPlayer(owner, 0, 0, C+I2S(GetUnitAbilityLevel(SpellEvent.CastingUnit,SPELL)) )
endif
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope HumveeDrive initializer init
globals
private constant integer SPELL = 'A0E1'
private constant integer UNIT_ID = 'n011'
endglobals
private function Actions takes nothing returns nothing
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
if GetUnitTypeId(SpellEvent.TargetUnit)==UNIT_ID then
call SetPilotVehicle(SpellEvent.CastingUnit,SpellEvent.TargetUnit)
else
call ErrorSound(owner)
call DisplayTextToPlayer(owner,0.,0.,"You must target an Humvee")
endif
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope HurricaneDrive initializer init
globals
private constant integer SPELL = 'A0E5'
private constant integer UNIT_ID = 'h01G'
endglobals
private function Actions takes nothing returns nothing
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
if GetUnitTypeId(SpellEvent.TargetUnit)==UNIT_ID then
call SetPilotVehicle(SpellEvent.CastingUnit,SpellEvent.TargetUnit)
else
call ErrorSound(owner)
call DisplayTextToPlayer(owner,0.,0.,"You must target a Hurricane")
endif
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=40
//TESH.alwaysfold=0
scope InterventionJetpack initializer init
globals
private constant real IMP = 0.10
private constant integer SPEED = 20
private constant integer SPELL = 'A0D0'
private constant string ANIM = "Spell Fourth"
private constant string FX = "Abilities\\Spells\\Orc\\LiquidFire\\Liquidfire.mdl"
endglobals
private struct str
unit caster
real angle
integer distance
integer i
effect fx
endstruct
private function Update takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
local real newX = GetUnitX(dat.caster) + SPEED*Cos(dat.angle)
local real newY = GetUnitY(dat.caster) + SPEED*Sin(dat.angle)
local real z = GetUnitFlyHeight(dat.caster)
local real newz = 0.
if dat.i < dat.distance then
set dat.i = dat.i + 1
call SetUnitPosition(dat.caster, newX, newY)
if dat.i < (dat.distance * 0.5) then
set newz = z + (dat.distance * IMP)
else
set newz = z - (dat.distance * IMP)
endif
call SetUnitFlyHeight(dat.caster, newz, 0.00)
else
call SetUnitPathing( dat.caster, true)
call SetUnitAnimation(dat.caster, "Stand")
call SetUnitTimeScale(dat.caster,1.)
call DestroyEffect(dat.fx)
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function Actions takes nothing returns nothing
local timer t = NewTimer()
local str dat = str.create()
local real x1 = GetUnitX(SpellEvent.CastingUnit)
local real y1 = GetUnitY(SpellEvent.CastingUnit)
local real x2 = SpellEvent.TargetX
local real y2 = SpellEvent.TargetY
set dat.caster = SpellEvent.CastingUnit
set dat.fx = AddSpecialEffectTarget(FX,dat.caster,"origin")
set dat.angle = Atan2((y2 -y1), (x2 - x1))
set dat.distance = R2I(SquareRoot((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)))/SPEED
set dat.i = 0
call SetUnitPathing( dat.caster, false)
call SetUnitTimeScale(dat.caster,1.)
call SetUnitAnimation(dat.caster,ANIM)
call SetTimerData(t, dat)
call TimerStart (t, TIMEOUT, true, function Update )
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope IonCanon initializer init
globals
private constant integer SPELL = 'A0KU'
private constant integer DUMMY_ID1 = 'o03Q'
private constant integer DUMMY_ID2 = 'o03R'
private constant real DISTANCE = 300.
private constant integer AMOUNT = 6
private constant real array Lifespan [3]
private constant integer DUR = 3
endglobals
private struct str
integer i
real x
real y
unit dummy
real angle
real offset
endstruct
private function Update takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
local integer i = 0
local real x = 0.
local real y = 0.
if dat.i < DUR then
loop
exitwhen i > AMOUNT-1
set x = dat.x + DISTANCE*Cos((i*dat.angle + dat.i*dat.offset)*bj_DEGTORAD)
set y = dat.y + DISTANCE*Sin((i*dat.angle + dat.i*dat.offset)*bj_DEGTORAD)
set dat.dummy = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),DUMMY_ID2,dat.x,dat.y,0.)
call IssuePointOrder(dat.dummy,"move",x,y)
call UnitApplyTimedLife(dat.dummy,'BTLF',Lifespan[dat.i])
set i = i + 1
endloop
set dat.i = dat.i + 1
else
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function Actions takes nothing returns nothing
local str dat = str.create()
local timer t = NewTimer()
local integer i = 0
set dat.x = GetUnitX(SpellEvent.TargetUnit)
set dat.y = GetUnitY(SpellEvent.TargetUnit)
set dat.i = 0
set dat.angle = 360./AMOUNT
set dat.offset = 360./DUR
set dat.dummy = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),DUMMY_ID1,dat.x,dat.y,0.)
call UnitApplyTimedLife(dat.dummy,'BTLF',I2R(DUR))
call SetTimerData(t,dat)
call TimerStart(t,0.5,true,function Update)
endfunction
public function init takes nothing returns nothing
set Lifespan[0] = 0.25
set Lifespan[1] = 0.5
set Lifespan[2] = 0.75
call RegisterSpellCastResponse(SPELL,Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope Jetpack initializer init
globals
private constant real IMP = 0.60
private constant integer SPEED = 20
private constant integer SPELL = 'A0A2'
private constant string ANIM = "spell fourth"
private constant real AOE = 300.
private constant real DMG = 500.
private constant string FX = "Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl"
endglobals
private struct str
unit caster
real angle
integer distance
integer i
endstruct
private function Update takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
local real newX = GetUnitX(dat.caster) + SPEED*Cos(dat.angle)
local real newY = GetUnitY(dat.caster) + SPEED*Sin(dat.angle)
local real z = GetUnitFlyHeight(dat.caster)
local real newz = 0.
if dat.i < dat.distance then
set dat.i = dat.i + 1
call SetUnitX(dat.caster, newX)
call SetUnitY(dat.caster, newY)
if dat.i < (dat.distance * 0.5) then
set newz = z + (dat.distance * IMP)
else
set newz = z - (dat.distance * IMP)
endif
call SetUnitFlyHeight(dat.caster, newz, 0.00)
else
call SetUnitPathing( dat.caster, true)
call SetUnitAnimation(dat.caster, "Stand")
call SetUnitTimeScale(dat.caster,1.)
call DestroyEffect(AddSpecialEffect(FX,newX,newY))
call UnitDamageEnemies(dat.caster,AOE,newX,newY,DMG,DMG_PHYSIC,false,0,0,0)
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function Actions takes nothing returns nothing
local timer t = NewTimer()
local str dat = str.create()
local real x1 = GetUnitX(SpellEvent.CastingUnit)
local real y1 = GetUnitY(SpellEvent.CastingUnit)
local real x2 = SpellEvent.TargetX
local real y2 = SpellEvent.TargetY
set dat.caster = SpellEvent.CastingUnit
set dat.angle = Atan2((y2 -y1), (x2 - x1))
set dat.distance = R2I(SquareRoot((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)))/SPEED
set dat.i = 0
call SetUnitPathing( dat.caster, false)
call SetUnitTimeScale(dat.caster,4.)
call SetUnitAnimation(dat.caster,ANIM)
call DestroyEffect(AddSpecialEffect(FX,x1,y1))
call UnitDamageEnemies(dat.caster,AOE,x1,y1,DMG,DMG_PHYSIC,false,0,0,0)
call SetTimerData(t, dat)
call TimerStart (t, TIMEOUT, true, function Update )
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope RegularJump initializer init
globals
private constant real IMP = 0.40
private constant integer SPEED = 20
private constant integer SPELL = 'A003'
private constant string ANIM = "Spell Fourth"
endglobals
private struct str
unit caster
real angle
integer distance
integer i
integer deltaZ
endstruct
private function Update takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
local real newX = GetUnitX(dat.caster) + SPEED*Cos(dat.angle)
local real newY = GetUnitY(dat.caster) + SPEED*Sin(dat.angle)
local real z = GetUnitFlyHeight(dat.caster)
local real newz = 0.
if dat.i < dat.distance then
set dat.i = dat.i + 1
call SetUnitX(dat.caster, newX)
call SetUnitY(dat.caster, newY)
if dat.i < (dat.distance * 0.5) then
set newz = z + (dat.distance * IMP)
else
set newz = z - (dat.distance * IMP)
endif
call SetUnitFlyHeight(dat.caster, newz, 0.00)
else
call SetUnitPathing( dat.caster, true)
call SetUnitAnimation(dat.caster, "Stand")
call SetUnitTimeScale(dat.caster,1.)
if dat.deltaZ > 1 then
call UnitAddBuffFract(dat.caster)
endif
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function Actions takes nothing returns nothing
local timer t = NewTimer()
local str dat = str.create()
local real x1 = GetUnitX(SpellEvent.CastingUnit)
local real y1 = GetUnitY(SpellEvent.CastingUnit)
local real x2 = SpellEvent.TargetX
local real y2 = SpellEvent.TargetY
set dat.deltaZ = GetTerrainCliffLevel(x1,y1)-GetTerrainCliffLevel(x2,y2)
if dat.deltaZ >= 0 then
set dat.caster = SpellEvent.CastingUnit
set dat.angle = Atan2((y2 -y1), (x2 - x1))
set dat.distance = R2I(SquareRoot((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)))/SPEED
set dat.i = 0
call SetUnitPathing( dat.caster, false)
call SetUnitTimeScale(dat.caster,1.)
call SetUnitAnimation(dat.caster,ANIM)
call SetTimerData(t, dat)
call TimerStart (t, TIMEOUT, true, function Update )
else
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope Launch initializer init
globals
private constant integer SPELL = 'A0B9'
private constant integer SPELLBOOK = 'A0BR'
private constant integer ID = 'o020'
private constant real DISTANCE = 150.
private constant integer SPEED = 20
private constant real AOE = 250.
private real FieldLife = 0.
private constant string FX = "Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl"
endglobals
private struct str
integer i
unit caster
unit field
integer distance
real angle
endstruct
private function Update takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
local real newX = GetUnitX(dat.field) + SPEED*Cos(dat.angle)
local real newY = GetUnitY(dat.field) + SPEED*Sin(dat.angle)
local real z = GetUnitFlyHeight(dat.field)
local real newz = 0.
if dat.i < dat.distance then
set dat.i = dat.i + 1
call SetUnitPosition(dat.field,newX,newY)
else
call DestroyEffect(AddSpecialEffect(FX,newX,newY))
call UnitDamageEnemies(dat.caster,AOE,newX,newY,GetUnitState(dat.field,UNIT_STATE_LIFE),DMG_ENERGETIC,false,0,0,0)
call KillUnit(dat.field)
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function RemoveField takes nothing returns boolean
if GetUnitTypeId(GetFilterUnit())==ID then
set FieldLife = GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)
call KillUnit(GetFilterUnit())
endif
return true
endfunction
private function Actions takes nothing returns nothing
local timer t = NewTimer()
local str dat = str.create()
local integer i = 0
local real x1 = GetUnitX(SpellEvent.CastingUnit)
local real y1 = GetUnitY(SpellEvent.CastingUnit)
local real x2 = SpellEvent.TargetX
local real y2 = SpellEvent.TargetY
local real angle = GetUnitFacing(SpellEvent.CastingUnit)
call GroupEnumUnitsOfPlayer(ENUM_GROUP,GetOwningPlayer(SpellEvent.CastingUnit),Filter(function RemoveField))
set dat.caster = SpellEvent.CastingUnit
set dat.field= CreateUnit(GetOwningPlayer(dat.caster),ID,x1+DISTANCE*Cos(angle*bj_DEGTORAD),y1+DISTANCE*Sin(angle*bj_DEGTORAD),0.)
call SetUnitAbilityLevel(dat.field,SPELLBOOK,GetUnitAbilityLevel(dat.caster,SPELL))
call SetUnitInvulnerable(dat.field,true)
call SetUnitState(dat.field,UNIT_STATE_LIFE,FieldLife)
set dat.angle = Atan2((y2 -y1), (x2 - x1))
set dat.distance = R2I(SquareRoot((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)))/SPEED
call SetUnitPathing(dat.field, false)
set dat.i = 0
call SetTimerData(t,dat)
call TimerStart(t,TIMEOUT,true,function Update)
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope LargeScaleLaser initializer init
globals
private constant integer SPELL = 'A0D3'
private constant integer SPELL_DUMMY = 'A0J2'
private constant integer SPELL_ITEM = 'A0J1'
endglobals
private function Actions takes nothing returns nothing
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local integer level = GetUnitAbilityLevel(SpellEvent.CastingUnit,SPELL)
local real x = GetUnitX(SpellEvent.CastingUnit)
local real y = GetUnitY(SpellEvent.CastingUnit)
local unit dummy = null
if GetUnitAbilityLevel(SpellEvent.CastingUnit,SPELL_ITEM)>=1 then
set dummy = CreateUnit(owner, DUMMY,x,y,0.)
call UnitAddAbility(dummy,SPELL_DUMMY)
call UnitApplyTimedLife(dummy,'BTLF',2.)
call SetUnitAbilityLevel(dummy,SPELL_DUMMY,level)
call IssueTargetOrder(dummy,"forkedlightning",SpellEvent.TargetUnit)
endif
set dummy = null
endfunction
public function init takes nothing returns nothing
call AbilityPreload(SPELL_DUMMY)
call RegisterSpellCastResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=38
//TESH.alwaysfold=0
scope LaserAcquisition initializer init
globals
private constant integer IDPLAYER = 11
private constant string LIGHTNING_ART = "DRAL"
private constant integer SPELL = 'A0HU'
private constant integer SPELL_NPC = 'A0G5'
private constant integer BUFF = 'B00K'
private real LIGHTNING_Z = 2.
private constant real DUR = 5.
private constant integer MALUS = 'A001'
endglobals
private struct str
unit caster
unit target
lightning fx
integer duration
integer i
endstruct
private function Update takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
local real x1 = GetUnitX(dat.caster)
local real y1 = GetUnitY(dat.caster)
local real z1 = GetUnitFlyHeight(dat.caster)
local real x2 = GetUnitX(dat.target)
local real y2 = GetUnitY(dat.target)
local real z2 = GetUnitFlyHeight(dat.target)
if dat.i < dat.duration and not (IsUnitType(dat.caster,UNIT_TYPE_DEAD)) and not (IsUnitType(dat.target,UNIT_TYPE_DEAD)) then
set dat.i = dat.i + 1
call MoveLightningEx(dat.fx,true,x1,y1,z1+LIGHTNING_Z,x2,y2,z2+LIGHTNING_Z)
else
call UnitRemoveAbility(dat.target,MALUS)
call DestroyLightning(dat.fx)
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function Cast takes nothing returns nothing
local timer t = NewTimer()
local str dat = str.create()
local real x1 = GetUnitX(SpellEvent.CastingUnit)
local real y1 = GetUnitY(SpellEvent.CastingUnit)
local real z1 = GetUnitFlyHeight(SpellEvent.CastingUnit)
local real x2 = GetUnitX(SpellEvent.TargetUnit)
local real y2 = GetUnitY(SpellEvent.TargetUnit)
local real z2 = GetUnitFlyHeight(SpellEvent.TargetUnit)
set dat.caster = SpellEvent.CastingUnit
set dat.target = SpellEvent.TargetUnit
call UnitAddAbility(dat.target,MALUS)
call SetUnitAbilityLevel(dat.target,MALUS,GetUnitAbilityLevel(dat.caster,SpellEvent.AbilityId))
set dat.duration = R2I(DUR/TIMEOUT)
set dat.fx = AddLightningEx(LIGHTNING_ART, true,x1,y1,z1+LIGHTNING_Z,x2,y2,z2+LIGHTNING_Z)
set dat.i = 0
call SetTimerData(t, dat)
call TimerStart (t, TIMEOUT, true, function Update )
endfunction
public function init takes nothing returns nothing
call AbilityPreload(MALUS)
call RegisterSpellFinishResponse(SPELL,Cast)
call RegisterSpellCastResponse(SPELL_NPC,Cast)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope LaserDesignator initializer init
globals
private constant integer SPELL = 'A0D9'
private constant real AOE = 800.
private unit Target = null
private player Owner = null
private constant integer DUR = 60
endglobals
private struct str
integer i
unit target
endstruct
private function Loop takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
if dat.i < DUR and not(IsUnitType(dat.target,UNIT_TYPE_DEAD))then
set dat.i = dat.i + 1
call PingMinimapEx(GetUnitX(dat.target),GetUnitY(dat.target),0.50,100,100,100,false)
else
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function Start takes unit target, unit source returns nothing
local timer t = NewTimer()
local str dat = str.create()
set dat.target = target
set dat.i = 0
call SetTimerData(t,dat)
call TimerStart(t,1.,true,function Loop)
endfunction
private function FilterAllied takes nothing returns boolean
local unit allied = GetFilterUnit()
if IsUnitAlly(allied,Owner) and GetUnitAbilityLevel(allied,ALLIED_CAN_BE_ORDERED)>=1 then
call IssueTargetOrder(allied,"attack",Target)
endif
set allied = null
return true
endfunction
private function Actions takes nothing returns nothing
local unit caster = SpellEvent.CastingUnit
local unit target = SpellEvent.TargetUnit
local real x = GetUnitX(target)
local real y = GetUnitY(target)
local player owner = GetOwningPlayer(caster)
local integer ownerId = GetPlayerId(owner)
set Target = target
set Owner = GetOwningPlayer(caster)
call GroupEnumUnitsInRange(ENUM_GROUP,x,y,AOE,Filter(function FilterAllied))
call DisplayAll(PlayerColor[ownerId]+GetPlayerName(owner),GetUnitName(target)+" has been designated")
call Start(target,caster)
set caster = null
set target = null
endfunction
public function init takes nothing returns nothing
call RegisterSpellCastResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope LastResort initializer init
globals
private constant integer DRONE_ID = 'n013'
private constant integer SPELL ='A0IL'
private constant integer SPEED = 50
private constant real AOE = 500.
private constant real IMP = 1.
private constant real SPAWN_DISTANCE = 2000.
private constant real SPAWN_Z = 500.
private constant real DMG = 10000.
private constant integer DUMMY_AOE = 'o01F'
private constant integer DUMMY_DPS = 'o03F'
private constant integer DUMMY_FX = 'o02V'
private constant real DURATION = 60.
endglobals
private function Damage takes unit whichUnit, real x, real y returns nothing
call KillUnit(CreateUnit(GetOwningPlayer(whichUnit),DUMMY_FX,x,y,0.))
call UnitApplyTimedLife(CreateUnit(GetOwningPlayer(whichUnit),DUMMY_DPS,x,y,0.),'BTLF',DURATION)
call UnitDamageAll(whichUnit,false,AOE,x,y,DMG,DMG_EXPLOSIVE,false,0,0,0)
call SetTerrainType(x,y,'Xdrt',-1,6,0)
endfunction
private struct str
unit drone
real angle
integer distance
integer firepoint
integer i
real targetX
real targetY
endstruct
private function Update takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
local real newX = GetUnitX(dat.drone) + SPEED*Cos(dat.angle)
local real newY = GetUnitY(dat.drone) + SPEED*Sin(dat.angle)
local real z = GetUnitFlyHeight(dat.drone)
local real newz = 0.
if dat.i < dat.distance then
set dat.i = dat.i + 1
call SetUnitPosition(dat.drone, newX, newY)
if dat.i == dat.firepoint then
call Damage(dat.drone,dat.targetX,dat.targetY)
endif
else
call RemoveUnit(dat.drone)
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function Actions takes nothing returns nothing
local timer t = NewTimer()
local str dat = str.create()
local real x1 = GetUnitX(SpellEvent.CastingUnit)
local real y1 = GetUnitY(SpellEvent.CastingUnit)
local real x2 = SpellEvent.TargetX
local real y2 = SpellEvent.TargetY
local real angle = Atan2((y2 -y1), (x2 - x1))
local real x3 = CheckPointValidity(x1 - SPAWN_DISTANCE*Cos(angle),MapXMin,MapXMax)
local real y3 = CheckPointValidity(y1 - SPAWN_DISTANCE*Sin(angle),MapYMin,MapYMax)
local real x4 = CheckPointValidity(x2 + SPAWN_DISTANCE*Cos(angle),MapXMin,MapXMax)
local real y4 = CheckPointValidity(y2 + SPAWN_DISTANCE*Sin(angle),MapYMin,MapYMax)
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local integer ownerId = GetPlayerId(owner)
call DisplayAll(PlayerColor[ownerId]+GetPlayerName(owner),"Move! Move! Move! Fighters missiles incoming!")
call FlySound()
call WillExplodeSound()
set dat.targetX = x2
set dat.targetY = y2
set dat.angle = angle
set dat.firepoint =R2I(1.25*SquareRoot((x3-x2)*(x3-x2)+(y3-y2)*(y3-y2))/SPEED)
set dat.distance =R2I(SquareRoot((x3-x4)*(x3-x4)+(y3-y4)*(y3-y4))/SPEED)
if dat.firepoint >= dat.distance then
set dat.firepoint = dat.distance
endif
call PingMinimapEx(x2, y2,5., 204, 196, 115, false)
call UnitApplyTimedLife(CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),DUMMY_AOE,x2,y2,0.),'BTLF',2.)
set dat.i = 0
set dat.drone = CreateUnit(GetOwningPlayer(SpellEvent.CastingUnit),DRONE_ID,x3,y3, dat.angle*bj_RADTODEG )
call SetUnitFlyHeight(dat.drone,SPAWN_Z,0.)
call SetTimerData(t, dat)
call TimerStart (t, TIMEOUT, true, function Update)
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=77
//TESH.alwaysfold=0
scope Legendary initializer init
globals
private constant integer SPELL = 'A08Y'
private constant integer DUMMY_ID1 = 'o03Q'
private constant integer DUMMY_ID2 = 'o03R'
private constant integer DUMMY_SPELL = 'A0AJ'
private constant real DISTANCE = 300.
private constant integer AMOUNT = 6
private constant real array Lifespan [3]
private constant integer DUR = 7
private constant integer SPELLBOOK = 'A0AG'
private constant real MOVE_DURATION = 10.
private constant real DAMAGE_DURATION = 10.
endglobals
private struct s_move
unit caster
endstruct
private function Wait takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_move dat = GetTimerData(t)
if GetUnitAbilityLevel(dat.caster,SPELLBOOK)>=1 then
call UnitRemoveAbility(dat.caster,SPELLBOOK)
endif
call ReleaseTimer(t)
call dat.destroy()
endfunction
private function RemoveMove takes unit caster returns nothing
local timer t = NewTimer()
local s_move dat = s_move.create()
set dat.caster = caster
if GetUnitAbilityLevel(dat.caster,SPELLBOOK)<=0 then
call UnitAddAbility(dat.caster, SPELLBOOK)
endif
call SetTimerData(t, dat)
call TimerStart (t,MOVE_DURATION, false, function Wait )
endfunction
private struct str
integer i
real x
real y
unit dummy
real angle
real offset
endstruct
private function Update takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
local integer i = 0
local real x = 0.
local real y = 0.
if dat.i < DUR then
loop
exitwhen i > AMOUNT-1
set x = dat.x + DISTANCE*Cos((i*dat.angle + dat.i*dat.offset)*bj_DEGTORAD)
set y = dat.y + DISTANCE*Sin((i*dat.angle + dat.i*dat.offset)*bj_DEGTORAD)
set dat.dummy = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),DUMMY_ID2,dat.x,dat.y,0.)
call IssuePointOrder(dat.dummy,"move",x,y)
call UnitApplyTimedLife(dat.dummy,'BTLF',Lifespan[dat.i])
set i = i + 1
endloop
set dat.i = dat.i + 1
else
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function Actions takes nothing returns nothing
local str dat = str.create()
local timer t = NewTimer()
local unit dummy = CreateUnit(GetOwningPlayer(SpellEvent.CastingUnit),DUMMY,SpellEvent.TargetX,SpellEvent.TargetY,0.)
call UnitAddAbility(dummy,DUMMY_SPELL)
call UnitApplyTimedLife(dummy,'BTLF',DAMAGE_DURATION)
set dat.x = GetUnitX(SpellEvent.TargetUnit)
set dat.y = GetUnitY(SpellEvent.TargetUnit)
set dat.i = 0
set dat.angle = 360./AMOUNT
set dat.offset = 360./DUR
call RemoveMove(SpellEvent.CastingUnit)
set dat.dummy = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),DUMMY_ID1,dat.x,dat.y,0.)
call UnitApplyTimedLife(dat.dummy,'BTLF',I2R(DUR))
call SetTimerData(t,dat)
call TimerStart(t,1.,true,function Update)
set dummy = null
endfunction
public function init takes nothing returns nothing
local integer i = 0
call AbilityPreload(SPELLBOOK)
call AbilityPreload(DUMMY_SPELL)
loop
exitwhen i > MAXPLAYER
call SetPlayerAbilityAvailable(Player(i),SPELLBOOK,false)
set i = i + 1
endloop
set Lifespan[0] = 0.50
set Lifespan[1] = 1.
set Lifespan[2] = 1.5
call RegisterSpellCastResponse(SPELL,Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope LoadEquipmentCrate initializer init
globals
private constant integer UNIT_ID = 'H029'
private constant string INFO_NOTARGET = "You do not carry any crate"
private constant string INFO_ERROR = "You must target an equipment crate"
private constant real LIGHTNING_Z = 0.
private constant integer SPELL_CONTROL = 'A0KN'
private constant integer SPELL_RELEASE = 'A0KO'
endglobals
private struct str
unit caster = null
timer tiOrbit = null
unit target = null
lightning bolt = null
player owner = null
private static method createFilter takes unit u returns boolean
return GetUnitTypeId(u)==UNIT_ID
endmethod
private method onCreate takes nothing returns nothing
set .tiOrbit = null
set .target = null
set .caster = me
set .bolt = null
set .owner = GetOwningPlayer(me)
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
set .tiOrbit = null
set .target = null
set .caster = null
set .bolt = null
endmethod
implement AutoDestroy
endstruct
private function CastRelease takes nothing returns nothing
local str dat = str[SpellEvent.CastingUnit]
if dat.target != null then
call ReleaseTimer(dat.tiOrbit)
set dat.tiOrbit = null
call SetUnitPathing( dat.target, true)
call DestroyLightning(dat.bolt)
call SetUnitFlyHeight(dat.target,0.,400.)
set dat.target = null
else
call ErrorSound(dat.owner)
call DisplayTextToPlayer(dat.owner,0.,0.,INFO_NOTARGET)
endif
endfunction
private function UpdateControl takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
local real x1 = GetUnitX(dat.caster)
local real y1 = GetUnitY(dat.caster)
local real x2 = GetUnitX(dat.target)
local real y2 = GetUnitY(dat.target)
if dat.target!=null and dat.caster != null and not(IsUnitType(dat.caster,UNIT_TYPE_DEAD)) and not(IsUnitType(dat.target,UNIT_TYPE_DEAD)) then
set x2 = x1
set y2 = y1
call SetUnitPosition(dat.target,x2,y2)
call MoveLightningEx(dat.bolt,true,x1,y1,GetUnitFlyHeight(dat.caster)+LIGHTNING_Z,x2,y2,GetUnitFlyHeight(dat.target)+LIGHTNING_Z)
else
call SetUnitPathing( dat.target, true)
call SetUnitFlyHeight(dat.target,0.,400.)
call DestroyLightning(dat.bolt)
call ReleaseTimer(t)
set dat.tiOrbit = null
endif
endfunction
private function CastControl takes nothing returns nothing
local str dat = str[SpellEvent.CastingUnit]
if GetUnitTypeId(SpellEvent.TargetUnit) == BOX_ID then
if dat.target!=null then
if dat.tiOrbit!= null then
call ReleaseTimer(dat.tiOrbit)
endif
call SetUnitPathing( dat.target, true)
call DestroyLightning(dat.bolt)
call SetUnitFlyHeight(dat.target,0.,400.)
endif
set dat.target = SpellEvent.TargetUnit
set dat.bolt = AddLightningEx( "LEAS", true, GetUnitX(dat.caster), GetUnitY(dat.caster), GetUnitFlyHeight(dat.caster)+LIGHTNING_Z, GetUnitX(dat.target), GetUnitY(dat.target), GetUnitFlyHeight(dat.target)+LIGHTNING_Z )
call SetUnitFlyHeight(dat.target,150.,400.)
call SetUnitPathing(dat.target,false)
set dat.tiOrbit = NewTimer()
call SetTimerData(dat.tiOrbit, dat )
call TimerStart(dat.tiOrbit, TIMEOUT, true, function UpdateControl )
else
call ErrorSound(dat.owner)
call DisplayTextToPlayer(dat.owner,0.,0.,INFO_ERROR)
endif
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL_CONTROL, CastControl)
call RegisterSpellFinishResponse(SPELL_RELEASE, CastRelease)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
library MachinegunDomination needs AmmoSystem
globals
private constant integer SPELL = 'A01Y'
private constant integer STABLE_REQ = 4
private constant integer STABLE_UP = 'R00D'
private constant integer SECONDARYCHAIN_REQ = 3
private constant integer SECONDARYCHAIN_BONUS = 200
endglobals
private function Conditions takes nothing returns boolean
local unit caster = GetTriggerUnit()
local player owner = GetOwningPlayer(caster)
local integer ownerId = GetPlayerId(owner)
if GetLearnedSkill() == SPELL then
if GetUnitAbilityLevel(caster,SPELL) == STABLE_REQ then
call SetPlayerTechResearched(owner, STABLE_UP,1)
elseif GetUnitAbilityLevel(caster,SPELL) == SECONDARYCHAIN_REQ then
call UpgradeMaxWeapon(caster,SECONDARYCHAIN_BONUS)
endif
endif
set caster = null
return false
endfunction
function MachinegunDomination takes unit hero returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterUnitEvent(t,hero,EVENT_UNIT_HERO_SKILL)
call TriggerAddCondition(t,Condition(function Conditions))
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library MachineryExpertise needs TextDisplay
globals
private constant integer SPELL = 'A01I'
private constant integer BIO_REQ = 6
private constant string BIO_INFO = "Bio Satellite activated; I hope you guys will appreciate the new datas"
endglobals
private function ShareVision takes nothing returns nothing
local integer i = 0
local integer j = 0
call FogMaskEnable(false)
loop
exitwhen i > MAXPLAYER
set j = 0
if HostileAllied == false then
loop
exitwhen j > MAXPLAYER+1
call SetPlayerAllianceBJ( Player(i), ALLIANCE_SHARED_VISION, true, Player(j) )
set j = j + 1
endloop
else
loop
exitwhen j > MAXPLAYER
call SetPlayerAllianceBJ( Player(i), ALLIANCE_SHARED_VISION, true, Player(j) )
set j = j + 1
endloop
endif
set i = i + 1
endloop
endfunction
private function Conditions takes nothing returns boolean
local unit caster = GetTriggerUnit()
local player owner = GetOwningPlayer(caster)
local integer ownerId = GetPlayerId(owner)
if GetLearnedSkill() == SPELL then
if GetUnitAbilityLevel(caster,SPELL) == BIO_REQ then
call ShareVision()
call DisplayAll(PlayerColor[ownerId]+GetPlayerName(owner),BIO_INFO)
endif
endif
set caster = null
return false
endfunction
function MachineryExpertise takes unit hero returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterUnitEvent(t,hero,EVENT_UNIT_HERO_SKILL)
call TriggerAddCondition(t,Condition(function Conditions))
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope MagneticShield initializer init
globals
private constant string FX = "Abilities\\Spells\\Items\\StaffOfPurification\\PurificationTarget.mdl"
private constant integer SPELL = 'A00T'
private constant real AOE = 600.
private constant real LIFE_BASE = 50.
private constant real MANA_BASE = 20.
private unit TmpCaster
private integer TmpLevel
endglobals
private function filter takes nothing returns boolean
local unit target = GetFilterUnit()
if IsUnitAlly(target, GetOwningPlayer(TmpCaster)) and not (IsUnitType(target,UNIT_TYPE_FLYING)) and not (IsUnitType(target,UNIT_TYPE_STRUCTURE)) and not (IsUnitType(target,UNIT_TYPE_DEAD)) then
call DestroyEffect(AddSpecialEffectTarget(FX,target,"origin"))
call SetUnitState(target,UNIT_STATE_LIFE,GetUnitState(target,UNIT_STATE_LIFE)+LIFE_BASE+LIFE_BASE*TmpLevel)
call SetUnitState(target,UNIT_STATE_MANA,GetUnitState(target,UNIT_STATE_MANA)+MANA_BASE*TmpLevel)
endif
set target = null
return true
endfunction
private function Actions takes nothing returns nothing
set TmpCaster = SpellEvent.CastingUnit
set TmpLevel = GetUnitAbilityLevel(SpellEvent.CastingUnit,SPELL)
call GroupEnumUnitsInRange(ENUM_GROUP, GetUnitX(TmpCaster),GetUnitY(TmpCaster),AOE,Condition(function filter))
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
library Marksmanship initializer init needs AbilityPreload
globals
private constant string ON = "magicdefense"
private constant string OFF = "magicundefense"
private constant integer BONUS = 'A0C2'
private constant integer BUFF = 'B01J'
endglobals
private function Conditions takes nothing returns boolean
local unit marine = GetTriggerUnit()
local string order = OrderId2String(GetIssuedOrderId())
if order == ON and GetUnitAbilityLevel(marine,BONUS)<=0 then
call UnitAddAbility(marine,BONUS)
elseif order == OFF then
if GetUnitAbilityLevel(marine,BONUS)>=1 then
call UnitRemoveAbility(marine,BONUS)
endif
if GetUnitAbilityLevel(marine,BUFF)>=1 then
call UnitRemoveAbility(marine,BUFF)
endif
endif
set marine = null
return false
endfunction
function Marksmanship takes unit hero returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterUnitEvent(t,hero,EVENT_UNIT_ISSUED_ORDER)
call TriggerAddCondition(t,Condition(function Conditions))
endfunction
private function init takes nothing returns nothing
call AbilityPreload(BONUS)
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope MechanicSynchronization initializer init
globals
private constant integer UNIT_ID = 'H010'
private constant string INFO_NOTARGET = "You are not synchronized with a mechanic unit."
private constant integer SPELL_CONTROL = 'A0A3'
private constant integer SPELL_RELEASE = 'A0A8'
endglobals
private struct str
unit caster = null
timer tiOrbit = null
unit target = null
player owner = null
private static method createFilter takes unit u returns boolean
return GetUnitTypeId(u)==UNIT_ID
endmethod
private method onCreate takes nothing returns nothing
set .tiOrbit = null
set .target = null
set .caster = me
set .owner = GetOwningPlayer(me)
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
set .tiOrbit = null
set .target = null
set .caster = null
endmethod
implement AutoDestroy
endstruct
private function CastRelease takes nothing returns nothing
local str dat = str[SpellEvent.CastingUnit]
if dat.target != null then
call SetUnitPathing( dat.caster, true)
call SetUnitFlyHeight(dat.caster,0.,300.)
call SetUnitInvulnerable(dat.caster,false)
call ReleaseTimer(dat.tiOrbit)
set dat.tiOrbit = null
else
call ErrorSound(dat.owner)
call DisplayTextToPlayer(dat.owner,0.,0.,INFO_NOTARGET)
endif
endfunction
private function UpdateControl takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
local real x = GetUnitX(dat.target)
local real y = GetUnitY(dat.target)
local real z = GetUnitFlyHeight(dat.target)
if dat.target!=null and not(IsUnitType(dat.target,UNIT_TYPE_DEAD)) and dat.caster != null and not(IsUnitType(dat.caster,UNIT_TYPE_DEAD)) then
call SetUnitX(dat.caster,x)
call SetUnitY(dat.caster,y)
call SetUnitFlyHeight(dat.caster,z,0.)
else
call SetUnitPathing( dat.caster, true)
call SetUnitFlyHeight(dat.caster,0.,300.)
call SetUnitInvulnerable(dat.caster,false)
call ReleaseTimer(t)
set dat.tiOrbit = null
if IsUnitType(dat.target,UNIT_TYPE_DEAD) then
call KillUnit(dat.caster)
endif
endif
endfunction
private function CastControl takes nothing returns nothing
local str dat = str[SpellEvent.CastingUnit]
if dat.target!=null then
if dat.tiOrbit!= null then
call ReleaseTimer(dat.tiOrbit)
endif
call SetUnitPathing( dat.caster, true)
call SetUnitFlyHeight(dat.caster,0.,0.)
endif
set dat.target = SpellEvent.TargetUnit
call SetUnitFlyHeight(dat.caster,GetUnitFlyHeight(dat.target),300.)
call SetUnitInvulnerable(dat.caster,true)
call SetUnitPathing(dat.caster,false)
set dat.tiOrbit = NewTimer()
call SetTimerData(dat.tiOrbit, dat )
call TimerStart(dat.tiOrbit, TIMEOUT, true, function UpdateControl )
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL_CONTROL, CastControl)
call RegisterSpellFinishResponse(SPELL_RELEASE, CastRelease)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope MechfighterProgram initializer init
globals
private constant integer SPELL = 'A05T'
private constant string FX = "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportCaster.mdl"
private constant integer MECH_ID = 'h006'
private constant string INFO = "Ground Walker GW-Cyclone teleportation complete."
private unit array Walker [12]
endglobals
private function Spawn takes nothing returns nothing
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local integer ownerId = GetPlayerId(owner)
local real x = GetRectCenterX(gg_rct_SpawnAllied)
local real y = GetRectCenterY(gg_rct_SpawnAllied)
call DestroyEffect(AddSpecialEffect(FX,x,y) )
if not(IsUnitType(Walker[ownerId],UNIT_TYPE_DEAD)) then
call KillUnit(Walker[ownerId])
endif
set Walker[ownerId] = CreateUnit(owner, MECH_ID,x,y,0.)
call IssueImmediateOrder(Walker[ownerId],ACTIVATE_AI_ORDER)
call DisplayAll(PlayerColor[ownerId]+GetPlayerName(owner),INFO)
call PingMinimap(x,y,1.)
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Spawn)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope MechScoutProgramm initializer init
globals
private constant integer SPELL = 'A06X'
private constant string FX = "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportCaster.mdl"
private constant integer MECH_ID = 'n006'
private constant string INFO = "Ground Walker GW-Frog teleportation complete."
private unit array Frog [12]
endglobals
private function Spawn takes nothing returns nothing
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local integer ownerId = GetPlayerId(owner)
local real x = GetRectCenterX(gg_rct_SpawnAllied)
local real y = GetRectCenterY(gg_rct_SpawnAllied)
call DestroyEffect(AddSpecialEffect(FX,x,y) )
if not(IsUnitType(Frog[ownerId],UNIT_TYPE_DEAD)) then
call KillUnit(Frog[ownerId])
endif
set Frog[ownerId] = CreateUnit(owner, MECH_ID,x,y,0.)
call IssueImmediateOrder(Frog[ownerId],ACTIVATE_AI_ORDER)
call DisplayAll(PlayerColor[ownerId]+GetPlayerName(owner),INFO)
call PingMinimap(x,y,1.)
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Spawn)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope MedicalDroid initializer init
globals
private constant integer UNIT_ID = 'n01I'
private constant integer SPELL = 'A0I9'
private constant real LIFESPAN = 60.
endglobals
private function Actions takes nothing returns nothing
local real x = GetUnitX(SpellEvent.CastingUnit)
local real y = GetUnitY(SpellEvent.CastingUnit)
local unit spawned = CreateUnit(GetOwningPlayer(SpellEvent.CastingUnit), UNIT_ID,x,y,0.)
call UnitApplyTimedLife(spawned,'BTLF',LIFESPAN)
call IssueImmediateOrder(spawned,ACTIVATE_AI_ORDER)
set spawned = null
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL,Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope MedicalInjection initializer init
globals
private constant integer BUFF = 'A0J8'
private constant real DUR = 20.
private constant integer SPELL = 'A0JJ'
private constant integer UP = 'R01J'
private constant real BONUS1_HP = 50.
private constant integer BONUS1_REQ = 2
private constant real BONUS2_HP = 50.
private constant integer BONUS2_REQ = 6
endglobals
private struct str
unit target
endstruct
private function Wait takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
if GetUnitAbilityLevel(dat.target,BUFF)>=1 then
call UnitRemoveAbility(dat.target,BUFF)
endif
call ReleaseTimer(t)
call dat.destroy()
endfunction
private function Actions takes nothing returns nothing
local timer t = NewTimer()
local str dat = str.create()
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
set dat.target = SpellEvent.TargetUnit
if GetUnitAbilityLevel(dat.target,BUFF)<=0 then
call UnitAddAbility(dat.target, BUFF)
call SetUnitAbilityLevel(dat.target,BUFF,GetUnitAbilityLevel(SpellEvent.CastingUnit,SPELL))
endif
if GetPlayerTechCount(owner,UP,true) >= BONUS1_REQ then
call SetUnitState(dat.target,UNIT_STATE_LIFE,GetUnitState(dat.target,UNIT_STATE_LIFE)+BONUS1_HP)
endif
if GetPlayerTechCount(owner,UP,true) >= BONUS2_REQ then
call SetUnitState(dat.target,UNIT_STATE_LIFE,GetUnitState(dat.target,UNIT_STATE_LIFE)+BONUS2_HP)
endif
call SetTimerData(t, dat)
call TimerStart (t,DUR, false, function Wait )
endfunction
public function init takes nothing returns nothing
call AbilityPreload(BUFF)
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
library MedicalPost initializer init needs AutoIndex, TimerUtils, GroupUtils
globals
private constant integer UNIT_ID = 'o02P'
private constant string ORDER_POISON = "summonwareagle"
private constant string ORDER_FRACT = "unbearform"
private constant string ORDER_HEAL = "heal"
private constant real TIMEOUT_CHECK = 5.
private constant real LIFE_PERCENT = 0.75
private constant real AOE = 300.
private unit Caster
endglobals
private struct str
unit caster
endstruct
private function CheckAllHeal takes nothing returns boolean
local unit target = GetFilterUnit()
if IsUnitAlly(Caster,GetOwningPlayer(target))==true then
if GetUnitAbilityLevel(target,BUFF_POISON1)>=1 or GetUnitAbilityLevel(target,BUFF_POISON2)>=1 then
call IssueTargetOrder(Caster,ORDER_POISON,target)
endif
if GetUnitAbilityLevel(target,BUFF_FRACT)>=1 then
call IssueTargetOrder(Caster,ORDER_FRACT,target)
endif
if GetUnitState(target,UNIT_STATE_LIFE)<=LIFE_PERCENT*GetUnitState(target,UNIT_STATE_MAX_LIFE) then
call IssueTargetOrder(Caster,ORDER_HEAL,target)
endif
endif
set target = null
return true
endfunction
private function CheckBuffs takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
if dat.caster!= null and not (IsUnitType(dat.caster,UNIT_TYPE_DEAD)) then
set Caster = dat.caster
call GroupEnumUnitsInRange(ENUM_GROUP,GetUnitX(dat.caster),GetUnitY(dat.caster),AOE,Filter(function CheckAllHeal))
else
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function StartCheck takes unit caster returns nothing
local timer t = NewTimer()
local str dat = str.create()
set dat.caster = caster
call SetTimerData(t,dat)
call TimerStart(t,TIMEOUT_CHECK,true,function CheckBuffs)
endfunction
private function Conditions takes nothing returns boolean
local unit whichUnit = GetTriggerUnit()
if GetUnitTypeId(whichUnit)==UNIT_ID then
call StartCheck(whichUnit)
endif
set whichUnit = null
return false
endfunction
public function init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterEnterRectSimple(t, bj_mapInitialPlayableArea)
call TriggerAddCondition(t, Condition(function Conditions))
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library Mercenary needs AmmoSystem
globals
private constant integer SPELL = 'A0AH'
private constant integer AMMO_REQ = 3
private constant integer AMMO_BONUS = 20
private constant real RELOAD_BONUS = 2.
endglobals
private function Conditions takes nothing returns boolean
local unit caster = GetTriggerUnit()
if GetLearnedSkill() == SPELL then
if GetUnitAbilityLevel(caster,SPELL) == AMMO_REQ then
call UpgradeMaxWeapon(caster,AMMO_BONUS)
call UpgradeReloadWeapon(caster,RELOAD_BONUS)
endif
endif
set caster = null
return false
endfunction
function Mercenary takes unit hero returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterUnitEvent(t,hero,EVENT_UNIT_HERO_SKILL)
call TriggerAddCondition(t,Condition(function Conditions))
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope MineField initializer init
globals
private constant integer SPELL = 'A0BH'
private constant integer MINE_ID = 'n002'
private constant integer AMOUNT_BASE = 3
private constant integer AMOUNT_COEFF = 2
private constant real AOE_BASE = 200.
private constant real AOE_COEFF = 25.
endglobals
private function Actions takes nothing returns nothing
local real x = GetUnitX(SpellEvent.CastingUnit)
local real y = GetUnitY(SpellEvent.CastingUnit)
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local integer level = GetUnitAbilityLevel(SpellEvent.CastingUnit,SPELL)
local integer count = AMOUNT_BASE + AMOUNT_COEFF*level
local real aoe = AOE_BASE + AOE_COEFF*level
local integer i = 0
loop
exitwhen i > count-1
call CreateUnit(owner,MINE_ID,x+GetRandomReal(-aoe,aoe),y+GetRandomReal(-aoe,aoe),0.)
set i = i + 1
endloop
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope MineThrower initializer init
globals
private constant integer SPELL = 'A0DU'
private constant integer MINE_ID = 'n002'
endglobals
private struct str1
unit caster
real x
real y
endstruct
private function WaitBeforeBoom takes nothing returns nothing
local timer t = GetExpiredTimer()
local str1 dat = GetTimerData(t)
call CreateUnit(GetOwningPlayer(dat.caster),MINE_ID,dat.x,dat.y,0.)
call ReleaseTimer(t)
call dat.destroy()
endfunction
private function Actions takes nothing returns nothing
local timer t = NewTimer()
local str1 dat = str1.create()
set dat.x = SpellEvent.TargetX
set dat.y = SpellEvent.TargetY
set dat.caster = SpellEvent.CastingUnit
call SetTimerData(t, dat)
call TimerStart (t, SquareRoot((dat.x-GetUnitX(dat.caster))*(dat.x-GetUnitX(dat.caster))+(dat.y-GetUnitY(dat.caster))*(dat.y-GetUnitY(dat.caster)))/600., false, function WaitBeforeBoom )
endfunction
public function init takes nothing returns nothing
call RegisterSpellCastResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope MobileHQ initializer init
globals
private constant integer SPELL = 'A07K'
private constant string FX = "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportCaster.mdl"
private constant string INFO = "Mobile HQ teleporation complete."
private integer array SentryId [6]
private unit array Sentry [12]
endglobals
private function Spawn takes nothing returns nothing
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local integer ownerId = GetPlayerId(owner)
local real x = GetRectCenterX(gg_rct_SpawnAllied)
local real y = GetRectCenterY(gg_rct_SpawnAllied)
if not(IsUnitType(Sentry[ownerId],UNIT_TYPE_DEAD)) then
call KillUnit(Sentry[ownerId])
endif
call DestroyEffect(AddSpecialEffect(FX,x,y) )
set Sentry[ownerId] = CreateUnit(owner,SentryId[GetUnitAbilityLevel(SpellEvent.CastingUnit,SPELL)-1],x,y,0.)
call DisplayAll(PlayerColor[ownerId]+GetPlayerName(owner),INFO)
call PingMinimap(x,y,1.)
endfunction
public function init takes nothing returns nothing
set SentryId[0]='h02F'
set SentryId[1]='h02G'
set SentryId[2]='h02H'
set SentryId[3]='h02I'
set SentryId[4]='h02J'
set SentryId[5]='h02K'
call RegisterSpellFinishResponse(SPELL, Spawn)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
library MultitaskDriver initializer init needs SpellEvent, TimerUtils, AutoIndex,TextDisplay
globals
private constant integer SPELL_MULTITASK = 'A0DZ'
private constant integer PILOT_ID = 'H01L'
private constant integer SPELL_UNLOADPILOT = 'A0E8'
private constant integer SPELL_UNLOADALL = 'A0EJ'
private constant integer HUMVEE_ID = 'n011'
private constant integer TRANSPORT_ID = 'n01H'
private constant integer BRADLEY_ID = 'h01E'
private constant integer TITAN_ID = 'n010'
private constant integer SPELL_BOARD = 'A0EI'
private constant real BOARD_DISTANCE_MAX = 200.
integer array TransportId[4]
integer array TransportSize[4]
unit HeroPilot
unit HeroVehicle
endglobals
private struct s_passenger
boolean transported
private static method createFilter takes unit u returns boolean
return GetUnitAbilityLevel(u,SPELL_BOARD)>=1
endmethod
private method onCreate takes nothing returns nothing
set .transported = false
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
set .transported = false
endmethod
implement AutoDestroy
endstruct
private struct s_transport
integer currentAmount = 0
integer maxAmount = 4
implement AutoData
private static method createFilter takes unit u returns boolean
return GetUnitTypeId(u) == HUMVEE_ID or GetUnitTypeId(u) == BRADLEY_ID or GetUnitTypeId(u) == TITAN_ID or GetUnitTypeId(u) == TRANSPORT_ID
endmethod
private method onCreate takes nothing returns nothing
set .currentAmount = 0
if GetUnitTypeId(me) == HUMVEE_ID then
set .maxAmount = 4
elseif GetUnitTypeId(me) == BRADLEY_ID then
set .maxAmount = 4
elseif GetUnitTypeId(me) == TITAN_ID then
set .maxAmount = 4
elseif GetUnitTypeId(me) == TRANSPORT_ID then
set .maxAmount = 6
endif
call SetUnitPathing(me,false)
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
set .currentAmount = 0
set .maxAmount = 0
endmethod
implement AutoDestroy
endstruct
private function TransportRemoveAllPassenger takes nothing returns nothing
local s_transport dat = s_transport[HeroVehicle]
set dat.currentAmount = 0
endfunction
private function TransportGetPassenger takes nothing returns boolean
local s_transport dat = s_transport[HeroVehicle]
return dat.currentAmount <= dat.maxAmount
endfunction
private function TransportAddPassenger takes nothing returns nothing
local s_transport dat = s_transport[HeroVehicle]
set dat.currentAmount = dat.currentAmount + 1
endfunction
private function TransportRemovePassenger takes nothing returns nothing
local s_transport dat = s_transport[HeroVehicle]
set dat.currentAmount = dat.currentAmount - 1
endfunction
private function UnitIsInTransport takes unit whichUnit returns boolean
local s_passenger dat = s_passenger[whichUnit]
return dat.transported
endfunction
private struct s_movePassenger
unit passenger
unit vehicle
endstruct
private function UpdatePassengerPosition takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_movePassenger dat = GetTimerData(t)
local real x = GetUnitX(dat.vehicle)
local real y = GetUnitY(dat.vehicle)
local real z = GetUnitFlyHeight(dat.vehicle)
if UnitIsInTransport(dat.passenger)==true and not(IsUnitType(dat.passenger,UNIT_TYPE_DEAD)) and not (IsUnitType(dat.vehicle,UNIT_TYPE_DEAD)) and dat.vehicle!= null and dat.passenger != null then
call SetUnitX(dat.passenger,x)
call SetUnitY(dat.passenger,y)
call SetUnitFlyHeight(dat.passenger,z,0.)
else
call SetUnitFlyHeight(dat.passenger,0.,0.)
call SetUnitPathing(dat.passenger,true)
call SetUnitInvulnerable(dat.passenger,false)
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function StartPassengerPositionUpdate takes unit passenger, unit vehicle returns nothing
local timer t = NewTimer()
local s_movePassenger dat = s_movePassenger.create()
set dat.passenger = passenger
set dat.vehicle = vehicle
call SetUnitPathing(dat.passenger,false)
call SetUnitInvulnerable(dat.passenger,true)
call SetTimerData(t,dat)
call TimerStart(t,TIMEOUT,true,function UpdatePassengerPosition)
endfunction
private function UnitGoToTransport takes unit whichUnit returns nothing
local s_passenger dat = s_passenger[whichUnit]
set dat.transported = true
call StartPassengerPositionUpdate(whichUnit,HeroVehicle)
endfunction
private function UnitLeaveTransport takes unit whichUnit returns nothing
local s_passenger dat = s_passenger[whichUnit]
set dat.transported = false
call TransportRemovePassenger()
endfunction
private function CheckUnload takes nothing returns boolean
local unit marine = GetFilterUnit()
if UnitIsInTransport(marine)==true and marine != HeroPilot then
call UnitLeaveTransport(marine)
endif
set marine = null
return true
endfunction
private function SpellUnloadAll takes nothing returns nothing
local real x = GetUnitX(HeroVehicle)
local real y = GetUnitY(HeroVehicle)
call GroupEnumUnitsInRange(ENUM_GROUP,x,y,100.,Filter(function CheckUnload))
call TransportRemoveAllPassenger()
endfunction
private function CheckBoard takes nothing returns nothing
local unit caster = SpellEvent.CastingUnit
local real x1 = GetUnitX(caster)
local real y1 = GetUnitY(caster)
local real x2 = GetUnitX(HeroVehicle)
local real y2 = GetUnitY(HeroVehicle)
local player owner = GetOwningPlayer(caster)
local real distance = SquareRoot((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1))
if UnitIsInTransport(caster)==false then
if HeroVehicle != null and not(IsUnitType(HeroVehicle,UNIT_TYPE_DEAD)) and (GetUnitTypeId(HeroVehicle) == TRANSPORT_ID or GetUnitTypeId(HeroVehicle) == HUMVEE_ID or GetUnitTypeId(HeroVehicle) == BRADLEY_ID or GetUnitTypeId(HeroVehicle) == TITAN_ID) then
if distance <= BOARD_DISTANCE_MAX then
if TransportGetPassenger()==true then
call UnitGoToTransport(caster)
call TransportAddPassenger()
call DisplayTextToPlayer(GetOwningPlayer(HeroVehicle),0.,0.,PlayerColor[GetPlayerId(owner)]+GetPlayerName(owner)+"|r "+" has entered your vehicle")
else
call ErrorSound(owner)
call DisplayTextToPlayer(owner,0.,0.,"The transport is full")
call ErrorSound(GetOwningPlayer(HeroVehicle))
call DisplayTextToPlayer(GetOwningPlayer(HeroVehicle),0.,0.,PlayerColor[GetPlayerId(owner)]+GetPlayerName(owner)+"|r "+" is trying to enter your vehicle but it is full")
endif
else
call ErrorSound(owner)
call DisplayTextToPlayer(owner,0.,0.,"The nearest transport is too far")
endif
elseif HeroVehicle == null or IsUnitType(HeroVehicle,UNIT_TYPE_DEAD) then
call ErrorSound(owner)
call DisplayTextToPlayer(owner,0.,0.,"There is no transport available")
endif
else
call TransportRemovePassenger()
call UnitLeaveTransport(caster)
call DisplayTextToPlayer(GetOwningPlayer(HeroVehicle),0.,0.,PlayerColor[GetPlayerId(owner)]+GetPlayerName(owner)+"|r "+" has left your vehicle")
endif
set caster = null
endfunction
private function UpdatePilotPosition takes nothing returns nothing
local timer t = GetExpiredTimer()
if not(IsUnitType(HeroPilot,UNIT_TYPE_DEAD)) and not (IsUnitType(HeroVehicle,UNIT_TYPE_DEAD)) and HeroVehicle!= null and HeroPilot != null and GetOwningPlayer(HeroPilot)==GetOwningPlayer(HeroVehicle) then
call SetUnitPosition(HeroPilot,GetUnitX(HeroVehicle),GetUnitY(HeroVehicle))
else
call ReleaseTimer(t)
endif
endfunction
private function StartPilotPositionUpdate takes nothing returns nothing
local timer t = NewTimer()
call TimerStart(t,TIMEOUT,true,function UpdatePilotPosition)
endfunction
private function OnDeath takes nothing returns boolean
local unit whichUnit = GetTriggerUnit()
local real x = GetUnitX(HeroVehicle)
local real y = GetUnitY(HeroVehicle)
if whichUnit == HeroVehicle and whichUnit != null then
call LoadSound(x,y)
call GroupEnumUnitsInRange(ENUM_GROUP,x,y,100.,Filter(function CheckUnload))
call TransportRemoveAllPassenger()
call SetUnitOwner(HeroVehicle,Player(PLAYER_NEUTRAL_PASSIVE),true)
call SetUnitPosition(HeroPilot,x,y)
call ShowUnit(HeroPilot,true)
call SetUnitInvulnerable(HeroPilot,false)
call UnitRemoveAbility(HeroPilot,GARN)
call SetUnitPathing(HeroPilot,true)
set HeroPilot = null
set HeroVehicle = null
endif
set whichUnit = null
return false
endfunction
function MultitaskDriver takes unit hero returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(t, GetOwningPlayer(hero), EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(t,Condition(function OnDeath))
endfunction
private function SpellRemoveOwnership takes nothing returns nothing
local real x = GetUnitX(HeroVehicle)
local real y = GetUnitY(HeroVehicle)
if HeroVehicle == SpellEvent.CastingUnit then
call LoadSound(x,y)
call GroupEnumUnitsInRange(ENUM_GROUP,x,y,100.,Filter(function CheckUnload))
call TransportRemoveAllPassenger()
call SetUnitOwner(HeroVehicle,Player(PLAYER_NEUTRAL_PASSIVE),true)
call SetUnitPosition(HeroPilot,x,y)
call ShowUnit(HeroPilot,true)
call SetUnitInvulnerable(HeroPilot,false)
call UnitRemoveAbility(HeroPilot,GARN)
call SetUnitPathing(HeroPilot,true)
if GetUnitFlyHeight(HeroVehicle)>0. then
call SetUnitFlyHeight(HeroVehicle,0.,500.)
call SetUnitAnimation(HeroVehicle,"stand")
call AddUnitAnimationProperties(HeroVehicle, "Alternate", true)
endif
set HeroPilot = null
set HeroVehicle = null
endif
endfunction
function SetPilotVehicle takes unit caster, unit target returns nothing
call LoadSound(GetUnitX(target),GetUnitY(target))
call SetUnitOwner(target,GetOwningPlayer(caster),true)
set HeroPilot = caster
set HeroVehicle = target
call ShowUnit(HeroPilot,false)
call SetUnitInvulnerable(HeroPilot,true)
call UnitAddAbility(HeroPilot,GARN)
call SetUnitPathing(HeroPilot,false)
call SetUnitPathing(HeroVehicle,false)
if IsUnitType(HeroVehicle, UNIT_TYPE_FLYING) then
call AddUnitAnimationProperties(HeroVehicle, "Alternate", false)
call SetUnitFlyHeight(HeroVehicle,500.,500.)
endif
call StartPilotPositionUpdate()
endfunction
private function init takes nothing returns nothing
set TransportId[0]=HUMVEE_ID
set TransportId[1]=BRADLEY_ID
set TransportId[2]=TITAN_ID
set TransportId[2]=TRANSPORT_ID
set TransportSize[0]=4
set TransportSize[1]=4
set TransportSize[2]=4
set TransportSize[3]=5
call RegisterSpellCastResponse(SPELL_UNLOADPILOT, SpellRemoveOwnership)
call RegisterSpellCastResponse(SPELL_UNLOADALL, SpellUnloadAll)
call RegisterSpellCastResponse(SPELL_BOARD,CheckBoard)
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope Nanitecloud initializer init
globals
private constant integer SPELL = 'A03D'
private constant integer DUMMY_SPELL = 'A03W'
private constant integer DUMMY_FX = 'o005'
private constant real DUR_FX = 10.
private constant real AOE = 400.
private unit Caster
endglobals
private function CheckEnemies takes nothing returns boolean
local unit target = GetFilterUnit()
local unit dummy = null
if IsUnitEnemy(target,GetOwningPlayer(Caster))==true then
set dummy =CreateUnit(GetOwningPlayer(SpellEvent.CastingUnit),DUMMY,GetUnitX(SpellEvent.TargetUnit),GetUnitY(SpellEvent.TargetUnit),0.)
call UnitAddAbility(dummy,DUMMY_SPELL)
call IssueTargetOrder(dummy,"rejuvination",SpellEvent.TargetUnit)
call UnitApplyTimedLife(dummy,'BTLF',2.)
call UnitAddBuffResidualNanites(SpellEvent.CastingUnit,SpellEvent.TargetUnit)
endif
set dummy = null
set target = null
return true
endfunction
private function Cast takes nothing returns nothing
local unit dummy = CreateUnit(GetOwningPlayer(SpellEvent.CastingUnit),DUMMY_FX,SpellEvent.TargetX,SpellEvent.TargetY,0.)
call UnitApplyTimedLife(dummy,'BTLF',DUR_FX)
set Caster = SpellEvent.CastingUnit
call GroupEnumUnitsInRange(ENUM_GROUP,SpellEvent.TargetX,SpellEvent.TargetY,AOE,Filter(function CheckEnemies))
set dummy = null
endfunction
public function init takes nothing returns nothing
call AbilityPreload(DUMMY_SPELL)
call RegisterSpellCastResponse(SPELL, Cast)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope NightVision initializer init
globals
private constant integer SPELL = 'A02X'
private constant integer BUFF = 'B02V'
private constant integer SPELLBOOK = 'A08J'
private constant string FX = "ReplaceableTextures\\CameraMasks\\White_mask.blp"
private boolean array Nightvision [10]
private constant integer NV_RED = 50
private constant integer NV_BLUE = 50
private constant integer NV_GREEN = 100
private constant real NV_TRANS = 0.
private constant integer NORMALRED = 100
private constant integer NORMALBLUE = 100
private constant integer NORMALGREEN = 100
private constant real NORMALTRANS = 100.
endglobals
private function Actions takes nothing returns nothing
local integer i = 0
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local integer ownerId = GetPlayerId(owner)
if Nightvision[ownerId] == false then
if GetUnitAbilityLevel(SpellEvent.CastingUnit,SPELLBOOK)<=1 then
call UnitAddAbility(SpellEvent.CastingUnit,SPELLBOOK)
endif
set Nightvision[ownerId] = true
if owner == GetLocalPlayer() then
call CinematicFilterGenericBJ(2.,BLEND_MODE_MODULATE,FX,100,100,100,100.,NV_RED,NV_GREEN,NV_BLUE,NV_TRANS)
endif
else
if GetUnitAbilityLevel(SpellEvent.CastingUnit,SPELLBOOK)>=1 then
call UnitRemoveAbility(SpellEvent.CastingUnit,SPELLBOOK)
endif
if GetUnitAbilityLevel(SpellEvent.CastingUnit,BUFF)>=1 then
call UnitRemoveAbility(SpellEvent.CastingUnit,BUFF)
endif
set Nightvision[ownerId] = false
if owner == GetLocalPlayer() then
call CinematicFilterGenericBJ(0,BLEND_MODE_MODULATE,FX,NV_RED,NV_GREEN,NV_BLUE,NV_TRANS,100,100,100,100.)
endif
endif
endfunction
public function init takes nothing returns nothing
local integer i = 0
call AbilityPreload(SPELLBOOK)
loop
exitwhen i > MAXPLAYER
call SetPlayerAbilityAvailable(Player(i),SPELLBOOK,false)
set i = i + 1
endloop
call RegisterSpellCastResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=19
//TESH.alwaysfold=0
scope NytrogenGrenade initializer init
globals
private constant integer SPELL = 'A0KV'
private constant integer DUMMY_SPELL = 'A0EV'
private constant integer AURA_ID = 'o01G'
private constant real LIFESPAN = 10.
endglobals
private struct str
unit caster
real x
real y
endstruct
private function WaitBeforeBoom takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
call UnitApplyTimedLife(CreateUnit(GetOwningPlayer(dat.caster),AURA_ID,dat.x,dat.y,0.),'BTLF',LIFESPAN)
call ReleaseTimer(t)
call dat.destroy()
endfunction
private function Actions takes nothing returns nothing
local unit dummy = CreateUnit(GetOwningPlayer(SpellEvent.CastingUnit),DUMMY,GetUnitX(SpellEvent.CastingUnit),GetUnitY(SpellEvent.CastingUnit),0.)
local timer t = NewTimer()
local str dat = str.create()
call UnitAddAbility(dummy,DUMMY_SPELL)
call SetUnitAnimation(SpellEvent.CastingUnit, "spell throw" )
call GrenadeSound(SpellEvent.TargetX,SpellEvent.TargetY)
call TextTagMessage("Whiskey Pete!",SpellEvent.CastingUnit, 0., 50., 64., 90., 9, 5., 2.00 )
set dat.x = SpellEvent.TargetX
set dat.y = SpellEvent.TargetY
set dat.caster = SpellEvent.CastingUnit
call IssuePointOrder(dummy,"clusterrockets",SpellEvent.TargetX,SpellEvent.TargetY)
call UnitApplyTimedLife(dummy,'BTLF',2.)
call SetTimerData(t, dat)
call TimerStart (t, 1., false, function WaitBeforeBoom )
set dummy = null
endfunction
public function init takes nothing returns nothing
call AbilityPreload(DUMMY_SPELL)
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
library OffensiveBuildings
globals
private constant integer SPELL = 'A0DE'
private constant integer UP = 'R011'
private constant integer UNIT_ID = 'H01C'
endglobals
private function Conditions takes nothing returns boolean
local unit caster = GetTriggerUnit()
local player owner = GetOwningPlayer(caster)
if GetLearnedSkill() == SPELL then
call SetPlayerTechResearched(owner, UP, GetPlayerTechCount(owner,UP,true)+1)
endif
set caster = null
return false
endfunction
function OffensiveBuildings takes unit hero returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterUnitEvent(t,hero,EVENT_UNIT_HERO_SKILL)
call TriggerAddCondition(t,Condition(function Conditions))
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope OpenCrate initializer init
globals
private constant integer SPELL = 'A08E'
private constant real LIFESPAN = 20.
endglobals
private function Actions takes nothing returns nothing
if GetUnitTypeId(SpellEvent.TargetUnit)==BOX_ID then
call KillUnit(SpellEvent.TargetUnit)
endif
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL,Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
library OpenFire initializer init needs AbilityPreload
globals
private constant string ON = "magicdefense"
private constant string OFF = "magicundefense"
private constant integer ID = 'H010'
private constant integer BONUS = 'A0C3'
private constant integer BUFF = 'B00K'
endglobals
private function UnitOrder takes nothing returns boolean
local unit marine = GetTriggerUnit()
local string order = OrderId2String(GetIssuedOrderId())
if order == ON and GetUnitAbilityLevel(marine,BONUS)<=0 then
call UnitAddAbility(marine,BONUS)
elseif order == OFF then
if GetUnitAbilityLevel(marine,BONUS)>=1 then
call UnitRemoveAbility(marine,BONUS)
endif
if GetUnitAbilityLevel(marine,BUFF)>=1 then
call UnitRemoveAbility(marine,BUFF)
endif
endif
set marine = null
return false
endfunction
function OpenFire takes unit hero returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterUnitEvent(t,hero,EVENT_UNIT_ISSUED_ORDER)
call TriggerAddCondition(t,Condition(function UnitOrder))
endfunction
private function init takes nothing returns nothing
call AbilityPreload(BONUS)
endfunction
endlibrary
//TESH.scrollpos=42
//TESH.alwaysfold=0
scope OpticalScope initializer init
globals
private constant integer SPELL = 'A0FM'
private constant integer BONUS_DMG = 'A097'
private constant real AOE = 1200.
private constant integer DURATION = 6
private constant integer SPELLBOOK = 'A09A'
private constant integer SPECIAL_BUFF = 'A06R'
private integer TmpCount = 0
private unit Caster
endglobals
private struct str
unit caster
integer i
endstruct
private function Update takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
if dat.i < DURATION then
set dat.i = dat.i + 1
else
if GetUnitAbilityLevel(dat.caster,SPELLBOOK)>=1 then
call UnitRemoveAbility(dat.caster,SPELLBOOK)
endif
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function FilterClassA takes nothing returns boolean
local unit target = GetFilterUnit()
if GetUnitAbilityLevel(target,SPECIAL_BUFF)>=1 and not (IsUnitType(target,UNIT_TYPE_DEAD)) then
set TmpCount = TmpCount + 1
call PingMinimapEx(GetUnitX(target),GetUnitY(target),3.,242,51,51,false)
if TmpCount > 6 then
set target = null
return false
endif
endif
set target = null
return true
endfunction
private function Actions takes nothing returns nothing
local timer t = NewTimer()
local str dat = str.create()
set dat.i = 0
set dat.caster = SpellEvent.CastingUnit
if GetUnitAbilityLevel(dat.caster,SPELLBOOK)<=0 then
call UnitAddAbility(dat.caster,SPELLBOOK)
endif
set TmpCount = 0
set Caster = dat.caster
call GroupEnumUnitsInRange(ENUM_GROUP,SpellEvent.TargetX,SpellEvent.TargetY,AOE,Filter(function FilterClassA))
call SetTimerData(t, dat)
call TimerStart (t, 1., true, function Update )
endfunction
public function init takes nothing returns nothing
local integer i = 0
call AbilityPreload(SPELLBOOK)
loop
exitwhen i > MAXPLAYER
call SetPlayerAbilityAvailable(Player(i),SPELLBOOK,false)
set i = i + 1
endloop
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=1
//TESH.alwaysfold=0
scope OrbitalStrike initializer init
globals
private constant string FX = "war3mapImported\\Barrage.mdx"
private constant string FX_SHELL = "Units\\Demon\\Infernal\\InfernalBirth.mdl"
private constant real DMG = 1000.
private constant real AOE_DMG = 250.
private constant real AOE_SAFE = 600.
private constant real AOE_STRIKE = 6000.
private constant real DAMAGE_DELAY = 1.
private constant integer SPELL = 'A09N'
private constant string INFO = "Orbital Strike starts. Stay inside safe area"
private constant integer DUMMY_AOE = 'o00Z'
private constant real TIMEOUT_STRIKE = 0.03
private constant real DURATION = 20.
endglobals
private struct s_delay
real x
real y
unit caster
endstruct
private function FireBarrageDealDamage takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_delay dat = GetTimerData(t)
call UnitDamageAll(dat.caster,true,AOE_DMG,dat.x,dat.y,DMG,DMG_EXPLOSIVE,false,0,0,0)
call ReleaseTimer(t)
call dat.destroy()
endfunction
private function FireBarrageDelayDamage takes unit caster, real x, real y returns nothing
local timer t = NewTimer()
local s_delay dat = s_delay.create()
set dat.caster = caster
set dat.x = x
set dat.y = y
call DestroyEffect(AddSpecialEffect(FX_SHELL,dat.x,dat.y))
call SetTimerData(t, dat)
call TimerStart (t, DAMAGE_DELAY,false, function FireBarrageDealDamage )
endfunction
private struct str
integer i
unit caster
real targetX
real targetY
integer count
unit dummy
player owner
integer duration
endstruct
private function FireBarrageLoop takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
local real angle = GetRandomReal(0.,360.)
local real x = dat.targetX+GetRandomReal(AOE_SAFE+AOE_DMG,AOE_STRIKE)*Cos(angle*bj_DEGTORAD)
local real y = dat.targetY+GetRandomReal(AOE_SAFE+AOE_DMG,AOE_STRIKE)*Sin(angle*bj_DEGTORAD)
if dat.i < dat.duration then
loop
exitwhen RectContainsCoords(bj_mapInitialPlayableArea,x,y)
set x = dat.targetX+GetRandomReal(AOE_SAFE+AOE_DMG,AOE_STRIKE)*Cos(angle*bj_DEGTORAD)
set y = dat.targetY+GetRandomReal(AOE_SAFE+AOE_DMG,AOE_STRIKE)*Sin(angle*bj_DEGTORAD)
endloop
set dat.i = dat.i + 1
call BombFallSound()
call DestroyEffect(AddSpecialEffect(FX,x,y))
call FireBarrageDelayDamage(dat.caster,x,y)
else
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function Actions takes nothing returns nothing
local timer t = NewTimer()
local str dat = str.create()
call WillExplodeSound()
set dat.i = 0
set dat.caster = SpellEvent.CastingUnit
set dat.targetX = SpellEvent.TargetX
set dat.targetY = SpellEvent.TargetY
call PingMinimapEx(SpellEvent.TargetX,SpellEvent.TargetY,3., 154, 206, 115, false)
set dat.duration = R2I(DURATION/TIMEOUT_STRIKE)
set dat.owner = GetOwningPlayer(SpellEvent.CastingUnit)
call UnitApplyTimedLife(CreateUnit(dat.owner,DUMMY_AOE,dat.targetX,dat.targetY,0.),'BTLF',DURATION)
call DisplayAll(PlayerColor[GetPlayerId(dat.owner)]+GetPlayerName(dat.owner),INFO)
call SetTimerData(t, dat)
call TimerStart (t, TIMEOUT_STRIKE,true, function FireBarrageLoop )
endfunction
public function init takes nothing returns nothing
call RegisterSpellCastResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope Overcloack initializer init
globals
private constant integer SPELL = 'A0IE'
private constant real DMG = 300.
endglobals
private function Actions takes nothing returns nothing
call UnitDamageTarget(SpellEvent.CastingUnit,SpellEvent.TargetUnit,DMG,false,false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL,Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope Overload initializer init
globals
private constant integer SPELL = 'A0KE'
private constant integer DUR = 7
private constant integer DUMMY_FX = 'h028'
private constant integer DUMMY_SPELL = 'A0KF'
private constant integer AMOUNT = 6
private constant real DISTANCE = 200.
private constant string LIGHTNING_FX = "CLPB"
private constant integer SPELLBOOK = 'A0KH'
private constant real DELAY = 10.
private boolean IsCasting
endglobals
private struct s_delay
unit caster
endstruct
private function Wait takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_delay dat = GetTimerData(t)
if GetUnitAbilityLevel(dat.caster,SPELLBOOK)>=1 then
call UnitRemoveAbility(dat.caster,SPELLBOOK)
endif
call ReleaseTimer(t)
call dat.destroy()
endfunction
private function DelayAttack takes unit caster returns nothing
local timer t = NewTimer()
local s_delay dat = s_delay.create()
set dat.caster = caster
if GetUnitAbilityLevel(dat.caster,SPELLBOOK)<=0 then
call UnitAddAbility(dat.caster, SPELLBOOK)
endif
call SetTimerData(t, dat)
call TimerStart (t,DELAY, false, function Wait )
endfunction
private function Damage takes unit caster, unit target returns nothing
local unit dummy = CreateUnit(GetOwningPlayer(caster),DUMMY,GetUnitX(target),GetUnitY(target),0.)
call UnitAddAbility(dummy,DUMMY_SPELL)
call IssueTargetOrder(dummy,"thunderbolt",target)
call UnitApplyTimedLife(dummy,'BTLF',2.)
call DelayAttack(caster)
set dummy = null
endfunction
private struct str
integer i
unit caster
unit target
unit array dummy [6]
endstruct
private function Update takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
local integer i = 0
if dat. i < DUR and IsCasting == true then
set dat.i = dat.i + 1
else
if IsCasting == true then
loop
exitwhen i > AMOUNT
call Eclair(dat.caster,dat.target,LIGHTNING_FX,1.)
call Eclair(dat.dummy[i],dat.target,LIGHTNING_FX,1.)
call UnitApplyTimedLife(dat.dummy[i],'BTLF',1.)
set i = i + 1
endloop
call Damage(dat.caster,dat.target)
endif
set IsCasting = false
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function SpellCast takes nothing returns nothing
local str dat = str.create()
local timer t = NewTimer()
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local integer i = 0
local real x1 = GetUnitX(SpellEvent.CastingUnit)
local real y1 = GetUnitY(SpellEvent.CastingUnit)
local real x2 = 0.
local real y2 = 0.
set dat.i = 0
set dat.caster = SpellEvent.CastingUnit
set dat.target = SpellEvent.TargetUnit
set IsCasting = true
loop
exitwhen i > AMOUNT
set x2 = x1 + DISTANCE*Cos(i*60.*bj_DEGTORAD)
set y2 = y1 + DISTANCE*Sin(i*60.*bj_DEGTORAD)
set dat.dummy[i] = CreateUnit(owner,DUMMY_FX,x2,y2,0.)
call SetUnitFlyHeight(dat.dummy[i],200.,0.)
call Eclair(dat.dummy[i],dat.caster,LIGHTNING_FX,7.)
set i = i + 1
endloop
call SetTimerData(t,dat)
call TimerStart(t,1.,true,function Update)
endfunction
private function SpellEndCast takes nothing returns nothing
if not SpellEvent.CastFinished then
set IsCasting = false
endif
endfunction
public function init takes nothing returns nothing
local integer i = 0
call AbilityPreload(SPELLBOOK)
call AbilityPreload(DUMMY_SPELL)
loop
exitwhen i > MAXPLAYER
call SetPlayerAbilityAvailable(Player(i),SPELLBOOK,false)
set i = i + 1
endloop
set IsCasting = false
call RegisterSpellCastResponse(SPELL,SpellCast)
call RegisterSpellEndCastResponse(SPELL,SpellEndCast)
endfunction
endscope
//TESH.scrollpos=27
//TESH.alwaysfold=0
scope Overmind initializer init
globals
private constant integer SPELL = 'A01U'
private constant real DMG = 1500.
private constant real AOE = 600.
private constant integer PORTAL_ID = 'h02C'
private constant real WAIT = 10.
private constant integer SPEED = 30
private constant real IMP = 0.2
private unit Caster
private real X
private real Y
private player Owner
integer SOUND_PORTALDEATH
integer SOUND_PORTALBIRTH
endglobals
private struct str
unit target
real angle
integer distance
integer i
endstruct
private function Update takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
local real x = GetUnitX(dat.target)
local real y = GetUnitY(dat.target)
local real newX = x + SPEED*Cos(dat.angle)
local real newY = y + SPEED*Sin(dat.angle)
local real z = GetUnitFlyHeight(dat.target)
local real newz = 0.00
if dat.i < dat.distance then
set dat.i = dat.i + 1
call SetUnitX(dat.target, newX)
call SetUnitY(dat.target, newY)
if dat.i < (dat.distance * 0.5) then
set newz = z + (dat.distance * IMP)
else
set newz = z - (dat.distance * IMP)
endif
call SetUnitFlyHeight(dat.target,newz,0.)
else
call SetUnitPathing(dat.target, true)
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function Grab takes unit target, real x2, real y2 returns nothing
local timer t = NewTimer()
local str dat = str.create()
local real x1 = GetUnitX(target)
local real y1 = GetUnitY(target)
set dat.target = target
set dat.angle = Atan2((y2 -y1), (x2 - x1))
set dat.distance = R2I(SquareRoot((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)))/SPEED
set dat.i = 0
call SetUnitPathing( dat.target, false)
call SetTimerData(t, dat)
call TimerStart (t, TIMEOUT, true, function Update )
endfunction
private function CheckEnemies takes nothing returns boolean
local unit target = GetFilterUnit()
if IsUnitEnemy(target,Owner)==true and not (IsUnitType(target,UNIT_TYPE_DEAD)) and not(IsUnitType(target,UNIT_TYPE_STRUCTURE)) then
call Grab(target,X,Y)
endif
set target = null
return false
endfunction
struct s_delay
real x
real y
unit caster
unit portal
endstruct
private function Delay takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_delay dat = GetTimerData(t)
set Caster = dat.caster
set Owner = GetOwningPlayer(dat.caster)
set X = dat.x
set Y = dat.y
call GroupEnumUnitsInRange(ENUM_GROUP,dat.x,dat.y,AOE,Filter(function CheckEnemies))
call UnitDamageEnemies(dat.caster,AOE,dat.x,dat.y,DMG,DMG_PHYSIC,false,0,0,0.)
call RunSoundOnUnit(SOUND_PORTALDEATH,dat.portal)
call KillUnit(dat.portal)
call ReleaseTimer(t)
call dat.destroy()
endfunction
private function Actions takes nothing returns nothing
local s_delay dat = s_delay.create()
local timer t = NewTimer()
set dat.x = SpellEvent.TargetX
set dat.y = SpellEvent.TargetY
set dat.caster = SpellEvent.CastingUnit
set dat.portal = CreateUnit(Player(15),PORTAL_ID,dat.x,dat.y,GetUnitFacing(dat.caster))
call SetUnitAnimation(dat.portal,"birth")
call RunSoundOnUnit(SOUND_PORTALBIRTH,dat.portal)
call SetTimerData(t,dat)
call TimerStart(t,WAIT-3.,false,function Delay)
endfunction
public function init takes nothing returns nothing
set SOUND_PORTALBIRTH = DefineSound("Sound\\Ambient\\DoodadEffects\\ShimmeringPortalBirth.wav",3000, false, true)
set SOUND_PORTALDEATH = DefineSound("Sound\\Ambient\\DoodadEffects\\ShimmeringPortalDeath.wav",3000, false, true)
call RegisterSpellFinishResponse(SPELL,Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope PercussionJump initializer init
globals
private constant real AOE = 250
private constant integer SPEED = 40
private constant real IMP = 0.25
private constant integer SPELL = 'A02B'
private constant string FX = "Abilities\\Spells\\Orc\\WarStomp\\WarStompCaster.mdl"
private constant string ANIM = "Spell Slam 2"
private constant real DMG = 200.
endglobals
private struct str
unit caster
real angle
integer distance
integer i
real dmg
integer deltaZ
endstruct
private function Update takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
local real x = GetUnitX(dat.caster)
local real y = GetUnitY(dat.caster)
local real newX = x + SPEED*Cos(dat.angle)
local real newY = y + SPEED*Sin(dat.angle)
local real z = GetUnitFlyHeight(dat.caster)
local real newz = 0.00
if dat.i < dat.distance then
set dat.i = dat.i + 1
call SetUnitX(dat.caster, newX)
call SetUnitY(dat.caster, newY)
if dat.i < (dat.distance * 0.5) then
set newz = z + (dat.distance * IMP)
else
set newz = z - (dat.distance * IMP)
endif
call SetUnitFlyHeight(dat.caster,newz,0.)
else
call SetUnitPathing(dat.caster, true)
call SetUnitAnimation(dat.caster, "attack slam")
call DestroyEffect(AddSpecialEffect(FX,x,y))
call UnitDamageEnemies(dat.caster,AOE,x,y,dat.dmg,DMG_PHYSIC,true,100,SPEED,IMP)
if dat.deltaZ > 1 then
call UnitAddBuffFract(dat.caster)
endif
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function Actions takes nothing returns nothing
local timer t = NewTimer()
local str dat = str.create()
local real x1 = GetUnitX(SpellEvent.CastingUnit)
local real y1 = GetUnitY(SpellEvent.CastingUnit)
local real x2 = SpellEvent.TargetX
local real y2 = SpellEvent.TargetY
set dat.deltaZ = GetTerrainCliffLevel(x1,y1)-GetTerrainCliffLevel(x2,y2)
if dat.deltaZ >= 0 then
set dat.caster = SpellEvent.CastingUnit
set dat.angle = Atan2((y2 -y1), (x2 - x1))
set dat.distance = R2I(SquareRoot((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)))/SPEED
set dat.i = 0
set dat.dmg = DMG*GetUnitAbilityLevel(dat.caster,SPELL)
call SetUnitPathing( dat.caster, false)
call SetUnitAnimation(dat.caster,ANIM)
call SetTimerData(t, dat)
call TimerStart (t, TIMEOUT, true, function Update )
else
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope PlasmaClockSpell initializer Init
globals
//--------------------------------------------------SETUP--------------------------------------------------
private constant integer SpellID = 'A0JT' //Raw code of the spell.
private constant integer DummyID = 'h026' //Raw code of the dummy unit.
private constant real Arrow1Damage = 8. //Damage the first (fast) arrow deals every 0.05 (default) seconds upon contact with enemies.
private constant real Arrow1DamageIncrease = 2. //Damage amount of the first arrow increased per level of the ability.
private constant real Arrow2Damage = 3. //Damage the second (slow) arrow deals every 0.05 (default) seconds upon contact with enemies. NOTE: This arrow moves very slowly, making the damage output big even though the number is small.
private constant real Arrow2DamageIncrease = 1. //Damage amount of the first arrow increased per level of the ability.
private constant boolean AttachClock = true //Wether to move the clock effect with the caster or not. (true - move, false - don't move).
private constant real HealBase = 200. //Amount healed over 8 secs for the duration of the spell at level 1. Affected by level increase below.
private constant real HealIncrease = 100. //Heal amount increased per level of the ability.
private constant real RotationStart = 90. //Starting rotation (degrees) of the arrows. 90 is most logical since it is the starting position of real clock arrows (doh).
private constant real RotationTotal = 360. //The total degrees the slow arrow rotates before finishing effect. (360 - default: 1 complete circle)
private constant real TotalTime = 8. //The total duration of the spell in seconds.
private constant real Interval = 0.05 //Period of time in which the arrow dummies are moved.
private constant real Separation = 120. //Separation distance between each light orb.
private constant integer DummyCount1 = 7 //Number of light orb dummies created for arrow 1 (fast arrow).
private constant integer DummyCount2 = 7 //Number of light orb dummies created for arrow 2 (slow arrow).
private constant string SpawnEffect = "Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl" //Effect created when the dummies are spawned.
private constant string DeathEffect = "Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl" //Effect created when the dummies are destroyed.
private constant attacktype AttackT = ATTACK_TYPE_NORMAL //Attack type of the spell.
private constant damagetype DamageT = DAMAGE_TYPE_NORMAL //Damage type of the spell.
private constant weapontype WeaponT = null //Weapon type of the spell (never knew what it was, so I always set it to null, hehe).
private constant boolean MagicImmune = true //Wether the spell affects magic immune units.
private constant boolean Building = true //Wether the spell affects buildings.
private constant boolean Flying = true //Wether the spell affects flying units.
endglobals
//------------------------------------------------SETUP END------------------------------------------------
globals
private timer ClockTimer = CreateTimer()
private integer ClockActiveTotal = 0
private integer array ClockStructID
private player TempP
private unit TempU
private real TempR
private group Targets = CreateGroup()
private constant real TotalExecutions = TotalTime / Interval
private constant real Rotation2Interval = RotationTotal / TotalExecutions * bj_DEGTORAD
private constant real Rotation1Interval = bj_RADTODEG * Rotation2Interval * 12. * bj_DEGTORAD
endglobals
private function DamageTargets takes nothing returns boolean
local unit Temp = GetFilterUnit()
local boolean B1
local boolean B2
local boolean B3
if IsUnitEnemy(Temp, TempP) and GetWidgetLife(Temp) > 0.405 then
set B1 = IsUnitType(Temp, UNIT_TYPE_MAGIC_IMMUNE) == false
set B2 = IsUnitType(Temp, UNIT_TYPE_STRUCTURE) == false
set B3 = IsUnitType(Temp, UNIT_TYPE_FLYING) == false
if MagicImmune then
set B1 = true
endif
if Building then
set B2 = true
endif
if Flying then
set B3 = true
endif
call UnitDamageTarget(TempU, Temp, TempR, true, false, AttackT, DamageT, WeaponT)
endif
set Temp = null
return false
endfunction
private struct Clock
private unit Caster
private real CenterX
private real CenterY
private unit array Arrow1Dummy[DummyCount1]
private unit array Arrow2Dummy[DummyCount2]
private integer ArrowMoveCount
private integer AbilityLevel
private real Arrow1Rotation
private real Arrow2Rotation
static method create takes unit source returns Clock
local Clock c = Clock.allocate()
local real PointX
local real PointY
local real Distance = 0.
local integer Count = 0
set c.Caster = source
set c.ArrowMoveCount = 0
set c.Arrow1Rotation = RotationStart * bj_DEGTORAD
set c.Arrow2Rotation = RotationStart * bj_DEGTORAD
set c.AbilityLevel = GetUnitAbilityLevel(source, SpellID)
set c.CenterX = GetUnitX(source)
set c.CenterY = GetUnitY(source)
loop
set Count = Count + 1
set PointX = c.CenterX + Distance * Cos(c.Arrow1Rotation)
set PointY = c.CenterY + Distance * Sin(c.Arrow1Rotation)
set c.Arrow1Dummy[Count] = CreateUnit(Player(15), DummyID, PointX, PointY, 0.)
call DestroyEffect(AddSpecialEffect(SpawnEffect, PointX, PointY))
set Distance = Distance + Separation
exitwhen Count == DummyCount1
endloop
set Count = 0
set Distance = 0.
loop
set Count = Count + 1
set PointX = c.CenterX + Distance * Cos(c.Arrow1Rotation)
set PointY = c.CenterY + Distance * Sin(c.Arrow1Rotation)
set c.Arrow2Dummy[Count] = CreateUnit(Player(15), DummyID, PointX, PointY, 0.)
call DestroyEffect(AddSpecialEffect(SpawnEffect, PointX, PointY))
set Distance = Distance + Separation
exitwhen Count == DummyCount2
endloop
if ClockActiveTotal == 0 then
call TimerStart(ClockTimer, Interval, true, function Clock.Move)
endif
set ClockStructID[ClockActiveTotal] = c
set ClockActiveTotal = ClockActiveTotal + 1
return c
endmethod
static method Move takes nothing returns nothing
local Clock TempStruct
local real PointX
local real PointY
local real Distance = 0.
local integer Count = 0
local integer Count2 = 0
local unit Temp
loop
exitwhen Count >= ClockActiveTotal
set TempStruct = ClockStructID[Count]
if AttachClock == true then
set TempStruct.CenterX = GetUnitX(TempStruct.Caster)
set TempStruct.CenterY = GetUnitY(TempStruct.Caster)
endif
call SetWidgetLife(TempStruct.Caster, GetWidgetLife(TempStruct.Caster) + (HealBase + (HealIncrease * TempStruct.AbilityLevel - HealIncrease))/TotalExecutions)
set TempStruct.Arrow1Rotation = TempStruct.Arrow1Rotation - Rotation1Interval
set TempStruct.Arrow2Rotation = TempStruct.Arrow2Rotation - Rotation2Interval
set TempStruct.ArrowMoveCount = TempStruct.ArrowMoveCount + 1
loop
set Count2 = Count2 + 1
set PointX = TempStruct.CenterX + Distance * Cos(TempStruct.Arrow1Rotation)
set PointY = TempStruct.CenterY + Distance * Sin(TempStruct.Arrow1Rotation)
call SetUnitPosition(TempStruct.Arrow1Dummy[Count2], PointX, PointY)
set TempP = GetOwningPlayer(TempStruct.Caster)
set TempU = TempStruct.Caster
set TempR = Arrow1Damage + (Arrow1DamageIncrease * TempStruct.AbilityLevel - Arrow1DamageIncrease)
call GroupEnumUnitsInRange(Targets, PointX, PointY, 80., Condition(function DamageTargets))
set TempU = null
set Distance = Distance + Separation
exitwhen Count2 == DummyCount1
endloop
set Count2 = 0
set Distance = 0.
loop
set Count2 = Count2 + 1
set PointX = TempStruct.CenterX + Distance * Cos(TempStruct.Arrow2Rotation)
set PointY = TempStruct.CenterY + Distance * Sin(TempStruct.Arrow2Rotation)
call SetUnitPosition(TempStruct.Arrow2Dummy[Count2], PointX, PointY)
set TempP = GetOwningPlayer(TempStruct.Caster)
set TempU = TempStruct.Caster
set TempR = Arrow2Damage + (Arrow2DamageIncrease * TempStruct.AbilityLevel - Arrow2DamageIncrease)
call GroupEnumUnitsInRange(Targets, PointX, PointY, 80., Condition(function DamageTargets))
set TempU = null
set Distance = Distance + Separation
exitwhen Count2 == DummyCount2
endloop
set Count2 = 0
set Distance = 0.
if TempStruct.ArrowMoveCount == TotalExecutions or GetWidgetLife(TempStruct.Caster) <= 0.405 then
call DestroyEffect(AddSpecialEffect(DeathEffect, TempStruct.CenterX, TempStruct.CenterY))
loop
set Count2 = Count2 + 1
set Distance = Distance + 150.
set PointX = TempStruct.CenterX + Distance * Cos(90. * bj_DEGTORAD)
set PointY = TempStruct.CenterY + Distance * Sin(90. * bj_DEGTORAD)
call DestroyEffect(AddSpecialEffect(DeathEffect, PointX, PointY))
exitwhen Count2 == 6
endloop
set Count2 = 0
loop
set Count2 = Count2 + 1
call KillUnit(TempStruct.Arrow1Dummy[Count2])
exitwhen Count2 == DummyCount1
endloop
set Count2 = 0
loop
set Count2 = Count2 + 1
call KillUnit(TempStruct.Arrow2Dummy[Count2])
exitwhen Count2 == DummyCount2
endloop
set ClockActiveTotal = ClockActiveTotal - 1
set ClockStructID[Count] = ClockStructID[ClockActiveTotal]
if ClockActiveTotal == 0 then
call PauseTimer(ClockTimer)
endif
call TempStruct.destroy()
elseif TempStruct.ArrowMoveCount > TotalExecutions then
call DestroyEffect(AddSpecialEffect(DeathEffect, TempStruct.CenterX, TempStruct.CenterY))
loop
set Count2 = Count2 + 1
set Distance = Distance + 150.
set PointX = TempStruct.CenterX + Distance * Cos(90. * bj_DEGTORAD)
set PointY = TempStruct.CenterY + Distance * Sin(90. * bj_DEGTORAD)
call DestroyEffect(AddSpecialEffect(DeathEffect, PointX, PointY))
exitwhen Count2 == 6
endloop
set Count2 = 0
loop
set Count2 = Count2 + 1
call KillUnit(TempStruct.Arrow1Dummy[Count2])
exitwhen Count2 == DummyCount1
endloop
set Count2 = 0
loop
set Count2 = Count2 + 1
call KillUnit(TempStruct.Arrow2Dummy[Count2])
exitwhen Count2 == DummyCount2
endloop
set ClockActiveTotal = ClockActiveTotal - 1
set ClockStructID[Count] = ClockStructID[ClockActiveTotal]
if ClockActiveTotal == 0 then
call PauseTimer(ClockTimer)
endif
call TempStruct.destroy()
endif
set Count = Count + 1
endloop
endmethod
method onDestroy takes nothing returns nothing
local integer Count = 0
loop
set Count = Count + 1
set .Arrow1Dummy[Count] = null
exitwhen Count == DummyCount1
endloop
set Count = 0
loop
set Count = Count + 1
set .Arrow2Dummy[Count] = null
exitwhen Count == DummyCount2
endloop
set .Caster = null
endmethod
endstruct
private function ConditionsActions takes nothing returns nothing
if GetSpellAbilityId() == SpellID then
call Clock.create(GetTriggerUnit())
endif
endfunction
private function Init takes nothing returns nothing
local trigger ClockTrig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(ClockTrig, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddAction(ClockTrig, function ConditionsActions)
call Preload(SpawnEffect)
call Preload(DeathEffect)
set ClockTrig = null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
library PlasmaField initializer init needs TimerUtils,SpellEvent
globals
private constant integer SPELL = 'A0B4'
private constant integer ID = 'o020'
private constant integer SPELLBOOK = 'A0BR'
private constant integer UP = 'R00X'
private constant real LIFESPAN = 60.
private constant real DISTANCE = 150.
endglobals
private struct str
integer i
unit caster
unit field
integer duration
endstruct
private function Update takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
local real x1 = GetUnitX(dat.caster)
local real y1 = GetUnitY(dat.caster)
local real angle = GetUnitFacing(dat.caster)
local real x2 = x1 + DISTANCE*Cos(angle*bj_DEGTORAD)
local real y2 = y1 + DISTANCE*Sin(angle*bj_DEGTORAD)
if not (IsUnitType(dat.caster,UNIT_TYPE_DEAD)) and not (IsUnitType(dat.field,UNIT_TYPE_DEAD)) and dat.i < dat.duration then
set dat.i = dat.i + 1
call SetUnitPosition(dat.field,x2,y2)
call SetUnitFacing(dat.field,angle)
call SetUnitFlyHeight(dat.field,GetUnitFlyHeight(dat.caster),0.)
else
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function OnCast takes nothing returns nothing
local timer t = NewTimer()
local str dat = str.create()
local integer i = 0
local real x = GetUnitX(SpellEvent.CastingUnit)
local real y = GetUnitY(SpellEvent.CastingUnit)
local real angle = GetUnitFacing(SpellEvent.CastingUnit)
set dat.caster = SpellEvent.CastingUnit
set dat.field = CreateUnit(GetOwningPlayer(dat.caster),ID,x+DISTANCE*Cos(angle*bj_DEGTORAD),y+DISTANCE*Sin(angle*bj_DEGTORAD),0.)
call UnitApplyTimedLife(dat.field,'BTLF',LIFESPAN)
set dat.i = 0
set dat.duration = R2I(LIFESPAN/TIMEOUT)
call SetTimerData(t,dat)
call TimerStart(t,TIMEOUT,true,function Update)
endfunction
private function OnLearn takes nothing returns boolean
local unit caster = GetTriggerUnit()
local player owner = GetOwningPlayer(caster)
if GetLearnedSkill() == SPELL and GetUnitAbilityLevel(caster,SPELL)>=2 then
call SetPlayerTechResearched(owner, UP, GetPlayerTechCount(owner,UP,true)+1)
endif
set caster = null
return false
endfunction
function PlasmaField takes unit hero returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterUnitEvent(t,hero,EVENT_UNIT_HERO_SKILL)
call TriggerAddCondition(t,Condition(function OnLearn))
endfunction
private function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, OnCast)
endfunction
endlibrary
//TESH.scrollpos=40
//TESH.alwaysfold=0
scope PlasmaFlare initializer init
globals
private constant integer SPELL = 'A0JR'
private constant integer FLARE_ID = 'o03K'
private constant real DUR = 60.
private constant real AOE = 250.
private constant real DMG = 500.
endglobals
private function UnitDeath takes nothing returns boolean
local unit victim = GetTriggerUnit()
local real x = GetUnitX(victim)
local real y = GetUnitY(victim)
call UnitDamageAll(victim,false,AOE,x,y,DMG,DMG_ENERGETIC,false,0,0,0)
set victim = null
return false
endfunction
private struct str
trigger trig
private static method createFilter takes unit u returns boolean
return GetUnitTypeId(u)==FLARE_ID
endmethod
private method onCreate takes nothing returns nothing
set .trig = CreateTrigger()
call TriggerRegisterUnitEvent(.trig,me,EVENT_UNIT_DEATH)
call TriggerAddCondition(.trig,Condition(function UnitDeath))
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
call DisableTrigger(.trig)
call DestroyTrigger(.trig)
set .trig = null
endmethod
implement AutoDestroy
endstruct
private struct s_wait
unit caster
real x
real y
endstruct
private function Wait takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_wait dat = GetTimerData(t)
local unit dummy = CreateUnit(GetOwningPlayer(dat.caster),FLARE_ID,dat.x,dat.y,0.)
call UnitApplyTimedLife(dummy,'BTLF',DUR)
call SetUnitPathing(dummy,false)
call ReleaseTimer(t)
call dat.destroy()
set dummy = null
endfunction
private function Cast takes nothing returns nothing
local timer t = NewTimer()
local s_wait dat = s_wait.create()
set dat.x = SpellEvent.TargetX
set dat.y = SpellEvent.TargetY
set dat.caster = SpellEvent.CastingUnit
call SetUnitAnimation( dat.caster, "spell throw" )
call SetTimerData(t, dat)
call TimerStart (t,1., false, function Wait )
endfunction
public function init takes nothing returns nothing
call RegisterSpellCastResponse(SPELL, Cast)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
library PlasmaTechnology needs TimerUtils
globals
private constant integer SPELL = 'A0B8'
private constant integer REACTION_REQ = 4
private constant integer REACTION_CHANCE = 40
private constant integer ID = 'o020'
private constant real LIFESPAN = 60.
private constant real DISTANCE = 150.
endglobals
private struct s_field
integer i
unit caster
unit field
integer duration
endstruct
private function Update takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_field dat = GetTimerData(t)
local real x1 = GetUnitX(dat.caster)
local real y1 = GetUnitY(dat.caster)
local real angle = GetUnitFacing(dat.caster)
local real x2 = x1 - DISTANCE*Cos(angle*bj_DEGTORAD)
local real y2 = y1 - DISTANCE*Sin(angle*bj_DEGTORAD)
if not (IsUnitType(dat.caster,UNIT_TYPE_DEAD)) and not (IsUnitType(dat.field,UNIT_TYPE_DEAD)) and dat.i < dat.duration then
set dat.i = dat.i + 1
call SetUnitPosition(dat.field,x2,y2)
call SetUnitFacing(dat.field,angle)
call SetUnitFlyHeight(dat.field,GetUnitFlyHeight(dat.caster),0.)
else
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function SpawnField takes unit caster returns nothing
local timer t = NewTimer()
local s_field dat = s_field.create()
local integer i = 0
local real x = GetUnitX(caster)
local real y = GetUnitY(caster)
local real angle = GetUnitFacing(caster)
set dat.caster = caster
set dat.field= CreateUnit(GetOwningPlayer(dat.caster),ID,x-DISTANCE*Cos(angle*bj_DEGTORAD),y-DISTANCE*Sin(angle*bj_DEGTORAD),0.)
call UnitApplyTimedLife(dat.field,'BTLF',LIFESPAN)
set dat.i = 0
set dat.duration = R2I(LIFESPAN/TIMEOUT)
call SetTimerData(t,dat)
call TimerStart(t,TIMEOUT,true,function Update)
endfunction
private function UnitAttacked takes nothing returns boolean
local unit whichUnit = GetTriggerUnit()
if GetUnitAbilityLevel(whichUnit,SPELL)>=REACTION_REQ and GetRandomInt(0,100)<=REACTION_CHANCE then
call SpawnField(whichUnit)
endif
set whichUnit = null
return false
endfunction
function PlasmaTechnology takes unit hero returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterUnitEvent(t,hero,EVENT_UNIT_ATTACKED)
call TriggerAddCondition(t,Condition(function UnitAttacked))
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope PretemporalKnowlede initializer init
globals
private constant integer SPELL = 'A0HE'
private constant integer DUMMY_SPELL = 'A04S'
private constant real DUR = 10.
endglobals
private function Actions takes nothing returns nothing
local unit dummy = CreateUnit(GetOwningPlayer(SpellEvent.CastingUnit),DUMMY,SpellEvent.TargetX,SpellEvent.TargetY,0.)
call UnitAddAbility(dummy,DUMMY_SPELL)
call SetUnitAbilityLevel(dummy,DUMMY_SPELL,GetUnitAbilityLevel(SpellEvent.CastingUnit,SPELL))
call IssuePointOrder(dummy,"cloudoffog",SpellEvent.TargetX,SpellEvent.TargetY)
call UnitApplyTimedLife(dummy,'BTLF',DUR)
set dummy = null
endfunction
public function init takes nothing returns nothing
call AbilityPreload(DUMMY_SPELL)
call RegisterSpellFinishResponse(SPELL,Actions)
endfunction
endscope
//TESH.scrollpos=27
//TESH.alwaysfold=0
library Prototype initializer init needs RegisterAnyUnitEvent, TimerUtils, AbilityPreload
globals
private constant integer SPELL = 'A0JO'
private constant integer ANTIDOTE_REQ = 1
private constant real ANTIDOTE_AMOUNT = 150.
private constant string ANTIDOTE_FX = "Abilities\\Spells\\NightElf\\FaerieDragonInvis\\FaerieDragon_Invis.mdl"
private constant integer PHEROMONE_CHANCE = 5
private constant real PHEROMONE_DUR = 5.
private constant integer PHEROMONE_REQ = 1
private constant string PHEROMONE_FX = "Abilities\\Spells\\Undead\\Curse\\CurseTarget.mdl"
private constant integer BATTERIES_BONUS = 'A04C'
private constant integer BATTERIES_REQ = 3
private constant integer SENTINENT_UP = 'R01L'
private constant integer SENTINENT_REQ = 6
endglobals
private struct str
unit target
player owner
unit realGeneralTarget
integer i
effect fx
endstruct
private function Update takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
call DestroyEffect(dat.fx)
set GeneralTarget = dat.realGeneralTarget
call SetUnitOwner(dat.target,dat.owner,false)
call ReleaseTimer(t)
call dat.destroy()
endfunction
private function AddPheromone takes unit target returns nothing
local timer t = NewTimer()
local str dat = str.create()
set dat.target = target
set dat.i = 0
set dat.fx = AddSpecialEffectTarget(PHEROMONE_FX,target,"origin")
set dat.owner = GetOwningPlayer(target)
call SetUnitOwner(target,Player(PLAYER_NEUTRAL_PASSIVE),false)
if GetUnitTypeId(GeneralTarget)!=GetUnitTypeId(dat.target) then
set dat.realGeneralTarget = GeneralTarget
set GeneralTarget = dat.target
endif
call SetTimerData(t,dat)
call TimerStart(t,PHEROMONE_DUR,false,function Update)
endfunction
private function UnitAttacked takes nothing returns boolean
local unit victim = GetTriggerUnit()
local unit attacker = GetAttacker()
if GetUnitAbilityLevel(attacker,SPELL)>=ANTIDOTE_REQ then
if not(IsUnitType(victim,UNIT_TYPE_MECHANICAL)) and IsUnitAlly(victim,GetOwningPlayer(attacker))==true then
call SetUnitState(victim,UNIT_STATE_LIFE,GetUnitState(victim,UNIT_STATE_LIFE)+ANTIDOTE_AMOUNT)
call DestroyEffect(AddSpecialEffectTarget(ANTIDOTE_FX,victim,"chest"))
endif
endif
if GetUnitAbilityLevel(attacker,SPELL)>=PHEROMONE_REQ then
if IsUnitEnemy(victim,GetOwningPlayer(attacker))==true and GetRandomInt(0,100)<=PHEROMONE_CHANCE then
call AddPheromone(victim)
endif
endif
set attacker = null
set victim = null
return false
endfunction
private function Conditions takes nothing returns boolean
local unit caster = GetTriggerUnit()
local player owner = GetOwningPlayer(caster)
if GetLearnedSkill() == SPELL then
if GetUnitAbilityLevel(caster,SPELL)==BATTERIES_REQ then
call UnitAddAbility(caster,BATTERIES_BONUS)
endif
if GetUnitAbilityLevel(caster,SPELL)==SENTINENT_REQ then
call SetPlayerTechResearched(owner,SENTINENT_UP,1)
endif
endif
set caster = null
return false
endfunction
function Prototype takes unit hero returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterUnitEvent(t,hero,EVENT_UNIT_HERO_SKILL)
call TriggerAddCondition(t,Condition(function Conditions))
call RegisterAnyUnitEvent(EVENT_PLAYER_UNIT_ATTACKED,function UnitAttacked)
endfunction
private function init takes nothing returns nothing
call AbilityPreload(BATTERIES_BONUS)
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope Purge initializer init
globals
private constant integer SPELL = 'A033'
private constant string SUCCESS_FRACTURE = "Fracture healed"
private constant string SUCCESS_POISON = "A poison removed"
endglobals
private function Actions takes nothing returns nothing
local unit target = SpellEvent.TargetUnit
if GetUnitAbilityLevel(target,BUFF_FRACT)>=1 then
call TextTagMessage(SUCCESS_FRACTURE,target,0.,50.,64.,90.,9,5.,4.)
call UnitRemoveAbility(target,BUFF_FRACT)
endif
if GetUnitAbilityLevel(target,BUFF_POISON1)>=1 or GetUnitAbilityLevel(target,BUFF_POISON2)>=1 then
if GetUnitAbilityLevel(target,BUFF_POISON1)>=1 then
call UnitRemoveAbility(target,BUFF_POISON1)
endif
if GetUnitAbilityLevel(target,BUFF_POISON2)>=1 then
call UnitRemoveAbility(target,BUFF_POISON2)
endif
call TextTagMessage(SUCCESS_POISON,target,0.,50.,64.,90.,9,5.,4.)
endif
set target = null
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL,Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope QCube initializer init
globals
private constant integer SPELL = 'A0GO'
private constant real LIFESPAN = 120.
private constant string FX = "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportCaster.mdl"
integer array CubeId [6]
endglobals
private function Spawn takes nothing returns nothing
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local real x = SpellEvent.TargetX
local real y = SpellEvent.TargetY
call DestroyEffect(AddSpecialEffect(FX,x,y) )
call UnitApplyTimedLife(CreateUnit(owner, CubeId[GetUnitAbilityLevel(SpellEvent.CastingUnit,SPELL)-1],x,y,0.),'BTLF',LIFESPAN)
call DestroyEffect(AddSpecialEffect(FX,x,y) )
endfunction
public function init takes nothing returns nothing
set CubeId[0] = 'n01D'
set CubeId[1] = 'n01C'
set CubeId[2] = 'n01E'
set CubeId[3] = 'n019'
set CubeId[4] = 'n01A'
set CubeId[5] = 'n01B'
call RegisterSpellFinishResponse(SPELL, Spawn)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope QCubeDetonate initializer init
globals
private constant integer SPELL_DETONATE = 'A0H6'
private constant real AOE = 300.
private constant real DMG = 2000.
private constant string FX1 = "FlameStrike1.mdx"
private constant string FX2 = "Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl"
endglobals
private function Detonate takes nothing returns nothing
local real x = GetUnitX(SpellEvent.CastingUnit)
local real y = GetUnitY(SpellEvent.CastingUnit)
call DestroyEffect(AddSpecialEffect(FX1,x,y))
call DestroyEffect(AddSpecialEffect(FX2,x,y))
call UnitDamageAll(SpellEvent.CastingUnit,false,AOE,x,y,DMG,DMG_EXPLOSIVE,false,0,0,0)
call KillUnit(SpellEvent.CastingUnit)
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL_DETONATE, Detonate)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope QCubeSignal initializer init
globals
private constant integer SPELL = 'A0H8'
private constant real TIMEOUT_PING = 15.
private constant real AOE = 2800.
private constant real MINRADIUS = 1200.
private constant integer SPECIAL_BUFF = 'A06R'
private integer TmpCount = 0
private unit Caster = null
endglobals
private function GetDistance takes unit u1, unit u2 returns real
local real x1 = GetUnitX(u1)
local real y1 = GetUnitY(u1)
local real x2 = GetUnitX(u2)
local real y2 = GetUnitY(u2)
return SquareRoot((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1))
endfunction
private function FilterClassA takes nothing returns boolean
local unit target = GetFilterUnit()
if GetUnitAbilityLevel(target,SPECIAL_BUFF)>=1 and not (IsUnitType(target,UNIT_TYPE_DEAD)) then
if GetDistance(Caster,target)>MINRADIUS then
set TmpCount = TmpCount + 1
call PingMinimapEx(GetUnitX(target),GetUnitY(target),3.,242,51,51,false)
if TmpCount > 6 then
set target = null
return false
endif
endif
endif
set target = null
return true
endfunction
private struct str
unit marine
endstruct
private function RavenScout takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
if not(IsUnitType(dat.marine,UNIT_TYPE_DEAD)) then
set TmpCount = 0
set Caster = dat.marine
call GroupEnumUnitsInRange(ENUM_GROUP,GetUnitX(dat.marine),GetUnitY(dat.marine),AOE,Filter(function FilterClassA))
else
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function ActivateSpecialPing takes unit marine returns nothing
local timer t = NewTimer()
local str dat = str.create()
set dat.marine = marine
set TmpCount = 0
call SetTimerData(t, dat)
call TimerStart (t, TIMEOUT_PING, true, function RavenScout )
endfunction
private function Conditions takes nothing returns boolean
local unit whichUnit = GetTriggerUnit()
if GetUnitAbilityLevel(whichUnit,SPELL)>=1 then
call ActivateSpecialPing(whichUnit)
endif
set whichUnit = null
return false
endfunction
public function init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterEnterRectSimple(t, bj_mapInitialPlayableArea)
call TriggerAddCondition(t, Condition(function Conditions))
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope QCubeTaunt initializer init
globals
private constant integer DUR = 15
private constant integer SPELL = 'A0H5'
endglobals
private struct str
unit caster
unit target
integer i
endstruct
private function Update takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
if dat.i < DUR and not (IsUnitType(dat.caster,UNIT_TYPE_DEAD)) then
set dat.i = dat.i + 1
else
set GeneralTarget = dat.target
call ReleaseTimer(t)
call dat.destroy()
endif
call ReleaseTimer(t)
call dat.destroy()
endfunction
private function Actions takes nothing returns nothing
local timer t = NewTimer()
local str dat = str.create()
set dat.caster = SpellEvent.CastingUnit
set dat.i = 0
if GetUnitTypeId(GeneralTarget)!=GetUnitTypeId(dat.caster) then
set dat.target = GeneralTarget
set GeneralTarget = dat.caster
endif
call SetTimerData(t, dat)
call TimerStart (t,1., true, function Update )
endfunction
public function init takes nothing returns nothing
call RegisterSpellCastResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope RadialImpulsion initializer init
globals
private constant integer SPELL = 'A0FS'
private constant string FX = "Units\\NightElf\\Wisp\\WispExplode.mdl"
private constant real AOE = 250.
private constant real DMG = 1000.
endglobals
private function Actions takes nothing returns nothing
local real x = SpellEvent.TargetX
local real y = SpellEvent.TargetY
call DestroyEffect(AddSpecialEffect(FX,x,y))
call UnitDamageAll(SpellEvent.CastingUnit,true,AOE,x,y,DMG,DMG_ENERGETIC,true,600,50,0.4)
endfunction
public function init takes nothing returns nothing
call RegisterSpellCastResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope ReconstructionNanites initializer init
globals
private constant integer SPELL = 'A08Q'
endglobals
private function Actions takes nothing returns nothing
call UnitAddBuffResidualNanites(SpellEvent.CastingUnit,SpellEvent.TargetUnit)
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL,Actions)
endfunction
endscope
//TESH.scrollpos=26
//TESH.alwaysfold=0
scope ReinforcementsSpell initializer init
globals
private constant integer SPELL = 'A09P'
private constant integer AMOUNT = 4
private constant string INFO = "Reinforcements arrived."
endglobals
private function SwitchOldUnits takes nothing returns boolean
local integer i = 0
local unit marine = GetFilterUnit()
local integer marineId = GetUnitTypeId(marine)
loop
exitwhen i > AlliedIdMax
if marineId == AlliedId[i] and marine!= null and not(IsUnitType(marine,UNIT_TYPE_DEAD)) then
if GameMode == 6 then
call KillUnit(marine)
else
call SetUnitOwner(marine,Player(10),true)
call UnitAddAbility(marine,LASTQUESTUNIT_SPELL)
call IssuePointOrder(marine,LASTQUESTUNIT_ORDER,GetRectCenterX(gg_rct_LastQuest),GetRectCenterY(gg_rct_LastQuest))
endif
set marine = null
return true
endif
set i = i + 1
endloop
set marine = null
return true
endfunction
private function Spawn takes nothing returns nothing
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local integer ownerId = GetPlayerId(owner)
local real x = GetRectCenterX(gg_rct_Reinforcement)
local real y = GetRectCenterY(gg_rct_Reinforcement)
local integer i = 0
local unit spawned = null
call GroupEnumUnitsOfPlayer(ENUM_GROUP,owner,Filter(function SwitchOldUnits))
loop
exitwhen i > AMOUNT-1
set spawned = CreateUnit(owner, AlliedId[GetRandomInt(0,AlliedIdMax)],x,y,0.)
call IssueImmediateOrder(spawned,ACTIVATE_AI_ORDER)
set i = i + 1
endloop
call DisplayAll(PlayerColor[ownerId]+GetPlayerName(owner),INFO)
call PingMinimap(x,y,1.)
set spawned = null
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Spawn)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope Release initializer init
globals
private constant integer SPELL = 'A00P'
private constant integer BUFF = 'B02Z'
private constant string FX = "Abilities\\Spells\\Other\\HealTarget2\\HealTarget2.mdl"
endglobals
private function RemoveBuff takes nothing returns boolean
if GetUnitAbilityLevel(GetFilterUnit(),BUFF)>=1 then
call UnitRemoveAbility(GetFilterUnit(),BUFF)
endif
return true
endfunction
private function Actions takes nothing returns nothing
call GroupEnumUnitsInRect(ENUM_GROUP,bj_mapInitialPlayableArea, Filter(function RemoveBuff))
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=2
//TESH.alwaysfold=0
scope RemoteBomb initializer init
globals
private constant integer REMOTEBOMB_ID = 'n00R'
private constant integer SPELL = 'A01E'
private constant integer SPELL_ITEM = 'A073'
private constant integer SPELL__BOMB_DETONATE = 'A02E'
private constant real AOE = 300.
private constant real DMG = 2000.
private constant string FX1 = "FlameStrike1.mdx"
private constant string FX2 = "Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl"
endglobals
private function Detonate takes nothing returns nothing
call KillUnit(SpellEvent.CastingUnit)
endfunction
private function UnitDeath takes nothing returns boolean
local unit victim = GetTriggerUnit()
local real x = GetUnitX(victim)
local real y = GetUnitY(victim)
call DestroyEffect(AddSpecialEffect(FX1,x,y))
call DestroyEffect(AddSpecialEffect(FX2,x,y))
call UnitDamageAll(victim,false,AOE,x,y,DMG,DMG_EXPLOSIVE,false,0,0,0)
set victim = null
return false
endfunction
private struct str
trigger trig
private static method createFilter takes unit u returns boolean
return GetUnitTypeId(u)==REMOTEBOMB_ID
endmethod
private method onCreate takes nothing returns nothing
set .trig = CreateTrigger()
call TriggerRegisterUnitEvent(.trig,me,EVENT_UNIT_DEATH)
call TriggerAddCondition(.trig,Condition(function UnitDeath))
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
call DisableTrigger(.trig)
call DestroyTrigger(.trig)
set .trig = null
endmethod
implement AutoDestroy
endstruct
private function Spawn takes nothing returns nothing
call CreateUnit(GetOwningPlayer(SpellEvent.CastingUnit),REMOTEBOMB_ID,SpellEvent.TargetX,SpellEvent.TargetY,0.)
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Spawn)
call RegisterSpellFinishResponse(SPELL_ITEM, Spawn)
call RegisterSpellFinishResponse(SPELL__BOMB_DETONATE, Detonate)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope Replacement initializer init
globals
private constant integer SPELL = 'A08T'
private constant string SUCCESS = "Fracture healed"
private constant string FX = "Abilities\\Spells\\Orc\\FeralSpirit\\feralspiritdone.mdl"
endglobals
private function Actions takes nothing returns nothing
local unit caster = SpellEvent.CastingUnit
if GetUnitAbilityLevel(caster,BUFF_FRACT)>=1 then
call DestroyEffect(AddSpecialEffectTarget(FX,caster,"origin"))
call UnitRemoveAbility(caster,BUFF_FRACT)
call TextTagMessage(SUCCESS,caster,0.,50.,64.,90.,9,5.,4.)
endif
set caster = null
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
library Resistance needs AmmoSystem
globals
private constant integer SPELL = 'A0CV'
private constant integer RELOAD_REQ = 2
private constant integer RELOAD_BONUS = 8
private constant real RELOAD_TIME = 2.
endglobals
private function Conditions takes nothing returns boolean
local unit caster = GetTriggerUnit()
if GetLearnedSkill() == SPELL then
if GetUnitAbilityLevel(caster,SPELL) == RELOAD_REQ then
call UpgradeReloadWeapon(caster,RELOAD_TIME)
call UpgradeMaxWeapon(caster,RELOAD_BONUS)
endif
endif
set caster = null
return false
endfunction
function Resistance takes unit hero returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterUnitEvent(t,hero,EVENT_UNIT_HERO_SKILL)
call TriggerAddCondition(t,Condition(function Conditions))
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope RetreiveNanites initializer init
globals
private constant integer SPELL = 'A02Y'
private constant real DMG = 50.
private constant real MANA = 50.
private constant real AOE = 400.
private constant integer DUMMY_SPELL = 'S004'
private constant real DUR = 2.
private unit Caster
private real Dmg
endglobals
private function CheckEnemies takes nothing returns boolean
local unit target = GetFilterUnit()
if GetUnitAbilityLevel(target,BUFF_RESIDUAL_NANITES)>=1 then
call UnitDamageTarget(Caster,target,DMG,false,false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
endif
set target = null
return true
endfunction
private function Cast takes nothing returns nothing
local unit dummy = CreateUnit(GetOwningPlayer(SpellEvent.CastingUnit),DUMMY,SpellEvent.TargetX,SpellEvent.TargetY,0.)
call UnitAddAbility(dummy,DUMMY_SPELL)
call UnitApplyTimedLife(dummy,'BTLF',DUR)
call SetUnitState(SpellEvent.CastingUnit,UNIT_STATE_MANA,GetUnitState(SpellEvent.CastingUnit,UNIT_STATE_MANA)+MANA)
set Caster = SpellEvent.CastingUnit
call GroupEnumUnitsInRange(ENUM_GROUP,SpellEvent.TargetX,SpellEvent.TargetY,AOE,Filter(function CheckEnemies))
set dummy = null
endfunction
public function init takes nothing returns nothing
call AbilityPreload(DUMMY_SPELL)
call RegisterSpellCastResponse(SPELL, Cast)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope Ride initializer init
globals
private constant integer SPELL = 'A0IK'
private constant string FX = "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportCaster.mdl"
private constant integer MECH_ID = 'h001'
private constant string INFO = "Fury teleportation complete."
private constant integer COUNT = 2
endglobals
private function CheckDrone takes nothing returns boolean
local unit target = GetFilterUnit()
local integer targetId = GetUnitTypeId(target)
if targetId==MECH_ID then
call KillUnit(target)
endif
set target = null
return true
endfunction
private function Spawn takes nothing returns nothing
local unit spawned = null
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local integer ownerId = GetPlayerId(owner)
local real x = GetRectCenterX(gg_rct_SpawnAllied)
local real y = GetRectCenterY(gg_rct_SpawnAllied)
local integer i = 0
call GroupEnumUnitsOfPlayer(ENUM_GROUP,owner,Filter(function CheckDrone))
loop
exitwhen i > COUNT-1
set spawned = CreateUnit(owner, MECH_ID,x,y,0.)
call DestroyEffect(AddSpecialEffectTarget(FX, spawned, "origin") )
call IssueImmediateOrder(spawned,ACTIVATE_AI_ORDER)
set i = i + 1
endloop
call DisplayAll(PlayerColor[ownerId]+GetPlayerName(owner),INFO)
call PingMinimap(x,y,1.)
set spawned = null
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Spawn)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope RifleGrenade initializer init
globals
private constant integer SPELL = 'A00S'
private constant integer SPELL_NPC = 'A096'
private constant real AOE = 225.00
private constant real DMG_BASE = 200.
private constant real DMG_COEFF = 200.
endglobals
private function Actions takes nothing returns nothing
local unit caster = SpellEvent.CastingUnit
local real x = SpellEvent.TargetX
local real y = SpellEvent.TargetY
local real dmg = DMG_BASE + DMG_COEFF*GetUnitAbilityLevel(caster,SpellEvent.AbilityId)
if SpellEvent.AbilityId == SPELL_NPC then
set dmg = 800.
endif
call GrenadeSound(x,y)
call TextTagMessage("Grenade!",caster, 0., 50., 64., 90., 9, 5., 2.00 )
call UnitDamageAll(caster,true,AOE,x,y,dmg,DMG_EXPLOSIVE,true,50,10,0.2)
set caster = null
endfunction
public function init takes nothing returns nothing
call RegisterSpellCastResponse(SPELL, Actions)
call RegisterSpellCastResponse(SPELL_NPC, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
library RobotDrone initializer init needs GroupUtils,GroupFunction,AutoIndex,TimerUtils,SpellEvent
globals
private constant integer UNIT_ID = 'H00H'
private constant integer DRONE_ID = 'n00K'
private constant real DISTANCE = 100.
private constant real TIMEOUT_CHECK = 2.
private constant real AOE = 700.
private constant real DUR = 30.
private constant integer MAX = 3
private constant string FX = "Abilities\\Spells\\Items\\ScrollOfRegeneration\\Scroll_Regen_Target.mdl"
private constant integer SPELL = 'A036'
private constant integer UP = 'R002'
private group TargetGroup
private real CasterX = 0.
private real CasterY = 0.
private real NearestDistance = 0.
private unit Target = null
endglobals
private struct str
unit caster = null
unit drone1 = null
unit drone2 = null
integer state1 = 0 //1 orbit, 2 attack, 3 back
integer state2 = 0
real angle1 = 0.
real angle2 = 0.
player owner = null
timer tOrbit = null
timer tCheck = null
unit target1 = null
unit target2 = null
private static method createFilter takes unit u returns boolean
return GetUnitTypeId(u)==UNIT_ID
endmethod
private method onCreate takes nothing returns nothing
set .drone1 = null
set .drone2 = null
set .caster = me
set .owner = GetOwningPlayer(me)
set .tOrbit = null
set .tCheck = null
set .state1 = 0
set .state2 = 0
set .angle1 = 0.
set .angle2 = 0.
set .target1 = null
set .target2 = null
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
set .drone1 = null
set .drone2 = null
set .caster = null
set .owner = null
set .tOrbit = null
endmethod
implement AutoDestroy
endstruct
private function SetToBack takes unit drone returns nothing
local str dat = str[Hero[GetPlayerId(GetOwningPlayer(drone))]]
if drone == dat.drone1 then
set dat.state1 = 3
elseif drone == dat.drone2 then
set dat.state2 = 3
endif
endfunction
private function TargetUnderAttack takes nothing returns boolean
local unit attacker = GetAttacker()
if GetUnitTypeId(attacker)==DRONE_ID then
call SetToBack(attacker)
endif
set attacker = null
return false
endfunction
private function CheckNearestTarget takes nothing returns nothing
local unit enumUnit = GetEnumUnit()
local real x2 = GetUnitY(enumUnit)
local real y2 = GetUnitX(enumUnit)
local real dist = SquareRoot((CasterX-x2)*(CasterX-x2)+(CasterY-y2)*(CasterY-y2))
if NearestDistance < 0 or dist < NearestDistance then
set Target = enumUnit
set NearestDistance = dist
endif
set enumUnit = null
endfunction
private function CheckIfTarget takes nothing returns boolean
return GetOwningPlayer(GetFilterUnit())==Player(11) or GetOwningPlayer(GetFilterUnit())==Player(13) or GetOwningPlayer(GetFilterUnit())==Player(14)
endfunction
private function FindNearestTarget takes real x, real y returns unit
set NearestDistance = -1
set CasterX = x
set CasterY = y
set Target = null
set TargetGroup = NewGroup()
call GroupEnumUnitsInRange(TargetGroup, CasterX,CasterY, AOE, Filter(function CheckIfTarget))
call ForGroup(TargetGroup, function CheckNearestTarget)
call ReleaseGroup(TargetGroup)
return Target
endfunction
private function UpdateCheck takes nothing returns nothing
local str dat = GetTimerData(GetExpiredTimer())
local real x = GetUnitX(dat.caster)
local real y = GetUnitY(dat.caster)
if dat.state1 == 1 then
set dat.target1 = FindNearestTarget(x,y)
if dat.target1 != null and not (IsUnitType(dat.target1,UNIT_TYPE_DEAD)) then
set dat.state1 = 2
call IssueTargetOrder(dat.drone1,"attack",dat.target1)
endif
elseif dat.state2 == 1 then
set dat.target2 = FindNearestTarget(x,y)
if dat.target2 != null and not (IsUnitType(dat.target2,UNIT_TYPE_DEAD)) then
set dat.state2 = 2
call IssueTargetOrder(dat.drone2,"attack",dat.target2)
endif
endif
endfunction
private function UpdateOrbit takes nothing returns nothing
local str dat = GetTimerData(GetExpiredTimer())
local real x1 = GetUnitX(dat.caster)
local real y1 = GetUnitY(dat.caster)
local real x2 = 0.
local real y2 = 0.
if not (IsUnitType(dat.caster,UNIT_TYPE_DEAD)) then
if not (IsUnitType(dat.drone1,UNIT_TYPE_DEAD)) then
if dat.state1 == 1 then
set dat.angle1 = dat.angle1 + (1.*bj_DEGTORAD)
set x2 = x1 + DISTANCE*Cos(dat.angle1)
set y2 = y1 + DISTANCE*Sin(dat.angle1)
call SetUnitPosition(dat.drone1,x2,y2)
elseif dat.state1 == 3 then
set x2 = GetUnitX(dat.drone1)
set y2 = GetUnitY(dat.drone2)
if SquareRoot((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)) > DISTANCE then
call IssuePointOrder(dat.drone1,"move",x1,y1)
else
set dat.state1 = 1
endif
endif
endif
if not (IsUnitType(dat.drone2,UNIT_TYPE_DEAD)) then
if dat.state2 == 1 then
set dat.angle2 = dat.angle2 + (1.*bj_DEGTORAD)
set x2 = x1 + DISTANCE*Cos(dat.angle2)
set y2 = y1 + DISTANCE*Sin(dat.angle2)
call SetUnitPosition(dat.drone2,x2,y2)
elseif dat.state2 == 3 then
set x2 = GetUnitX(dat.drone2)
set y2 = GetUnitY(dat.drone2)
if SquareRoot((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)) > DISTANCE then
call IssuePointOrder(dat.drone2,"move",x1,y1)
else
set dat.state2 = 1
endif
endif
endif
if IsUnitType(dat.drone1,UNIT_TYPE_DEAD) and IsUnitType(dat.drone2,UNIT_TYPE_DEAD) then
call ReleaseTimer(dat.tOrbit)
call ReleaseTimer(dat.tCheck)
endif
else
call KillUnit(dat.drone1)
call KillUnit(dat.drone2)
call ReleaseTimer(dat.tOrbit)
call ReleaseTimer(dat.tCheck)
endif
endfunction
private function SpawnDrone takes nothing returns nothing
local str dat=str[SpellEvent.CastingUnit]
local real x = GetUnitX(dat.caster)
local real y = GetUnitY(dat.caster)
set dat.drone1 = CreateUnit(dat.owner,DRONE_ID,x,y,0.)
set dat.drone2 = CreateUnit(dat.owner,DRONE_ID,x,y,0.)
call UnitApplyTimedLife(dat.drone1,'BTLF',DUR)
call UnitApplyTimedLife(dat.drone2,'BTLF',DUR)
call SetUnitPathing(dat.drone1,false)
call SetUnitPathing(dat.drone2,false)
set dat.state1 = 1
set dat.state2 = 1
set dat.angle1 = 0.*bj_DEGTORAD
set dat.angle2 = 180.*bj_DEGTORAD
set dat.tOrbit = NewTimer()
call SetTimerData(dat.tOrbit,dat)
call TimerStart(dat.tOrbit,TIMEOUT,true,function UpdateOrbit)
set dat.tCheck = NewTimer()
call SetTimerData(dat.tCheck,dat)
call TimerStart(dat.tCheck,TIMEOUT,true,function UpdateCheck)
endfunction
private function OnLearn takes nothing returns boolean
local unit caster = GetTriggerUnit()
local player owner = GetOwningPlayer(caster)
if GetLearnedSkill() == SPELL then
call SetPlayerTechResearched(owner, UP, GetPlayerTechCount(owner,UP,true)+1)
endif
set caster = null
return false
endfunction
function RobotDrone takes unit hero returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterUnitEvent(t,hero,EVENT_UNIT_HERO_SKILL)
call TriggerAddCondition(t,Condition(function OnLearn))
endfunction
private function init takes nothing returns nothing
local trigger t = CreateTrigger()
call RegisterSpellFinishResponse(SPELL, SpawnDrone)
call TriggerRegisterPlayerUnitEvent(t,Player(11), EVENT_PLAYER_UNIT_ATTACKED,null )
call TriggerRegisterPlayerUnitEvent(t,Player(13), EVENT_PLAYER_UNIT_ATTACKED,null )
call TriggerRegisterPlayerUnitEvent(t,Player(14), EVENT_PLAYER_UNIT_ATTACKED,null )
call TriggerAddCondition(t, Condition( function TargetUnderAttack ) )
endfunction
endlibrary
//TESH.scrollpos=135
//TESH.alwaysfold=0
scope DemolitionRockets initializer init
globals
private constant real AOE_EXPLO = 300
private constant real AOE_ENERG = 150
private constant real AOE_ANTHRAX = 300
private constant integer SPEED = 75
private constant integer SPELL_EXPLO = 'A0EZ'
private constant integer SPELL_ENERG = 'A01S'
private constant integer SPELL_ANTHRAX = 'A0K1'
private constant integer SPELL_EXPLO_APACHE = 'A0F1'
private constant integer SPELL_ENERG_APACHE = 'A0EA'
private constant string FX = "war3mapImported\\Barrage.mdx"
private constant real DMG_BASE_EXPLO = 250.
private constant real DMG_COEFF_EXPLO = 250.
private constant real DMG_BASE_ENERG = 0.
private constant real DMG_COEFF_ENERG = 500.
private constant real DMG_BASE_ANTHRAX = 100.
private constant real DMG_COEFF_ANTHRAX = 100.
private constant real DMG_BASE_EXPLO_APACHE = 1000.
private constant real DMG_BASE_ENERG_APACHE = 4000.
private constant integer MODE_EXPLO = 1
private constant integer MODE_ENERG = 2
private constant integer MODE_ANTHRAX = 3
private constant real WAIT = 1.
private constant integer ROCKET_EXPLO = 'h01I'
private constant integer ROCKET_ENERG = 'h01J'
private constant integer ROCKET_ANTHRAX = 'h027'
private constant integer DUMMY_ANTHRAX = 'o03M'
private constant integer BUFF_ANTHRAX = 'A0K5'
private constant real ANTHRAX_DUR = 10.
endglobals
private function DamageEffect takes unit caster, real x, real y, integer mode returns nothing
local real dmg = 0.
local real aoe = 0.
local unit dummy = null
if mode == MODE_EXPLO then
if GetUnitAbilityLevel(caster,SPELL_EXPLO_APACHE)>=1 then
set dmg = DMG_BASE_EXPLO_APACHE
else
set dmg = DMG_BASE_EXPLO+DMG_COEFF_EXPLO*GetUnitAbilityLevel(caster,SPELL_EXPLO)
endif
set aoe = AOE_EXPLO
call DestroyEffect(AddSpecialEffect(FX,x,y))
call UnitDamageAll(caster,true,aoe,x,y,dmg,DMG_EXPLOSIVE,true,200,50,0.2)
elseif mode == MODE_ENERG then
if GetUnitAbilityLevel(caster,SPELL_ENERG_APACHE)>=1 then
set dmg = DMG_BASE_ENERG_APACHE
else
set dmg = DMG_BASE_ENERG+DMG_COEFF_ENERG*GetUnitAbilityLevel(caster,SPELL_ENERG)
endif
set aoe = AOE_ENERG
call DestroyEffect(AddSpecialEffect(FX,x,y))
call UnitDamageAll(caster,true,aoe,x,y,dmg,DMG_ENERGETIC,true,400,50,0.2)
elseif mode == MODE_ANTHRAX then
set dmg = DMG_BASE_ANTHRAX+DMG_COEFF_ANTHRAX*GetUnitAbilityLevel(caster,SPELL_ANTHRAX)
set aoe = AOE_ANTHRAX
call UnitDamageAll(caster,true,aoe,x,y,dmg,DMG_PHYSIC,true,400,50,0.2)
set dummy = CreateUnit(GetOwningPlayer(caster),DUMMY_ANTHRAX,x,y,0.)
call SetUnitAbilityLevel(dummy,BUFF_ANTHRAX,GetUnitAbilityLevel(caster,SPELL_ANTHRAX))
call UnitApplyTimedLife(dummy,'BTLF',ANTHRAX_DUR)
endif
set dummy = null
endfunction
private struct s_move
unit caster
unit rocket
real angle
integer distance
integer i
integer mode
endstruct
private function UpdateMove takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_move dat = GetTimerData(t)
local real x = GetUnitX(dat.rocket)
local real y = GetUnitY(dat.rocket)
local real newX = x + SPEED*Cos(dat.angle)
local real newY = y + SPEED*Sin(dat.angle)
if dat.i < dat.distance then
set dat.i = dat.i + 1
call SetUnitPosition(dat.rocket,newX,newY)
else
call KillUnit(dat.rocket)
call ExplosionSound(x,y)
call DamageEffect(dat.caster,x,y,dat.mode)
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function StartMove takes unit caster, real x1, real y1, real x2, real y2, integer mode returns nothing
local timer t = NewTimer()
local s_move dat = s_move.create()
local integer rocketId = 0
set dat.caster = caster
set dat.angle = Atan2((y2 -y1), (x2 - x1))
set dat.distance = R2I(SquareRoot((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)))/SPEED
set dat.i = 0
set dat.mode = mode
if dat.mode == MODE_EXPLO then
set rocketId = ROCKET_EXPLO
elseif dat.mode == MODE_ENERG then
set rocketId = ROCKET_ENERG
elseif dat.mode == MODE_ANTHRAX then
set rocketId = ROCKET_ANTHRAX
endif
set dat.rocket = CreateUnit(GetOwningPlayer(dat.caster),rocketId,x1,y1,0.)
call RocketSound(x1,y1)
call SetUnitPathing(dat.rocket, false)
call SetUnitFacing(dat.rocket,dat.angle*bj_RADTODEG)
call SetTimerData(t, dat)
call TimerStart (t, TIMEOUT, true, function UpdateMove )
endfunction
private struct s_delay
unit caster
real x1
real y1
real x2
real y2
integer mode
endstruct
private function Wait takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_delay dat = GetTimerData(t)
call StartMove(dat.caster,dat.x1,dat.y1,dat.x2,dat.y2,dat.mode)
call ReleaseTimer(t)
call dat.destroy()
endfunction
private function OnCast takes nothing returns nothing
local timer t = NewTimer()
local s_delay dat = s_delay.create()
set dat.caster = SpellEvent.CastingUnit
set dat.x1 = GetUnitX(SpellEvent.CastingUnit)
set dat.y1 = GetUnitY(SpellEvent.CastingUnit)
set dat.x2 = SpellEvent.TargetX
set dat.y2 = SpellEvent.TargetY
if SpellEvent.AbilityId ==SPELL_EXPLO or SpellEvent.AbilityId ==SPELL_EXPLO_APACHE then
set dat.mode = MODE_EXPLO
elseif SpellEvent.AbilityId == SPELL_ENERG or SpellEvent.AbilityId == SPELL_ENERG_APACHE then
set dat.mode = MODE_ENERG
elseif SpellEvent.AbilityId == SPELL_ANTHRAX then
set dat.mode = MODE_ANTHRAX
endif
call GrenadeSound(dat.x1,dat.y1)
call TextTagMessage("Boom!", dat.caster, 0., 50., 64., 90., 9, 5., 2.00 )
call SetTimerData(t, dat)
call TimerStart (t, WAIT, false, function Wait )
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL_EXPLO, OnCast)
call RegisterSpellFinishResponse(SPELL_ENERG, OnCast)
call RegisterSpellFinishResponse(SPELL_EXPLO_APACHE, OnCast)
call RegisterSpellFinishResponse(SPELL_ENERG_APACHE, OnCast)
call RegisterSpellFinishResponse(SPELL_ANTHRAX, OnCast)
endfunction
endscope
//TESH.scrollpos=32
//TESH.alwaysfold=0
scope Rush initializer init
globals
private constant integer DRONE_ID = 'n00G'
private constant real LIFESPAN = 60.
private constant string INFO = "Reinforcements incoming by the aerial way."
private constant integer SPELL ='A0AQ'
private constant integer SPEED = 25
private constant real SPAWN_DISTANCE = 4000.
private constant real SPAWN_Z = 500.
private constant real WAIT = 3.
endglobals
private struct s_control
unit marine
endstruct
private function RemoveControl takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_control dat = GetTimerData(t)
if not (IsUnitType(dat.marine,UNIT_TYPE_DEAD)) and dat.marine != null then
call SetUnitOwner(dat.marine,Player(10),true)
call UnitAddAbility(dat.marine,LASTQUESTUNIT_SPELL)
call IssuePointOrder(dat.marine,LASTQUESTUNIT_ORDER,GetRectCenterX(gg_rct_LastQuest),GetRectCenterY(gg_rct_LastQuest))
endif
call ReleaseTimer(t)
call dat.destroy()
endfunction
private function StartRemoveControl takes unit marine returns nothing
local timer t = NewTimer()
local s_control dat = s_control.create()
set dat.marine = marine
call SetTimerData(t, dat)
call TimerStart (t, LIFESPAN, false, function RemoveControl)
endfunction
private struct s_delay
unit drone
integer level
endstruct
private function Wait takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_delay dat = GetTimerData(t)
local integer i = 0
local real x = GetUnitX(dat.drone)
local real y = GetUnitY(dat.drone)
local player owner = GetOwningPlayer(dat.drone)
call SetUnitFlyHeight(dat.drone,SPAWN_Z,300.)
call UnitAddAbility(dat.drone,LASTQUESTUNIT_SPELL)
call IssuePointOrder(dat.drone,LASTQUESTUNIT_ORDER,GetRectCenterX(gg_rct_LastQuest),GetRectCenterY(gg_rct_LastQuest))
loop
exitwhen i > dat.level-1
if GameMode == 6 then
call UnitApplyTimedLife(CreateUnit(owner,AlliedId[GetRandomInt(0,AlliedIdMax)],x,y,0.),'BTLF',LIFESPAN)
else
call StartRemoveControl(CreateUnit(Player(10),AlliedId[GetRandomInt(0,AlliedIdMax)],x,y,0.))
endif
set i = i + 1
endloop
call ReleaseTimer(t)
call dat.destroy()
endfunction
private function DelayControl takes unit drone, integer level returns nothing
local timer t = NewTimer()
local s_delay dat = s_delay.create()
set dat.level = level
set dat.drone = drone
call SetTimerData(t, dat)
call TimerStart (t, WAIT, false, function Wait)
endfunction
private struct s_drop
player owner
unit drone
integer level
real angle
integer distance
integer i
endstruct
private function Update takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_drop dat = GetTimerData(t)
local real newX = GetUnitX(dat.drone) + SPEED*Cos(dat.angle)
local real newY = GetUnitY(dat.drone) + SPEED*Sin(dat.angle)
if dat.i < dat.distance then
set dat.i = dat.i + 1
call SetUnitPosition(dat.drone, newX, newY)
else
call SetUnitFlyHeight(dat.drone,100.,300.)
call DelayControl(dat.drone,dat.level)
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function Actions takes nothing returns nothing
local timer t = NewTimer()
local s_drop dat = s_drop.create()
local real x1 = GetUnitX(SpellEvent.CastingUnit)
local real y1 = GetUnitY(SpellEvent.CastingUnit)
local real x2 = SpellEvent.TargetX
local real y2 = SpellEvent.TargetY
local real angle = Atan2((y2 -y1), (x2 - x1))
local real x3 = CheckPointValidity(x1 - SPAWN_DISTANCE*Cos(angle),MapXMin,MapXMax)
local real y3 = CheckPointValidity(y1 - SPAWN_DISTANCE*Sin(angle),MapYMin,MapYMax)
local real x4 = CheckPointValidity(x2 + SPAWN_DISTANCE*Cos(angle),MapXMin,MapXMax)
local real y4 = CheckPointValidity(y2 + SPAWN_DISTANCE*Sin(angle),MapYMin,MapYMax)
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local integer ownerId = GetPlayerId(owner)
call DisplayAll(PlayerColor[ownerId]+GetPlayerName(owner),INFO)
call PingMinimap(x2,y2,1.)
set dat.angle = angle
set dat.distance =R2I(SquareRoot((x3-x2)*(x3-x2)+(y3-y2)*(y3-y2))/SPEED)
set dat.i = 0
set dat.owner = owner
set dat.drone = CreateUnit(dat.owner,DRONE_ID,x3,y3, dat.angle*bj_RADTODEG )
call SetUnitFlyHeight(dat.drone,SPAWN_Z,0.)
set dat.level = GetUnitAbilityLevel(SpellEvent.CastingUnit,SPELL)
call SetTimerData(t, dat)
call TimerStart (t, TIMEOUT, true, function Update)
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope Safety initializer init
globals
private constant string ON = "darkportal"
private constant integer SPELL = 'A06D'
private constant integer BONUS = 'A0A9'
private constant integer BUFF = 'B01R'
endglobals
private function UnitOrder takes nothing returns boolean
local unit marine = GetTriggerUnit()
local string order = OrderId2String(GetIssuedOrderId())
if order == ON then
if GetUnitAbilityLevel(marine,BONUS)<=0 then
call UnitAddAbility(marine,BONUS)
call UnitAddAbility(marine,GARN)
call TextTagMessage("safety on",marine, 0., 50., 64., 90., 9, 5., 2.00 )
else
if GetUnitAbilityLevel(marine,BONUS)>=1 then
call UnitRemoveAbility(marine,BONUS)
endif
if GetUnitAbilityLevel(marine,BUFF)>=1 then
call UnitRemoveAbility(marine,BUFF)
endif
if GetUnitAbilityLevel(marine,GARN)>=1 then
call UnitRemoveAbility(marine,GARN)
endif
call TextTagMessage("safety off",marine, 0., 50., 64., 90., 9, 5., 2.00 )
endif
endif
set marine = null
return false
endfunction
private struct str
trigger trig
private static method createFilter takes unit u returns boolean
return GetUnitAbilityLevel(u,SPELL)>=1
endmethod
private method onCreate takes nothing returns nothing
set .trig = CreateTrigger()
call TriggerRegisterUnitEvent(.trig,me,EVENT_UNIT_ISSUED_ORDER)
call TriggerAddCondition(.trig,Condition(function UnitOrder))
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
call DisableTrigger(.trig)
call DestroyTrigger(.trig)
set .trig = null
endmethod
implement AutoDestroy
endstruct
public function init takes nothing returns nothing
call AbilityPreload(BONUS)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope Satchel initializer init
globals
private integer TimerCurrent = 5
private constant integer TOGGLE_TIMER_REQ = 3
private constant integer MINIBOSS_ID = 'u011'
private constant integer SPELL_EXPLOSIVE_SCIENCE ='A03Z'
private constant integer SATCHEL_ID = 'n005'
private constant integer SPELL = 'A021'
private constant integer SPELL_ITEM = 'A07D'
private constant integer SPELL_TIMER = 'A07I'
private constant integer MODEMAX = 10
private constant integer ROCKID = 'e002'
private constant integer DUMMY_DUST = 'o00G'
private string array FrankText [10]
private integer FrankCount = 0
private integer array TimerMode [10]
private rect array CaveRect [7]
private constant real AOE = 800.
private constant real RADIUS = 400.
private constant real DMG = 20000.
private constant integer AMOUNT = 15
private constant string COM_TIMER = "-prime"
private integer Com_Timer_Lenght = 0
private constant string TEXT_TIMER = " Satchel Timer set to : "
private constant string TEXT_EXPLODE = " Satchel exploding in : "
private constant string FX = "Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl"
endglobals
private function SetSatchelVariables takes nothing returns nothing
set Com_Timer_Lenght = StringLength(COM_TIMER)
set TimerMode[0] = 1
set TimerMode[1] = 2
set TimerMode[2] = 3
set TimerMode[3] = 4
set TimerMode[4] = 5
set TimerMode[5] = 6
set TimerMode[6] = 7
set TimerMode[7] = 8
set TimerMode[8] = 9
set TimerMode[9] = 10
set CaveRect[1]=gg_rct_Spawn001
set CaveRect[2]=gg_rct_Spawn002
set CaveRect[3]=gg_rct_Spawn003
set CaveRect[4]=gg_rct_Spawn004
set CaveRect[5]=gg_rct_Spawn005
set CaveRect[6]=gg_rct_Spawn006
set FrankText[0]="Stupid men. Do not kill zombies. They required years of work!"
set FrankText[1]="Stop to destroy my experiments! You are destroying the best weapons ever!"
set FrankText[2]="You will die for your arrogance."
set FrankText[3]="You will pay for your ignorance. Can't you understand zombies are my tools?"
set FrankText[4]="I will never forgive this. When you seal the caves, my creations are stucked!"
set FrankText[5]="You will not be able to kill me. I'm like them, you know?"
endfunction
private function FrankTalk takes nothing returns nothing
call ReleaseTimer(GetExpiredTimer())
call DisplayAll("Doctor Frank",FrankText[FrankCount])
endfunction
private function StartFrankText takes nothing returns nothing
local timer t = NewTimer()
call TimerStart(t,GetRandomReal(5.,20.),false,function FrankTalk)
endfunction
private function ToggleTimer takes nothing returns nothing
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local integer ownerId = GetPlayerId(owner)
local integer i = 0
loop
exitwhen i > MODEMAX
if TimerCurrent == TimerMode[i] and i < MODEMAX-1 then
set TimerCurrent = TimerMode[i+1]
call DisplayAll(GetPlayerName(owner),TEXT_TIMER+I2S(TimerCurrent)+ " seconds")
set owner = null
return
endif
set i = i + 1
endloop
if TimerCurrent == TimerMode[MODEMAX-1] then
set TimerCurrent = TimerMode[0]
call DisplayAll(PlayerColor[ownerId]+GetPlayerName(owner),TEXT_TIMER+I2S(TimerCurrent)+ " seconds")
endif
endfunction
private function CheckComTimer takes nothing returns boolean
local player owner = GetTriggerPlayer()
local integer ownerId = GetPlayerId(owner)
local string text = GetEventPlayerChatString()
local integer string_length = StringLength(text)
local integer amount = 0
if SubString(text,0,Com_Timer_Lenght) == COM_TIMER then
set text = SubString(text,Com_Timer_Lenght+1,string_length)
if text != null then
if GetUnitAbilityLevel(Hero[ownerId],SPELL_TIMER)>=1 then
set amount = S2I(text)
if amount >=TimerMode[0] and amount <= TimerMode[MODEMAX-1] then
set TimerCurrent = amount
call DisplayAll(PlayerColor[ownerId]+GetPlayerName(owner),TEXT_TIMER+I2S(TimerCurrent)+ " seconds")
else
call ErrorSound(owner)
call DisplayTextToPlayer(owner,0.,0.,"Please enter an integer between "+I2S(TimerMode[0])+" and "+I2S(TimerMode[MODEMAX-1]))
endif
else
call ErrorSound(owner)
call DisplayTextToPlayer(owner,0.,0.,"You must be a Demolition Expert with Explosive Science at level "+I2S(TOGGLE_TIMER_REQ))
endif
endif
endif
set text = null
return false
endfunction
private function DustDeath takes nothing returns boolean
local unit cave = GetTriggerUnit()
local real x = GetUnitX(cave)
local real y = GetUnitY(cave)
if GetUnitTypeId(cave)==DUMMY_DUST then
call CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),ROCKID,x,y,GetRandomReal(0.,360.))
set CaveToDestroy = CaveToDestroy - 1
set SideQuestEta[1]="A cave has been sealed. "+I2S(CaveToDestroy)+" caves to seal."
call UpdateSideQuest(1)
call SpawnCreeps(MINIBOSS_ID,14,x,y)
call StartFrankText()
set FrankCount = FrankCount + 1
if CaveToDestroy == 0 then
call EndSideQuest(1)
endif
endif
set cave = null
return false
endfunction
private function CreepsCheckCave takes real x, real y, real delay returns nothing
local integer i = 0
local unit dust = null
loop
exitwhen i > 6
if RectContainsCoords(CaveRect[i],x,y)==true then
if SpawnCaveDestroyed[i]==false then
set dust = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),DUMMY_DUST,GetRectCenterX(CaveRect[i]),GetRectCenterY(CaveRect[i]),GetRandomReal(0.,360.))
call UnitApplyTimedLife(dust,'BTLF',delay+2.)
call IssuePointOrder(dust,"healingspray",GetRectCenterX(CaveRect[i]),GetRectCenterY(CaveRect[i]))
set SpawnCaveDestroyed[i]=true
set dust = null
return
else
set dust = null
return
endif
endif
set i = i + 1
endloop
set dust = null
endfunction
private function UnitDeath takes nothing returns boolean
local unit victim = GetTriggerUnit()
local real x = GetUnitX(victim)
local real y = GetUnitY(victim)
local integer i = 0
loop
exitwhen i > AMOUNT
call DestroyEffect(AddSpecialEffect(FX,x+GetRandomReal(-RADIUS,RADIUS),y+GetRandomReal(-RADIUS,RADIUS)))
set i = i + 1
endloop
call UnitDamageAll(victim,false,AOE,x,y,DMG,DMG_EXPLOSIVE,false,0,0,0)
set victim = null
return false
endfunction
private struct str
trigger trig
private static method createFilter takes unit u returns boolean
return GetUnitTypeId(u)==SATCHEL_ID
endmethod
private method onCreate takes nothing returns nothing
set .trig = CreateTrigger()
call TriggerRegisterUnitEvent(.trig,me,EVENT_UNIT_DEATH)
call TriggerAddCondition(.trig,Condition(function UnitDeath))
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
call DisableTrigger(.trig)
call DestroyTrigger(.trig)
set .trig = null
endmethod
implement AutoDestroy
endstruct
private function Wait takes nothing returns nothing
call ReleaseTimer(GetExpiredTimer())
call BipSound()
endfunction
private function SecondSound takes real duration returns nothing
local timer t = NewTimer()
call TimerStart(t,duration,false,function Wait)
endfunction
private struct s_timer
unit satchel
integer duration
integer i
real x
real y
endstruct
private function Update takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_timer dat = GetTimerData(t)
if dat.i < dat.duration and not (IsUnitType(dat.satchel,UNIT_TYPE_DEAD)) then
set dat.i = dat.i + 1
call PingMinimap(dat.x,dat.y,1.)
call BipSound()
if dat.i > 0.5*dat.duration and dat.i <= 0.75*dat.duration then
call SecondSound(0.5)
elseif dat.i > 0.75*dat.duration then
call SecondSound(0.25)
endif
else
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function Spawn takes nothing returns nothing
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local integer ownerId = GetPlayerId(owner)
local timer t = NewTimer()
local s_timer dat = s_timer.create()
set dat.i = 0
call PingMinimapEx(SpellEvent.TargetX,SpellEvent.TargetY,5., 204, 196, 115, false)
call WillExplodeSound()
set dat.duration = TimerCurrent
set dat.x = SpellEvent.TargetX
set dat.y = SpellEvent.TargetY
call CreepsCheckCave(dat.x,dat.y,I2R(dat.duration))
call PingMinimap(dat.x,dat.y,1.)
call DisplayAll(PlayerColor[ownerId]+GetPlayerName(owner),TEXT_EXPLODE+I2S(dat.duration)+ " seconds")
set dat.satchel = CreateUnit(owner,SATCHEL_ID,dat.x,dat.y,0.)
call UnitApplyTimedLife(dat.satchel,'BTLF',I2R(dat.duration))
call SetTimerData(t,dat)
call TimerStart(t,1.,true,function Update)
endfunction
public function init takes nothing returns nothing
local integer i = 0
local trigger t1 = CreateTrigger()
local trigger t2 = CreateTrigger()
set TimerCurrent = 5
call SetSatchelVariables()
set FrankCount = 0
call RegisterSpellFinishResponse(SPELL, Spawn)
call RegisterSpellCastResponse(SPELL_TIMER, ToggleTimer)
call RegisterSpellFinishResponse(SPELL_ITEM, Spawn)
loop
exitwhen i > MAXPLAYER
call TriggerRegisterPlayerChatEvent( t1, Player(i), COM_TIMER, false)
set i = i + 1
endloop
call TriggerAddCondition(t1, Condition(function CheckComTimer))
call TriggerRegisterPlayerUnitEvent(t2, Player(PLAYER_NEUTRAL_PASSIVE), EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(t2, Condition(function DustDeath))
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope SatelliteOverdrive initializer init
globals
private constant integer SPELL = 'A0DM'
private constant real DUR = 60.
private constant string INFO = "Satellite routed on our position"
endglobals
private function UnShareVision takes nothing returns nothing
local integer i = 0
loop
exitwhen i > MAXPLAYER
call SetPlayerAllianceStateBJ(Player(10),Player(i),bj_ALLIANCE_ALLIED)
set i = i + 1
endloop
endfunction
private function StartCooldown takes nothing returns nothing
local timer t = NewTimer()
call TimerStart(t,DUR,false,function UnShareVision)
endfunction
private function ShareVision takes nothing returns nothing
local integer i = 0
loop
exitwhen i > MAXPLAYER
call SetPlayerAllianceStateBJ(Player(10),Player(i),bj_ALLIANCE_ALLIED_VISION)
set i = i + 1
endloop
endfunction
private function Actions takes nothing returns nothing
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local integer ownerId = GetPlayerId(owner)
call DisplayAll(PlayerColor[ownerId]+GetPlayerName(owner),INFO)
call ShareVision()
call StartCooldown()
endfunction
public function init takes nothing returns nothing
call RegisterSpellCastResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
library ScoutTraining needs TimerUtils,GroupUtils,TextDisplay
globals
private constant integer SPELL = 'A00O'
private constant integer CAMO_REQ = 2
private constant integer CAMO_SPELL = 'A016'
private constant string CAMO_INFO = "Camouflage system online. I will provide you tactical information about enemies."
private constant real TIMEOUT_PING = 15.
private constant real AOE = 2800.
private constant real MINRADIUS = 1200.
private constant integer SPECIAL_BUFF = 'A06R'
private integer TmpCount = 0
private unit Caster = null
endglobals
private function GetDistance takes unit u1, unit u2 returns real
local real x1 = GetUnitX(u1)
local real y1 = GetUnitY(u1)
local real x2 = GetUnitX(u2)
local real y2 = GetUnitY(u2)
return SquareRoot((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1))
endfunction
private function FilterClassA takes nothing returns boolean
local unit target = GetFilterUnit()
if GetUnitAbilityLevel(target,SPECIAL_BUFF)>=1 and not (IsUnitType(target,UNIT_TYPE_DEAD)) then
if GetDistance(Caster,target)>MINRADIUS then
set TmpCount = TmpCount + 1
call PingMinimapEx(GetUnitX(target),GetUnitY(target),3.,242,51,51,false)
if TmpCount > 6 then
set target = null
return false
endif
endif
endif
set target = null
return true
endfunction
private struct str
unit marine
endstruct
private function RavenScout takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
if not(IsUnitType(dat.marine,UNIT_TYPE_DEAD)) then
set TmpCount = 0
set Caster = dat.marine
call GroupEnumUnitsInRange(ENUM_GROUP,GetUnitX(dat.marine),GetUnitY(dat.marine),AOE,Filter(function FilterClassA))
else
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function ActivateSpecialPing takes unit marine returns nothing
local timer t = NewTimer()
local str dat = str.create()
set dat.marine = marine
set TmpCount = 0
call SetTimerData(t, dat)
call TimerStart (t, TIMEOUT_PING, true, function RavenScout )
endfunction
private function Conditions takes nothing returns boolean
local unit caster = GetTriggerUnit()
local player owner = GetOwningPlayer(caster)
local integer ownerId = GetPlayerId(owner)
if GetLearnedSkill() == SPELL then
if GetUnitAbilityLevel(caster,SPELL)== CAMO_REQ then
call DisplayAll(PlayerColor[ownerId]+GetPlayerName(owner),CAMO_INFO)
call UnitAddAbility(caster,CAMO_SPELL)
call ActivateSpecialPing(caster)
set QuestPingAllowed = true
endif
endif
set caster = null
return false
endfunction
function ScoutTraining takes unit hero returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterUnitEvent(t,hero,EVENT_UNIT_HERO_SKILL)
call TriggerAddCondition(t,Condition(function Conditions))
endfunction
endlibrary
//TESH.scrollpos=1
//TESH.alwaysfold=0
scope SecurityOfficer initializer init
globals
private constant integer MARINE_ID = 'h003'
private constant string FX_SPAWN= "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportCaster.mdl"
private constant integer SPELL = 'A0IV'
private constant integer COUNT = 2
private constant real AOE = 100.
endglobals
private function CheckSoldier takes nothing returns boolean
local unit target = GetFilterUnit()
if GetUnitTypeId(target)==MARINE_ID then
if GameMode == 6 then
call KillUnit(target)
else
call SetUnitOwner(target,Player(10),true)
call UnitAddAbility(target,LASTQUESTUNIT_SPELL)
call IssuePointOrder(target,LASTQUESTUNIT_ORDER,GetRectCenterX(gg_rct_LastQuest),GetRectCenterY(gg_rct_LastQuest))
endif
endif
set target = null
return true
endfunction
private function Spawn takes nothing returns nothing
local unit spawned = null
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local real x = GetRectCenterX(gg_rct_Reinforcement)
local real y = GetRectCenterY(gg_rct_Reinforcement)
local integer i = 0
call GroupEnumUnitsOfPlayer(ENUM_GROUP,owner,Filter(function CheckSoldier))
loop
exitwhen i > COUNT-1
set spawned = CreateUnit(owner, MARINE_ID,x+GetRandomReal(-AOE,AOE),y+GetRandomReal(-AOE,AOE),0.)
call DestroyEffect(AddSpecialEffectTarget(FX_SPAWN, spawned, "origin") )
call IssueImmediateOrder(spawned,ACTIVATE_AI_ORDER)
set i = i + 1
endloop
set spawned = null
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Spawn)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
library SecurityTraining needs AmmoSystem
globals
private constant integer SPELL = 'A00B'
private constant integer SPELL_DOG = 'A02J'
private constant integer RELOAD_REQ = 4
private constant real RELOAD_BONUS = 1.
endglobals
private function Conditions takes nothing returns boolean
local unit caster = GetTriggerUnit()
if GetLearnedSkill() == SPELL then
call SetUnitAbilityLevel(caster,SPELL_DOG,GetUnitAbilityLevel(caster,SPELL))
if GetUnitAbilityLevel(caster,SPELL) == RELOAD_REQ then
call UpgradeReloadWeapon(caster,RELOAD_BONUS)
endif
endif
set caster = null
return false
endfunction
function SecurityTraining takes unit hero returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterUnitEvent(t,hero,EVENT_UNIT_HERO_SKILL)
call TriggerAddCondition(t,Condition(function Conditions))
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope SelfHeal initializer init
globals
private constant integer SPELL = 'A0CZ'
private constant real AMOUNT = 150.
private constant string SUCCESS_FRACTURE = "Fracture healed"
private constant string SUCCESS_POISON = "A poison removed"
endglobals
private function Actions takes nothing returns nothing
local unit target = SpellEvent.CastingUnit
call SetUnitState(target,UNIT_STATE_LIFE,GetUnitState(target,UNIT_STATE_LIFE)+AMOUNT)
if GetUnitAbilityLevel(target,BUFF_FRACT)>=1 then
call TextTagMessage(SUCCESS_FRACTURE,target,0.,50.,64.,90.,9,5.,4.)
call UnitRemoveAbility(target,BUFF_FRACT)
endif
if GetUnitAbilityLevel(target,BUFF_POISON1)>=1 or GetUnitAbilityLevel(target,BUFF_POISON2)>=1 then
if GetUnitAbilityLevel(target,BUFF_POISON1)>=1 then
call UnitRemoveAbility(target,BUFF_POISON1)
endif
if GetUnitAbilityLevel(target,BUFF_POISON2)>=1 then
call UnitRemoveAbility(target,BUFF_POISON2)
endif
call TextTagMessage(SUCCESS_POISON,target,0.,50.,64.,90.,9,5.,4.)
endif
set target = null
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL,Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope SelfHealSO initializer init
globals
private constant integer SPELL = 'A07P'
private constant integer MINI_SPELL = 'A0AU'
private constant string SUCCESS_POISON = "A poison removed"
private constant real AMOUNT = 100.
endglobals
private function Actions takes nothing returns nothing
local unit target = SpellEvent.CastingUnit
call SetUnitState(target,UNIT_STATE_LIFE,GetUnitState(target,UNIT_STATE_LIFE)+AMOUNT)
if GetUnitAbilityLevel(target,BUFF_POISON1)>=1 or GetUnitAbilityLevel(target,BUFF_POISON2)>=1 then
if GetUnitAbilityLevel(target,BUFF_POISON1)>=1 then
call UnitRemoveAbility(target,BUFF_POISON1)
endif
if GetUnitAbilityLevel(target,BUFF_POISON2)>=1 then
call UnitRemoveAbility(target,BUFF_POISON2)
endif
call TextTagMessage(SUCCESS_POISON,target,0.,50.,64.,90.,9,5.,4.)
endif
set target = null
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL,Actions)
call RegisterSpellFinishResponse(MINI_SPELL,Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope sgbot initializer init
globals
private constant integer UNIT_ID = 'n00H'
private constant string FX_DEATH= "Abilities\\Weapons\\BoatMissile\\BoatMissile.mdl"
private constant string FX_SPAWN= "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportCaster.mdl"
private constant integer SPELL = 'A05N'
private constant integer SPELL_BOOM = 'A05O'
private constant real AOE = 150.
private constant integer COUNT = 4
endglobals
private function UnitDeath takes nothing returns boolean
local unit victim = GetTriggerUnit()
call DestroyEffect(AddSpecialEffect(FX_DEATH,GetUnitX(victim),GetUnitY(victim)))
set victim = null
return false
endfunction
private struct str
trigger trig
private static method createFilter takes unit u returns boolean
return GetUnitTypeId(u)==UNIT_ID
endmethod
private method onCreate takes nothing returns nothing
set .trig = CreateTrigger()
call TriggerRegisterUnitEvent(.trig,me,EVENT_UNIT_DEATH)
call TriggerAddCondition(.trig,Condition(function UnitDeath))
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
call DisableTrigger(.trig)
call DestroyTrigger(.trig)
set .trig = null
endmethod
implement AutoDestroy
endstruct
private function Spawn takes nothing returns nothing
local unit spawned = null
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local real x = GetUnitX(SpellEvent.CastingUnit)
local real y = GetUnitY(SpellEvent.CastingUnit)
local integer level = GetUnitAbilityLevel(SpellEvent.CastingUnit,SPELL)
local integer i = 0
loop
exitwhen i > COUNT-1
set spawned = CreateUnit(owner, UNIT_ID,x+GetRandomReal(-AOE,AOE),y+GetRandomReal(-AOE,AOE),0.)
call DestroyEffect(AddSpecialEffectTarget(FX_SPAWN, spawned, "origin") )
call SetUnitAbilityLevel(spawned,SPELL_BOOM,level)
call IssueImmediateOrder(spawned,ACTIVATE_AI_ORDER)
set i = i + 1
endloop
set spawned = null
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Spawn)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope Sentry initializer init
globals
private constant integer SPELL = 'A08C'
private constant string FX = "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportCaster.mdl"
private constant string INFO = "Air Walker AW-Sentry teleporation complete."
private integer array SentryId [6]
private unit array Sentry [12]
endglobals
private function Spawn takes nothing returns nothing
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local integer ownerId = GetPlayerId(owner)
local real x = GetRectCenterX(gg_rct_SpawnAllied)
local real y = GetRectCenterY(gg_rct_SpawnAllied)
if not(IsUnitType(Sentry[ownerId],UNIT_TYPE_DEAD)) then
call KillUnit(Sentry[ownerId])
endif
call DestroyEffect(AddSpecialEffect(FX,x,y) )
set Sentry[ownerId] = CreateUnit(owner,SentryId[GetUnitAbilityLevel(SpellEvent.CastingUnit,SPELL)-1],x,y,0.)
call IssueImmediateOrder(Sentry[ownerId],ACTIVATE_AI_ORDER)
call DisplayAll(PlayerColor[ownerId]+GetPlayerName(owner),INFO)
call PingMinimap(x,y,1.)
endfunction
public function init takes nothing returns nothing
set SentryId[0]='n00I'
set SentryId[1]='n007'
set SentryId[2]='n00E'
set SentryId[3]='n00D'
set SentryId[4]='n009'
set SentryId[5]='n008'
call RegisterSpellFinishResponse(SPELL, Spawn)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
library ServiceIntelligence initializer init needs AbilityPreload
globals
private constant integer SPELL = 'A0GT'
private constant integer VISION_REQ = 6
private constant integer SPELL_VISION = 'A0H1'
endglobals
private function Conditions takes nothing returns boolean
local unit caster = GetTriggerUnit()
if GetLearnedSkill() == SPELL then
if GetUnitAbilityLevel(caster,SPELL) == VISION_REQ then
call UnitAddAbility(caster,SPELL_VISION)
endif
endif
set caster = null
return false
endfunction
function ServiceIntelligence takes unit hero returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterUnitEvent(t,hero,EVENT_UNIT_HERO_SKILL)
call TriggerAddCondition(t,Condition(function Conditions))
endfunction
private function init takes nothing returns nothing
local integer i = 0
call AbilityPreload(SPELL_VISION)
loop
exitwhen i > MAXPLAYER
call SetPlayerAbilityAvailable(Player(i),SPELL_VISION,false)
set i = i + 1
endloop
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope AutomaticTurret initializer init
globals
private integer array TurretId [6]
private constant integer SPELL = 'A02C'
private unit array Turret [12]
endglobals
private function Spawn takes nothing returns nothing
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local integer ownerId = GetPlayerId(owner)
local integer level = GetUnitAbilityLevel(SpellEvent.CastingUnit,SPELL)-1
local real x = SpellEvent.TargetX
local real y = SpellEvent.TargetY
if not (IsUnitType(Turret[ownerId],UNIT_TYPE_DEAD)) then
call KillUnit(Turret[ownerId])
endif
set Turret[ownerId] = CreateUnit(owner,TurretId[level],x,y,0.)
endfunction
public function init takes nothing returns nothing
local integer i = 0
set TurretId[0] = 'o00H'
set TurretId[1] = 'o01A'
set TurretId[2] = 'o019'
set TurretId[3] = 'o018'
set TurretId[4] = 'o01B'
set TurretId[5] = 'o01C'
loop
exitwhen i > MAXPLAYER
set Turret[i] = null
set i = i + 1
endloop
call RegisterSpellFinishResponse(SPELL, Spawn)
endfunction
endscope
//TESH.scrollpos=1
//TESH.alwaysfold=0
scope ShockTroop initializer init
globals
private constant integer MARINE_ID = 'h00U'
private constant string FX_SPAWN= "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportCaster.mdl"
private constant integer SPELL = 'A0J0'
private constant integer COUNT = 1
private constant real AOE = 100.
endglobals
private function CheckSoldier takes nothing returns boolean
local unit target = GetFilterUnit()
if GetUnitTypeId(target)==MARINE_ID then
if GameMode == 6 then
call KillUnit(target)
else
call SetUnitOwner(target,Player(10),true)
call UnitAddAbility(target,LASTQUESTUNIT_SPELL)
call IssuePointOrder(target,LASTQUESTUNIT_ORDER,GetRectCenterX(gg_rct_LastQuest),GetRectCenterY(gg_rct_LastQuest))
endif
endif
set target = null
return true
endfunction
private function Spawn takes nothing returns nothing
local unit spawned = null
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local real x = GetRectCenterX(gg_rct_Reinforcement)
local real y = GetRectCenterY(gg_rct_Reinforcement)
local integer i = 0
call GroupEnumUnitsOfPlayer(ENUM_GROUP,owner,Filter(function CheckSoldier))
loop
exitwhen i > COUNT-1
set spawned = CreateUnit(owner, MARINE_ID,x+GetRandomReal(-AOE,AOE),y+GetRandomReal(-AOE,AOE),0.)
call DestroyEffect(AddSpecialEffectTarget(FX_SPAWN, spawned, "origin") )
call IssueImmediateOrder(spawned,ACTIVATE_AI_ORDER)
set i = i + 1
endloop
set spawned = null
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Spawn)
endfunction
endscope
//TESH.scrollpos=24
//TESH.alwaysfold=0
scope LightForceField initializer init
globals
private constant integer SPELL = 'A032'
private constant integer FIELD_ID = 'o00I'
private constant integer DUMMY_SPELL = 'A034'
private constant real DUR = 10.
private constant real RADIUS = 300.
private constant real ANGLE = 6.
private constant integer COUNT = 60
endglobals
private struct str
lightning array light [COUNT]
endstruct
private function Wait takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
local integer i = 0
loop
set i = i + 1
exitwhen i > COUNT
call DestroyLightning(dat.light[i])
set dat.light[i]= null
endloop
call ReleaseTimer(t)
call dat.destroy()
endfunction
private function Actions takes nothing returns nothing
local integer i = 0
local timer t = NewTimer()
local str dat = str.create()
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local real x1 = 0.
local real y1 = 0.
local real x2 = 0.
local real y2 = 0.
local unit dummy = CreateUnit(owner,DUMMY,SpellEvent.TargetX,SpellEvent.TargetY,0.)
call UnitAddAbility(dummy,DUMMY_SPELL)
call UnitApplyTimedLife(dummy,'BTLF',DUR)
loop
set i = i + 1
exitwhen i > COUNT
set x1 = SpellEvent.TargetX + RADIUS * Cos(i * ANGLE *bj_DEGTORAD)
set y1 = SpellEvent.TargetY + RADIUS * Sin(i * ANGLE *bj_DEGTORAD)
call UnitApplyTimedLife(CreateUnit(owner,FIELD_ID,x1,y1,0.),'BTLF',DUR)
set x2 = SpellEvent.TargetX + RADIUS * Cos(((i * ANGLE)-ANGLE) *bj_DEGTORAD)
set y2 = SpellEvent.TargetY + RADIUS * Sin(((i * ANGLE)-ANGLE) *bj_DEGTORAD)
set dat.light[i] = AddLightning("HWPB",true,x1,y1,x2,y2)
endloop
call SetTimerData(t, dat)
call TimerStart (t,DUR,false,function Wait )
set dummy = null
endfunction
public function init takes nothing returns nothing
call AbilityPreload(DUMMY_SPELL)
call RegisterSpellFinishResponse(SPELL,Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope SetUpAMine
globals
private constant integer MINE_ID = 'n002'
private constant real AOE1 = 250.
private constant real DMG1 = 500.
private constant real AOE2 = 350.
private constant real DMG2 = 100.
private constant string FX1 = "FlameStrike1.mdx"
private constant string FX2 = "Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl"
endglobals
private function UnitDeath takes nothing returns boolean
local unit victim = GetTriggerUnit()
local real x = GetUnitX(victim)
local real y = GetUnitY(victim)
call DestroyEffect(AddSpecialEffect(FX1,x,y))
call DestroyEffect(AddSpecialEffect(FX2,x,y))
call UnitDamageAll(victim,false,AOE1,x,y,DMG1,DMG_EXPLOSIVE,false,0,0,0)
call UnitDamageAll(victim,false,AOE2,x,y,DMG2,DMG_EXPLOSIVE,true,100,10,0.2)
set victim = null
return false
endfunction
private struct str
trigger trig
private static method createFilter takes unit u returns boolean
return GetUnitTypeId(u)==MINE_ID
endmethod
private method onCreate takes nothing returns nothing
set .trig = CreateTrigger()
call TriggerRegisterUnitEvent(.trig,me,EVENT_UNIT_DEATH)
call TriggerAddCondition(.trig,Condition(function UnitDeath))
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
call DisableTrigger(.trig)
call DestroyTrigger(.trig)
set .trig = null
endmethod
implement AutoDestroy
endstruct
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope ShilkaDrive initializer init
globals
private constant integer SPELL = 'A0E6'
private constant integer UNIT_ID = 'h01F'
endglobals
private function Actions takes nothing returns nothing
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
if GetUnitTypeId(SpellEvent.TargetUnit)==UNIT_ID then
call SetPilotVehicle(SpellEvent.CastingUnit,SpellEvent.TargetUnit)
else
call ErrorSound(owner)
call DisplayTextToPlayer(owner,0.,0.,"You must target a Shilka")
endif
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope ShockWaveHeavySoldier initializer init
globals
private constant integer SPELL = 'A05M'
private constant real AOE = 500.00
endglobals
private function Actions takes nothing returns nothing
local real x = GetUnitX(SpellEvent.CastingUnit)
local real y = GetUnitY(SpellEvent.CastingUnit)
call TerrainDeformRipple(x,y,AOE,120.,2000,1,1.00,5.,0.20,false)
endfunction
public function init takes nothing returns nothing
call RegisterSpellCastResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope ShoulderMountedRocketLauncher initializer init
globals
private constant integer SPELL = 'A09G'
private constant real AOE_BASE = 175.
private constant real AOE_COEFF = 25.
private constant real DMG_BASE = 500.
private constant real DMG_COEFF = 250.
endglobals
private struct str
unit caster
real x
real y
endstruct
private function Wait takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
call UnitDamageAll(dat.caster,true,AOE_BASE+AOE_COEFF*GetUnitAbilityLevel(dat.caster,SPELL),dat.x,dat.y,DMG_BASE+DMG_COEFF*GetUnitAbilityLevel(dat.caster,SPELL),DMG_EXPLOSIVE,true,50,10,0.2)
call ReleaseTimer(t)
call dat.destroy()
endfunction
private function Cast takes nothing returns nothing
local timer t = NewTimer()
local str dat = str.create()
set dat.x = SpellEvent.TargetX
set dat.y = SpellEvent.TargetY
set dat.caster = SpellEvent.CastingUnit
call TextTagMessage("Boom!", dat.caster, 0., 50., 64., 90., 9, 5., 2.00 )
call SetTimerData(t, dat)
call TimerStart (t,0.95, false, function Wait )
endfunction
public function init takes nothing returns nothing
call RegisterSpellCastResponse(SPELL, Cast)
endfunction
endscope
//TESH.scrollpos=44
//TESH.alwaysfold=0
scope slashcircle initializer init
globals
private constant string FX = "Abilities\\Weapons\\SentinelMissile\\SentinelMissile.mdl"
private constant integer SPELL = 'A05B'
private constant integer SPELLBOOK = 'A02T'
private constant integer AOE1 = 200
private constant integer AOE2 = 300
private constant integer DUR = 4
endglobals
private struct str
unit caster
real angle
real distance
integer i
integer duration
endstruct
private function Update takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
local real x1 = GetUnitX(dat.caster)
local real y1 = GetUnitY(dat.caster)
local real x2 = 0.
local real y2 = 0.
if dat.i < dat.duration and not (IsUnitType(dat.caster,UNIT_TYPE_DEAD)) then
set dat.i = dat.i + 1
set dat.angle = dat.angle + 1.00
set x2 = x1 + AOE1 * Cos(dat.angle)
set y2 = y1 + AOE1 * Sin(dat.angle)
call DestroyEffect(AddSpecialEffect(FX,x2,y2))
set x2 = x1 - AOE1 * Cos(dat.angle)
set y2 = y1 - AOE1 * Sin(dat.angle)
call DestroyEffect(AddSpecialEffect(FX,x2,y2))
set x2 = x1 + AOE2 * Cos(dat.angle)
set y2 = y1 + AOE2 * Sin(dat.angle)
call DestroyEffect(AddSpecialEffect(FX,x2,y2))
set x2 = x1 - AOE2 * Cos(dat.angle)
set y2 = y1 - AOE2 * Sin(dat.angle)
call DestroyEffect(AddSpecialEffect(FX,x2,y2))
else
if GetUnitAbilityLevel(dat.caster,SPELLBOOK)>=1 then
call UnitRemoveAbility(dat.caster,SPELLBOOK)
endif
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function Cast takes nothing returns nothing
local timer t = NewTimer()
local str dat = str.create()
set dat.caster = SpellEvent.CastingUnit
set dat.i = 0
if GetUnitAbilityLevel(dat.caster,SPELLBOOK)<=0 then
call UnitAddAbility(dat.caster,SPELLBOOK)
endif
set dat.duration = R2I(DUR/TIMEOUT)
call SetTimerData(t, dat)
call TimerStart (t, TIMEOUT, true, function Update )
endfunction
public function init takes nothing returns nothing
local integer i = 0
call AbilityPreload(SPELLBOOK)
loop
exitwhen i > MAXPLAYER
call SetPlayerAbilityAvailable(Player(i),SPELLBOOK,false)
set i = i + 1
endloop
call RegisterSpellFinishResponse(SPELL, Cast)
endfunction
endscope
//TESH.scrollpos=19
//TESH.alwaysfold=0
scope SmokeGrenade initializer init
globals
private constant integer SPELL = 'A04K'
private constant integer DUMMY_SPELL = 'A0EV'
private constant integer AURA_ID = 'o00F'
private constant real LIFESPAN = 30.
endglobals
private struct str
unit caster
real x
real y
endstruct
private function WaitBeforeBoom takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
call UnitApplyTimedLife(CreateUnit(GetOwningPlayer(dat.caster),AURA_ID,dat.x,dat.y,0.),'BTLF',LIFESPAN)
call ReleaseTimer(t)
call dat.destroy()
endfunction
private function Actions takes nothing returns nothing
local unit dummy = CreateUnit(GetOwningPlayer(SpellEvent.CastingUnit),DUMMY,GetUnitX(SpellEvent.CastingUnit),GetUnitY(SpellEvent.CastingUnit),0.)
local timer t = NewTimer()
local str dat = str.create()
call SetUnitAnimation(SpellEvent.CastingUnit, "spell throw" )
call GrenadeSound(SpellEvent.TargetX,SpellEvent.TargetY)
call TextTagMessage("Smoke!",SpellEvent.CastingUnit, 0., 50., 64., 90., 9, 5., 2.00 )
set dat.x = SpellEvent.TargetX
set dat.y = SpellEvent.TargetY
set dat.caster = SpellEvent.CastingUnit
call UnitAddAbility(dummy,DUMMY_SPELL)
call IssuePointOrder(dummy,"clusterrockets",SpellEvent.TargetX,SpellEvent.TargetY)
call UnitApplyTimedLife(dummy,'BTLF',2.)
call SetTimerData(t, dat)
call TimerStart (t, 1., false, function WaitBeforeBoom )
set dummy = null
endfunction
public function init takes nothing returns nothing
call AbilityPreload(DUMMY_SPELL)
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=13
//TESH.alwaysfold=0
scope ShutDown initializer init
globals
private constant integer DUMMY_SPELL = 'A0JZ'
private constant integer SPELL = 'A0JU'
private constant integer SPELLBOOK = 'A0JY'
private constant real DUR = 15.
private constant real AOE = 500.
private player Owner
endglobals
private struct str
unit caster
endstruct
private function Wait takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
if GetUnitAbilityLevel(dat.caster,SPELLBOOK)>=1 then
call UnitRemoveAbility(dat.caster,SPELLBOOK)
endif
call ReleaseTimer(t)
call dat.destroy()
endfunction
private function CheckAllied takes nothing returns boolean
local unit target = GetFilterUnit()
local unit dummy = null
if IsUnitAlly(target,Owner) and not (IsUnitType(target,UNIT_TYPE_MECHANICAL)) then
set dummy = CreateUnit(Owner,DUMMY,GetUnitX(target),GetUnitY(target),0.)
call UnitAddAbility(dummy,DUMMY_SPELL)
call IssueTargetOrder(dummy,"rejuvination",target)
call UnitApplyTimedLife(dummy,'BTLF',1.)
endif
set dummy = null
set target = null
return true
endfunction
private function Actions takes nothing returns nothing
local timer t = NewTimer()
local str dat = str.create()
set dat.caster = SpellEvent.CastingUnit
if GetUnitAbilityLevel(dat.caster,SPELLBOOK)<=0 then
call UnitAddAbility(dat.caster, SPELLBOOK)
endif
set Owner = GetOwningPlayer(dat.caster)
call GroupEnumUnitsInRange(ENUM_GROUP,GetUnitX(dat.caster),GetUnitY(dat.caster),AOE,Filter(function CheckAllied))
call SetTimerData(t, dat)
call TimerStart (t,DUR, false, function Wait )
endfunction
public function init takes nothing returns nothing
local integer i = 0
call AbilityPreload(SPELLBOOK)
call AbilityPreload(DUMMY_SPELL)
loop
exitwhen i > MAXPLAYER
call SetPlayerAbilityAvailable(Player(i),SPELLBOOK,false)
set i = i + 1
endloop
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
library SteyrScoutFeatures needs AmmoSystem
globals
private constant integer SPELL = 'A08D'
private constant integer AMMO_BONUS = 1
private constant real RELOAD_BONUS = 0.5
endglobals
private function Conditions takes nothing returns boolean
local unit caster = GetTriggerUnit()
if GetLearnedSkill() == SPELL then
call UpgradeMaxWeapon(caster,AMMO_BONUS)
call UpgradeReloadWeapon(caster,RELOAD_BONUS)
endif
set caster = null
return false
endfunction
function SteyrScoutFeatures takes unit hero returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterUnitEvent(t,hero,EVENT_UNIT_HERO_SKILL)
call TriggerAddCondition(t,Condition(function Conditions))
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library SteyrScoutFeaturesMk2 needs AmmoSystem
globals
private constant integer SPELL_PS = 'A08W'
private constant integer SPELL_LS = 'A0FI'
private constant real RELOAD_BONUS = 0.5
endglobals
private function Conditions takes nothing returns boolean
local unit caster = GetTriggerUnit()
if GetLearnedSkill() == SPELL_PS or GetLearnedSkill() == SPELL_LS then
call UpgradeReloadWeapon(caster,RELOAD_BONUS)
endif
set caster = null
return false
endfunction
function SteyrScoutFeaturesMk2 takes unit hero returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterUnitEvent(t,hero,EVENT_UNIT_HERO_SKILL)
call TriggerAddCondition(t,Condition(function Conditions))
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library SurgicalStrike initializer init needs TextDisplay,TimerUtils,CheckPointValidity,SpellEvent
globals
private constant integer DRONE_ID = 'n00A'
private constant integer DUMMY_ID = 'e000'
private constant integer SPELL ='A0HQ'
private constant integer SPEED = 50
private constant real IMP = 0.5
private constant real SPAWN_DISTANCE = 2000.
private constant real SPAWN_Z = 500.
private constant integer UP = 'R01G'
private constant integer UNIT_ID = 'H01Z'
endglobals
private function Conditions takes nothing returns boolean
local unit caster = GetTriggerUnit()
local player owner = GetOwningPlayer(caster)
if GetLearnedSkill() == SPELL then
call SetPlayerTechResearched(owner, UP, GetPlayerTechCount(owner,UP,true)+1)
endif
set caster = null
return false
endfunction
function SurgicalStrike takes unit hero returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterUnitEvent(t,hero,EVENT_UNIT_HERO_SKILL)
call TriggerAddCondition(t,Condition(function Conditions))
endfunction
private function Damage takes unit whichUnit, real x1, real y1, real x2, real y2 returns nothing
local player owner = GetOwningPlayer(whichUnit)
local unit dummy = CreateUnit(owner,DUMMY_ID,x1,y1,0.)
call IssuePointOrder(dummy,"attackground",x2,y2)
call UnitApplyTimedLife(dummy, 'BTLF', 0.5 )
set dummy = null
endfunction
private struct str
unit drone
real angle
integer distance
integer firepoint
integer i
real targetX
real targetY
endstruct
private function Update takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
local real newX = GetUnitX(dat.drone) + SPEED*Cos(dat.angle)
local real newY = GetUnitY(dat.drone) + SPEED*Sin(dat.angle)
local real z = GetUnitFlyHeight(dat.drone)
local real newz = 0.
if dat.i < dat.distance then
set dat.i = dat.i + 1
call SetUnitPosition(dat.drone, newX, newY)
if dat.i < dat.distance*0.5 then
set newz = z - (dat.distance * IMP)
else
set newz = z + (dat.distance * IMP)
endif
call SetUnitFlyHeight(dat.drone, newz, 0.)
if dat.i == dat.firepoint then
call Damage(dat.drone,newX,newY,dat.targetX,dat.targetY)
endif
else
call RemoveUnit(dat.drone)
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function Actions takes nothing returns nothing
local timer t = NewTimer()
local str dat = str.create()
local real x1 = GetUnitX(SpellEvent.CastingUnit)
local real y1 = GetUnitY(SpellEvent.CastingUnit)
local real x2 = SpellEvent.TargetX
local real y2 = SpellEvent.TargetY
local real angle = Atan2((y2 -y1), (x2 - x1))
local real x3 = CheckPointValidity(x1 - SPAWN_DISTANCE*Cos(angle),MapXMin,MapXMax)
local real y3 = CheckPointValidity(y1 - SPAWN_DISTANCE*Sin(angle),MapYMin,MapYMax)
local real x4 = CheckPointValidity(x2 + SPAWN_DISTANCE*Cos(angle),MapXMin,MapXMax)
local real y4 = CheckPointValidity(y2 + SPAWN_DISTANCE*Sin(angle),MapYMin,MapYMax)
call FlySound()
set dat.targetX = x2
set dat.targetY = y2
set dat.angle = angle
set dat.firepoint =R2I(0.5*SquareRoot((x3-x2)*(x3-x2)+(y3-y2)*(y3-y2))/SPEED)
set dat.distance =R2I(SquareRoot((x3-x4)*(x3-x4)+(y3-y4)*(y3-y4))/SPEED)
set dat.i = 0
set dat.drone = CreateUnit(GetOwningPlayer(SpellEvent.CastingUnit),DRONE_ID,x3,y3, dat.angle*bj_RADTODEG )
call SetUnitFlyHeight(dat.drone,SPAWN_Z,0.)
call SetTimerData(t, dat)
call TimerStart (t, TIMEOUT, true, function Update)
endfunction
private function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library SurvivalSkills needs GroupFunction
globals
private constant integer SPELL = 'A031'
private constant integer CINETIC_REQ = 4
private constant integer CINETIC_CHANCE_HP = 10
private constant integer CINETIC_CHANCE_DMG = 25
private constant real CINETIC_DMG = 500.
private constant integer CINETIC_MANABONUS = 5
private constant string FX = "Abilities\\Spells\\Items\\StaffOfPurification\\PurificationCaster.mdl"
private constant string FX2 = "Abilities\\Spells\\Human\\Feedback\\SpellBreakerAttack.mdl"
private constant real AOE = 400.00
endglobals
private function MarineAttacked takes nothing returns boolean
local unit marine = GetTriggerUnit()
local real hpBonus = GetUnitAbilityLevel(marine,SPELL)*0.01
local real hpTotal = GetUnitState(marine, UNIT_STATE_MAX_LIFE)
local real hpCurrent = GetUnitState(marine, UNIT_STATE_LIFE)
local real mpCurrent = GetUnitState(marine, UNIT_STATE_MANA)
if GetUnitAbilityLevel(marine,SPELL)>=CINETIC_REQ then
if GetRandomInt(0,100)<= CINETIC_CHANCE_HP then
call SetUnitState(marine, UNIT_STATE_LIFE,hpCurrent+hpBonus*hpTotal)
endif
if GetRandomInt(0,100)<= CINETIC_CHANCE_DMG then
call UnitDamageEnemies(marine,AOE,GetUnitX(marine),GetUnitY(marine),CINETIC_DMG,DMG_ENERGETIC,false,0,0,0.)
endif
call SetUnitState(marine, UNIT_STATE_MANA,mpCurrent+CINETIC_MANABONUS)
call DestroyEffect(AddSpecialEffectTarget(FX2,marine,"overhead"))
endif
set marine = null
return false
endfunction
function SurvivalSkills takes unit hero returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterUnitEvent(t,hero,EVENT_UNIT_ATTACKED)
call TriggerAddCondition(t,Condition(function MarineAttacked))
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope Synthetize initializer init
globals
private constant integer SPELL = 'A03B'
private constant real AOE = 200.
private constant integer ITEM_ID = 'I01C'
endglobals
private function CheckEnemies takes nothing returns boolean
local unit target = GetFilterUnit()
if IsUnitType(target,UNIT_TYPE_DEAD) then
call CreateItem(ITEM_ID,GetUnitX(target),GetUnitY(target))
endif
set target = null
return true
endfunction
private function Cast takes nothing returns nothing
call GroupEnumUnitsInRange(ENUM_GROUP,SpellEvent.TargetX,SpellEvent.TargetY,AOE,Filter(function CheckEnemies))
endfunction
public function init takes nothing returns nothing
call RegisterSpellCastResponse(SPELL, Cast)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope TakeCommandOverSoldier initializer init
globals
private constant integer SPELL = 'A0AZ'
private constant integer UNIT_ID = 'h00P'
private constant string INFO_ACTIVATED = "I take the command, Soldier!"
private constant string INFO_ERROR = " You can only take control of a NPC Medical Troop; it must belong to the Restricted Complex 601 staff"
private unit array Medic [12]
endglobals
private function Actions takes nothing returns nothing
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local integer ownerId = GetPlayerId(owner)
local integer targetId = GetUnitTypeId(SpellEvent.TargetUnit)
if targetId == UNIT_ID and GetOwningPlayer(SpellEvent.TargetUnit)==Player(10) then
if not(IsUnitType(Medic[ownerId],UNIT_TYPE_DEAD)) then
call SetUnitOwner(Medic[ownerId],Player(10),true)
call SwitchUnitToAssautGroup(Medic[ownerId])
endif
set Medic[ownerId] = SpellEvent.TargetUnit
call SetUnitOwner(Medic[ownerId],owner,true)
call IssueImmediateOrder(Medic[ownerId],ACTIVATE_AI_ORDER)
call DisplayAll(PlayerColor[ownerId]+GetPlayerName(owner),INFO_ACTIVATED)
else
call ErrorSound(owner)
call DisplayTextToPlayer(owner,0.,0.,INFO_ERROR)
endif
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope TakeZombieSample initializer init
globals
private constant integer SPELL = 'A0B3'
private constant string INFO_ACTIVATED = "A sample of Zombie has been taken."
private constant string INFO_ERROR_TYPE = " You can only take samples from Zombie units"
private constant string INFO_ERROR_ALREADY_DONE = " You have already taken a sample from this zombie type."
private integer ZombieMax = 0
private integer ZombieDone = 0
private integer array ZombieId [10]
private boolean array ZombieOk [10]
endglobals
private function Actions takes nothing returns nothing
local integer i = 0
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local integer targetId = GetUnitTypeId(SpellEvent.TargetUnit)
loop
exitwhen i > ZombieMax
if targetId == ZombieId[i] then
if ZombieOk[i]==false then
set ZombieOk[i]=true
set ZombieDone = ZombieDone + 1
set SideQuestEta[2]=INFO_ACTIVATED+I2S(ZombieDone)+"/"+I2S(ZombieMax)+" done."
call UpdateSideQuest(2)
if ZombieDone == ZombieMax then
call EndSideQuest(2)
endif
set owner = null
return
else
call ErrorSound(owner)
call DisplayTextToPlayer(owner,0.,0.,INFO_ERROR_ALREADY_DONE)
set owner = null
return
endif
endif
set i = i + 1
endloop
call ErrorSound(owner)
call DisplayTextToPlayer(owner,0.,0.,INFO_ERROR_TYPE)
endfunction
public function init takes nothing returns nothing
local integer i = 0
set ZombieDone = 0
set ZombieId[i]='u001'
set i = i + 1
set ZombieId[i]='u003'
set i = i + 1
set ZombieId[i]='u005'
set i = i + 1
set ZombieId[i]='u00C'
set i = i + 1
set ZombieId[i]='u00E'
set i = i + 1
set ZombieId[i]='u00F'
set ZombieMax = i
set i = 0
loop
exitwhen i > ZombieMax
set ZombieOk[i]=false
set i = i + 1
endloop
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope TankProgram initializer init
globals
private constant integer DRONE_ID = 'n00G'
private constant integer UNIT_ID = 'h015'
private constant string INFO = "Iron Turtle incoming by the aerial way."
private unit array Walker [12]
private constant integer SPELL ='A0B0'
private constant integer SPEED = 25
private constant real SPAWN_DISTANCE = 4000.
private constant real SPAWN_Z = 500.
private constant real WALKER_Z = 50.
private constant real WAIT = 3.
endglobals
private struct s_delay
unit drone
unit walker
endstruct
private function Wait takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_delay dat = GetTimerData(t)
call SetUnitFlyHeight(dat.drone,SPAWN_Z,300.)
call SetUnitFlyHeight(dat.walker, 0., 0.)
call UnitRemoveAbility(dat.walker,GARN)
call SetUnitInvulnerable(dat.walker,false)
call UnitAddAbility(dat.drone,LASTQUESTUNIT_SPELL)
call IssuePointOrder(dat.drone,LASTQUESTUNIT_ORDER,GetRectCenterX(gg_rct_LastQuest),GetRectCenterY(gg_rct_LastQuest))
call ReleaseTimer(t)
call dat.destroy()
endfunction
private function DelayControl takes unit drone, unit walker returns nothing
local timer t = NewTimer()
local s_delay dat = s_delay.create()
set dat.walker = walker
set dat.drone = drone
call SetTimerData(t, dat)
call TimerStart (t, WAIT, false, function Wait)
endfunction
private struct s_drop
player owner
unit drone
unit walker
real angle
integer distance
integer i
endstruct
private function Update takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_drop dat = GetTimerData(t)
local real newX = GetUnitX(dat.drone) + SPEED*Cos(dat.angle)
local real newY = GetUnitY(dat.drone) + SPEED*Sin(dat.angle)
if dat.i < dat.distance then
set dat.i = dat.i + 1
call SetUnitPosition(dat.drone, newX, newY)
call SetUnitPosition(dat.walker, newX, newY)
else
call SetUnitFlyHeight(dat.drone,100.,300.)
call SetUnitFlyHeight(dat.walker, 0., 300.)
call DelayControl(dat.drone,dat.walker)
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function Actions takes nothing returns nothing
local timer t = NewTimer()
local s_drop dat = s_drop.create()
local real x1 = GetUnitX(SpellEvent.CastingUnit)
local real y1 = GetUnitY(SpellEvent.CastingUnit)
local real x2 = SpellEvent.TargetX
local real y2 = SpellEvent.TargetY
local real angle = Atan2((y2 -y1), (x2 - x1))
local real x3 = CheckPointValidity(x1 - SPAWN_DISTANCE*Cos(angle),MapXMin,MapXMax)
local real y3 = CheckPointValidity(y1 - SPAWN_DISTANCE*Sin(angle),MapYMin,MapYMax)
local real x4 = CheckPointValidity(x2 + SPAWN_DISTANCE*Cos(angle),MapXMin,MapXMax)
local real y4 = CheckPointValidity(y2 + SPAWN_DISTANCE*Sin(angle),MapYMin,MapYMax)
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local integer ownerId = GetPlayerId(owner)
if not(IsUnitType(Walker[ownerId],UNIT_TYPE_DEAD)) then
call KillUnit(Walker[ownerId])
endif
call DisplayAll(PlayerColor[ownerId]+GetPlayerName(owner),INFO)
call PingMinimap(x2,y2,1.)
set dat.angle = angle
set dat.distance =R2I(SquareRoot((x3-x2)*(x3-x2)+(y3-y2)*(y3-y2))/SPEED)
set dat.i = 0
set dat.owner = owner
set dat.drone = CreateUnit(dat.owner,DRONE_ID,x3,y3, dat.angle*bj_RADTODEG )
call SetUnitFlyHeight(dat.drone,SPAWN_Z,0.)
set dat.walker = CreateUnit(dat.owner,UNIT_ID,x3,y3,0.)
call SetUnitFlyHeight(dat.walker, SPAWN_Z-WALKER_Z, 0.)
call UnitAddAbility(dat.walker,GARN)
call SetUnitInvulnerable(dat.walker,true)
set Walker[ownerId] = dat.walker
call SetTimerData(t, dat)
call TimerStart (t, TIMEOUT, true, function Update)
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope TaxiDriver initializer init
globals
private constant integer SPELL = 'A0DN'
private constant string FX = "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportCaster.mdl"
private constant integer MECH_ID = 'n012'
private constant string INFO = "Big Bee available."
private unit array Chopper [12]
endglobals
private function Spawn takes nothing returns nothing
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local integer ownerId = GetPlayerId(owner)
local real x = GetRectCenterX(gg_rct_ChopperStart)
local real y = GetRectCenterY(gg_rct_ChopperStart)
call DestroyEffect(AddSpecialEffect(FX,x,y) )
if not(IsUnitType(Chopper[ownerId],UNIT_TYPE_DEAD)) then
call KillUnit(Chopper[ownerId])
endif
set Chopper[ownerId] = CreateUnit(owner, MECH_ID,x,y,0.)
call IssueImmediateOrder(Chopper[ownerId],ACTIVATE_AI_ORDER)
call DisplayAll(PlayerColor[ownerId]+GetPlayerName(owner),INFO)
call PingMinimap(x,y,1.)
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Spawn)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
library TeslaEnhancing initializer init needs RegisterAnyUnitEvent
globals
private constant string ON = "poisonarrows"
private constant string OFF = "unpoisonarrows"
private constant integer CHANCE_BASE = 3
private constant integer CHANCE_COEFF = 2
private constant integer SPELL = 'A0JW'
private constant integer DUMMY_SPELL = 'A0JM'
private boolean Tesla
private unit Cerberus
endglobals
private function UnitAttacked takes nothing returns boolean
local unit victim = GetTriggerUnit()
local unit dummy = null
local integer level = 0
if GetAttacker()==Cerberus then
set level = GetUnitAbilityLevel(Cerberus,SPELL)
if level>=1 and GetRandomInt(0,100)<=CHANCE_BASE*CHANCE_COEFF*level and Tesla==true then
set dummy = CreateUnit(GetOwningPlayer(Cerberus),DUMMY,GetUnitX(victim),GetUnitY(victim),0.)
call UnitAddAbility(dummy,DUMMY_SPELL)
call IssueImmediateOrder(dummy,"fanofknives")
call UnitApplyTimedLife(dummy,'BTLF',2.)
endif
endif
set dummy = null
set victim = null
return false
endfunction
private function CheckOrder takes nothing returns boolean
local string order = OrderId2String(GetIssuedOrderId())
if order == ON then
set Tesla = true
else
set Tesla = false
endif
return false
endfunction
function TeslaEnhancing takes unit hero returns nothing
local trigger t = CreateTrigger()
set Cerberus = hero
call TriggerRegisterUnitEvent(t,hero,EVENT_UNIT_ISSUED_ORDER)
call TriggerAddCondition(t,Condition(function CheckOrder))
call RegisterAnyUnitEvent(EVENT_PLAYER_UNIT_ATTACKED,function UnitAttacked)
endfunction
private function init takes nothing returns nothing
call AbilityPreload(DUMMY_SPELL)
set Tesla = false
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope timewarp initializer init
globals
private constant integer INVIS = 'A0B2'
private constant integer SPELL = 'A02D'
private constant integer SPELL_HERO = 'A0F0'
private constant real DUR_NORMAL = 10.
private constant real DUR_HERO_BASE = 3.
private constant real DUR_HERO_COEFF = 2.
private constant real AOE = 800.
private constant integer DUMMY_SPELL = 'S000'
private constant integer AMOUNT = 30
private constant real ANGLE = 12.
private player Owner
endglobals
private struct s_invis
unit whichUnit
endstruct
private function RemoveInvis takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_invis dat = GetTimerData(t)
if GetUnitAbilityLevel(dat.whichUnit,INVIS)>=1 then
call UnitRemoveAbility(dat.whichUnit,INVIS)
endif
call ReleaseTimer(t)
call dat.destroy()
endfunction
private function WaitBeforeRemoveInvis takes unit whichUnit returns nothing
local s_invis dat = s_invis.create()
local timer t = NewTimer()
set dat.whichUnit = whichUnit
call SetTimerData(t,dat)
call TimerStart(t,1.,false,function RemoveInvis)
endfunction
private function AddInvis takes nothing returns boolean
local unit target = GetFilterUnit()
if IsUnitAlly(target,Owner) == true and GetUnitAbilityLevel(target,INVIS)<=0 and not (IsUnitType(target,UNIT_TYPE_STRUCTURE)) and not (IsUnitType(target,UNIT_TYPE_DEAD)) then
call UnitAddAbility(target,INVIS)
call WaitBeforeRemoveInvis(target)
endif
set target = null
return true
endfunction
private struct s_aura
unit caster
integer i
real x
real y
integer duration
endstruct
private function Update takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_aura dat = GetTimerData(t)
if dat.i < dat.duration then
set dat.i = dat.i + 1
set Owner = GetOwningPlayer(dat.caster)
call GroupEnumUnitsInRange(ENUM_GROUP, dat.x, dat.y, AOE,Filter(function AddInvis))
else
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function StartAura takes unit caster,real x, real y, real duration returns nothing
local timer t = NewTimer()
local s_aura dat = s_aura.create()
set dat.caster = caster
set dat.i = 0
set dat.x = x
set dat.y = y
set dat.duration = R2I(duration)
call SetTimerData(t, dat)
call TimerStart (t, 1., true, function Update )
endfunction
private struct s_lightning
lightning array light [AMOUNT]
endstruct
private function RemoveLightning takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_lightning dat = GetTimerData(t)
local integer i = 0
loop
set i = i + 1
exitwhen i > AMOUNT
call DestroyLightning(dat.light[i])
set dat.light[i]= null
endloop
call ReleaseTimer(t)
call dat.destroy()
endfunction
private function Cast takes nothing returns nothing
local timer t = NewTimer()
local s_lightning dat = s_lightning.create()
local integer i = 0
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local real x1 = 0.
local real y1 = 0.
local real x2 = 0.
local real y2 = 0.
local real duration = 0.
local unit dummy = CreateUnit(owner,DUMMY,SpellEvent.TargetX,SpellEvent.TargetY,0.)
if SpellEvent.AbilityId == SPELL then
set duration = DUR_NORMAL
elseif SpellEvent.AbilityId == SPELL_HERO then
set duration = DUR_HERO_BASE + DUR_HERO_COEFF*GetUnitAbilityLevel(SpellEvent.CastingUnit,SPELL_HERO)
endif
call UnitAddAbility(dummy,DUMMY_SPELL)
call UnitApplyTimedLife(dummy,'BTLF',duration)
loop
set i = i + 1
exitwhen i > AMOUNT
set x1 = SpellEvent.TargetX + AOE * Cos(i * ANGLE *bj_DEGTORAD)
set y1 = SpellEvent.TargetY + AOE * Sin(i * ANGLE *bj_DEGTORAD)
set x2 = SpellEvent.TargetX + AOE * Cos(((i * ANGLE)-ANGLE) *bj_DEGTORAD)
set y2 = SpellEvent.TargetY + AOE * Sin(((i * ANGLE)-ANGLE) *bj_DEGTORAD)
set dat.light[i] = AddLightning("DRAM",true,x1,y1,x2,y2)
call UnitApplyTimedLife(CreateUnit(owner,DUMMY, x1,y1, bj_UNIT_FACING),'BTLF',duration)
endloop
call StartAura(SpellEvent.CastingUnit,x1,y1,duration)
call SetTimerData(t, dat)
call TimerStart (t,duration,false,function RemoveLightning )
set dummy = null
endfunction
public function init takes nothing returns nothing
call AbilityPreload(INVIS)
call AbilityPreload(DUMMY_SPELL)
call RegisterSpellFinishResponse(SPELL, Cast)
call RegisterSpellFinishResponse(SPELL_HERO, Cast)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope TimeoutSpell initializer init
globals
private constant integer SPELL = 'A03Z'
private constant string SUCCESS_FRACTURE = "Fracture healed"
private constant string SUCCESS_POISON = "A poison removed"
endglobals
private function Actions takes nothing returns nothing
local unit target = SpellEvent.TargetUnit
if GetUnitAbilityLevel(target,BUFF_FRACT)>=1 then
call TextTagMessage(SUCCESS_FRACTURE,target,0.,50.,64.,90.,9,5.,4.)
call UnitRemoveAbility(target,BUFF_FRACT)
endif
if GetUnitAbilityLevel(target,BUFF_POISON1)>=1 or GetUnitAbilityLevel(target,BUFF_POISON2)>=1 then
if GetUnitAbilityLevel(target,BUFF_POISON1)>=1 then
call UnitRemoveAbility(target,BUFF_POISON1)
endif
if GetUnitAbilityLevel(target,BUFF_POISON2)>=1 then
call UnitRemoveAbility(target,BUFF_POISON2)
endif
call TextTagMessage(SUCCESS_POISON,target,0.,50.,64.,90.,9,5.,4.)
endif
set target = null
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL,Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope TitanDrive initializer init
globals
private constant integer SPELL = 'A0E2'
private constant integer UNIT_ID = 'n010'
endglobals
private function Actions takes nothing returns nothing
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
if GetUnitTypeId(SpellEvent.TargetUnit)==UNIT_ID then
call SetPilotVehicle(SpellEvent.CastingUnit,SpellEvent.TargetUnit)
else
call ErrorSound(owner)
call DisplayTextToPlayer(owner,0.,0.,"You must target a Titan")
endif
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope TitanCarry initializer init
globals
private constant integer UNIT_ID = 'n010'
private constant string INFO_NOTARGET = "Your Titan does not carry an object"
private constant integer SPELL_CONTROL = 'A0E7'
private constant integer SPELL_RELEASE = 'A0E9'
private constant real SPAWN_Z = 500.
private constant real WALKER_Z = 50.
private constant real RATE_Z = 400.
endglobals
private struct str
unit caster = null
timer tiOrbit = null
unit target = null
integer i = 0
player owner = null
private static method createFilter takes unit u returns boolean
return GetUnitTypeId(u)==UNIT_ID
endmethod
private method onCreate takes nothing returns nothing
set .tiOrbit = null
set .target = null
set .caster = me
set .owner = GetOwningPlayer(me)
endmethod
implement AutoCreate
private method onDestroy takes nothing returns nothing
set .tiOrbit = null
set .target = null
set .caster = null
endmethod
implement AutoDestroy
endstruct
private function CastRelease takes nothing returns nothing
local str dat = str[SpellEvent.CastingUnit]
if dat.target != null then
call ReleaseTimer(dat.tiOrbit)
set dat.tiOrbit = null
call SetUnitPathing( dat.target, true)
if GetUnitAbilityLevel(dat.target,GARN)>=1 then
call UnitRemoveAbility(dat.target, GARN)
endif
call SetUnitInvulnerable(dat.target,false)
call SetUnitFlyHeight(dat.target,0.,RATE_Z)
set dat.target = null
else
call ErrorSound(dat.owner)
call DisplayTextToPlayer(dat.owner,0.,0.,INFO_NOTARGET)
endif
endfunction
private function UpdateControl takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
local real x = GetUnitX(dat.caster)
local real y = GetUnitY(dat.caster)
local real z = GetUnitFlyHeight(dat.caster)
if dat.target!=null and dat.caster != null and not(IsUnitType(dat.caster,UNIT_TYPE_DEAD)) then
call SetUnitPosition(dat.target,x,y)
call SetUnitFlyHeight(dat.caster,z,0.)
if (z - WALKER_Z) >= 0. then
call SetUnitFlyHeight(dat.target,z-WALKER_Z,0.)
endif
else
call SetUnitPathing( dat.target, true)
call SetUnitFlyHeight(dat.target,0.,0.)
if GetUnitAbilityLevel(dat.target,GARN)>=1 then
call UnitRemoveAbility(dat.target, GARN)
endif
call SetUnitInvulnerable(dat.target,false)
call ReleaseTimer(t)
set dat.tiOrbit = null
endif
endfunction
private function CastControl takes nothing returns nothing
local str dat = str[SpellEvent.CastingUnit]
if dat.target!=null then
if dat.tiOrbit!= null then
call ReleaseTimer(dat.tiOrbit)
endif
call SetUnitPathing( dat.target, true)
if GetUnitAbilityLevel(dat.target,GARN)>=1 then
call UnitRemoveAbility(dat.target, GARN)
endif
call SetUnitInvulnerable(dat.target,false)
call SetUnitFlyHeight(dat.target,0.,RATE_Z)
endif
call SetUnitFlyHeight(dat.caster,0.,RATE_Z)
set dat.target = SpellEvent.TargetUnit
if GetUnitAbilityLevel(dat.target,GARN)<=0 then
call UnitAddAbility(dat.target, GARN)
endif
call SetUnitInvulnerable(dat.target,true)
call SetUnitFlyHeight(dat.caster,SPAWN_Z,RATE_Z)
call SetUnitPathing(dat.target,false)
set dat.tiOrbit = NewTimer()
call SetTimerData(dat.tiOrbit, dat )
call TimerStart(dat.tiOrbit, TIMEOUT, true, function UpdateControl )
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL_CONTROL, CastControl)
call RegisterSpellFinishResponse(SPELL_RELEASE, CastRelease)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope Tornado initializer init
globals
private constant integer DRONE_ID = 'n00G'
private constant integer UNIT_ID = 'h01U'
private constant string INFO = "Tornado incoming by the aerial way."
private unit array Walker [12]
private constant integer SPELL ='A0GP'
private constant integer SPEED = 25
private constant real SPAWN_DISTANCE = 4000.
private constant real SPAWN_Z = 500.
private constant real WALKER_Z = 50.
private constant real WAIT = 3.
endglobals
private struct s_delay
unit drone
unit walker
endstruct
private function Wait takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_delay dat = GetTimerData(t)
call SetUnitFlyHeight(dat.drone,SPAWN_Z,300.)
call SetUnitFlyHeight(dat.walker, 0., 0.)
call UnitRemoveAbility(dat.walker,GARN)
call SetUnitInvulnerable(dat.walker,false)
call UnitAddAbility(dat.drone,LASTQUESTUNIT_SPELL)
call IssuePointOrder(dat.drone,LASTQUESTUNIT_ORDER,GetRectCenterX(gg_rct_LastQuest),GetRectCenterY(gg_rct_LastQuest))
call ReleaseTimer(t)
call dat.destroy()
endfunction
private function DelayControl takes unit drone, unit walker returns nothing
local timer t = NewTimer()
local s_delay dat = s_delay.create()
set dat.walker = walker
set dat.drone = drone
call SetTimerData(t, dat)
call TimerStart (t, WAIT, false, function Wait)
endfunction
private struct s_drop
player owner
unit drone
unit walker
real angle
integer distance
integer i
endstruct
private function Update takes nothing returns nothing
local timer t = GetExpiredTimer()
local s_drop dat = GetTimerData(t)
local real newX = GetUnitX(dat.drone) + SPEED*Cos(dat.angle)
local real newY = GetUnitY(dat.drone) + SPEED*Sin(dat.angle)
if dat.i < dat.distance then
set dat.i = dat.i + 1
call SetUnitPosition(dat.drone, newX, newY)
call SetUnitPosition(dat.walker, newX, newY)
else
call SetUnitFlyHeight(dat.drone,100.,300.)
call SetUnitFlyHeight(dat.walker, 0., 300.)
call DelayControl(dat.drone,dat.walker)
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function Actions takes nothing returns nothing
local timer t = NewTimer()
local s_drop dat = s_drop.create()
local real x1 = GetUnitX(SpellEvent.CastingUnit)
local real y1 = GetUnitY(SpellEvent.CastingUnit)
local real x2 = SpellEvent.TargetX
local real y2 = SpellEvent.TargetY
local real angle = Atan2((y2 -y1), (x2 - x1))
local real x3 = CheckPointValidity(x1 - SPAWN_DISTANCE*Cos(angle),MapXMin,MapXMax)
local real y3 = CheckPointValidity(y1 - SPAWN_DISTANCE*Sin(angle),MapYMin,MapYMax)
local real x4 = CheckPointValidity(x2 + SPAWN_DISTANCE*Cos(angle),MapXMin,MapXMax)
local real y4 = CheckPointValidity(y2 + SPAWN_DISTANCE*Sin(angle),MapYMin,MapYMax)
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local integer ownerId = GetPlayerId(owner)
if not(IsUnitType(Walker[ownerId],UNIT_TYPE_DEAD)) then
call KillUnit(Walker[ownerId])
endif
call DisplayAll(PlayerColor[ownerId]+GetPlayerName(owner),INFO)
call PingMinimap(x2,y2,1.)
set dat.angle = angle
set dat.distance =R2I(SquareRoot((x3-x2)*(x3-x2)+(y3-y2)*(y3-y2))/SPEED)
set dat.i = 0
set dat.owner = owner
set dat.drone = CreateUnit(dat.owner,DRONE_ID,x3,y3, dat.angle*bj_RADTODEG )
call SetUnitFlyHeight(dat.drone,SPAWN_Z,0.)
set dat.walker = CreateUnit(dat.owner,UNIT_ID,x3,y3,0.)
call SetUnitFlyHeight(dat.walker, SPAWN_Z-WALKER_Z, 0.)
call UnitAddAbility(dat.walker,GARN)
call SetUnitInvulnerable(dat.walker,true)
set Walker[ownerId] = dat.walker
call SetTimerData(t, dat)
call TimerStart (t, TIMEOUT, true, function Update)
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope toxfield initializer init
globals
private constant real AOE = 500.00
private constant integer DUMMY_SPELL = 'A00R'
private constant integer SPELL = 'A05D'
private constant integer BUFF = 'A00R'
private unit Caster
private player Owner
private integer TmpLevel
endglobals
private function Damage takes nothing returns boolean
local unit target = GetFilterUnit()
local unit dummy = null
if IsUnitEnemy(target,Owner) and not(IsUnitType(target,UNIT_TYPE_STRUCTURE)) and not(IsUnitType(target,UNIT_TYPE_DEAD)) then
set dummy = CreateUnit(Owner,DUMMY,GetUnitX(target),GetUnitY(target),0.)
call UnitAddAbility(dummy,DUMMY_SPELL)
call SetUnitAbilityLevel(dummy,'A00R',TmpLevel)
call IssueTargetOrder(dummy, "attack", target)
call UnitApplyTimedLife(dummy,'BTLF',1.)
endif
set target = null
set dummy = null
return true
endfunction
private function Actions takes nothing returns nothing
set Caster = SpellEvent.CastingUnit
set Owner = GetOwningPlayer(SpellEvent.CastingUnit)
set TmpLevel = GetUnitAbilityLevel(SpellEvent.CastingUnit,SPELL)
call GroupEnumUnitsInRange(ENUM_GROUP,GetUnitX(SpellEvent.CastingUnit),GetUnitY(SpellEvent.CastingUnit),AOE,Filter(function Damage))
endfunction
public function init takes nothing returns nothing
call AbilityPreload(DUMMY_SPELL)
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=15
//TESH.alwaysfold=0
library ToxineExpertise
globals
private constant integer SPELL = 'A0K4'
private constant integer GAMMA_REQ = 3
private constant integer GAMMA_CHANCE = 10
private constant integer GAMMA_DUMMY_SPELL = 'A0KC'
private constant integer TOXINE_RESISTANCE_REQ = 4
private constant integer TOXINE_RESISTANCE_CHANCE = 5
private constant integer TOXINE_DUMMY_SPELL = 'A0KD'
endglobals
private function UnitAttacked takes nothing returns boolean
local unit victim = GetTriggerUnit()
local unit attacker = GetAttacker()
local unit dummy = null
if GetUnitAbilityLevel(attacker,SPELL)>=TOXINE_RESISTANCE_REQ and GetRandomInt(0,100)<=TOXINE_RESISTANCE_CHANCE then
set dummy = CreateUnit(GetOwningPlayer(attacker),DUMMY,GetUnitX(victim),GetUnitY(victim),0.)
call UnitAddAbility(dummy,TOXINE_DUMMY_SPELL)
call IssueTargetOrder(dummy,"acidbomb", victim)
call UnitApplyTimedLife(dummy,'BTLF',2.)
endif
set attacker = null
set victim = null
set dummy = null
return false
endfunction
private function UnitDeath takes nothing returns boolean
local unit victim = GetTriggerUnit()
local unit attacker = GetKillingUnit()
local unit dummy = null
if GetUnitAbilityLevel(attacker,SPELL)>=GAMMA_REQ and GetRandomInt(0,100)<=GAMMA_CHANCE then
set dummy = CreateUnit(GetOwningPlayer(attacker),DUMMY,GetUnitX(victim),GetUnitY(victim),0.)
call UnitAddAbility(dummy,GAMMA_DUMMY_SPELL)
call IssueImmediateOrder(dummy,"fanofknives")
call UnitApplyTimedLife(dummy,'BTLF',2.)
endif
set attacker = null
set victim = null
set dummy = null
return false
endfunction
function ToxineExpertise takes unit hero returns nothing
call AbilityPreload(GAMMA_DUMMY_SPELL)
call AbilityPreload(TOXINE_DUMMY_SPELL)
call RegisterAnyUnitEvent(EVENT_PLAYER_UNIT_ATTACKED,function UnitAttacked)
call RegisterAnyUnitEvent(EVENT_PLAYER_UNIT_DEATH,function UnitDeath)
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope TransportDrive initializer init
globals
private constant integer SPELL = 'A0HH'
private constant integer UNIT_ID = 'n01H'
endglobals
private function Actions takes nothing returns nothing
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
if GetUnitTypeId(SpellEvent.TargetUnit)==UNIT_ID then
call SetPilotVehicle(SpellEvent.CastingUnit,SpellEvent.TargetUnit)
else
call ErrorSound(owner)
call DisplayTextToPlayer(owner,0.,0.,"You must target a GW-Transport")
endif
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope TurretTrap initializer init
globals
private constant integer ID1 = 'o03C'
private constant integer ID2 = 'o03D'
private constant integer SPELL = 'A0HC'
endglobals
private function KillAllTurrets takes nothing returns boolean
if GetUnitTypeId(GetFilterUnit())==ID1 or GetUnitTypeId(GetFilterUnit())==ID2 then
call KillUnit(GetFilterUnit())
endif
return true
endfunction
private function Spawn takes nothing returns nothing
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local integer ownerId = GetPlayerId(owner)
local real x = SpellEvent.TargetX
local real y = SpellEvent.TargetY
call GroupEnumUnitsOfPlayer(ENUM_GROUP,owner,Filter(function KillAllTurrets))
call CreateUnit(owner,ID1,x,y,0.)
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Spawn)
endfunction
endscope
//TESH.scrollpos=4
//TESH.alwaysfold=0
scope UnderFire initializer init
globals
private constant integer SPELLBOOK = 'A0H3'
private constant real DUR = 10.
private constant integer SPELL = 'A0GQ'
private constant integer BONUS = 'A0H2'
private constant integer BUFF = 'B027'
endglobals
private struct str
unit caster
endstruct
private function Wait takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
if GetUnitAbilityLevel(dat.caster,SPELLBOOK)>=1 then
call UnitRemoveAbility(dat.caster,SPELLBOOK)
endif
if GetUnitAbilityLevel(dat.caster,BUFF)>=1 then
call UnitRemoveAbility(dat.caster,BUFF)
endif
call ReleaseTimer(t)
call dat.destroy()
endfunction
private function Actions takes nothing returns nothing
local timer t = NewTimer()
local str dat = str.create()
set dat.caster = SpellEvent.CastingUnit
if GetUnitAbilityLevel(dat.caster,SPELLBOOK)<=0 then
call UnitAddAbility(dat.caster, SPELLBOOK)
call SetUnitAbilityLevel(dat.caster,BONUS,GetUnitAbilityLevel(dat.caster,SPELL))
endif
call SetTimerData(t, dat)
call TimerStart (t,DUR, false, function Wait )
endfunction
public function init takes nothing returns nothing
local integer i = 0
call AbilityPreload(SPELLBOOK)
loop
exitwhen i > MAXPLAYER
call SetPlayerAbilityAvailable(Player(i),SPELLBOOK,false)
set i = i + 1
endloop
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope VitalSigns initializer init
globals
private constant integer SPELL = 'A02R'
endglobals
private function Actions takes nothing returns nothing
local integer i = 0
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local integer ownerId = GetPlayerId(owner)
call DisplayAll(PlayerColor[ownerId]+GetPlayerName(owner),"Checking vital signs...")
loop
exitwhen i > MAXPLAYER
if GetPlayerSlotState(Player(i))==PLAYER_SLOT_STATE_PLAYING and GetPlayerController(Player(i)) == MAP_CONTROL_USER and IsHeroDefinitelyDead(i)==false then
if GetUnitAbilityLevel(Hero[i],BUFF_POISON1)>=1 or GetUnitAbilityLevel(Hero[i],BUFF_POISON2)>=1 then
call DisplayAll(PlayerColor[i]+GetPlayerName(Player(i)),"is poisoned")
endif
if GetUnitAbilityLevel(Hero[i],BUFF_FRACT)>=1 then
call DisplayAll(PlayerColor[i]+GetPlayerName(Player(i)),"has a fracture")
endif
if GetUnitState(Hero[i],UNIT_STATE_LIFE)<0.30*GetUnitState(Hero[i],UNIT_STATE_MAX_LIFE) then
call DisplayAll(PlayerColor[i]+GetPlayerName(Player(i)),"is wounded")
call PingMinimapEx(GetUnitX(Hero[i]),GetUnitY(Hero[i]),1., 255, 0, 0, false)
endif
if IsUnitType(Hero[i],UNIT_TYPE_DEAD) and IsHeroDefinitelyDead(i)==false then
call DisplayAll(PlayerColor[i]+GetPlayerName(Player(i)),"is dying")
call PingMinimapEx(GetUnitX(Hero[i]),GetUnitY(Hero[i]),1., 255, 0, 0, false)
endif
endif
set i = i + 1
endloop
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
library WarUpgrade needs AmmoSystem
globals
private constant integer SPELL = 'A0GG'
private constant integer AMMO_REQ = 2
private constant integer AMMO_BONUS = 10
private constant real RELOAD_BONUS = 1.
private constant integer ARMOR_REQ = 6
private constant integer ARMOR_BONUS = 'A07H'
endglobals
private function Conditions takes nothing returns boolean
local unit caster = GetTriggerUnit()
if GetLearnedSkill() == SPELL then
if GetUnitAbilityLevel(caster,SPELL) == AMMO_REQ then
call UpgradeMaxWeapon(caster,AMMO_BONUS)
call UpgradeReloadWeapon(caster,RELOAD_BONUS)
elseif GetUnitAbilityLevel(caster,SPELL) == ARMOR_REQ then
call UnitAddAbility(caster,ARMOR_BONUS)
endif
endif
set caster = null
return false
endfunction
function WarUpgrade takes unit hero returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterUnitEvent(t,hero,EVENT_UNIT_HERO_SKILL)
call TriggerAddCondition(t,Condition(function Conditions))
endfunction
endlibrary
//TESH.scrollpos=66
//TESH.alwaysfold=0
scope WeaponOfMassDestruction initializer init
globals
private constant integer DRONE_ID = 'n013'
private constant integer SPELL ='A0KA'
private constant integer SPEED = 50
private constant real AOE = 800.
private constant real AOE_FX = 400.
private constant real IMP = 1.
private constant real SPAWN_DISTANCE = 2000.
private constant real SPAWN_Z = 500.
private constant integer COUNT = 8
private constant integer DUMMY_AOE = 'o00Z'
private constant integer DUMMY_ANTHRAX = 'o03M'
private constant real DUR = 30.
endglobals
private function Damage takes unit whichUnit, real x, real y returns nothing
local integer i = 0
loop
exitwhen i > COUNT
call UnitApplyTimedLife(CreateUnit(GetOwningPlayer(whichUnit),DUMMY_ANTHRAX,x+GetRandomReal(-AOE_FX,AOE_FX),y+GetRandomReal(-AOE_FX,AOE_FX),0.),'BTLF',DUR)
set i = i + 1
endloop
endfunction
private struct str
unit drone
real angle
integer distance
integer firepoint
integer i
real targetX
real targetY
endstruct
private function Update takes nothing returns nothing
local timer t = GetExpiredTimer()
local str dat = GetTimerData(t)
local real newX = GetUnitX(dat.drone) + SPEED*Cos(dat.angle)
local real newY = GetUnitY(dat.drone) + SPEED*Sin(dat.angle)
local real z = GetUnitFlyHeight(dat.drone)
local real newz = 0.
if dat.i < dat.distance then
set dat.i = dat.i + 1
call SetUnitPosition(dat.drone, newX, newY)
if dat.i == dat.firepoint then
call Damage(dat.drone,dat.targetX,dat.targetY)
endif
else
call RemoveUnit(dat.drone)
call ReleaseTimer(t)
call dat.destroy()
endif
endfunction
private function Actions takes nothing returns nothing
local timer t = NewTimer()
local str dat = str.create()
local real x1 = GetUnitX(SpellEvent.CastingUnit)
local real y1 = GetUnitY(SpellEvent.CastingUnit)
local real x2 = SpellEvent.TargetX
local real y2 = SpellEvent.TargetY
local real angle = Atan2((y2 -y1), (x2 - x1))
local real x3 = CheckPointValidity(x1 - SPAWN_DISTANCE*Cos(angle),MapXMin,MapXMax)
local real y3 = CheckPointValidity(y1 - SPAWN_DISTANCE*Sin(angle),MapYMin,MapYMax)
local real x4 = CheckPointValidity(x2 + SPAWN_DISTANCE*Cos(angle),MapXMin,MapXMax)
local real y4 = CheckPointValidity(y2 + SPAWN_DISTANCE*Sin(angle),MapYMin,MapYMax)
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local integer ownerId = GetPlayerId(owner)
call DisplayAll(PlayerColor[ownerId]+GetPlayerName(owner),"Move! Move! Move! Anthrax missiles incoming!")
call FlySound()
call WillExplodeSound()
set dat.targetX = x2
set dat.targetY = y2
set dat.angle = angle
set dat.firepoint =R2I(1.25*SquareRoot((x3-x2)*(x3-x2)+(y3-y2)*(y3-y2))/SPEED)
set dat.distance =R2I(SquareRoot((x3-x4)*(x3-x4)+(y3-y4)*(y3-y4))/SPEED)
if dat.firepoint >= dat.distance then
set dat.firepoint = dat.distance
endif
call PingMinimapEx(x2, y2,5., 204, 196, 115, false)
call UnitApplyTimedLife(CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),DUMMY_AOE,x2,y2,0.),'BTLF',2.)
set dat.i = 0
set dat.drone = CreateUnit(GetOwningPlayer(SpellEvent.CastingUnit),DRONE_ID,x3,y3, dat.angle*bj_RADTODEG )
call SetUnitFlyHeight(dat.drone,SPAWN_Z,0.)
call SetTimerData(t, dat)
call TimerStart (t, TIMEOUT, true, function Update)
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope Wrath initializer init
globals
private constant integer SPELL = 'A0HD'
private constant string FX = "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportCaster.mdl"
private constant integer MECH_ID = 'h01W'
private constant string INFO = "Wrath incoming on our position."
private unit array Chopper [12]
endglobals
private function Spawn takes nothing returns nothing
local player owner = GetOwningPlayer(SpellEvent.CastingUnit)
local integer ownerId = GetPlayerId(owner)
local real x = GetRectCenterX(gg_rct_ChopperStart)
local real y = GetRectCenterY(gg_rct_ChopperStart)
call DestroyEffect(AddSpecialEffect(FX,x,y) )
if not(IsUnitType(Chopper[ownerId],UNIT_TYPE_DEAD)) then
call KillUnit(Chopper[ownerId])
endif
set Chopper[ownerId] = CreateUnit(owner, MECH_ID,x,y,0.)
call IssueImmediateOrder(Chopper[ownerId],ACTIVATE_AI_ORDER)
call DisplayAll(PlayerColor[ownerId]+GetPlayerName(owner),INFO)
call PingMinimap(x,y,1.)
endfunction
public function init takes nothing returns nothing
call RegisterSpellFinishResponse(SPELL, Spawn)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
library WrathOfZeus initializer init needs SpellEvent, GroupUtils
globals
private constant integer ABILITY_ID = 'A0J6' //Raw code of the triggering ability
private constant integer DUMMY = 'e004' //The dummy unit, please import dummy.mdl and make a proper dummy unit
private constant integer STATIC_LINKS = 32 //The links that are created when the orb crashes
private constant integer CHARGED_BOLTS_AMOUNT = 3 //The amount of orbiting missiles that are created around the caster when the ability is learned
private constant real CHARGED_BOLTS_SIZE = .88 //The scale value of the orbiting missiles
private constant real PRIMARY_BASE_DAMAGE = 200 //The base damage when the orb crashes
private constant real PRIMARY_INC_DAMAGE = 200 // The increment damage of the orb
private constant real SECONDARY_BASE_DAMAGE = 50 //The damage each static link deals
private constant real SECONDARY_INC_DAMAGE = 50 // The increment damage of each static link
private constant real BOLT_SCALE = 1. //The scale of the lightning bolt
private constant real NORMAL_OFFSET = 120. //The default rotating offset of the orbiting bolts
private constant real MAX_OFFSET = 200. //The maximum rotating offset the bolts can reach when overloading
private constant real ENUM_OFFSET = 50. //the range that units are checked from each static link. You should decrease this if you use a LOT of static links!
private constant string BALL_ART = "Abilities\\Weapons\\FarseerMissile\\FarseerMissile.mdl" //The missiles that rotate around the cast
private constant string TAIL_LIGHTNING = "CLPB" //The lightning tail of the bolt
private constant string CHARGED_LIGHTNING = "CLSB" //The lightning tail of the secondary static links
private constant string ORBITAL_LIGHTNING = "CLSB" //The lightning that links all the orbital missiles
private constant string BOLT_LIGHTNING = "Abilities\\Weapons\\SpiritOfVengeanceMissile\\SpiritOfVengeanceMissile.mdl" //The lightning bolt art
private constant string PRIMARY_EFFECT = "Abilities\\Weapons\\Bolt\\BoltImpact.mdl" //The effect that is created upon impact
private constant string SECONDARY_EFFECT = "Abilities\\Spells\\Orc\\LightningShield\\LightningShieldBuff.mdl" //The effect that is created on damaged units of secondary effect
private constant attacktype ATTACK_TYPE = ATTACK_TYPE_MAGIC
private constant damagetype DAMAGE_TYPE = DAMAGE_TYPE_MAGIC
private constant weapontype WEAPON_TYPE = WEAPON_TYPE_WHOKNOWS
///
private constant boolean USE_GROUPUTILS = true //Whether to use Group utils library, if the library isn't found, it will CreateGroup() instead
///
endglobals
////===============
globals
private location loc = Location(0, 0)
private location loc2 = Location(0, 0)
private integer instance = 0
private boolexpr BE
private constant group Group = CreateGroup()
private constant integer Cbolts = CHARGED_BOLTS_AMOUNT - 1
private real MINX
private real MINY
private real MAXX
private real MAXY
endglobals
/////=================
//Extra functions
//
private function SafeX takes real x returns real
local real rx=MINX+50
if(x<rx)then
return rx
endif
set rx=MAXX-50
if(x>rx)then
return rx
endif
return x
endfunction
private function SafeY takes real y returns real
local real ry=MINY+50
if(y<ry)then
return ry
endif
set ry=MAXY-50
if(y>ry)then
return ry
endif
return y
endfunction
/////////=======================================
private struct spark
unit u
lightning l
real ang
real sx
real sy
real x
real y
real time = 1.5
real time2 = 2
real dmg
group damaged
static integer tot = 0
static spark array ar
static timer stim = CreateTimer()
static method SecondaryEffects takes unit u, unit t, real x, real y returns nothing
local integer i = 1
local spark data
loop
exitwhen i > STATIC_LINKS
set data = spark.create()
set data.u = u
set data.sx = x
set data.sy = y
set data.x = x
set data.y = y
set data.ang = (360 / STATIC_LINKS) * i
static if USE_GROUPUTILS then
static if LIBRARY_GroupUtils then
set data.damaged = NewGroup()
else
set data.damaged = CreateGroup()
debug call BJDebugMsg(LIBRARY_PREFIX+": Could not find GroupUtils")
endif
else
set data.damaged = CreateGroup()
endif
if t != null then
call GroupAddUnit(data.damaged, t)
endif
set data.dmg = SECONDARY_BASE_DAMAGE + (SECONDARY_INC_DAMAGE * (GetUnitAbilityLevel(data.u, ABILITY_ID) - 1))
set data.l = AddLightning(CHARGED_LIGHTNING, true, x, y, x+5, y+5)
call SetLightningColor(data.l, .7, .7, 1, .7)
if spark.tot == 0 then
call TimerStart(spark.stim, .042, true, function spark.Loop)
endif
set spark.ar[spark.tot] = data
set spark.tot = spark.tot + 1
set i = i + 1
endloop
endmethod
static method Enum takes nothing returns boolean
local spark data = instance
local unit e = GetFilterUnit()
if IsUnitInGroup(e, data.damaged) then
set e = null
return false
else
if (not(IsUnitType(e, UNIT_TYPE_STRUCTURE))) and (GetWidgetLife(e)>.405) and (IsUnitEnemy(e, GetOwningPlayer(data.u))) then
call DestroyEffect(AddSpecialEffectTarget(SECONDARY_EFFECT, e, "origin"))
call UnitDamageTarget(data.u, e, data.dmg, false, false, ATTACK_TYPE, DAMAGE_TYPE, WEAPON_TYPE)
call GroupAddUnit(data.damaged, e)
endif
endif
set e = null
return false
endmethod
static method Loop takes nothing returns nothing
local spark data
local integer i = 0
local real p
loop
exitwhen i >= spark.tot
set data = spark.ar[i]
if data.time > 0 then
set data.time = data.time - .042
set data.x = SafeX(data.x + 30 * Cos(data.ang * bj_DEGTORAD))
set data.y = SafeX(data.y + 30 * Sin(data.ang * bj_DEGTORAD))
set p = SquareRoot((data.x - data.sx) * (data.x - data.sx) + (data.y - data.sy) * (data.y - data.sy))
if p > 450 then
set data.sx = data.sx + 30 * Cos(data.ang * bj_DEGTORAD)
set data.sy = data.sy + 30 * Sin(data.ang * bj_DEGTORAD)
endif
set instance = data
call GroupEnumUnitsInRange(Group, data.x, data.y, ENUM_OFFSET, BE)
call MoveLocation(loc, data.sx, data.sy)
call MoveLocation(loc2, data.x, data.y)
call MoveLightningEx(data.l, true, data.sx, data.sy, GetLocationZ(loc), data.x, data.y, GetLocationZ(loc2))
else
if (SquareRoot((data.x - data.sx) * (data.x - data.sx) + (data.y - data.sy) * (data.y - data.sy)) > 50) and data.time2 > 0 then
set data.sx = data.sx + 30 * Cos(data.ang * bj_DEGTORAD)
set data.sy = data.sy + 30 * Sin(data.ang * bj_DEGTORAD)
call MoveLocation(loc, data.sx, data.sy)
call MoveLocation(loc2, data.x, data.y)
call MoveLightningEx(data.l, true, data.sx, data.sy, GetLocationZ(loc), data.x, data.y, GetLocationZ(loc2))
set instance = data
call GroupEnumUnitsInRange(Group, data.sx, data.sy, 125, BE)
set data.time2 = data.time2 - .04
else
call data.destroy()
set spark.tot = spark.tot - 1
set spark.ar[i] = spark.ar[spark.tot]
endif
endif
set i = i + 1
endloop
if spark.tot == 0 then
call PauseTimer(spark.stim)
endif
endmethod
method onDestroy takes nothing returns nothing
call DestroyLightning(.l)
static if USE_GROUPUTILS then
static if LIBRARY_GroupUtils then
call ReleaseGroup(.damaged)
else
call DestroyGroup(.damaged)
debug call BJDebugMsg(LIBRARY_PREFIX+": Could not find GroupUtils")
endif
else
call DestroyGroup(.damaged)
endif
endmethod
endstruct
private struct bolt
unit u
unit t
unit d
real damage
lightning l
effect art
static integer total = 0
static bolt array arr
static timer tim = CreateTimer()
static method create takes unit u, unit t returns bolt
local bolt data = bolt.allocate()
local real x
local real y
local real x2
local real y2
local sound snd
local string array s
local integer r = GetRandomInt(0, 1)
set s[0] = "Abilities\\Spells\\Orc\\LightningShield\\LightningShieldTarget.wav"
set s[1] = "Abilities\\Spells\\Orc\\LightningBolt\\LightningBolt.wav"
set data.u = u
set snd = CreateSound(s[r], false, false, true, 12700, 12700, "")
set x = GetUnitX(data.u) + 100 * Cos(GetUnitFacing(data.u) * bj_DEGTORAD)
set y = GetUnitY(data.u) + 100 * Sin(GetUnitFacing(data.u) * bj_DEGTORAD)
set data.d = CreateUnit(GetOwningPlayer(data.u), DUMMY, x, y, 0)
call AttachSoundToUnit(snd, data.d)
set x2 = GetUnitX(data.d) + 200 * Cos((GetUnitFacing(data.u)-180) * bj_DEGTORAD)
set y2 = GetUnitY(data.d) + 200 * Sin((GetUnitFacing(data.u)-180) * bj_DEGTORAD)
set data.t = t
call UnitAddAbility(data.d, 'Amrf')
call UnitRemoveAbility(data.d, 'Amrf')
call SetUnitFlyHeight(data.d, 90, 550)
call SetUnitTimeScale(data.d, 0)
call SetUnitScale(data.d, BOLT_SCALE, BOLT_SCALE, BOLT_SCALE)
set data.l = AddLightning(TAIL_LIGHTNING, true, x2, y2, x, y)
call StartSound(snd)
call KillSoundWhenDone(snd)
set snd = null
set data.damage = PRIMARY_BASE_DAMAGE + (PRIMARY_INC_DAMAGE * (GetUnitAbilityLevel(data.u, ABILITY_ID)-1))
set data.art = AddSpecialEffectTarget(BOLT_LIGHTNING, data.d, "origin")
if bolt.total == 0 then
call TimerStart(bolt.tim, .0303, true, function bolt.Loop)
endif
set bolt.arr[bolt.total] = data
set bolt.total = bolt.total + 1
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Human\\StormBolt\\StormBoltMissile.mdl", data.u, "weapon,right"))
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\FarseerMissile\\FarseerMissile.mdl", data.d, "origin"))
return data
endmethod
static method Loop takes nothing returns nothing
local bolt data
local integer i = 0
local real p = 0
local real a=0
local real x=0
local real y=0
local real x2=0
local real y2=0
local real z=0
local real d=0
local real dx=0
local real dy=0
loop
exitwhen i >= bolt.total
set data = bolt.arr[i]
set x = GetUnitX(data.d)
set y = GetUnitY(data.d)
set x2 = GetUnitX(data.t)
set y2 = GetUnitY(data.t)
set a = bj_RADTODEG * Atan2(y2 - y, x2 - x)
call SetUnitFacing(data.d, a)
if IsUnitInRange(data.d, data.t, 50) then
call DestroyEffect(data.art)
call KillUnit(data.d)
call DestroyEffect(AddSpecialEffectTarget(PRIMARY_EFFECT, data.t, "origin"))
call UnitDamageTarget(data.u, data.t, data.damage, false, false, ATTACK_TYPE, DAMAGE_TYPE, WEAPON_TYPE)
call spark.SecondaryEffects(data.u, data.t, x2, y2)
call DestroyLightning(data.l)
set data.d = CreateUnit(Player(12), DUMMY, x2, y2, 0)
call SetUnitScale(data.d, 3.5, 3.5, 3.5)
call SetUnitVertexColor(data.d, 170, 170, 255, 255)
call DestroyEffect(AddSpecialEffectTarget(PRIMARY_EFFECT, data.d, "origin"))
call KillUnit(data.d)
call data.destroy()
set bolt.total = bolt.total - 1
set bolt.arr[i] = bolt.arr[bolt.total]
else
set p = SquareRoot((x - x2) * (x - x2) + (y - y2) * (y - y2))
set d = 17 + (p * .012)
///------------------------------------
set dx = SafeX(x + d * Cos(a * bj_DEGTORAD))
set dy = SafeY(y + d * Sin(a * bj_DEGTORAD))
call SetUnitX(data.d, dx)
call SetUnitY(data.d, dy)
////-----------------------------------
set x = GetUnitX(data.d)
set y = GetUnitY(data.d)
set a = (a-180)
set dx = x + 200 * Cos(a * bj_DEGTORAD)
set dy = y + 200 * Sin(a * bj_DEGTORAD)
call MoveLocation(loc, dx, dy)
call MoveLocation(loc2, x, y)
call MoveLightningEx(data.l, true, dx, dy, (GetLocationZ(loc)+90), x, y, (GetLocationZ(loc2)+GetUnitFlyHeight(data.d)))
endif
set i = i + 1
endloop
if bolt.total == 0 then
call PauseTimer(bolt.tim)
endif
endmethod
endstruct
// Charged bolts //
private struct Charged
unit u
unit array mis[CHARGED_BOLTS_AMOUNT]
real array fh[CHARGED_BOLTS_AMOUNT]
real array fi[CHARGED_BOLTS_AMOUNT]
real array x[CHARGED_BOLTS_AMOUNT]
lightning array l[CHARGED_BOLTS_AMOUNT]
lightning array l2[CHARGED_BOLTS_AMOUNT]
boolean array fb[CHARGED_BOLTS_AMOUNT]
effect array fx[CHARGED_BOLTS_AMOUNT]
boolean dead = false //If the flag is turned on, the charged bolts dissapear until the hero is alive again
real tick = 0
real xtick = .94 //Defines the duration of the lightning rotation
real rat = SquareRoot(NORMAL_OFFSET) / bj_PI
real limit = NORMAL_OFFSET
boolean charged = false
static thistype array arr
static integer total = 0
static timer tim = CreateTimer()
////
private static string str1 = "Abilities\\Spells\\Orc\\LightningShield\\LightningShieldBuff.mdl"
////
static method create takes unit u returns thistype
local thistype this = thistype.allocate()
local integer i = 0
local trigger t = CreateTrigger()
local real x
local real y
local real cx = GetUnitX(u)
local real cy = GetUnitY(u)
set this.u = u
loop
exitwhen i > Cbolts
set this.mis[i] = CreateUnit(GetOwningPlayer(u), DUMMY, GetUnitX(u), GetUnitY(u), 0)
set this.fx[i] = AddSpecialEffectTarget(BALL_ART , this.mis[i], "origin")
set x = cx + 60 * Cos(( (360 / (Cbolts+1)) * (i+1) ) * bj_DEGTORAD)
set y = cy + 60 * Sin(( (360 / (Cbolts+1)) * (i+1) ) * bj_DEGTORAD)
call SetUnitX(this.mis[i], x)
call SetUnitY(this.mis[i], y)
call UnitAddAbility(this.mis[i], 'Amrf')
call SetUnitTimeScale(this.mis[i], 0)
call UnitRemoveAbility(this.mis[i], 'Amrf')
set this.fh[i] = 30 * i
call SetUnitFlyHeight(this.mis[i], this.fh[i], 0)
call SetUnitScale(this.mis[i], CHARGED_BOLTS_SIZE, CHARGED_BOLTS_SIZE, CHARGED_BOLTS_SIZE)
set this.fb[i] = true
set this.x[i] = bj_RADTODEG * Atan2(y - cy, x - cx)
set i = i + 1
endloop
call TriggerAddCondition(t, Condition(function Charged.ready))
call TriggerRegisterUnitEvent(t, u, EVENT_UNIT_SPELL_CAST)
if thistype.total == 0 then
call TimerStart(thistype.tim, .047, true, function Charged.fly)
endif
set thistype.total = thistype.total + 1
set thistype.arr[thistype.total - 1] = this
return this
endmethod
static method ready takes nothing returns boolean
local thistype this
local integer i = 0
local integer k = 0
local sound snd
if GetSpellAbilityId()!= ABILITY_ID then
return false
else
set this = thistype.GetInstance(GetTriggerUnit())
if this.charged then
return false
endif
set snd = CreateSound("Units\\Orc\\StasisTotem\\StasisTotem.wav", false, false, true, 12700, 12700, "")
call AttachSoundToUnit(snd, GetTriggerUnit())
set this.charged = true
set this.xtick = .8
set this.rat = this.rat + SquareRoot(MAX_OFFSET)
set this.limit = MAX_OFFSET
call StartSound(snd)
call KillSoundWhenDone(snd)
set snd = null
loop
exitwhen i>Cbolts
set k = i + 1
if k > Cbolts then
set k = 0
endif
set this.l[i] = AddLightning(CHARGED_LIGHTNING, true, GetUnitX(this.mis[i]), GetUnitY(this.mis[i]), GetUnitX(this.u), GetUnitY(this.u))
call SetLightningColor(this.l[i], 1, 1, 1, .6)
set this.l2[i] = AddLightning(ORBITAL_LIGHTNING, true, GetUnitX(this.mis[i]), GetUnitY(this.mis[i]), GetUnitX(this.mis[k]), GetUnitY(this.mis[k]))
call SetLightningColor(this.l2[i], .3, .1, 1, 1)
set i = i + 1
endloop
endif
return false
endmethod
static method GetInstance takes unit u returns integer
local thistype this
local integer i = 0
loop
exitwhen i >= thistype.total
set this = thistype.arr[i]
if IsUnit(u, this.u) then
return this
endif
set i = i + 1
endloop
return 0
endmethod
static method fly takes nothing returns nothing
local thistype this
local integer i = 0
local integer k = 0
local real x =0
local real y =0
local real cx
local real cy
local integer j = 0
loop
exitwhen i >= thistype.total
set this = thistype.arr[i]
set k = 0
set j = 0
set cx = GetUnitX(this.u)
set cy = GetUnitY(this.u)
loop
exitwhen k > Cbolts
set j = k + 1
if j > Cbolts then
set j = 0
endif
if (not(this.dead)) and this.mis[k] != null then
if this.fb[k] then
set this.fh[k] = this.fh[k] + 3
else
set this.fh[k] = this.fh[k] - 3
endif
if GetUnitFlyHeight(this.mis[k])<50 then
set this.fb[k] = true
elseif GetUnitFlyHeight(this.mis[k]) > 275 then
set this.fb[k] = false
endif
set this.tick = this.tick + .047
call SetUnitFlyHeight(this.mis[k], this.fh[k], 530)
set this.x[k] = this.x[k] + 4
if this.rat < this.limit then
set this.rat = this.rat + 2
elseif this.rat > this.limit then
set this.rat = this.rat - .5
endif
set x = cx + this.rat * Cos(this.x[k] * bj_DEGTORAD)
set y = cy + this.rat * Sin(this.x[k] * bj_DEGTORAD)
call SetUnitX(this.mis[k], x)
call SetUnitY(this.mis[k], y)
if this.charged then
if this.xtick > 0 then
set this.x[k] = this.x[k] + 6
call MoveLocation(loc, x, y)
call MoveLocation(loc2, GetUnitX(this.u), GetUnitY(this.u))
call MoveLightningEx(this.l[k], true, x, y, (GetLocationZ(loc)+GetUnitFlyHeight(this.mis[k])), cx, cy, (GetLocationZ(loc2)+GetUnitFlyHeight(this.u)+20))
call MoveLocation(loc2, GetUnitX(this.mis[j]), GetUnitY(this.mis[j]))
call MoveLightningEx(this.l2[k], true, x, y, (GetLocationZ(loc)+GetUnitFlyHeight(this.mis[k])), GetUnitX(this.mis[j]), GetUnitY(this.mis[j]), (GetLocationZ(loc2)+GetUnitFlyHeight(this.mis[j])))
else
call DestroyLightning(this.l[k])
call DestroyLightning(this.l2[k])
endif
endif
if this.tick > 1.75 then
set this.tick = 0
call DestroyEffect(AddSpecialEffectTarget(thistype.str1 , this.mis[k], "origin"))
endif
endif
set k = k + 1
endloop
if this.charged then
if this.xtick > 0 then
set this.xtick = this.xtick - .05
else
set this.charged = false
set this.limit = NORMAL_OFFSET
endif
endif
if GetWidgetLife(this.u)<.405 then
call this.hide()
set this.dead = true
elseif GetWidgetLife(this.u)>=.405 and this.dead then
set this.dead = false
call this.show()
endif
set i = i + 1
endloop
endmethod
method hide takes nothing returns nothing
local integer i = 0
loop
exitwhen i > Cbolts
if .mis[i] != null then
//call UnitRemoveAbility(.mis[i], 'Aloc')
call ShowUnit(.mis[i], false)
endif
set i = i + 1
endloop
endmethod
method show takes nothing returns nothing
local integer i = 0
loop
exitwhen i > Cbolts
if .mis[i] != null then
call ShowUnit(.mis[i], true)
call UnitAddAbility(.mis[i], 'Aloc')
endif
set i = i + 1
endloop
endmethod
endstruct
///////===================\\\\\\\
private function BoltStart takes nothing returns nothing
call bolt.create(GetTriggerUnit(), GetSpellTargetUnit())
endfunction
private function BoltCharge takes nothing returns boolean
if GetLearnedSkill() == ABILITY_ID then
if GetUnitAbilityLevel(GetTriggerUnit(), ABILITY_ID)<2 then
call Charged.create(GetTriggerUnit())
endif
endif
return false
endfunction
function WrathOfZeus takes unit hero returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterUnitEvent(t,hero,EVENT_UNIT_HERO_SKILL)
call TriggerAddCondition(t, Condition(function BoltCharge))
endfunction
private function init takes nothing returns nothing
set BE = Condition(function spark.Enum)
set MINX = GetRectMinX(bj_mapInitialPlayableArea)
set MINY = GetRectMinY(bj_mapInitialPlayableArea)
set MAXX = GetRectMaxX(bj_mapInitialPlayableArea)
set MAXY = GetRectMaxY(bj_mapInitialPlayableArea)
call RegisterSpellEffectResponse(ABILITY_ID, BoltStart)
endfunction
endlibrary