function KillAllKill takes nothing returns nothing
call KillUnit(GetEnumUnit())
endfunction
function KillAll takes player p returns nothing
local group g=GetUnitsOfPlayerAll(p)
call ForGroup(g,function KillAllKill)
call GroupClear(g)
set g=null
set p=null
endfunction
function End takes nothing returns nothing
call DestroyTimerDialog(udg_WaveTimerWindow)
call DestroyTimer(udg_WaveTimer)
call LeaderboardDisplay(bj_lastCreatedLeaderboard,false)
call DisableTrigger(gg_trg_Heroes)
call DisableTrigger(gg_trg_Level_Up)
call DisableTrigger(gg_trg_Kills)
call EnableTrigger(gg_trg_Skip_End)
call DisableTrigger(gg_trg_Stat_Caps)
call DisableTrigger(gg_trg_Leavers)
call DisableTrigger(gg_trg_Every30)
call SetMusicVolume(0)
call StartSound(gg_snd_Defeat)
call PauseAllUnitsBJ(true)
call CinematicModeBJ(true,GetPlayersAll())
endfunction
Name | Type | is_array | initial_value |
Alive | boolean | Yes | |
BonusKillNum | integer | Yes | |
Bonuss | string | Yes | |
Bonusspell | abilcode | Yes | |
Effects | string | Yes | |
Farms | integer | No | |
KillBoard | leaderboard | No | |
Kills | integer | Yes | |
maxstat | integer | No | 250 |
MovieTxt | string | Yes | |
Numalive | integer | No | |
Spawn_Rect | rect | Yes | |
TerrainType | terraintype | Yes | |
TmpLoc | location | No | |
TmpUnit | unit | No | |
Wave | integer | No | |
WaveTimer | timer | No | |
WaveTimerWindow | timerdialog | No | |
Zombies | integer | No | |
ZombieType | unitcode | Yes |
function Trig_Heroes_Conditions takes nothing returns boolean
return IsUnitType(GetDyingUnit(),UNIT_TYPE_HERO)==true
endfunction
function Trig_Heroes_Actions takes nothing returns nothing
local unit u=GetDyingUnit()
local player p=GetOwningPlayer(u)
local string s="Objects\\Spawnmodels\\Undead\\UDeathSmall\\UDeathSmall.mdl"
local unit U
local integer i=0
local integer I=GetPlayerTechCountSimple('R000',Player(11))
local location l
if GetUnitTypeId(u)=='H00B'then
set l=GetRandomLocInRect(udg_Spawn_Rect[GetRandomInt(0,3)])
call ReviveHeroLoc(u,l,false)
call DestroyEffect(AddSpecialEffectLoc(s,l))
call SetHeroLevel(u,GetHeroLevel(u)+1,true)
call PanCameraToTimedLocForPlayer(p,l,1)
call RemoveLocation(l)
set l=null
call SelectUnitForPlayerSingle(u,p)
else
loop
exitwhen i>10
call UnitRemoveItemFromSlot(u,i)
call SetPlayerAllianceStateBJ(p,Player(i),bj_ALLIANCE_UNALLIED)
call SetPlayerAllianceStateBJ(Player(i),p,bj_ALLIANCE_UNALLIED)
set i=i+1
endloop
call SetPlayerAllianceStateBJ(p,Player(11),bj_ALLIANCE_ALLIED_VISION)
call SetPlayerAllianceStateBJ(Player(11),p,bj_ALLIANCE_ALLIED_VISION)
call CinematicFadeBJ(bj_CINEFADETYPE_FADEOUT,.01,"ReplaceableTextures\\CameraMasks\\DreamFilter_Mask.blp",100,0,0,0)
call CinematicFadeBJ(bj_CINEFADETYPE_FADEIN,2,"ReplaceableTextures\\CameraMasks\\DreamFilter_Mask.blp",100,0,0,0)
set l=GetRandomLocInRect(udg_Spawn_Rect[GetRandomInt(0,3)])
set U=CreateUnitAtLoc(p,'H00B',l,0)
call SetHeroLevel(U,I,true)
call DisplayTextToForce(GetPlayersAll(),(("|cffff0000"+GetPlayerName(p))+" has died at level "+I2S(I)+" and is now a Lich!|r"))
call LeaderboardSetPlayerItemLabelBJ(p,GetLastCreatedLeaderboard(),"["+I2S(I)+"][Lich] "+GetPlayerName(p))
call LeaderboardSetPlayerItemValueBJ(p,GetLastCreatedLeaderboard(),0)
set udg_Alive[GetPlayerId(p)]=false
set udg_Numalive=udg_Numalive-1
call SetPlayerState(p,PLAYER_STATE_RESOURCE_GOLD,0)
call DestroyEffect(AddSpecialEffectLoc(s,l))
call PanCameraToTimedLocForPlayer(p,l,1)
call RemoveLocation(l)
set l=null
call SelectUnitForPlayerSingle(U,p)
endif
set U=null
set u=null
set p=null
endfunction
function InitTrig_Heroes takes nothing returns nothing
set gg_trg_Heroes=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Heroes,EVENT_PLAYER_UNIT_DEATH)
call TriggerAddCondition(gg_trg_Heroes,Condition(function Trig_Heroes_Conditions))
call TriggerAddAction(gg_trg_Heroes,function Trig_Heroes_Actions)
endfunction
function Trig_LeaversLoop takes nothing returns nothing
call RemoveUnit(GetEnumUnit())
endfunction
function Trig_Leavers_Actions takes nothing returns nothing
call DisplayTextToForce(GetPlayersAll(),"|cffff0000"+GetPlayerName(GetTriggerPlayer())+" has left the game!")
call LeaderboardRemovePlayerItemBJ(GetTriggerPlayer(),GetLastCreatedLeaderboard())
call ForGroupBJ(GetUnitsOfPlayerAll(GetTriggerPlayer()),function Trig_LeaversLoop)
if udg_Alive[GetPlayerId(GetTriggerPlayer())]==true then
set udg_Numalive=udg_Numalive-1
endif
set udg_Alive[GetPlayerId(GetTriggerPlayer())]=false
endfunction
function InitTrig_Leavers takes nothing returns nothing
set gg_trg_Leavers=CreateTrigger()
call TriggerAddAction(gg_trg_Leavers,function Trig_Leavers_Actions)
endfunction
function Trig_Level_Up_Conditions takes nothing returns boolean
return GetHeroLevel(GetLevelingUnit())==50
endfunction
function Trig_Level_Up_Actions takes nothing returns nothing
local player p=GetOwningPlayer(GetLevelingUnit())
call UnitAddAbility(GroupPickRandomUnit(GetUnitsOfPlayerAndTypeId(p,'H00A')),'A00M')
call DisplayTextToForce(GetPlayersAll(),"|c00FFFF00"+GetPlayerName(p)+udg_Bonuss[5])
set p=null
endfunction
function InitTrig_Level_Up takes nothing returns nothing
set gg_trg_Level_Up=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Level_Up,EVENT_PLAYER_HERO_LEVEL)
call TriggerAddCondition(gg_trg_Level_Up,Condition(function Trig_Level_Up_Conditions))
call TriggerAddAction(gg_trg_Level_Up,function Trig_Level_Up_Actions)
endfunction
function Trig_Life_Gain_Conditions takes nothing returns boolean
return GetUnitTypeId(GetAttacker())=='H00A'and UnitHasItemOfTypeBJ(GetAttacker(),'lgdh')==true
endfunction
function Trig_Life_Gain_Actions takes nothing returns nothing
local unit u=GetAttacker()
call SetUnitLifeBJ(u,GetUnitState(u,UNIT_STATE_LIFE)+1)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Undead\\ReplenishHealth\\ReplenishHealthCasterOverhead.mdl",u,"overhead"))
set u=null
endfunction
function InitTrig_Life_Gain takes nothing returns nothing
set gg_trg_Life_Gain=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Life_Gain,EVENT_PLAYER_UNIT_ATTACKED)
call TriggerAddCondition(gg_trg_Life_Gain, Condition(function Trig_Life_Gain_Conditions))
call TriggerAddAction(gg_trg_Life_Gain,function Trig_Life_Gain_Actions)
endfunction
function Trig_Item_Lose_Conditions takes nothing returns boolean
return GetItemTypeId(GetManipulatedItem())=='lhst'
endfunction
function Trig_Item_Lose_Actions takes nothing returns nothing
call UnitRemoveAbilityBJ('A00N',GetManipulatingUnit())
endfunction
function InitTrig_Item_Lose takes nothing returns nothing
set gg_trg_Item_Lose=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Item_Lose,EVENT_PLAYER_UNIT_DROP_ITEM)
call TriggerAddCondition(gg_trg_Item_Lose,Condition(function Trig_Item_Lose_Conditions))
call TriggerAddAction(gg_trg_Item_Lose,function Trig_Item_Lose_Actions)
endfunction
function Trig_Item_Upgrades_Conditions takes nothing returns boolean
return GetUnitTypeId(GetTriggerUnit())!='H00B'
endfunction
function ai takes integer i,unit u returns item
return UnitAddItemByIdSwapped(i,u)
endfunction
function ri takes unit u,integer i returns nothing
call RemoveItem(GetItemOfTypeFromUnitBJ(u,i))
endfunction
function Trig_Item_Upgrades_Actions takes nothing returns nothing
local unit u=GetTriggerUnit()
local integer i=GetItemTypeId(GetManipulatedItem())
if i=='rde1'then
call RemoveItem(GetManipulatedItem())
if UnitHasItemOfTypeBJ(u,'I004')==true then
call ri(u,'I004')
call ai('I000',u)
elseif UnitHasItemOfTypeBJ(u,'I003')==true then
call ri(u,'I003')
call ai('I004',u)
elseif UnitHasItemOfTypeBJ(u,'I002')==true then
call ri(u,'I002')
call ai('I003',u)
elseif UnitHasItemOfTypeBJ(u,'I001')==true then
call ri(u,'I001')
call ai('I002',u)
else
call ai('I001',u)
endif
elseif i=='rat3'then
call RemoveItem(GetManipulatedItem())
if UnitHasItemOfTypeBJ(u,'I008')==true then
call ri(u,'I008')
call ai('I009',u)
elseif UnitHasItemOfTypeBJ(u,'I007')==true then
call ri(u,'I007')
call ai('I008',u)
elseif UnitHasItemOfTypeBJ(u,'I006')==true then
call ri(u,'I006')
call ai('I007',u)
elseif UnitHasItemOfTypeBJ(u,'I005')==true then
call ri(u,'I005')
call ai('I006',u)
else
call ai('I005',u)
endif
elseif i=='rst1'then
call RemoveItem(GetManipulatedItem())
if UnitHasItemOfTypeBJ(u,'I00B')==true then
call ri(u,'I00B')
call ai('I00A',u)
elseif UnitHasItemOfTypeBJ(u,'I00E')==true then
call ri(u,'I00E')
call ai('I00B',u)
elseif UnitHasItemOfTypeBJ(u,'I00C')==true then
call ri(u,'I00C')
call ai('I00E',u)
elseif UnitHasItemOfTypeBJ(u,'I00D')==true then
call ri(u,'I00D')
call ai('I00C',u)
else
call ai('I00D',u)
endif
elseif i=='rin1'then
call RemoveItem(GetManipulatedItem())
if UnitHasItemOfTypeBJ(u,'I00G')==true then
call ri(u,'I00G')
call ai('I00J',u)
elseif UnitHasItemOfTypeBJ(u,'I00H')==true then
call ri(u,'I00H')
call ai('I00G',u)
elseif UnitHasItemOfTypeBJ(u,'I00I')==true then
call ri(u,'I00I')
call ai('I00H',u)
elseif UnitHasItemOfTypeBJ(u,'I00F')==true then
call ri(u,'I00F')
call ai('I00I',u)
else
call ai('I00F',u)
endif
elseif i=='lhst'then
call UnitAddAbility(u,'A00N')
return
endif
set u=null
endfunction
function InitTrig_Item_Upgrades takes nothing returns nothing
set gg_trg_Item_Upgrades=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Item_Upgrades,EVENT_PLAYER_UNIT_PICKUP_ITEM)
call TriggerAddCondition(gg_trg_Item_Upgrades,Condition(function Trig_Item_Upgrades_Conditions))
call TriggerAddAction(gg_trg_Item_Upgrades,function Trig_Item_Upgrades_Actions)
endfunction
function Trig_Zombies_Func008001001002 takes nothing returns boolean
return GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>0
endfunction
function Trig_Zombies_Conditions takes nothing returns boolean
return CountUnitsInGroup(GetUnitsOfPlayerMatching(Player(11), Condition(function Trig_Zombies_Func008001001002))) < 500
endfunction
function Trig_Zombies_Actions takes nothing returns nothing
local location L=GetRandomLocInRect(udg_Spawn_Rect[GetRandomInt(0,3)])
if udg_Zombies==0then
call DisableTrigger(gg_trg_Zombies)
if udg_Wave==51then
call End()
call CinematicFadeBJ(1,.01,"ReplaceableTextures\\CameraMasks\\White_mask.blp",100,100,100,0)
call CinematicFadeBJ(0,5,"ReplaceableTextures\\CameraMasks\\White_mask.blp",100,100,100,0)
call KillAll(Player(11))
call TransmissionFromUnitWithNameBJ(GetPlayersAll(),null,"Story:",null,"You have defeated the army of undeath! Congratulations!",1,15,true)
call TransmissionFromUnitWithNameBJ(GetPlayersAll(),null,"Story:",null,"You return to Capital City to celebrate your victory for you've all earned it!",1,10,true)
call TransmissionFromUnitWithNameBJ(GetPlayersAll(),null,"Story:",null,"After a week of parties you and your fellow marines falls ill. Soon after the illness spreads and only too late does anyone realize it's the infection you fought off! Over the next two days the whole city falls. Will this world ever know peace?",1,20,true)
call TriggerSleepAction(2)
call TriggerExecute(gg_trg_Skip_End)
endif
else
set udg_Zombies=udg_Zombies-1
call IssuePointOrder(CreateUnitAtLoc(Player(11),udg_ZombieType[GetRandomInt(0,5)],L,0),"attack",0,0)
endif
call RemoveLocation(L)
set L=null
endfunction
function InitTrig_Zombies takes nothing returns nothing
set gg_trg_Zombies=CreateTrigger()
call TriggerRegisterTimerEvent(gg_trg_Zombies,.05,true)
call TriggerAddCondition(gg_trg_Zombies,Condition(function Trig_Zombies_Conditions))
call TriggerAddAction(gg_trg_Zombies,function Trig_Zombies_Actions)
endfunction
function Trig_Farms_Conditions takes nothing returns boolean
return GetUnitTypeId(GetDyingUnit())=='h007'
endfunction
function Trig_Farms_Actions takes nothing returns nothing
set udg_Farms=udg_Farms-1
endfunction
function InitTrig_Farms takes nothing returns nothing
set gg_trg_Farms=CreateTrigger()
call TriggerRegisterPlayerUnitEvent(gg_trg_Farms,Player(0),EVENT_PLAYER_UNIT_DEATH,null)
call TriggerAddCondition(gg_trg_Farms,Condition(function Trig_Farms_Conditions))
call TriggerAddAction(gg_trg_Farms,function Trig_Farms_Actions)
endfunction
function Trig_Kills_Actions takes nothing returns nothing
local unit u=GetKillingUnit()
local player p=GetOwningPlayer(u)
local integer i=0
local integer a=GetPlayerId(p)+1
set udg_Kills[a]=udg_Kills[a]+1
call LeaderboardSetPlayerItemValueBJ(p,udg_KillBoard,udg_Kills[a])
call LeaderboardSortItemsByValue(udg_KillBoard,false)
if gg_unit_h006_0042==GetDyingUnit()then
call End()
call CinematicFadeBJ(1,01,"ReplaceableTextures\\CameraMasks\\White_mask.blp",100,0,0,0)
call CinematicFadeBJ(0,5,"ReplaceableTextures\\CameraMasks\\White_mask.blp",100,0,0,0)
call KillAll(Player(0))
call TransmissionFromUnitWithNameBJ(GetPlayersAll(),null,"Story:",null,"With nothing stopping the infection and the army the zombies and undead march on to claim more villages and towns and cities.",1,15,true)
call TransmissionFromUnitWithNameBJ(GetPlayersAll(),null,"Story:",null,"Even the Elite Hunters are no match for this foe, and they join their ranks as undead.",1,10,true)
call TransmissionFromUnitWithNameBJ(GetPlayersAll(),null,"Story:",null,"Finaly they reach their final goal; Capital City. The gates are barred the doors sealed shut. Yet even that can't stop the horde of undeath. Soon after the army gains enterance into the city it falls into a burning ruin, a shadow of it's past glory.",1,20,true)
call TriggerSleepAction(2)
call TriggerExecute(gg_trg_Skip_End)
endif
if p!=Player(0)and p!=Player(11)then
loop
exitwhen i>4
if udg_Kills[a]==udg_BonusKillNum[i]and GetUnitAbilityLevel(u,udg_Bonusspell[i])==0then
call DisplayTextToForce(GetPlayersAll(),"|c00FFFF00"+GetPlayerName(p)+udg_Bonuss[i])
call UnitAddAbility(GroupPickRandomUnit(GetUnitsOfPlayerAndTypeId(p,'H00A')),udg_Bonusspell[i])
endif
set i=i+1
endloop
if UnitHasItemOfTypeBJ(u,'kpin')==true then
call SetUnitManaBJ(u,GetUnitState(u,UNIT_STATE_MANA)+1)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Undead\\ReplenishMana\\ReplenishManaCasterOverhead.mdl",u,"overhead"))
endif
endif
endfunction
function InitTrig_Kills takes nothing returns nothing
set gg_trg_Kills=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Kills,EVENT_PLAYER_UNIT_DEATH)
call TriggerAddAction(gg_trg_Kills,function Trig_Kills_Actions)
endfunction
function Trig_Skip_End_Actions takes nothing returns nothing
local integer a=0
loop
exitwhen a>11
call CustomVictoryBJ(Player(a),true,true)
set a=a+1
endloop
endfunction
function InitTrig_Skip_End takes nothing returns nothing
set gg_trg_Skip_End=CreateTrigger()
call DisableTrigger(gg_trg_Skip_End)
call TriggerAddAction(gg_trg_Skip_End,function Trig_Skip_End_Actions)
endfunction
function Trig_Every30_Actions takes nothing returns nothing
local integer a=1
local integer I=udg_Farms*80/udg_Numalive
set udg_Wave=udg_Wave+1
call EnableTrigger(gg_trg_Zombies)
if udg_Wave<51then
set udg_Zombies=udg_Zombies+(20+GetRandomInt(0,20)+(udg_Wave))*4
loop
exitwhen a>10
if udg_Alive[a]then
call AdjustPlayerStateBJ(I,Player(a),PLAYER_STATE_RESOURCE_GOLD)
call DisplayTextToPlayer(Player(a),0,0,"|c0000FF00+"+I2S(I)+"|r |c00FFFF00Gold|r!")
endif
set a=a+1
endloop
call DisplayTextToForce(GetPlayersAll(),"|c00FF8000[Wave "+I2S(udg_Wave)+"]|r More zombies have been sighted!")
call SetPlayerTechResearched(Player(11),'R000',udg_Wave)
call LeaderboardSetLabelBJ(udg_KillBoard,"|c00FF8000[Wave "+I2S(udg_Wave)+"]|r")
else
call DestroyTimerDialog(udg_WaveTimerWindow)
call DestroyTimer(udg_WaveTimer)
call DisableTrigger(gg_trg_Every30)
call DestroyTrigger(gg_trg_Every30)
endif
endfunction
function InitTrig_Every30 takes nothing returns nothing
set gg_trg_Every30=CreateTrigger()
call TriggerRegisterUnitEvent(gg_trg_Every30,gg_unit_h006_0042,EVENT_UNIT_DEATH)
call TriggerRegisterTimerExpireEvent(gg_trg_Every30,udg_WaveTimer)
call TriggerAddAction(gg_trg_Every30,function Trig_Every30_Actions)
endfunction
function Trig_Stat_Caps takes nothing returns nothing
local unit u=GetEnumUnit()
local integer s=udg_maxstat
if GetHeroStr(u,false)>s then
call SetHeroStr(u,s,true)
endif
if GetHeroInt(u,false)>s then
call SetHeroInt(u,s,true)
endif
if GetHeroAgi(u,false)>s then
call SetHeroAgi(u,s,true)
endif
if UnitHasItemOfTypeBJ(u,'lhst')==true then
call SetUnitAbilityLevel(u,'A00N',R2I(GetHeroAgi(u,false)/10))
endif
set u=null
endfunction
function Trig_Stat_Caps_Actions takes nothing returns nothing
local group g=GetUnitsOfTypeIdAll('H00A')
call ForGroup(g,function Trig_Stat_Caps)
call GroupClear(g)
set g=null
endfunction
function InitTrig_Stat_Caps takes nothing returns nothing
set gg_trg_Stat_Caps=CreateTrigger()
call TriggerRegisterTimerEvent(gg_trg_Stat_Caps,1,true)
call TriggerAddAction(gg_trg_Stat_Caps,function Trig_Stat_Caps_Actions)
endfunction