//Anti-spawn Kill
function Inuln takes unit u returns nothing
local effect e=AddSpecialEffectTargetUnitBJ("origin",u,"Abilities\\Spells\\Human\\DivineShield\\DivineShieldTarget.mdl")
call SetUnitInvulnerable(u,true)
call TriggerSleepAction(10)
call SetUnitInvulnerable(u,false)
call DestroyEffect(e)
endfunction
//Income
function Income takes integer P0,integer P1,integer P2 returns nothing
local integer I=GetPlayerState(Player(P0),PLAYER_STATE_RESOURCE_GOLD)/udg_Int_Teams[P0]
call DisplayTextToForce(GetPlayersAllies(Player(P0)),"+"+I2S(I)+" |cff0000ffHonor|r!")
loop
exitwhen P1>P2
if GetPlayerSlotState(Player(P1))==PLAYER_SLOT_STATE_PLAYING then
call AdjustPlayerStateBJ(I,Player(P1),PLAYER_STATE_RESOURCE_GOLD)
endif
set P1=P1+1
endloop
call SetPlayerState(Player(P0),PLAYER_STATE_RESOURCE_GOLD,0)
endfunction
function Trig_Levels_Actions takes nothing returns nothing
local unit u=GetLevelingUnit()
set udg_Level[GetPlayerId(GetOwningPlayer(u))+1]=GetHeroLevel(u)
endfunction
Name | Type | is_array | initial_value |
Boolea_N_B | boolean | No | true |
Boolea_N_S | boolean | No | true |
Boolea_S_B | boolean | No | true |
Boolea_S_S | boolean | No | true |
Dialog_H_P_B | button | Yes | |
Dialog_Menus | dialog | No | |
Int_I_A | integer | Yes | |
Int_I_M | integer | Yes | |
Int_I_R | integer | Yes | |
Int_I_W | integer | Yes | |
Int_Teams | integer | Yes | |
Int_templvl | integer | No | |
Int_unM | integer | No | 1 |
Int_unm | integer | No | 1 |
Int_unr | integer | No | 1 |
Int_usm | integer | No | 1 |
Int_usM | integer | No | 1 |
Int_usr | integer | No | 1 |
Items_Armor | itemcode | Yes | |
Items_Lengendary | itemcode | Yes | |
Items_Misc | itemcode | Yes | |
Items_Rings | itemcode | Yes | |
Items_Weapons | itemcode | Yes | |
Level | integer | Yes | 1 |
String_DeathString | string | Yes | |
String_P_N | string | Yes | |
Tomes | integer | Yes | |
TreeEF | string | Yes | |
Unit_H_U | unitcode | Yes | |
Unit_um | unitcode | Yes | |
Unit_uM | unitcode | Yes | |
Unit_ur | unitcode | Yes | |
yutyutu | unit | No |
function Trig_Hero_Pick_Actions takes nothing returns nothing
local integer i=GetPlayerId(GetTriggerPlayer())
local integer I=1
loop
exitwhen I>8
if GetClickedButton()==udg_Dialog_H_P_B[I]then
if i>=1and i<=5then
call SetHeroLevel(CreateUnitAtLoc(Player(i),udg_Unit_H_U[I],GetUnitLoc(gg_unit_ncp3_0008),0),udg_Level[i+1],false)
else
call SetHeroLevel(CreateUnitAtLoc(Player(i),udg_Unit_H_U[I],GetUnitLoc(gg_unit_ncp3_0008),0),udg_Level[i+1],false)
endif
endif
set I=I+1
endloop
endfunction
function InitTrig_Hero_Pick takes nothing returns nothing
set gg_trg_Hero_Pick=CreateTrigger()
call TriggerRegisterDialogEventBJ(gg_trg_Hero_Pick,udg_Dialog_Menus)
call TriggerAddAction(gg_trg_Hero_Pick,function Trig_Hero_Pick_Actions)
endfunction
function Trig_Hero_Rez_Conditions takes nothing returns boolean
return IsUnitType(GetTriggerUnit(),UNIT_TYPE_HERO)==true
endfunction
function Trig_Hero_Rez_Actions takes nothing returns nothing
local unit u=GetDyingUnit()
local unit U=GetKillingUnit()
local player p=GetOwningPlayer(u)
call DisplayTextToForce(GetPlayersAll(),(udg_String_P_N[GetPlayerId(p)+1]+(("'s "+GetUnitName(u))+udg_String_DeathString[GetRandomInt(1,6)]+"|r by "+udg_String_P_N[GetPlayerId(GetOwningPlayer(U))+1]+"!")))
if IsUnitAlly(u,Player(6))==true then
call ReviveHeroLoc(u,GetUnitLoc(gg_unit_ncp3_0009),true)
else
call ReviveHeroLoc(u,GetUnitLoc(gg_unit_ncp3_0008),true)
endif
call SelectUnitForPlayerSingle(u,p)
call PanCameraToTimedLocForPlayer(p,GetUnitLoc(u),0)
call Inuln(u)
endfunction
function InitTrig_Hero_Rez takes nothing returns nothing
set gg_trg_Hero_Rez=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Hero_Rez,EVENT_PLAYER_UNIT_DEATH)
call TriggerAddCondition(gg_trg_Hero_Rez,Condition(function Trig_Hero_Rez_Conditions))
call TriggerAddAction(gg_trg_Hero_Rez,function Trig_Hero_Rez_Actions)
endfunction
function Trig_Init takes nothing returns nothing
local integer i=1
if GetDestructableTypeId(GetEnumDestructable())=='ATtr'then
loop
exitwhen i>15
call AddSpecialEffectLoc(udg_TreeEF[GetRandomInt(1,6)],PolarProjectionBJ(GetDestructableLoc(GetEnumDestructable()),GetRandomReal(0,150),GetRandomReal(0,360)))
set i=i+1
endloop
endif
endfunction
function Trig_Init_Actions takes nothing returns nothing
local integer i=2
call DisplayTimedTextToForce(GetPlayersAll(),5,"TRIGSTR_713")
call TriggerSleepAction(1)
//Quests
call CreateQuestBJ(bj_QUESTTYPE_OPT_DISCOVERED,"TRIGSTR_698","TRIGSTR_699","ReplaceableTextures\\CommandButtons\\BTNBansheeMaster.blp")
call CreateQuestBJ(bj_QUESTTYPE_OPT_DISCOVERED,"TRIGSTR_764","TRIGSTR_765","ReplaceableTextures\\CommandButtons\\BTNBansheeMaster.blp")
call CreateQuestBJ(bj_QUESTTYPE_OPT_DISCOVERED,"TRIGSTR_752","TRIGSTR_753","ReplaceableTextures\\CommandButtons\\BTNBansheeMaster.blp")
call CreateQuestBJ(bj_QUESTTYPE_REQ_DISCOVERED,"TRIGSTR_700","TRIGSTR_701","UI\\Feedback\\Resources\\ResourceGold.blp")
call CreateQuestBJ(bj_QUESTTYPE_REQ_DISCOVERED,"TRIGSTR_702","TRIGSTR_703","ReplaceableTextures\\CommandButtons\\BTNHumanCaptureFlag.blp")
call CreateQuestBJ(bj_QUESTTYPE_REQ_DISCOVERED,"TRIGSTR_704","TRIGSTR_705","ReplaceableTextures\\WorldEditUI\\Editor-MultipleUnits.blp")
//Gates
call ModifyGateBJ(bj_GATEOPERATION_OPEN,gg_dest_LTe3_0135)
call ModifyGateBJ(bj_GATEOPERATION_OPEN,gg_dest_LTe3_0138)
call ModifyGateBJ(bj_GATEOPERATION_OPEN,gg_dest_LTe1_0137)
call ModifyGateBJ(bj_GATEOPERATION_OPEN,gg_dest_LTe1_0136)
//Players
call SetPlayerName(Player(0),"TRIGSTR_706")
call SetPlayerName(Player(6),"TRIGSTR_707")
set i=1
loop
exitwhen i>12
call SetPlayerFlagBJ(PLAYER_STATE_GIVES_BOUNTY,true,ConvertedPlayer(i))
set i=i+1
endloop
//Units
call SetUnitInvulnerable(gg_unit_hcas_0010,true)
call SetUnitInvulnerable(gg_unit_hctw_0029,true)
call SetUnitInvulnerable(gg_unit_hctw_0028,true)
call SetUnitInvulnerable(gg_unit_hctw_0024,true)
call SetUnitInvulnerable(gg_unit_hctw_0025,true)
call SetUnitInvulnerable(gg_unit_hcas_0011,true)
call SetUnitInvulnerable(gg_unit_hctw_0031,true)
call SetUnitInvulnerable(gg_unit_hctw_0027,true)
call SetUnitInvulnerable(gg_unit_hctw_0030,true)
call SetUnitInvulnerable(gg_unit_hctw_0026,true)
//Start
set udg_TreeEF[1]="Doodads\\Ruins\\Plants\\Ruins_Flower\\Ruins_Flower2.mdl"
set udg_TreeEF[2]="Doodads\\Ruins\\Plants\\Ruins_Flower\\Ruins_Flower3.mdl"
set udg_TreeEF[3]="Doodads\\Ashenvale\\Plants\\AshenBush0\\AshenBush0"
set udg_TreeEF[4]="Doodads\\Ruins\\Plants\\Ruins_Shrub\\Ruins_Shrub0.mdl"
set udg_TreeEF[5]="Doodads\\Ruins\\Plants\\Ruins_Shrub\\Ruins_Shrub1.mdl"
set udg_TreeEF[6]="Doodads\\Ruins\\Plants\\Ruins_Shrub\\Ruins_Shrub2.mdl"
call EnumDestructablesInRectAll(GetPlayableMapRect(),function Trig_Init)
set udg_String_DeathString[1]=" |CFFFF0000w|CFFFF5500a|CFFFFFF00s |CFF55FF00k|CFF00FF00i|CFF00AA55l|CFF0000FFl|CFF552AFFe|CFFAA55FFd"
set udg_String_DeathString[2]=" |CFFFF3300h|CFFFF6600a|CFFFF9900s |CFFCCFF00b|CFF99FF00e|CFF66FF00e|CFF00FF00n |CFF009966s|CFF006699l|CFF0033CCa|CFF0000FFi|CFF3319FFn"
set udg_String_DeathString[3]=" |CFFFF3300h|CFFFF6600a|CFFFF9900s |CFFCCFF00b|CFF99FF00e|CFF66FF00e|CFF33FF00n |CFF00CC33c|CFF009966r|CFF006699u|CFF0000FFs|CFF3319FFh|CFF6633FFe|CFF994CFFd"
set udg_String_DeathString[4]=" |CFFFF2A00h|CFFFF5500a|CFFFF7F00s |CFFFFFF00b|CFFD5FF00e|CFFAAFF00e|CFF80FF00n |CFF2BFF00a|CFF00FF00n|CFF00D52An|CFF00AA55i|CFF00807Fh|CFF0055AAi|CFF0000FFl|CFF2A15FFa|CFF552AFFt|CFF7F3FFFe|CFFAA55FFd"
set udg_String_DeathString[5]=" |CFFFF3300h|CFFFF6600a|CFFFF9900s |CFFCCFF00b|CFF99FF00e|CFF66FF00e|CFF33FF00n |CFF00CC33s|CFF009966q|CFF006699u|CFF0000FFa|CFF3319FFs|CFF6633FFh|CFF994CFFe|CFFCC66FFd"
set udg_String_DeathString[6]=" |CFFFF2A00h|CFFFF5500a|CFFFF7F00s |CFFFFFF00b|CFFD5FF00e|CFFAAFF00e|CFF80FF00n |CFF2BFF00o|CFF00FF00b|CFF00D52Al|CFF00AA55i|CFF00807Ft|CFF0055AAe|CFF0000FFr|CFF2A15FFa|CFF552AFFt|CFF7F3FFFe|CFFAA55FFd"
set i=2
loop
exitwhen i>12
set udg_Int_I_A[i]=0
set udg_Int_I_M[i]=0
set udg_Int_I_R[i]=0
set udg_Int_I_W[i]=0
set i=i+1
endloop
set udg_String_P_N[1]=("|CFFFF0000"+(GetPlayerName(Player(0))+"|r"))
set udg_String_P_N[2]=("|CFF0000FF"+(GetPlayerName(Player(1))+"|r"))
set udg_String_P_N[3]=("|CFF18E7BD"+(GetPlayerName(Player(2))+"|r"))
set udg_String_P_N[4]=("|CFF520084"+(GetPlayerName(Player(3))+"|r"))
set udg_String_P_N[5]=("|CFFFFFF00"+(GetPlayerName(Player(4))+"|r"))
set udg_String_P_N[6]=("|CFFFF8A08"+(GetPlayerName(Player(5))+"|r"))
set udg_String_P_N[7]=("|CFF18BE00"+(GetPlayerName(Player(6))+"|r"))
set udg_String_P_N[8]=("|CFFE759AD"+(GetPlayerName(Player(7))+"|r"))
set udg_String_P_N[9]=("|CFF949694"+(GetPlayerName(Player(8))+"|r"))
set udg_String_P_N[10]=("|CFF7BBEF7"+(GetPlayerName(Player(9))+"|r"))
set udg_String_P_N[11]=("|CFF086142"+(GetPlayerName(Player(10))+"|r"))
set udg_String_P_N[12]=("|CFF4A2800"+(GetPlayerName(Player(11))+"|r"))
set udg_Items_Armor[1]='brac'
set udg_Items_Armor[2]='bspd'
set udg_Items_Armor[3]='rag1'
set udg_Items_Armor[4]='rin1'
set udg_Items_Armor[5]='bgst'
set udg_Items_Misc[1]='shtm'
set udg_Items_Misc[2]='spsh'
set udg_Items_Misc[3]='evtl'
set udg_Items_Misc[4]='afac'
set udg_Items_Misc[5]='modt'
set udg_Items_Rings[1]='vddl'
set udg_Items_Rings[2]='sprn'
set udg_Items_Rings[3]='rlif'
set udg_Items_Rings[4]='rwiz'
set udg_Items_Rings[5]='rde4'
set udg_Items_Lengendary[1]='ciri'
set udg_Items_Lengendary[2]='clfm'
set udg_Items_Lengendary[3]='frhg'
set udg_Items_Lengendary[4]='pnvl'
set udg_Items_Lengendary[5]='tsct'
set udg_Items_Lengendary[6]='ckng'
set udg_Items_Weapons[1]='asbl'
set udg_Items_Weapons[2]='ssil'
set udg_Items_Weapons[3]='rst1'
set udg_Items_Weapons[4]='rat3'
set udg_Items_Weapons[5]='desc'
set udg_Unit_uM[1]='hmpr'//Priest
set udg_Unit_uM[2]='hsor'//Sorceress
set udg_Unit_uM[3]='hspt'//Spell Breaker
set udg_Unit_um[1]='hpea'//Peasant
set udg_Unit_um[2]='hfoo'//footman
set udg_Unit_um[3]='hkni'//Knight
set udg_Unit_ur[1]='nhea'//Archer
set udg_Unit_ur[2]='hrif'//Rifleman
set udg_Unit_ur[3]='hmtm'//Mortar Team
set udg_Unit_H_U[1]='Hpal'//Paladin
set udg_Unit_H_U[2]='Hamg'//Archmage
set udg_Unit_H_U[3]='Hmkg'//Mountain King
set udg_Unit_H_U[4]='Hblm'//Blood Mage
set udg_Unit_H_U[5]='Obla'//Blademaster
set udg_Unit_H_U[6]='Ofar'//Far Seer
set udg_Unit_H_U[7]='Otch'//Tauren Chieftain
set udg_Unit_H_U[8]='Oshd'//Shadow Hunter
//Dialogs
call DialogSetMessage(udg_Dialog_Menus,"TRIGSTR_672")
set udg_Dialog_H_P_B[1]=DialogAddButton(udg_Dialog_Menus,"TRIGSTR_673",0)
set udg_Dialog_H_P_B[2]=DialogAddButton(udg_Dialog_Menus,"TRIGSTR_674",0)
set udg_Dialog_H_P_B[3]=DialogAddButton(udg_Dialog_Menus,"TRIGSTR_675",0)
set udg_Dialog_H_P_B[4]=DialogAddButton(udg_Dialog_Menus,"TRIGSTR_676",0)
set udg_Dialog_H_P_B[5]=DialogAddButton(udg_Dialog_Menus,"TRIGSTR_677",0)
set udg_Dialog_H_P_B[6]=DialogAddButton(udg_Dialog_Menus,"TRIGSTR_678",0)
set udg_Dialog_H_P_B[7]=DialogAddButton(udg_Dialog_Menus,"TRIGSTR_679",0)
set udg_Dialog_H_P_B[8]=DialogAddButton(udg_Dialog_Menus,"TRIGSTR_680",0)
call DisplayTextToForce(GetPlayersAll(),"Welcom to |cffffff00Castle Warz|r!\nVersion: |cff00ff004.1|r\nPlease read quests!")
set i=1
loop
exitwhen i>5
call CreateFogModifierRectBJ(true,Player(i),FOG_OF_WAR_VISIBLE,gg_rct_SC)
call CreateFogModifierRectBJ(true,Player(i),FOG_OF_WAR_VISIBLE,gg_rct_SS)
call CreateFogModifierRectBJ(true,Player(i),FOG_OF_WAR_VISIBLE,gg_rct_SB)
call SetPlayerAllianceBJ(Player(1),ALLIANCE_SHARED_VISION,true,Player(i))
call SetPlayerAllianceBJ(Player(i),ALLIANCE_SHARED_VISION,true,Player(1))
if GetPlayerSlotState(Player(i))==PLAYER_SLOT_STATE_PLAYING then
call TriggerRegisterPlayerChatEvent(gg_trg_Repick,Player(i),"-repick",true)
call TriggerRegisterPlayerEventLeave(gg_trg_Leavers,Player(i))
call DialogDisplay(Player(i),udg_Dialog_Menus,true)
set udg_Int_Teams[0]=udg_Int_Teams[0]+1
else
call CreateUnitAtLoc(Player(0),udg_Unit_H_U[GetRandomInt(1,8)],GetUnitLoc(gg_unit_ncp3_0008),0)
endif
set i=i+1
endloop
set i=7
loop
exitwhen i >11
call CreateFogModifierRectBJ(true,Player(i),FOG_OF_WAR_VISIBLE,gg_rct_NS)
call CreateFogModifierRectBJ(true,Player(i),FOG_OF_WAR_VISIBLE,gg_rct_NC)
call CreateFogModifierRectBJ(true,Player(i),FOG_OF_WAR_VISIBLE,gg_rct_NB)
call SetPlayerAllianceBJ(Player(7),ALLIANCE_SHARED_VISION,true,Player(i))
call SetPlayerAllianceBJ(Player(i),ALLIANCE_SHARED_VISION,true,Player(7))
if GetPlayerSlotState(Player(i))==PLAYER_SLOT_STATE_PLAYING then
call TriggerRegisterPlayerEventLeave(gg_trg_Leavers,Player(i))
call TriggerRegisterPlayerChatEvent(gg_trg_Repick,Player(i),"-repick",true)
call DialogDisplay(Player(i),udg_Dialog_Menus,true)
set udg_Int_Teams[6]=udg_Int_Teams[6]+1
else
call CreateUnitAtLoc(Player(6),udg_Unit_H_U[GetRandomInt(1,8)],GetUnitLoc(gg_unit_ncp3_0009),0)
endif
set i=i+1
endloop
call SetPlayerTechResearched(Player(0),'Rhme',4-udg_Int_Teams[0])
call SetPlayerTechResearched(Player(6),'Rhme',4-udg_Int_Teams[6])
call DestroyTrigger(GetTriggeringTrigger())
endfunction
function InitTrig_Init takes nothing returns nothing
set gg_trg_Init=CreateTrigger()
call TriggerRegisterTimerEventSingle(gg_trg_Init,0)
call TriggerAddAction(gg_trg_Init,function Trig_Init_Actions)
endfunction
function Trig_Get_Actions takes nothing returns nothing
local item i=GetManipulatedItem()
local unit u=GetManipulatingUnit()
local integer I=GetPlayerId(GetOwningPlayer(u))+1
local integer int=1
local trigger T=GetTriggeringTrigger()
local real II=GetItemLifeBJ(i)
local playerstate g=PLAYER_STATE_RESOURCE_GOLD
local boolean b=false
call DisableTrigger(gg_trg_Item_Lose)
call UnitRemoveItem(u,i)
call EnableTrigger(gg_trg_Item_Lose)
loop
exitwhen int>6
if GetItemTypeId(i)==udg_Items_Armor[int]then
if udg_Int_I_A[I]<1then
call DisableTrigger(T)
call UnitAddItem(u,i)
call EnableTrigger(T)
set udg_Int_I_A[I]=1
else
set b=true
endif
elseif GetItemTypeId(i)==udg_Items_Misc[int]then
if udg_Int_I_M[I]<2then
call DisableTrigger(T)
call UnitAddItem(u,i)
call EnableTrigger(T)
set udg_Int_I_M[I]=udg_Int_I_M[I]+1
else
set b=true
endif
elseif GetItemTypeId(i)==udg_Items_Rings[int]then
if udg_Int_I_R[I]<2then
call DisableTrigger(T)
call UnitAddItem(u,i)
call EnableTrigger(T)
set udg_Int_I_R[I]=udg_Int_I_R[I]+1
else
set b=true
endif
elseif GetItemTypeId(i)==udg_Items_Lengendary[int]then
call DisableTrigger(T)
call UnitAddItem(u,i)
call EnableTrigger(T)
elseif GetItemTypeId(i)==udg_Items_Weapons[int]then
if udg_Int_I_W[I]<1then
call DisableTrigger(T)
call UnitAddItem(u,i)
call EnableTrigger(T)
set udg_Int_I_W[I]=1
else
set b=true
endif
endif
if b then
call DisplayTextToForce(GetForceOfPlayer(ConvertedPlayer(I)),"|c00FF0000Error|r: You can't have more of that type of Item!")
call AdjustPlayerStateBJ(R2I(II),GetOwningPlayer(u),g)
call RemoveItem(i)
return
endif
set int=int+1
endloop
if GetItemTypeId(i)=='tdex'or GetItemTypeId(i)=='tint'or GetItemTypeId(i)=='tstr'then
set udg_Tomes[I]=udg_Tomes[I]+25
endif
endfunction
function InitTrig_Item_Get takes nothing returns nothing
set gg_trg_Item_Get=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Item_Get,EVENT_PLAYER_UNIT_PICKUP_ITEM)
call TriggerAddAction(gg_trg_Item_Get,function Trig_Get_Actions)
endfunction
function Trig_Lose_Actions takes nothing returns nothing
local item i=GetManipulatedItem()
local unit u=GetManipulatingUnit()
local integer I=GetConvertedPlayerId(GetOwningPlayer(u))
local integer int=1
loop
exitwhen int>5
if GetItemTypeId(i)==udg_Items_Armor[int]then
set udg_Int_I_A[I]=0
elseif GetItemTypeId(i)==udg_Items_Misc[int]then
set udg_Int_I_M[I]=udg_Int_I_M[I]-1
elseif GetItemTypeId(i)==udg_Items_Rings[int]then
set udg_Int_I_R[I]=udg_Int_I_R[I]-1
elseif GetItemTypeId(i)==udg_Items_Weapons[int]then
set udg_Int_I_W[I]=0
endif
set int=int+1
endloop
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 TriggerAddAction(gg_trg_Item_Lose,function Trig_Lose_Actions)
endfunction
function Trig_Leavers takes nothing returns nothing
call RemoveUnit(GetEnumUnit())
endfunction
function Trig_Leavers_Actions takes nothing returns nothing
call ForGroup(GetUnitsOfPlayerAll(GetTriggerPlayer()),function Trig_Leavers)
call DisplayTextToForce(GetPlayersAll(),(udg_String_P_N[GetConvertedPlayerId(GetTriggerPlayer())]+"|cffff0000 has left the game!|r"))
call PlaySoundBJ(gg_snd_Leaver)
call KillSoundWhenDone(GetLastPlayedSound())
endfunction
function InitTrig_Leavers takes nothing returns nothing
set gg_trg_Leavers=CreateTrigger()
call TriggerAddAction(gg_trg_Leavers,function Trig_Leavers_Actions)
endfunction
function InitTrig_Levels takes nothing returns nothing
set gg_trg_Levels=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Levels,EVENT_PLAYER_HERO_LEVEL)
call TriggerAddAction(gg_trg_Levels,function Trig_Levels_Actions)
endfunction
function Trig_North_Buildings_Actions takes nothing returns nothing
local integer i=1
local unit u=GetDyingUnit()
if u==gg_unit_hbar_0012 then
call DisplayTextToForce(GetPlayersAll(),(((udg_String_P_N[7]+"'s ")+GetUnitName(u))+" has been destroyed!"))
call KillUnit(gg_unit_hgtw_0019)
call KillUnit(gg_unit_hgtw_0018)
call RemoveUnit(gg_unit_ncop_0002)
set udg_Boolea_N_B=false
endif
if u==gg_unit_hars_0015 then
call KillUnit(gg_unit_hgtw_0017)
call KillUnit(gg_unit_hgtw_0016)
call RemoveUnit(gg_unit_ncop_0003)
set udg_Boolea_N_S=false
call DisplayTextToForce(GetPlayersAll(),(((udg_String_P_N[7]+"'s ")+GetUnitName(u))+" has been destroyed!"))
endif
if udg_Boolea_N_B==false and udg_Boolea_N_S==false then
call SetUnitInvulnerable(gg_unit_hctw_0031,false)
call SetUnitInvulnerable(gg_unit_hctw_0027,false)
call SetUnitInvulnerable(gg_unit_hctw_0030,false)
call SetUnitInvulnerable(gg_unit_hctw_0026,false)
endif
if CountLivingPlayerUnitsOfTypeId('hctw',Player(6))==0then
call SetUnitInvulnerable(gg_unit_hcas_0011,false)
endif
if u==gg_unit_hcas_0011 then
call TriggerSleepAction(2)
loop
exitwhen i>5
call CustomVictoryBJ(Player(i),false,true)
set i=i+1
endloop
set i=6
loop
exitwhen i>11
call CustomDefeatBJ(Player(i),"TRIGSTR_785")
set i=i+1
endloop
endif
endfunction
function InitTrig_North_Buildings takes nothing returns nothing
set gg_trg_North_Buildings=CreateTrigger()
call TriggerRegisterPlayerUnitEventSimple(gg_trg_North_Buildings,Player(6),EVENT_PLAYER_UNIT_DEATH)
call TriggerAddAction(gg_trg_North_Buildings,function Trig_North_Buildings_Actions)
endfunction
function Trig_Repick takes nothing returns boolean
return IsUnitType(GetFilterUnit(),UNIT_TYPE_HERO)==true
endfunction
function Trig_Repick_Actions takes nothing returns nothing
local playerstate g=PLAYER_STATE_RESOURCE_GOLD
local integer i=0
local unit u=GroupPickRandomUnit(GetUnitsOfPlayerMatching(GetTriggerPlayer(),Condition(function Trig_Repick)))
loop
exitwhen i>5
call AdjustPlayerStateBJ(R2I(GetItemLifeBJ(UnitItemInSlot(u,i))),GetTriggerPlayer(),g)
set i=i+1
endloop
call AdjustPlayerStateBJ(udg_Tomes[GetPlayerId(GetTriggerPlayer())+1]+25,GetTriggerPlayer(),g)
set udg_Tomes[GetPlayerId(GetTriggerPlayer())+1]=0
call RemoveUnit(u)
call DialogDisplay(GetTriggerPlayer(),udg_Dialog_Menus,true)
endfunction
function InitTrig_Repick takes nothing returns nothing
set gg_trg_Repick=CreateTrigger()
call TriggerAddAction(gg_trg_Repick,function Trig_Repick_Actions)
endfunction
function Trig_South_Buildings_Actions takes nothing returns nothing
local integer i=1
local unit u=GetDyingUnit()
if u==gg_unit_hbar_0013 then
call DisplayTextToForce(GetPlayersAll(),(((udg_String_P_N[1]+"'s ")+GetUnitName(u))+" has been destroyed!"))
call KillUnit(gg_unit_hgtw_0022)
call KillUnit(gg_unit_hgtw_0023)
call RemoveUnit(gg_unit_ncop_0004)
set udg_Boolea_S_B=false
endif
if u==gg_unit_hars_0014 then
call KillUnit(gg_unit_hgtw_0021)
call KillUnit(gg_unit_hgtw_0020)
call RemoveUnit(gg_unit_ncop_0007)
set udg_Boolea_S_S=false
call DisplayTextToForce(GetPlayersAll(),(((udg_String_P_N[1]+"'s ")+GetUnitName(u))+" has been destroyed!"))
endif
if udg_Boolea_S_B==false and udg_Boolea_S_S==false then
call SetUnitInvulnerable(gg_unit_hctw_0024,false)
call SetUnitInvulnerable(gg_unit_hctw_0025,false)
call SetUnitInvulnerable(gg_unit_hctw_0029,false)
call SetUnitInvulnerable(gg_unit_hctw_0028,false)
endif
if CountLivingPlayerUnitsOfTypeId('hctw',Player(0))==0then
call SetUnitInvulnerable(gg_unit_hcas_0010,false)
endif
if u==gg_unit_hcas_0010 then
call TriggerSleepAction(2)
loop
exitwhen i>5
call CustomDefeatBJ(Player(i),"TRIGSTR_785")
set i=i+1
endloop
set i=6
loop
exitwhen i>11
call CustomVictoryBJ(Player(i),false,true)
set i=i+1
endloop
endif
endfunction
function InitTrig_South_Buildings takes nothing returns nothing
set gg_trg_South_Buildings=CreateTrigger()
call TriggerRegisterPlayerUnitEventSimple(gg_trg_South_Buildings,Player(0),EVENT_PLAYER_UNIT_DEATH)
call TriggerAddAction(gg_trg_South_Buildings,function Trig_South_Buildings_Actions)
endfunction
function Trig_Spawner_Func001A takes nothing returns nothing
local integer i=1
local location l=GetUnitLoc(GroupPickRandomUnit(GetUnitsOfPlayerAndTypeId(Player(6),'ncop')))
if IsUnitType(GetEnumUnit(),UNIT_TYPE_STRUCTURE)==true and GetUnitTypeId(GetEnumUnit())=='ncop'then
loop
exitwhen i>2
call IssuePointOrderLoc(CreateUnitAtLoc(Player(0),udg_Unit_um[udg_Int_usm],GetUnitLoc(GetEnumUnit()),0),"attack",l)
call IssuePointOrderLoc(CreateUnitAtLoc(Player(0),udg_Unit_uM[udg_Int_usM],GetUnitLoc(GetEnumUnit()),0),"attack",l)
call IssuePointOrderLoc(CreateUnitAtLoc(Player(0),udg_Unit_ur[udg_Int_usr],GetUnitLoc(GetEnumUnit()),0),"attack",l)
set i=i+1
endloop
else
call IssuePointOrderLoc(GetEnumUnit(),"attack",l)
endif
endfunction
function Trig_Spawner_Func002A takes nothing returns nothing
local integer i=1
local location l=GetUnitLoc(GroupPickRandomUnit(GetUnitsOfPlayerAndTypeId(Player(0),'ncop')))
if IsUnitType(GetEnumUnit(),UNIT_TYPE_STRUCTURE)==true and GetUnitTypeId(GetEnumUnit())=='ncop'then
loop
exitwhen i>2
call IssuePointOrderLoc(CreateUnitAtLoc(Player(6),udg_Unit_um[udg_Int_unm],GetUnitLoc(GetEnumUnit()),0),"attack",l)
call IssuePointOrderLoc(CreateUnitAtLoc(Player(6),udg_Unit_uM[udg_Int_unM],GetUnitLoc(GetEnumUnit()),0),"attack",l)
call IssuePointOrderLoc(CreateUnitAtLoc(Player(6),udg_Unit_ur[udg_Int_unr],GetUnitLoc(GetEnumUnit()),0),"attack",l)
set i=i+1
endloop
else
call IssuePointOrderLoc(GetEnumUnit(),"attack",l)
endif
endfunction
function Trig_Spawner_Actions takes nothing returns nothing
call ForGroupBJ(GetUnitsOfPlayerAll(Player(0)),function Trig_Spawner_Func001A)
call ForGroupBJ(GetUnitsOfPlayerAll(Player(6)),function Trig_Spawner_Func002A)
call Income(0,1,4)
call TriggerSleepAction(1)
call Income(6,7,11)
endfunction
function InitTrig_Spawner takes nothing returns nothing
set gg_trg_Spawner=CreateTrigger()
call TriggerRegisterTimerEventPeriodic(gg_trg_Spawner,15)
call TriggerAddAction(gg_trg_Spawner,function Trig_Spawner_Actions)
endfunction
function Trig_Spells_Heal takes nothing returns nothing
local real r=GetUnitStateSwap(UNIT_STATE_LIFE,GetEnumUnit())+(2*udg_Int_templvl)
if IsUnitAlly(GetEnumUnit(),GetOwningPlayer(GetSpellAbilityUnit()))==true and IsUnitAliveBJ(GetEnumUnit())==true then
call AddSpecialEffectLoc("Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl",GetUnitLoc(GetEnumUnit()))
call DestroyEffect(GetLastCreatedEffectBJ())
call SetUnitLifeBJ(GetEnumUnit(),r)
if IsUnitAlly(GetEnumUnit(),GetOwningPlayer(GetSpellAbilityUnit()))==true then
call SetUnitLifeBJ(GetEnumUnit(),r)
endif
endif
endfunction
function Trig_Spells_Actions takes nothing returns nothing
local integer i=1
local unit array u
local integer I
if GetSpellAbilityId()=='A000'then
set u[0]=GetSpellAbilityUnit()
set I=GetUnitAbilityLevel(u[0],'A000')*4
loop
exitwhen i>I
set u[i]=CreateUnitAtLoc(GetOwningPlayer(u[0]),'h000',GetUnitLoc(u[0]),0)
call UnitAddAbility(u[i],'AOcl')
call SetUnitAbilityLevel(u[i],'AOcl',I/2)
call IssueTargetOrder(u[i],"chainlightning",GetSpellTargetUnit())
set i=i+1
endloop
call TriggerSleepAction(1)
set i=1
loop
exitwhen i>I
call RemoveUnit(u[i])
set i=i+1
endloop
elseif GetSpellAbilityId()=='AHhb'then
set udg_Int_templvl=GetUnitAbilityLevel(GetSpellAbilityUnit(),GetSpellAbilityId())
call ForGroupBJ(GetUnitsInRangeOfLocAll(500,GetUnitLoc(GetSpellTargetUnit())),function Trig_Spells_Heal)
loop
exitwhen i>72
call AddSpecialEffectLoc("Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl",PolarProjectionBJ(GetUnitLoc(GetSpellTargetUnit()),500,5*i))
call DestroyEffect(GetLastCreatedEffectBJ())
set i=i+1
endloop
endif
endfunction
function InitTrig_Spells takes nothing returns nothing
set gg_trg_Spells=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Spells,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddAction(gg_trg_Spells,function Trig_Spells_Actions)
endfunction
function Trig_Upgrades_Actions takes nothing returns nothing
local player p=GetOwningPlayer(GetManipulatingUnit())
local playerstate P=PLAYER_STATE_RESOURCE_GOLD
if IsUnitAlly(GetManipulatingUnit(),Player(0))==true then
if GetItemTypeId(GetManipulatedItem())=='rspd'then
if udg_Int_usM==3then
call AdjustPlayerStateBJ(50,p,P)
else
set udg_Int_usM=udg_Int_usM+1
endif
elseif GetItemTypeId(GetManipulatedItem())=='rspl'then
if udg_Int_usm==3then
call AdjustPlayerStateBJ(50,p,P)
else
set udg_Int_usm=udg_Int_usm+1
endif
elseif GetItemTypeId(GetManipulatedItem())=='rwat'then
if udg_Int_usr==3then
call AdjustPlayerStateBJ(50,p,P)
else
set udg_Int_usr=udg_Int_usr+1
endif
elseif GetItemTypeId(GetManipulatedItem())=='rsps'then
if GetPlayerTechCountSimple('Rhac',Player(0))==25then
call AdjustPlayerStateBJ(50,p,P)
else
call SetPlayerTechResearched(Player(0),'Rhac',GetPlayerTechCount(Player(0),'Rhac',true)+1)
endif
endif
else
if GetItemTypeId(GetManipulatedItem())=='rspd'then
if udg_Int_unM==3then
call AdjustPlayerStateBJ(50,p,P)
else
set udg_Int_unM=udg_Int_unM+1
endif
elseif GetItemTypeId(GetManipulatedItem())=='rspl'then
if udg_Int_unm==3then
call AdjustPlayerStateBJ(50,p,P)
else
set udg_Int_unm=udg_Int_unm+1
endif
elseif GetItemTypeId(GetManipulatedItem())=='rwat'then
if udg_Int_unr==3then
call AdjustPlayerStateBJ(50,p,P)
else
set udg_Int_unr=udg_Int_unr+1
endif
elseif GetItemTypeId(GetManipulatedItem())=='rsps'then
if GetPlayerTechCountSimple('Rhac',Player(6))==25then
call AdjustPlayerStateBJ(50,p,P)
else
call SetPlayerTechResearched(Player(6),'Rhac',GetPlayerTechCount(Player(6),'Rhac',true)+1)
endif
endif
endif
endfunction
function InitTrig_Upgrades takes nothing returns nothing
set gg_trg_Upgrades=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Upgrades,EVENT_PLAYER_UNIT_PICKUP_ITEM)
call TriggerAddAction(gg_trg_Upgrades,function Trig_Upgrades_Actions)
endfunction