///////////////////////////////////////////////////////////////////////////
//////////////////////PORTAL SYSTEM////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
function newportal takes integer sum,integer spawn,integer rate,real x,real y,player p,boolean preview returns nothing
local unit u=CreateUnit(p,sum,x,y,0)
local integer id=GetHandleId(u)
call SaveLightningHandle(udg_GPOR_Hash,id,StringHash("Light"),AddLightningEx(udg_GPOR_Beam,true,x,y,350,GetUnitX(u),GetUnitY(u),25))
call SaveEffectHandle(udg_GPOR_Hash,id,StringHash("BeamSFX"),AddSpecialEffectTarget(udg_GPOR_Channel,u,"chest"))
call SaveInteger(udg_GPOR_Hash,id,StringHash("Spawn"),spawn)
call SaveInteger(udg_GPOR_Hash,id,StringHash("Tick"),rate)
call SaveInteger(udg_GPOR_Hash,id,StringHash("Rate"),rate)
call SaveEffectHandle(udg_GPOR_Hash,id,StringHash("SFX"),AddSpecialEffect(udg_GPOR_Portal,x,y))
call SaveStr(udg_GPOR_Hash,id,StringHash("Teleport"),udg_GPOR_Teleport)
call SaveReal(udg_GPOR_Hash,id,StringHash("X"),x)
call SaveReal(udg_GPOR_Hash,id,StringHash("Y"),y)
call GroupAddUnit(udg_GPOR_Portals,u)
set u=null
if preview then
set u=CreateUnit(p,spawn,x,y,GetRandomReal(0,360))
call SetUnitPathing(u,false)
call SetUnitPosition(u,x,y)
call SaveUnitHandle(udg_GPOR_Hash,id,StringHash("Preview"),u)
call UnitAddAbility(u,'Amrf')
call UnitRemoveAbility(u,'Amrf')
call SetUnitFlyHeight(u,325,2500)
call PauseUnit(u,true)
call UnitAddAbility(u,'Avul')
call UnitAddAbility(u,'Aloc')
call SetUnitVertexColor(u,255,255,255,128)
set u=null
endif
call EnableTrigger(gg_trg_Portal_System)
set p=null
endfunction
///////////////////////////////////////////////////////////////////////////
////////////////////MAP FUNCTIONS//////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
function spawn1 takes nothing returns boolean
return GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>0and IsUnitAlly(GetFilterUnit(),Player(0))
endfunction
function spawn takes integer id returns nothing
local group g=CreateGroup()
local unit u
local unit U
local real array xy
call GroupEnumUnitsInRect(g,GetPlayableMapRect(),Condition(function spawn1))
set U=GroupPickRandomUnit(udg_Spawners)
set xy[0]=GetLocationX(GetUnitLoc(U))
set xy[1]=GetLocationY(GetUnitLoc(U))
set U=GroupPickRandomUnit(g)
set xy[2]=GetLocationX(GetUnitLoc(U))
set xy[3]=GetLocationY(GetUnitLoc(U))
set u=CreateUnit(Player(12),id,xy[0],xy[1],0)
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Human\\MassTeleport\\MassTeleportCaster.mdl",xy[0],xy[1]))
call IssuePointOrder(u,"attack",xy[2],xy[3])
call SetUnitAcquireRange(u,1000000)
call SetUnitUserData(u,1)
call GroupClear(g)
set g=null
set u=null
endfunction
function GetHost takes nothing returns nothing
local gamecache g=InitGameCache("Map.w3v")
call StoreInteger(g,"Map","Host",GetPlayerId(GetLocalPlayer())+1)
call TriggerSyncStart()
call SyncStoredInteger(g,"Map","Host")
call TriggerSyncReady()
set udg_Host=Player(GetStoredInteger(g,"Map","Host")-1)
call DisplayTextToPlayer(GetLocalPlayer(),0,0,"Detected "+GetPlayerName(udg_Host)+" as the host!")
call FlushGameCache(g)
set g=null
endfunction
function Terrain takes integer base,integer t1,integer t2,integer t3 returns nothing
local integer array IDs
local integer x=-41
local integer y=-41
set IDs[0]=base
set IDs[1]=t1
set IDs[2]=t2
set IDs[3]=t3
loop
exitwhen y>41
set x=-41
loop
exitwhen x>41
if IsTerrainPathable(x*128,y*128,PATHING_TYPE_BUILDABILITY)==false then
call SetTerrainType(x*128,y*128,IDs[GetRandomInt(0,3)],-1,1,0)
call AddSpecialEffect(udg_TS_Effects[GetRandomInt(0,2)],(x*128)+GetRandomReal(-64,64),(y*128)+GetRandomReal(-64,64))
endif
set x=x+1
endloop
call TriggerSleepAction(0.01)
set y=y+1
endloop
endfunction
function Default takes player p returns nothing
local unit u=CreateUnit(p,udg_Brace[0],0,0,0)
set udg_Builder[GetPlayerId(p)]=u
if p==udg_Host then
call DialogDisplay(p,udg_Menu_Terrain,false)
call DialogDisplay(p,udg_Menu_Spawn,false)
call DialogDisplay(p,udg_Menu_Movie,false)
set udg_TS_Effects[0]="Doodads\\LordaeronSummer\\Plants\\CornWheatScorched\\CornWheatScorched0.mdl"
set udg_TS_Effects[1]="Doodads\\LordaeronSummer\\Props\\RottenHay\\RottenHay2.mdl"
set udg_TS_Effects[2]="Doodads\\LordaeronSummer\\Props\\WheelBarrelBroken\\WheelBarrelBroken.mdl"
call Terrain('Ldrt','Ldrg','Lgrd','Lgrs')
call SetTerrainFogEx(0,1500,5000,.5,.5,1,.5)
call EnableWeatherEffect(AddWeatherEffect(Rect(-3968,-3968,3968,3968),'LRaa'),true)
endif
call DialogDisplay(udg_Host,udg_Menu_Race,false)
call PauseUnit(u,true)
call UnitAddItemById(u,'I000')
call UnitAddItemById(u,'I003')
call UnitAddItemById(u,'I004')
call UnitAddItemById(u,'I005')
call UnitAddItemById(u,'I002')
call UnitAddItemById(u,'I001')
call PanCameraToTimedForPlayer(p,0,0,0)
set u=null
set p=null
endfunction
function AddLightningEffect_Child takes nothing returns nothing
local lightning l=bj_lastCreatedLightning
local real alpha=1
loop
call TriggerSleepAction(0.25)
set alpha=alpha-0.25
exitwhen alpha<=0
call SetLightningColor(l,1,1,1,alpha)
endloop
call DestroyLightning(l)
set l=null
endfunction
function AddLightningEffect takes string style,real x1,real x2,real y1,real y2 returns nothing
local lightning l=AddLightning(style,true,x1,y1,x2,y2)
local trigger t=CreateTrigger()
set bj_lastCreatedLightning=l
call TriggerAddAction(t,function AddLightningEffect_Child)
call TriggerExecute(t)
call DestroyTrigger(t)
set t=null
set l=null
endfunction
function Hills takes rect r,integer num,real avgsize,real z returns nothing
local integer i=0
local real x1=GetRectMinX(r)
local real x2=GetRectMaxX(r)
local real y1=GetRectMinY(r)
local real y2=GetRectMaxY(r)
loop
exitwhen i>=num
set i=i+1
call TerrainDeformCrater(GetRandomReal(x1,x2),GetRandomReal(y1,y2),GetRandomReal(avgsize/3*2,avgsize/3*4),GetRandomReal(-z,z),1,true)
endloop
set r=null
endfunction
function floatingtext_child takes nothing returns nothing
local integer alpha=255
local integer red=S2I(SubString(bj_cineFadeContinueTex,1,4))
local integer green=S2I(SubString(bj_cineFadeContinueTex,4,7))
local integer blue=S2I(SubString(bj_cineFadeContinueTex,7,10))
local texttag t=bj_lastCreatedTextTag
loop
call TriggerSleepAction(.25)
set alpha=alpha-64
exitwhen alpha<=0
call SetTextTagColor(t,red,green,blue,alpha)
endloop
call DestroyTextTag(t)
set t=null
endfunction
function SetFloatingText takes player whichplayer, string FloatText, real x, real y, integer ZOffset, integer red, integer green, integer blue returns nothing
local texttag t=CreateTextTag()
local trigger child=CreateTrigger()
call SetTextTagText(t,FloatText,.025)
call SetTextTagPos(t,x,y,ZOffset)
call SetTextTagColor(t,red,green,blue,255)
call SetTextTagVisibility(t,(GetLocalPlayer()==whichplayer))
call SetTextTagVelocity(t,0,.04)
call TriggerAddAction(child,function floatingtext_child)
set bj_lastCreatedTextTag=t
set bj_cineFadeContinueTex=I2S(1000000000+red*1000000+green*1000+blue)
call TriggerExecute(child)
call DestroyTrigger(child)
set t=null
set child=null
endfunction
function IsAlive takes nothing returns boolean
return GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>0
endfunction
function NewLevel_Remove takes nothing returns nothing
local unit u=GetEnumUnit()
call DisplayTextToPlayer(Player(0),0,0,GetUnitName(u))
call KillUnit(u)
call RemoveUnit(u)
set u=null
endfunction
function UpTech takes nothing returns nothing
local player p=GetEnumPlayer()
call SetPlayerTechResearched(p,'R00D',udg_Numwave)
set p=null
endfunction
function NewLevel takes nothing returns nothing
local integer i=1
local real array xy
local group g=GetUnitsOfPlayerMatching(Player(12),Condition(function IsAlive))
call ForForce(udg_Players,function UpTech)
set udg_Numwave=udg_Numwave+1
call LeaderboardSetItemValue(udg_Stats,LeaderboardGetPlayerIndex(udg_Stats,Player(12)),udg_Numwave)
call SetPlayerTechResearched(Player(12),'R005',udg_Numwave)
call ForGroup(g,function NewLevel_Remove)
set udg_CreepNum=0
loop
exitwhen i>12
if udg_Alive[i]==true then
set xy[0]=GetLocationX(GetUnitLoc(udg_Builder[i-1]))
set xy[1]=GetLocationY(GetUnitLoc(udg_Builder[i-1]))
call DisplayTextToPlayer(Player(i-1),0,0,"|cff00ff00Wave|r: "+I2S(udg_Numwave)+"\nYou have been awarded one |cffffff00Gold Coin|r!")
call SetPlayerState(Player(i-1),PLAYER_STATE_RESOURCE_GOLD,GetPlayerState(Player(i-1),PLAYER_STATE_RESOURCE_GOLD)+1)
call DestroyEffect(AddSpecialEffect("UI\\Feedback\\GoldCredit\\GoldCredit.mdl",xy[0],xy[1]))
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Items\\ResourceItems\\ResourceEffectTarget.mdl",xy[0],xy[1]))
call SetFloatingText(Player(i-1),"+1",xy[0],xy[1],25,255,255,0)
endif
set i=i+1
endloop
if udg_Numwave<11then
set udg_CreepNum=udg_Difficulty
call EnableTrigger(gg_trg_Creeps)
else
call spawn('H000')
call DisplayTextToPlayer(GetLocalPlayer(),0,0,"|cffff00ffArena Master|r: You may have lasted this long, but this is the end for you!")
call DisableTrigger(gg_trg_Waves)
endif
endfunction
function Set_Vars takes unit u1,unit u2 returns nothing
// Unit 1, attacker, Tower
set udg_xy[0] = GetWidgetX(u1)
set udg_xy[1] = GetWidgetY(u1)
set udg_TmpUnitType = GetUnitTypeId(u1)
set udg_TmpReal = GetUnitState(u1,UNIT_STATE_MANA)
set u1=null
// Unit 2, attacked, Creep
set udg_xy[3] = GetWidgetX(u2)
set udg_xy[4] = GetWidgetY(u2)
set udg_TmpUnitType2 = GetUnitTypeId(u2)
set udg_TmpReal2 = GetUnitState(u2,UNIT_STATE_MANA)
set u2=null
endfunction
function Trig_Powerups_Freeze_Enum takes unit u,integer t returns nothing
local integer id=GetHandleId(u)
if IsUnitInGroup(u,udg_Freeze)==false then
call SaveEffectHandle(udg_PowerupTable,id,StringHash("Ice"),AddSpecialEffectTarget("Abilities\\Spells\\Undead\\FreezingBreath\\FreezingBreathTargetArt.mdl",u,"origin"))
call GroupAddUnit(udg_Freeze,u)
endif
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Undead\\FrostNova\\FrostNovaTarget.mdl",GetWidgetX(u),GetWidgetY(u)))
call SaveInteger(udg_PowerupTable,id,StringHash("Icetime"),LoadInteger(udg_PowerupTable,id,StringHash("Icetime"))+t)
call SetUnitVertexColor(u,0,0,255,255)
call PauseUnit(u,true)
call SetUnitTimeScale(u,0)
set u=null
endfunction
/////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////PROJECTILE SYSTEM 2////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////
function PS_Reset takes nothing returns nothing
set udg_PS_Angle=0
set udg_PS_ColColSize=0
set udg_PS_ColDeath=true
set udg_PS_ColNum=0
set udg_PS_ColSFX=""
set udg_PS_ColSize=0
set udg_PS_ColUnit=0
set udg_PS_CurProjectile=null
set udg_PS_Custom=0
set udg_PS_Dmg=0
set udg_PS_DmgAoE=0
set udg_PS_Filter=1
set udg_PS_Keep=false
set udg_PS_Life=0
set udg_PS_Speed=0
set udg_PS_TrailChance=0
set udg_PS_TrailNum=0
set udg_PS_TrailSFX=""
set udg_PS_TrailUnit=0
set udg_PS_Turn=0
set udg_PS_TypeAttack=0
set udg_PS_TypeDamage=4
set udg_PS_Wiggle=0
endfunction
function PS_New takes integer projectile,integer trail,integer col,real x,real y,player p returns nothing
local unit u=CreateUnit(p,projectile,x,y,udg_PS_Angle)
local integer id=GetHandleId(u)
call GroupAddUnit(udg_PSG_Projectiles,u)
call SaveReal(udg_PSG_Hash,id,StringHash("Angle"),udg_PS_Angle)
call SaveReal(udg_PSG_Hash,id,StringHash("Wiggle"),udg_PS_Wiggle)
call SaveReal(udg_PSG_Hash,id,StringHash("Turn"),udg_PS_Turn)
call SaveReal(udg_PSG_Hash,id,StringHash("Speed"),udg_PS_Speed)
call SaveReal(udg_PSG_Hash,id,StringHash("ColSize"),udg_PS_ColSize)
call SaveReal(udg_PSG_Hash,id,StringHash("ColColSize"),udg_PS_ColColSize)
call SaveReal(udg_PSG_Hash,id,StringHash("Dmg"),udg_PS_Dmg)
call SaveReal(udg_PSG_Hash,id,StringHash("DmgAoE"),udg_PS_DmgAoE)
call SaveInteger(udg_PSG_Hash,id,StringHash("TrailUnit"),trail)
call SaveInteger(udg_PSG_Hash,id,StringHash("ColUnit"),col)
call SaveInteger(udg_PSG_Hash,id,StringHash("TrailChance"),udg_PS_TrailChance)
call SaveInteger(udg_PSG_Hash,id,StringHash("TrailNum"),udg_PS_TrailNum)
call SaveInteger(udg_PSG_Hash,id,StringHash("Life"),udg_PS_Life)
call SaveInteger(udg_PSG_Hash,id,StringHash("ColNum"),udg_PS_ColNum)
call SaveInteger(udg_PSG_Hash,id,StringHash("Custom"),udg_PS_Custom)
call SaveInteger(udg_PSG_Hash,id,StringHash("Filter"),udg_PS_Filter)
call SaveInteger(udg_PSG_Hash,id,StringHash("TypeAttack"),udg_PS_TypeAttack)
call SaveInteger(udg_PSG_Hash,id,StringHash("TypeDamage"),udg_PS_TypeDamage)
call SaveBoolean(udg_PSG_Hash,id,StringHash("ColDeath"),udg_PS_ColDeath)
call SaveStr(udg_PSG_Hash,id,StringHash("TrailSFX"),udg_PS_TrailSFX)
call SaveStr(udg_PSG_Hash,id,StringHash("ColSFX"),udg_PS_ColSFX)
call EnableTrigger(gg_trg_PS)
if udg_PS_Keep==false then
call PS_Reset()
else
set udg_PS_Keep=false
endif
set u=null
set p=null
endfunction
function IsPathableEnum takes nothing returns boolean
local unit u=GetFilterUnit()
local boolean b=not(IsUnitType(u,UNIT_TYPE_STRUCTURE))or not(IsUnitInGroup(u,udg_PSG_Projectiles))
set u=null
if b then
set udg_PSG_Count2=udg_PSG_Count2+1
endif
return b
endfunction
function IsPathable takes real x,real y,integer id returns boolean
local item I=CreateItem(id,x,y)
local boolean B=false
local location l=Location(x,y)
local group g
local integer i
set udg_PSG_Count2=0
set g=GetUnitsInRangeOfLocMatching(24,l,Condition(function IsPathableEnum))
set i=udg_PSG_Count2
if (SquareRoot((GetItemX(I)-x)*(GetItemX(I)-x)+(GetItemY(I)-y)*(GetItemY(I)-y))>=32)and i==0then
set B=true
endif
call DestroyGroup(g)
set g=null
call RemoveLocation(l)
set l=null
call RemoveItem(I)
set I=null
return B
endfunction
Name | Type | is_array | initial_value |
Alive | boolean | Yes | |
Brace | unitcode | Yes | |
Builder | unit | Yes | |
CreepNum | integer | No | |
Difficulty | integer | No | |
Freeze | group | No | |
GlobWeather | weathereffect | No | |
GPOR_Beam | lightningtype | No | |
GPOR_Channel | string | No | |
GPOR_Count | integer | No | |
GPOR_Hash | hashtable | No | |
GPOR_Portal | string | No | |
GPOR_Portals | group | No | |
GPOR_Teleport | string | No | |
Hash | hashtable | No | |
Host | player | No | |
Invuln | group | No | |
Lightning | lightningtype | No | |
LightningPoint | location | No | |
Menu_Btn_Movie | button | No | |
Menu_Btns_Difficulty | button | Yes | |
Menu_Btns_Race | button | Yes | |
Menu_Btns_Spawn | button | Yes | |
Menu_Btns_Terrain | button | Yes | |
Menu_Difficulty | dialog | No | |
Menu_Movie | dialog | No | |
Menu_Race | dialog | No | |
Menu_Spawn | dialog | No | |
Menu_Terrain | dialog | No | |
Movie | boolean | No | |
Numcreep | integer | No | |
Numplayer | integer | No | |
Numwave | integer | No | |
Picked | boolean | Yes | |
Player_Color | string | Yes | |
PlayerNumber | integer | Yes | |
Players | force | No | |
PowerupTable | hashtable | No | |
PS_Angle | real | No | |
PS_ColColSize | real | No | |
PS_ColDeath | boolean | No | |
PS_ColNum | integer | No | |
PS_ColSFX | string | No | |
PS_ColSize | real | No | |
PS_ColUnit | unitcode | No | |
PS_CurProjectile | unit | No | |
PS_Custom | integer | No | |
PS_Dmg | real | No | |
PS_DmgAoE | real | No | |
PS_Filter | integer | No | |
PS_Keep | boolean | No | |
PS_Life | integer | No | |
PS_Speed | real | No | |
PS_TrailChance | integer | No | |
PS_TrailNum | integer | No | |
PS_TrailSFX | string | No | |
PS_TrailUnit | unitcode | No | |
PS_Turn | real | No | |
PS_TypeAttack | integer | No | |
PS_TypeDamage | integer | No | |
PS_Wiggle | real | No | |
PSG_Count | integer | No | |
PSG_Count2 | integer | No | |
PSG_Hash | hashtable | No | |
PSG_Projectiles | group | No | |
PSG_Rate | real | No | |
PSG_Terrain | terraintype | No | |
PSG_TestItem | itemcode | No | |
Spawn | boolean | Yes | |
Spawners | group | No | |
Stats | leaderboard | No | |
Timer_Wave | timer | No | |
Timer_Wave_Window | timerdialog | No | |
TmpGroup | group | No | |
TmpGroup2 | group | No | |
TmpInt | integer | No | |
TmpInt2 | integer | No | |
TmpLightning | lightning | Yes | |
TmpLoc | location | No | |
TmpLoc2 | location | No | |
TmpLoc3 | location | No | |
TmpPlayer | player | No | |
TmpReal | real | No | |
TmpReal2 | real | No | |
TmpString | string | No | |
TmpUnit | unit | No | |
TmpUnit2 | unit | No | |
TmpUnitType | unitcode | No | |
TmpUnitType2 | unitcode | No | |
TowersF | unitcode | Yes | |
TowersR | unitcode | Yes | |
TS_Effects | string | Yes | |
x | real | No | |
xy | real | Yes | |
y | real | No |
TODO:
************
**add AI**
************
fix leveling
finish settings
- show what's selected
Compleate Race Features:
Towers:
- 4 Hero towers
- Each based off a race's melee hero set.
- Each having two abilities, one offensive one defensive.
- Walls, Repairers, Troop Building, and Research Facility.
- Arena Contestant.
- Racial Passive (25% extra hp, spiked barracades, ect)
Units:
- Three unit types to train, Melee, Ranged, Flying.
- Each has two researchable passive or autocast abilities.
- These abilities are one def, one off.
HUMANS - [22/26]:
Racial Spell: +25% hp to all units
Towers:
- Archmage:
- Frozen Shield.
- Spark Ball.
- Palladin:
- Dvivne Vengance
- Divine Defense
- Mountain King:
- [None]
- [None]
- Blood Mage:
- [None]
- [None]
Buildings:
- Barracks
- Blacksmith
- Wall
- Peasant
Units:
- Melee - Footman
- Defend
- Iron Forged Swords
- Ranged - Rifleman
- Piercing Rounds
- Long Rifles
- Flying - Gryphon Rider
- Storm Hammers
- Gryphon War Training
ORCS - [10/26]:
Racial Spell: [none]
Towers:
- Farseer:
- [None]
- Summon Elementals.
- Tuaren Chieftain:
- [None]
- [None]
- Blademaster:
- [None]
- [None]
- Shadow Hunter:
- [None]
- [None]
Buildings:
- Barracks - [3/9]
- Warmill
- Wall
- Peon
Units:
- Melee - Grunt
- [None]
- [None]
- Ranged - None
- [None]
- [None]
- Flying - Wavyrn Rider
- [None]
- [None]
Recode all hero spells to be triggered and passive.
- Human:
- Mountain King
- Blood Mage
- Orc
- Seer
- Tuaren Chief
- Shadow Hunter
- Blade Master
<Add> FIX Enviroment detail (bushes ect) for tileset generated terrain.
Add unit Rank system
Change units to Melee, Ranged, Flying, and add researchable spells (2) to them.
- Spells should be passive and/or triggered like hero spells.
Make a better techtree
finish racesRaces to add:
- Undead
- Night Elf
function Trig_Music_Actions takes nothing returns nothing
call PlayMusic(gg_snd_hamstersong_24k )
endfunction
function InitTrig_Music takes nothing returns nothing
set gg_trg_Music=CreateTrigger()
call TriggerRegisterTimerEvent(gg_trg_Music,215,true)
call TriggerAddAction(gg_trg_Music,function Trig_Music_Actions)
endfunction
function Trig_Death_Conditions takes nothing returns boolean
local integer id=GetUnitTypeId(GetDyingUnit())
return id=='H011'or id=='H004'
endfunction
function Trig_Death takes nothing returns nothing
call KillUnit(GetEnumUnit())
endfunction
function Trig_Death2 takes nothing returns nothing
call CinematicFadeBJ(1,.01,"ReplaceableTextures\\CameraMasks\\White_mask.blp",100,0,0,0)
call CinematicFadeBJ(0,2,"ReplaceableTextures\\CameraMasks\\White_mask.blp",100,0,0,0)
endfunction
function Trig_Death3 takes nothing returns nothing
call CustomDefeatBJ(GetEnumPlayer(),"Defeat!")
endfunction
function Trig_Death_Actions takes nothing returns nothing
local integer i=1
local player p=GetOwningPlayer(GetDyingUnit())
call DisplayTimedTextToForce(GetPlayersAll(),30,udg_Player_Color[GetPlayerId(p)+1]+GetPlayerName(p)+"|r Has Died!")
set udg_Alive[GetConvertedPlayerId(p)]=false
call LeaderboardSetPlayerItemLabelColorBJ(p,udg_Stats,20,20,20,0)
call SetPlayerStateBJ(p,PLAYER_STATE_RESOURCE_LUMBER,0)
call SetPlayerStateBJ(p,PLAYER_STATE_RESOURCE_GOLD,0)
call ForGroupBJ(GetUnitsOfPlayerAll(p),function Trig_Death)
call ForForce(GetPlayersAll(),function Trig_Death2)
loop
exitwhen i>12
if udg_Alive[i]==true then
return
endif
set i=i+1
endloop
call ForForce(GetPlayersAll(),function Trig_Death3)
set p=null
endfunction
function InitTrig_Death takes nothing returns nothing
set gg_trg_Death=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Death,EVENT_PLAYER_UNIT_DEATH)
call TriggerAddCondition(gg_trg_Death,Condition(function Trig_Death_Conditions))
call TriggerAddAction(gg_trg_Death,function Trig_Death_Actions)
endfunction
function Trig_Kills takes nothing returns nothing
call CustomVictoryBJ(GetEnumPlayer(),false,true)
endfunction
function Trig_Kills1 takes nothing returns boolean
return IsUnitType(GetFilterUnit(),UNIT_TYPE_HERO)
endfunction
function Trig_Kills2 takes nothing returns nothing
call AddHeroXP(GetEnumUnit(),GetUnitLevel(GetDyingUnit()),true)
endfunction
function Trig_Kills_Actions takes nothing returns nothing
local unit u=GetKillingUnit()
local player p=GetOwningPlayer(u)
local playerstate l=PLAYER_STATE_RESOURCE_LUMBER
local group g=CreateGroup()
local boolexpr f=Condition(function Trig_Kills1)
call GroupEnumUnitsOfPlayer(g,p,f)
call DestroyBoolExpr(f)
set f=null
if GetUnitTypeId(GetDyingUnit())=='H000'then
call DisableTrigger(gg_trg_Leavers)
call DisableTrigger(gg_trg_Death)
call DisableTrigger(gg_trg_Kills)
call DisplayTextToForce(GetPlayersAll(),"|cffff00ffArena Master|r: Gah! You... have... won...!")
call TriggerSleepAction(5)
call DisplayTextToForce(GetPlayersAll(),"|cffffcc00Game will end in 5 seconds...|r")
call TriggerSleepAction(5)
call ForForce(GetPlayersAll(),function Trig_Kills)
return
endif
call SetPlayerState(p,l,GetPlayerState(p,l)+1)
call ForGroup(g,function Trig_Kills2)
call GroupClear(g)
set g=null
set p=null
set u=null
set l=null
endfunction
function InitTrig_Kills takes nothing returns nothing
set gg_trg_Kills=CreateTrigger()
call TriggerRegisterPlayerUnitEvent(gg_trg_Kills,Player(12),EVENT_PLAYER_UNIT_DEATH,null)
call TriggerAddAction(gg_trg_Kills,function Trig_Kills_Actions)
endfunction
function Trig_Leavers takes nothing returns nothing
call KillUnit(GetEnumUnit())
endfunction
function Trig_Leavers_Actions takes nothing returns nothing
local player p=GetTriggerPlayer()
local group g=GetUnitsOfPlayerAll(p)
call DisplayTimedTextToForce(GetPlayersAll(),30,udg_Player_Color[GetPlayerId(p)+1]+GetPlayerName(p)+"|r Has left the game!")
call ForGroup(g,function Trig_Leavers)
call GroupClear(g)
set g=null
set p=null
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_Race_Pick_Actions takes nothing returns nothing
local integer a=0
local unit u
local player p=GetTriggerPlayer()
set udg_Picked[GetPlayerId(p)+1]=true
call DialogDisplay(p,udg_Menu_Race,false)
loop
exitwhen a>3
if GetClickedButton()==udg_Menu_Btns_Race[a]then
set u=CreateUnit(p,udg_Brace[a],0,0,0)
set udg_Builder[GetPlayerId(p)]=u
call PauseUnit(u,true)
call UnitAddItemById(u,'I000')
call UnitAddItemById(u,'I003')
call UnitAddItemById(u,'I004')
call UnitAddItemById(u,'I005')
call UnitAddItemById(u,'I002')
call UnitAddItemById(u,'I001')
call PanCameraToTimedForPlayer(p,0,0,0)
set u=null
endif
set a=a+1
endloop
set p=null
endfunction
function InitTrig_Race_Pick takes nothing returns nothing
set gg_trg_Race_Pick=CreateTrigger()
call TriggerRegisterDialogEvent(gg_trg_Race_Pick,udg_Menu_Race)
call TriggerAddAction(gg_trg_Race_Pick,function Trig_Race_Pick_Actions)
endfunction
function Trig_Movie_Actions takes nothing returns nothing
call DialogDisplay(udg_Host,udg_Menu_Movie,false)
call DialogDisplay(udg_Host,udg_Menu_Spawn,true)
if GetClickedButtonBJ()==udg_Menu_Btn_Movie then
set udg_Movie=true
call DisplayTextToPlayer(GetLocalPlayer(),0,0,udg_Player_Color[GetPlayerId(udg_Host)+1]+GetPlayerName(udg_Host)+"|r has choosesn to skip the intro movie")
else
call DisplayTextToPlayer(GetLocalPlayer(),0,0,udg_Player_Color[GetPlayerId(udg_Host)+1]+GetPlayerName(udg_Host)+"|r has choosesn to watch the intro movie")
endif
call DestroyTrigger(gg_trg_Movie)
endfunction
function InitTrig_Movie takes nothing returns nothing
set gg_trg_Movie=CreateTrigger()
call TriggerRegisterDialogEvent(gg_trg_Movie,udg_Menu_Movie)
call TriggerAddAction(gg_trg_Movie,function Trig_Movie_Actions)
endfunction
function Trig_Spawn_Points_Actions takes nothing returns nothing
local button b=GetClickedButton()
call DialogDisplay(udg_Host,udg_Menu_Spawn,false)
call DialogDisplay(udg_Host,udg_Menu_Terrain,true)
if b==udg_Menu_Btns_Spawn[0]then//Middle
call RemoveUnit(gg_unit_h00Z_0013)
call RemoveUnit(gg_unit_h00Z_0014)
call RemoveUnit(gg_unit_h00Z_0016)
call RemoveUnit(gg_unit_h00Z_0008)
call RemoveUnit(gg_unit_h00Z_0009)
call RemoveUnit(gg_unit_h00Z_0018)
call RemoveUnit(gg_unit_h00Z_0019)
call RemoveUnit(gg_unit_h00Z_0020)
call GroupAddUnit(udg_Spawners,gg_unit_h00Z_0015)
elseif b==udg_Menu_Btns_Spawn[1]then//Sides
call RemoveUnit(gg_unit_h00Z_0015)
call RemoveUnit(gg_unit_h00Z_0009)
call RemoveUnit(gg_unit_h00Z_0018)
call RemoveUnit(gg_unit_h00Z_0019)
call RemoveUnit(gg_unit_h00Z_0020)
call GroupAddUnit(udg_Spawners,gg_unit_h00Z_0013)
call GroupAddUnit(udg_Spawners,gg_unit_h00Z_0014)
call GroupAddUnit(udg_Spawners,gg_unit_h00Z_0016)
call GroupAddUnit(udg_Spawners,gg_unit_h00Z_0008)
elseif b==udg_Menu_Btns_Spawn[2]then//Corners
call RemoveUnit(gg_unit_h00Z_0015)
call RemoveUnit(gg_unit_h00Z_0013)
call RemoveUnit(gg_unit_h00Z_0014)
call RemoveUnit(gg_unit_h00Z_0016)
call RemoveUnit(gg_unit_h00Z_0008)
call GroupAddUnit(udg_Spawners,gg_unit_h00Z_0009)
call GroupAddUnit(udg_Spawners,gg_unit_h00Z_0018)
call GroupAddUnit(udg_Spawners,gg_unit_h00Z_0019)
call GroupAddUnit(udg_Spawners,gg_unit_h00Z_0020)
endif
set b=null
endfunction
function InitTrig_Spawn_Points takes nothing returns nothing
set gg_trg_Spawn_Points=CreateTrigger()
call TriggerRegisterDialogEvent(gg_trg_Spawn_Points,udg_Menu_Spawn)
call TriggerAddAction(gg_trg_Spawn_Points,function Trig_Spawn_Points_Actions)
endfunction
function Trig_Difficulty_Actions takes nothing returns nothing
local button b=GetClickedButton()
local string s="|cffffff00Normal|r"
call DialogDisplay(udg_Host,udg_Menu_Terrain,false)
call DialogDisplay(udg_Host,udg_Menu_Race,true)
if b==udg_Menu_Btns_Difficulty[0]then//Easy
set s="|cff00ff00Easy|r"
set udg_Difficulty=100
elseif b==udg_Menu_Btns_Difficulty[2]then//Hard
set s="|cffff4500Hard|r"
set udg_Difficulty=200
elseif b==udg_Menu_Btns_Difficulty[3]then//Extreme
set s="|cffff0000Extreme|r"
set udg_Difficulty=250
endif
call DisplayTextToPlayer(GetLocalPlayer(),0,0,"|cffffcc00Difficulty|r: "+s)
set b=null
endfunction
function InitTrig_Difficulty takes nothing returns nothing
set gg_trg_Difficulty=CreateTrigger()
call TriggerRegisterDialogEvent(gg_trg_Difficulty,udg_Menu_Difficulty)
call TriggerAddAction(gg_trg_Difficulty,function Trig_Difficulty_Actions)
endfunction
function Trig_Terrain_Actions takes nothing returns nothing
local integer i=0
local integer I=1
local real r=1
local real g=1
local real b=1
local integer we
call DialogDisplay(udg_Host,udg_Menu_Terrain,false)
call DialogDisplay(udg_Host,udg_Menu_Difficulty,true)
loop
exitwhen i>10
if GetClickedButton()==udg_Menu_Btns_Terrain[i]then
set I=i
endif
set i=i+1
endloop
if I==0then
set I=GetRandomInt(1,10)
endif
if I==1then//Ashenvale
set udg_TS_Effects[0]="Doodads\\Ashenvale\\Plants\\AshenBush0\\AshenBush0.mdl"
set udg_TS_Effects[1]="Doodads\\Ruins\\Plants\\Ruins_Shrub\\Ruins_Shrub0.mdl"
set udg_TS_Effects[2]="Doodads\\Ruins\\Plants\\Ruins_Flower\\Ruins_Flower3.mdl"
call Terrain('Adrg','Agrs','Agrd','Alvd')
set we='RAhr'
set r=.2
set b=.3
set g=1
elseif I==2then//Barrens
set udg_TS_Effects[0]="Doodads\\Barrens\\Props\\Barrens_Bones\\Barrens_Bones8.mdl"
set udg_TS_Effects[1]="Doodads\\Barrens\\Props\\Barrens_Bones\\Barrens_Bones9.mdl"
set udg_TS_Effects[2]="Doodads\\Barrens\\Props\\Barrens_Bones\\Barrens_Bones0.mdl"
call Terrain('Bdrt','Bdrh','Bdrr','Bdsr')
set we='WNcw'
set r=.8
set b=0
set g=.4
elseif I==3then//Dal Ruins
set udg_TS_Effects[0]="Doodads\\Ashenvale\\Props\\ScorchedRemains\\ScorchedRemains0.mdl"
set udg_TS_Effects[1]="Doodads\\Cityscape\\Structures\\CityBuildingSmall135_0_BaseRuin\\CityBuildingSmall135_0_BaseRuin.mdl"
set udg_TS_Effects[2]="Doodads\\Cityscape\\Structures\\City_ColumnSingle2_Ruined\\City_ColumnSingle2_Ruined.mdl"
call Terrain('Jdrt','Jgsb','Jhdg','Jdtr')
set we='MEds'
set r=.8
set b=.4
set g=.8
elseif I==4then//Dungeon
set udg_TS_Effects[0]="Doodads\\Cinematic\\FirePillarMedium\\FirePillarMedium.mdl"
set udg_TS_Effects[1]="Doodads\\Cinematic\\FireRockSmall\\FireRockSmall.mdl"
set udg_TS_Effects[2]="Doodads\\Dungeon\\Props\\LavaCracks\\LavaCracks3.mdl"
call Terrain('Ddrt','Dlvc','Dlav','Drds')
set we='FDrh'
set r=1
set b=0
set g=0
elseif I==5then//Felwood
set udg_TS_Effects[0]="Doodads\\Felwood\\Plants\\FelwoodBush\\FelwoodBush0.mdl"
set udg_TS_Effects[1]="Doodads\\Ruins\\Plants\\Ruins_Shrub\\Ruins_Shrub0.mdl"
set udg_TS_Effects[2]="Doodads\\Northrend\\Plants\\North_Thorns\\North_Thorns2.mdl"
call Terrain('Cdrt','Cdrd','Cpos','Cvin')
set we='FDgh'
set r=0
set b=0
set g=1
elseif I==6then//Lorderon
set udg_TS_Effects[0]="Doodads\\LordaeronSummer\\Plants\\CornWheatScorched\\CornWheatScorched0.mdl"
set udg_TS_Effects[1]="Doodads\\LordaeronSummer\\Props\\RottenHay\\RottenHay2.mdl"
set udg_TS_Effects[2]="Doodads\\LordaeronSummer\\Props\\WheelBarrelBroken\\WheelBarrelBroken.mdl"
call Terrain('Ldrt','Ldrg','Lgrd','Lgrs')
set we='LRaa'
set r=.5
set b=1
set g=.5
elseif I==7then//Northrend
set udg_TS_Effects[0]="Doodads\\Northrend\\Props\\North_Bones\\North_Bones8.mdl"
set udg_TS_Effects[1]="Doodads\\Icecrown\\Rocks\\IceBlock\\IceBlock1.mdl"
set udg_TS_Effects[2]="Doodads\\Icecrown\\Water\\IceEdge\\IceEdge3.mdl"
call Terrain('Ndrt','Nrck','Nice','Nsnw')
set we='SNbs'
set r=1
set b=1
set g=1
elseif I==8then//Outlands
set udg_TS_Effects[0]="Doodads\\Outland\\Plants\\Outland_Plant\\Outland_Plant0.mdl"
set udg_TS_Effects[1]="Doodads\\Outland\\Plants\\Outland_Plant\\Outland_Plant4.mdl"
set udg_TS_Effects[2]="Doodads\\Outland\\Plants\\Outland_Plant\\Outland_Plant3.mdl"
call Terrain('Odtr','Olgb','Osmb','Ofst')
set we='WOcw'
set r=1
set b=0
set g=.5
elseif I==9then//Sunken Ruins
set udg_TS_Effects[0]="Doodads\\Ruins\\Plants\\VinyPlant\\VinyPlant1.mdl"
set udg_TS_Effects[1]="Doodads\\Ruins\\Props\\Ruins_Shells\\Ruins_Shells8.mdl"
set udg_TS_Effects[2]="Doodads\\Ruins\\Props\\Ruins_Shells\\Ruins_Shells4.mdl"
call Terrain('Zsan','Zbks','Ztil','Zbkl')
set we='RLhr'
set r=.5
set b=1
set g=1
elseif I==10then//Village
set udg_TS_Effects[0]="Doodads\\LordaeronSummer\\Plants\\Corn\\Corn.mdl"
set udg_TS_Effects[1]="Doodads\\LordaeronSummer\\Plants\\Wheat\\Wheat.mdl"
set udg_TS_Effects[2]="Doodads\\LordaeronSummer\\Props\\Hay\\Hay2.mdl"
call Terrain('Vdrt','Vcrp','Vcbp','Vgrs')
set we='LRma'
set r=.8
set b=.4
set g=.6
endif
call SetTerrainFogEx(0,1500,5000,.5,r,g,b)
call EnableWeatherEffect(AddWeatherEffect(Rect(-3968,-3968,3968,3968),we),true)
endfunction
function InitTrig_Terrain takes nothing returns nothing
set gg_trg_Terrain=CreateTrigger()
call TriggerRegisterDialogEventBJ(gg_trg_Terrain, udg_Menu_Terrain)
call TriggerAddAction(gg_trg_Terrain,function Trig_Terrain_Actions)
endfunction
function Trig_Creeps_Actions takes nothing returns nothing
if udg_CreepNum>0then
set udg_CreepNum=udg_CreepNum-1
call spawn(ChooseRandomCreep(udg_Numwave))
else
call DisableTrigger(gg_trg_Creeps)
endif
endfunction
function InitTrig_Creeps takes nothing returns nothing
set gg_trg_Creeps=CreateTrigger()
call TriggerRegisterTimerEvent(gg_trg_Creeps,.07,true)
call TriggerAddAction(gg_trg_Creeps,function Trig_Creeps_Actions)
endfunction
function Trig_Waves_Actions takes nothing returns nothing
local integer i=0
local group g
local boolexpr b
call NewLevel()
loop
set g=CreateGroup()
set b=Condition(function IsAlive)
call GroupEnumUnitsOfPlayer(g,Player(12),b)
call ForGroup(g,function CountUnitsInGroupEnum)
set i=bj_groupCountUnits+udg_CreepNum
set bj_groupCountUnits=0
call GroupClear(g)
set g=null
set b=null
call LeaderboardSetItemValue(udg_Stats,LeaderboardGetPlayerIndex(udg_Stats,Player(13)),i)
exitwhen i<=0
call TriggerSleepAction(1)
endloop
if udg_Numwave<11then
call TriggerExecute(gg_trg_Waves)
endif
endfunction
function InitTrig_Waves takes nothing returns nothing
set gg_trg_Waves=CreateTrigger()
call DisableTrigger(gg_trg_Waves)
call TriggerAddAction(gg_trg_Waves,function Trig_Waves_Actions)
endfunction
function Trig_Wave_Once_Actions takes nothing returns nothing
call TimerDialogDisplay(udg_Timer_Wave_Window,false)
call DestroyTimerDialog(udg_Timer_Wave_Window)
set udg_Timer_Wave_Window=null
call DestroyTrigger(gg_trg_Wave_Once)
set gg_trg_Wave_Once=null
call TriggerExecute(gg_trg_Waves)
endfunction
function InitTrig_Wave_Once takes nothing returns nothing
set gg_trg_Wave_Once=CreateTrigger()
call TriggerRegisterTimerExpireEvent(gg_trg_Wave_Once,udg_Timer_Wave)
call TriggerAddAction(gg_trg_Wave_Once,function Trig_Wave_Once_Actions)
endfunction
function Trig_Towers_Conditions takes nothing returns boolean
return GetUnitPointValue(GetConstructedStructure())==123
endfunction
function Trig_Towers_Actions takes nothing returns nothing
local unit u=GetConstructedStructure()
local real array xy
local integer i=GetUnitTypeId(u)
local unit U
local integer I=1
set xy[0]=GetLocationX(GetUnitLoc(u))
set xy[1]=GetLocationY(GetUnitLoc(u))
loop
exitwhen I>16
if udg_TowersF[I]==i then
set U=CreateUnit(GetOwningPlayer(u),udg_TowersR[I],xy[0],xy[1],0)
endif
set I=I+1
endloop
call SetUnitScale(u,0,0,0)
call SaveUnitHandleBJ(u,StringHash("base"),GetHandleId(U),udg_Hash)
set U=null
set u=null
endfunction
function InitTrig_Towers takes nothing returns nothing
set gg_trg_Towers=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Towers,EVENT_PLAYER_UNIT_CONSTRUCT_FINISH)
call TriggerAddCondition(gg_trg_Towers,Condition(function Trig_Towers_Conditions))
call TriggerAddAction(gg_trg_Towers,function Trig_Towers_Actions)
endfunction
function Trig_Towers_kill_Conditions takes nothing returns boolean
local unit u=GetDyingUnit()
local boolean b=IsUnitType(u,UNIT_TYPE_STRUCTURE)==true and IsUnitType(u,UNIT_TYPE_HERO)==true
set u=null
return b
endfunction
function Trig_Towers_kill_Actions takes nothing returns nothing
local integer i=GetHandleId(GetDyingUnit())
call RemoveUnit(LoadUnitHandleBJ(StringHash("base"),i,udg_Hash))
call FlushChildHashtableBJ(i,udg_Hash)
endfunction
function InitTrig_Towers_kill takes nothing returns nothing
set gg_trg_Towers_kill=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( gg_trg_Towers_kill,EVENT_PLAYER_UNIT_DEATH)
call TriggerAddCondition(gg_trg_Towers_kill,Condition(function Trig_Towers_kill_Conditions))
call TriggerAddAction(gg_trg_Towers_kill,function Trig_Towers_kill_Actions)
endfunction
function Trig_Destroy_Conditions takes nothing returns boolean
return GetResearched()=='R004'
endfunction
function Trig_Destroy_Actions takes nothing returns nothing
local unit u=GetResearchingUnit()
call KillUnit(u)
call RemoveUnit(u)
set u=null
endfunction
function InitTrig_Destroy takes nothing returns nothing
set gg_trg_Destroy=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Destroy,EVENT_PLAYER_UNIT_RESEARCH_START)
call TriggerAddCondition(gg_trg_Destroy,Condition(function Trig_Destroy_Conditions))
call TriggerAddAction(gg_trg_Destroy,function Trig_Destroy_Actions)
endfunction
function Trig_Dismiss_Conditions takes nothing returns boolean
return GetSpellAbilityId()=='A002'
endfunction
function Trig_Dismiss_Actions takes nothing returns nothing
local unit u=GetSpellAbilityUnit()
call KillUnit(u)
call RemoveUnit(u)
set u=null
endfunction
function InitTrig_Dismiss takes nothing returns nothing
set gg_trg_Dismiss=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Dismiss,EVENT_PLAYER_UNIT_SPELL_CAST)
call TriggerAddCondition(gg_trg_Dismiss,Condition(function Trig_Dismiss_Conditions))
call TriggerAddAction(gg_trg_Dismiss,function Trig_Dismiss_Actions)
endfunction
function Trig_freeze takes nothing returns nothing
local unit u=GetEnumUnit()
local integer i=LoadIntegerBJ(StringHash("Icetime"),GetHandleId(u),udg_PowerupTable)
if i>0then
call SaveIntegerBJ(i-1,StringHash("Icetime"),GetHandleId(u),udg_PowerupTable)
else
call DestroyEffect(LoadEffectHandleBJ(StringHash("Ice"),GetHandleId(u),udg_PowerupTable))
call FlushChildHashtableBJ(GetHandleId(u),udg_PowerupTable)
call GroupRemoveUnit(udg_Freeze,u)
call SetUnitVertexColor(u,255,255,255,255)
call PauseUnit(u,false)
call SetUnitTimeScale(u,1)
endif
set u=null
endfunction
function Trig_invuln takes nothing returns nothing
local unit u=GetEnumUnit()
local integer i=LoadIntegerBJ(StringHash("Shieldtime"),GetHandleId(u),udg_PowerupTable)
if i>0then
call SaveIntegerBJ(i-1,StringHash("Shieldtime"),GetHandleId(u),udg_PowerupTable)
else
call DestroyEffect(LoadEffectHandleBJ(StringHash("Shield"),GetHandleId(u),udg_PowerupTable))
call FlushChildHashtableBJ(GetHandleId(u),udg_PowerupTable)
call GroupRemoveUnit(udg_Invuln,u)
call SetUnitInvulnerable(u,false)
endif
set u=null
endfunction
function Trig_PowerupsEnd_Actions takes nothing returns nothing
call ForGroup(udg_Freeze,function Trig_freeze)
call ForGroup(udg_Invuln,function Trig_invuln)
endfunction
function InitTrig_PowerupsEnd takes nothing returns nothing
set gg_trg_PowerupsEnd=CreateTrigger()
call TriggerRegisterTimerEventPeriodic(gg_trg_PowerupsEnd,1)
call TriggerAddAction(gg_trg_PowerupsEnd,function Trig_PowerupsEnd_Actions)
endfunction
function Trig_Creeps takes nothing returns boolean
return GetUnitTypeId(GetFilterUnit())!='H000'and GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>0
endfunction
function Trig_humans takes nothing returns boolean
return GetOwningPlayer(GetFilterUnit())!=Player(12)and GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>0
endfunction
function Trig_Powerups_Freeze takes nothing returns nothing
local unit u=GetEnumUnit()
call Trig_Powerups_Freeze_Enum(u,10)
set u=null
endfunction
function Trig_Powerups_kill takes nothing returns nothing
call DestroyEffect(AddSpecialEffectLoc("Abilities\\Spells\\Undead\\DeathCoil\\DeathCoilSpecialArt.mdl",GetUnitLoc(GetEnumUnit())))
call SetUnitLifeBJ(GetEnumUnit(),1)
endfunction
function Trig_Powerups_reset takes nothing returns nothing
local unit u=GetEnumUnit()
local location l=GetUnitLoc(GroupPickRandomUnit(udg_Spawners))
local location L=GetUnitLoc(u)
call DestroyEffect(AddSpecialEffectLoc("Abilities\\Spells\\Human\\MassTeleport\\MassTeleportCaster.mdl",L))
call SetUnitPositionLoc(u,l)
set L=GetUnitLoc(GroupPickRandomUnit(udg_TmpGroup))
call IssuePointOrderLoc(u,"attack",L)
call RemoveLocation(l)
set l=null
call RemoveLocation(L)
set L=null
set u=null
endfunction
function Trig_Powerups_invuln takes nothing returns nothing
local unit u=GetEnumUnit()
if GetUnitAbilityLevel(u,'Avul')==0then
if IsUnitInGroup(u,udg_Invuln)==false then
call SaveEffectHandleBJ(AddSpecialEffectTarget("Abilities\\Spells\\Human\\DivineShield\\DivineShieldTarget.mdl",u,"origin"),StringHash("Shield"),GetHandleId(u),udg_PowerupTable)
call GroupAddUnit(udg_Invuln,u)
endif
call DestroyEffect(AddSpecialEffectLoc("Abilities\\Spells\\Human\\Resurrect\\ResurrectTarget.mdl",GetUnitLoc(u)))
call SaveIntegerBJ(10,StringHash("Shieldtime"),GetHandleId(u),udg_PowerupTable)
call SetUnitInvulnerable(u,true)
endif
endfunction
//call SetPlayerState(p,ps,GetPlayerState(p,ps)+change)
function Trig_Powerups_Actions takes nothing returns nothing
local group g=GetUnitsOfPlayerMatching(Player(12),Condition(function Trig_Creeps))
local integer i=GetItemTypeId(GetManipulatedItem())
local unit u=GetManipulatingUnit()
local player p=GetOwningPlayer(u)
local integer nwood=GetPlayerState(p,PLAYER_STATE_RESOURCE_LUMBER)
local integer ngold=GetPlayerState(p,PLAYER_STATE_RESOURCE_GOLD)
if i=='I005'and nwood>=35then
call SetPlayerState(p,PLAYER_STATE_RESOURCE_LUMBER,nwood-35)
call ForGroup(g,function Trig_Powerups_Freeze)
elseif i=='I004'and nwood>=150then
call SetPlayerState(p,PLAYER_STATE_RESOURCE_LUMBER,nwood-150)
call ForGroup(g,function Trig_Powerups_kill)
elseif i=='I002'and nwood>=25then
call SetPlayerState(p,PLAYER_STATE_RESOURCE_LUMBER,nwood-25)
set udg_TmpGroup=GetUnitsInRectMatching(GetPlayableMapRect(),Condition(function Trig_humans))
call ForGroupBJ(g,function Trig_Powerups_reset)
elseif i=='I000'and nwood>=250then
call SetPlayerState(p,PLAYER_STATE_RESOURCE_LUMBER,nwood-250)
call AdjustPlayerStateBJ(1,GetOwningPlayer(u),PLAYER_STATE_RESOURCE_GOLD)
elseif i=='I003'and ngold>=1then
call SetPlayerState(p,PLAYER_STATE_RESOURCE_GOLD,ngold-1)
call SetPlayerState(p,PLAYER_STATE_RESOURCE_LUMBER,nwood+250)
endif
call GroupClear(g)
set g=GetUnitsOfPlayerMatching(GetOwningPlayer(u),Condition(function Trig_humans))
if i=='I001'and nwood>=15then
call SetPlayerState(p,PLAYER_STATE_RESOURCE_LUMBER,nwood-15)
call ForGroupBJ(g,function Trig_Powerups_invuln)
endif
call GroupClear(g)
call GroupClear(udg_TmpGroup)
endfunction
function InitTrig_Powerups takes nothing returns nothing
set gg_trg_Powerups=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Powerups,EVENT_PLAYER_UNIT_USE_ITEM)
call TriggerAddAction(gg_trg_Powerups,function Trig_Powerups_Actions)
endfunction
function Trig_Summon_Elementals_Conditions takes nothing returns boolean
return GetSpellAbilityId()=='A00N'
endfunction
function Trig_Summon_Elementals_Actions takes nothing returns nothing
local real array xy
local unit u=GetSpellAbilityUnit()
local player p=GetOwningPlayer(u)
set xy[0]=GetLocationX(GetUnitLoc(u))
set xy[1]=GetLocationY(GetUnitLoc(u))
call UnitApplyTimedLife(CreateUnit(p,'h00R',xy[0]+256,xy[1],0),'BTLF',30)
call UnitApplyTimedLife(CreateUnit(p,'h00M',xy[0],xy[1]+256,90),'BTLF',30)
call UnitApplyTimedLife(CreateUnit(p,'h00N',xy[0]-256,xy[1],180),'BTLF',30)
call UnitApplyTimedLife(CreateUnit(p,'h00Q',xy[0],xy[1]-256,270),'BTLF',30)
set p=null
set u=null
endfunction
function InitTrig_Summon_Elementals takes nothing returns nothing
set gg_trg_Summon_Elementals=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Summon_Elementals,EVENT_PLAYER_UNIT_SPELL_CAST)
call TriggerAddCondition(gg_trg_Summon_Elementals,Condition(function Trig_Summon_Elementals_Conditions))
call TriggerAddAction(gg_trg_Summon_Elementals,function Trig_Summon_Elementals_Actions)
endfunction
===========================================================================
Explaination of variables
===========================================================================
Note: Col=Hitting a unit, running out of life, or hitting the 'Death' terrain type.
====================
'LOCAL' VARIABLES
====================
udg_PS_Angle
- Real
- Determines the angle that the projectile moves in.
- NOTE: Saves after each iteration.
====================
udg_PS_ColColSize
- Real
- Radius to damage units for udg_PS_DmgAoE when the projectile collides (aka explodes)
====================
udg_PS_ColDeath
- Boolean
- Whether or not the projectiles dies when it collides.
====================
udg_PS_ColNum
- Integer
- How many units to create when the projectile collides or dies.
- WARNING: Use care with high numbers!
====================
usg_PS_ColSFX
- String
- The special effect to create when the projectile collides or dies.
- WARNING: Try to use 'small' models if udg_PS_ColDeath = true.
====================
udg_PS_ColSize
- Real
- How far of a radius to check for colliding with units.
====================
udg_PS_ColUnit
- Integer (unit type)
- The unit type to create when the projectile collides or dies.
====================
udg_PS_CurProjectile
- Unit
- This is a temporary variable used internally, basically the EnumUnit in the loop.
====================
udg_PS_Custom
- Integer
- A custom value (like a unit's custom value) that can be used to pass some data along the projectile.
- NPTE: This value is passed to all TrailUnits or ColUnits it creates.
- NOTE: Not used in the system, but by the unser on a spell by spell basis.
====================
udg_PS_Dmg
- Real
- How much damage to deal to a unit it collides with.
====================
udg_PS_DmgAoE
- Real
- How much damage to deal to all units in udg_PS_ColColSize, stacks with udg_PS_Dmg.
====================
udg_PS_Keep
- Boolean
- After calling PS_New() function if this is true you keep all the global variable values, rather thanr esetting them.
- WARNING: Each iteration of the projectile system resets the values, so don't use waits.
- NOTE: You have to set this to true after each call of PS_New() as that will always reset it to false.
====================
udg_PS_Life
- Integer
- How far (in distance) the projectile moves before dieing.
- NOTE: Saves after each iteration.
====================
udg_PS_Speed
- Real
- How far the projectile moves.
====================
udg_PS_TrailChance
- Integer
- The chance (0-100) that the projectile will create udg_PS_TrailNum udg_PS_TrailUnit's.
- WARNING: Use care with high chances!
====================
udg_PS_TrailNum
- Integer
- How many units to create when it creates a trail unit.
- WARNING: Use care with high numbers!
====================
udg_PS_TrailSFX
- String
- The special effect to create each iteration.
- WARNING: Try to use 'small' models.
====================
udg_PS_TrailUnit
- Integer (unit type)
- The unit type the projectile has a chance to make each iteration.
====================
udg_PS_Turn
- Real
- Is added to udg_PS_Angle.
====================
udg_PS_TypeAttack
- Integer
- The attack type the projectile will use.
====================
udg_PS_TypeDamage
- Integer
- The damage type the projectile will use.
====================
udg_PS_Wiggle
- Real
- Nudges udg_PS_Angle by this ammount, positive or negitive.
====================
'GLOBAL' VARIABLES
====================
udg_PSG_Count
- Integer
- Counter used internally, check if the looping trigger should be turned off.
====================
udg_PSG_Count2
- Integer
- Counter used internally, check if the projectile collides.
====================
udg_PSG_Hash
- Hashtable
- Stores all projectile data in this.
====================
udg_PSG_Projectiles
- Unit Group
- Contains all projectiles to iterate through them.
====================
udg_PSG_Rate
- Real
- This is like the rate of time, and is defualted to 1.00, is put to 2.00 the projectiles move and turn twice as fast. if set to 0 they will freeze.
- WARNING: Becareful of low values!
- Note: High values are look worse (5+).
====================
udg_PSG_Terrain
- Integer (Terrian Type)
- A terrain type that will kill any touching projectile.
====================
REFERANCE LIST
====================
real udg_PS_Angle
real udg_PS_ColColSize
boolean udg_PS_ColDeath
integer udg_PS_ColNum
string udg_PS_ColSFX
real udg_PS_ColSize
unit-type udg_PS_ColUnit
unit udg_PS_CurProjectile
integer udg_PS_Custom
real udg_PS_Dmg
real udg_PS_DmgAoE
boolean udg_PS_Keep
integer udg_PS_Life
real udg_PS_Speed
integer udg_PS_TrailChance
integer udg_PS_TrailNum
string udg_PS_TrailSFX
unit-type udg_PS_TrailUnit
real udg_PS_Turn
integer udg_PS_TypeAttack
integer udg_PS_TypeDamage
real udg_PS_Wiggle
integer udg_PSG_Count
integer udg_PSG_Count2
hashtable udg_PSG_Hash
unitgroup udg_PSG_Projectiles
real udg_PSG_Rate
terrain-type udg_PSG_Terrain
function Trig_PS_TargetFilter takes nothing returns boolean
local unit u=GetFilterUnit()
local boolean b=GetWidgetLife(u)>0and IsUnitEnemy(u,GetOwningPlayer(udg_PS_CurProjectile))==true and IsUnitInGroup(u,udg_PSG_Projectiles)==false
set u=null
if b then
set udg_PSG_Count2=udg_PSG_Count2+1
endif
return b
endfunction
function Trig_PS_Target takes nothing returns nothing
call UnitDamageTarget(udg_PS_CurProjectile,GetEnumUnit(),udg_PS_Dmg,true,false,ConvertAttackType(udg_PS_TypeAttack),ConvertDamageType(udg_PS_TypeDamage),null)
endfunction
function Trig_PS_Target2 takes nothing returns nothing
call UnitDamageTarget(udg_PS_CurProjectile,GetEnumUnit(),udg_PS_DmgAoE,true,false,ConvertAttackType(udg_PS_TypeAttack),ConvertDamageType(udg_PS_TypeDamage),null)
endfunction
function Trig_PS_Loop takes nothing returns nothing
local unit u=GetEnumUnit()
local integer id=GetHandleId(u)
local real array xy
local boolean Boom=false
local group g=CreateGroup()
local integer i
local player p=GetOwningPlayer(u)
local real an
local unit U
local boolexpr filter=Condition(function Trig_PS_TargetFilter)
//Reals
set udg_PS_Wiggle=LoadReal(udg_PSG_Hash,id,StringHash("Wiggle"))*udg_PSG_Rate
set udg_PS_Turn=LoadReal(udg_PSG_Hash,id,StringHash("Turn"))*udg_PSG_Rate
set udg_PS_Angle=LoadReal(udg_PSG_Hash,id,StringHash("Angle"))+udg_PS_Turn+GetRandomReal(-udg_PS_Wiggle,udg_PS_Wiggle)
set udg_PS_Speed=LoadReal(udg_PSG_Hash,id,StringHash("Speed"))*udg_PSG_Rate
set udg_PS_ColSize=LoadReal(udg_PSG_Hash,id,StringHash("ColSize"))
set udg_PS_ColColSize=LoadReal(udg_PSG_Hash,id,StringHash("ColColSize"))
set udg_PS_Dmg=LoadReal(udg_PSG_Hash,id,StringHash("Dmg"))
set udg_PS_DmgAoE=LoadReal(udg_PSG_Hash,id,StringHash("DmgAoE"))
//Integers
//Ids
set udg_PS_TrailUnit=LoadInteger(udg_PSG_Hash,id,StringHash("TrailUnit"))
set udg_PS_ColUnit=LoadInteger(udg_PSG_Hash,id,StringHash("ColUnit"))
//Ints
set udg_PS_TrailChance=LoadInteger(udg_PSG_Hash,id,StringHash("TrailChance"))
set udg_PS_TrailNum=LoadInteger(udg_PSG_Hash,id,StringHash("TrailNum"))
set udg_PS_Life=LoadInteger(udg_PSG_Hash,id,StringHash("Life"))-R2I(udg_PS_Speed)
set udg_PS_ColNum=LoadInteger(udg_PSG_Hash,id,StringHash("ColNum"))
set udg_PS_Custom=LoadInteger(udg_PSG_Hash,id,StringHash("Custom"))
set udg_PS_Filter=LoadInteger(udg_PSG_Hash,id,StringHash("Filter"))
set udg_PS_TypeAttack=LoadInteger(udg_PSG_Hash,id,StringHash("TypeAttack"))
set udg_PS_TypeDamage=LoadInteger(udg_PSG_Hash,id,StringHash("TypeDamage"))
//Booleans
set udg_PS_ColDeath=LoadBoolean(udg_PSG_Hash,id,StringHash("ColDeath"))
//Strings
set udg_PS_TrailSFX=LoadStr(udg_PSG_Hash,id,StringHash("TrailSFX"))
set udg_PS_ColSFX=LoadStr(udg_PSG_Hash,id,StringHash("ColSFX"))
//System
if udg_PS_Filter==0 then
set udg_PS_Filter=1
endif
set udg_PS_CurProjectile=u
set xy[0]=GetWidgetX(udg_PS_CurProjectile)+udg_PS_Speed*Cos(udg_PS_Angle*.01745)
set xy[1]=GetWidgetY(udg_PS_CurProjectile)+udg_PS_Speed*Sin(udg_PS_Angle*.01745)
call SetUnitX(udg_PS_CurProjectile,xy[0])
call SetUnitY(udg_PS_CurProjectile,xy[1])
call SetUnitFacing(udg_PS_CurProjectile,udg_PS_Angle)
set udg_PSG_Count2=0
call GroupEnumUnitsInRange(g,xy[0],xy[1],udg_PS_ColSize,filter)
call DestroyGroup(g)
set g=null
if udg_PSG_Count2>0then
set Boom=true
call ForGroup(g,function Trig_PS_Target)
if udg_PS_ColDeath then
set udg_PS_Life=0
endif
endif
call DestroyGroup(g)
call GroupClear(g)
set g=null
/////////////////////////
//Trail SFX and units
/////////////////////////
call DestroyEffect(AddSpecialEffect(udg_PS_TrailSFX,xy[0],xy[1]))
if udg_PS_TrailChance>0and udg_PS_TrailUnit!=0and udg_PS_TrailNum>0then
if GetRandomInt(1,100)<=udg_PS_TrailChance then
set i=0
loop
exitwhen i==udg_PS_TrailNum
set i=i+1
if udg_PS_TrailNum==1then
set an=GetRandomReal(0,360)
else
set an=360/udg_PS_TrailNum*i
endif
set U=CreateUnit(p,udg_PS_TrailUnit,xy[0],xy[1],an)
call SaveInteger(udg_PSG_Hash,GetHandleId(U),StringHash("Custom"),udg_PS_Custom)
set U=null
endloop
endif
endif
/////////////////////////
//Save the values we change
/////////////////////////
call SaveReal(udg_PSG_Hash,id,StringHash("Angle"),udg_PS_Angle)
call SaveInteger(udg_PSG_Hash,id,StringHash("Life"),udg_PS_Life)
/////////////////////////
//If out of life or on Death Terrain->die
/////////////////////////
if GetTerrainType(xy[0],xy[1])==udg_PSG_Terrain or udg_PS_Life<=0 or IsTerrainPathable(xy[0],xy[1],PATHING_TYPE_WALKABILITY) or IsTerrainPathable(xy[0],xy[1],ConvertPathingType(udg_PS_Filter))then
set Boom=true
call KillUnit(udg_PS_CurProjectile)
call GroupRemoveUnit(udg_PSG_Projectiles,udg_PS_CurProjectile)
call FlushChildHashtable(udg_PSG_Hash,id)
endif
/////////////////////////
//If collide with unit or die->boom
/////////////////////////
if Boom then
set g=CreateGroup()
call GroupEnumUnitsInRange(g,xy[0],xy[1],udg_PS_ColColSize,filter)
call ForGroup(g,function Trig_PS_Target2)
call DestroyGroup(g)
set g=null
call DestroyEffect(AddSpecialEffect(udg_PS_ColSFX,xy[0],xy[1]))
//call UnitDamagePoint(udg_PS_CurProjectile,0,udg_PS_ColColSize,xy[0],xy[1],udg_PS_DmgAoE,true,false,ConvertAttackType(udg_PS_TypeAttack),ConvertDamageType(udg_PS_TypeDamage),null)
if udg_PS_ColUnit!=0and udg_PS_ColNum>0then
set i=0
loop
exitwhen i==udg_PS_ColNum
set i=i+1
if udg_PS_ColNum==1then
set an=GetRandomReal(0,360)
else
set an=360/udg_PS_ColNum*i
endif
set U=CreateUnit(p,udg_PS_ColUnit,xy[0],xy[1],an)
call SaveInteger(udg_PSG_Hash,GetHandleId(U),StringHash("Custom"),udg_PS_Custom)
set U=null
endloop
endif
endif
//clear locals
call DestroyBoolExpr(filter)
set filter=null
set p=null
set u=null
//reset globals
call PS_Reset()
set udg_PSG_Count=udg_PSG_Count+1
endfunction
function Trig_PS_Actions takes nothing returns nothing
set udg_PSG_Count=0
call ForGroup(udg_PSG_Projectiles,function Trig_PS_Loop)
if udg_PSG_Count<1then
call DisableTrigger(gg_trg_PS)
endif
endfunction
function InitTrig_PS takes nothing returns nothing
set gg_trg_PS=CreateTrigger()
call DisableTrigger(gg_trg_PS)
call TriggerRegisterTimerEvent(gg_trg_PS,0.04,true)
call TriggerAddAction(gg_trg_PS,function Trig_PS_Actions)
endfunction
function Trig_Portal_System_Loop takes nothing returns nothing
//Load values spacific to each portal
local unit u=GetEnumUnit()
local integer id=GetHandleId(u)
local real x=LoadReal(udg_GPOR_Hash,id,StringHash("X"))
local real y=LoadReal(udg_GPOR_Hash,id,StringHash("Y"))
local integer tick=LoadInteger(udg_GPOR_Hash,id,StringHash("Tick"))
local lightning light=LoadLightningHandle(udg_GPOR_Hash,id,StringHash("Light"))
local unit U=LoadUnitHandle(udg_GPOR_Hash,id,StringHash("Preview"))
set udg_GPOR_Count=udg_GPOR_Count+1
call MoveLightningEx(light,true,x,y,350,GetWidgetX(u),GetWidgetY(u),25)
set tick=tick-1
call SetUnitPosition(U,x,y)
call SetUnitFacingTimed(U,GetUnitFacing(U)+30,.25)
if tick==0then
set tick=LoadInteger(udg_GPOR_Hash,id,StringHash("Rate"))
call CreateUnit(GetOwningPlayer(u),LoadInteger(udg_GPOR_Hash,id,StringHash("Spawn")),x,y,0)
call DestroyEffect(AddSpecialEffect(LoadStr(udg_GPOR_Hash,id,StringHash("Teleport")),x,y))
endif
//save changed values
call SaveInteger(udg_GPOR_Hash,id,StringHash("Tick"),tick)
//if it needs to be removed, remove it +effects
if GetWidgetLife(u)<=0then
call DestroyEffect(LoadEffectHandle(udg_GPOR_Hash,id,StringHash("SFX")))
call DestroyEffect(LoadEffectHandle(udg_GPOR_Hash,id,StringHash("BeamSFX")))
call RemoveUnit(U)
call DestroyLightning(light)
call GroupRemoveUnit(udg_GPOR_Portals,u)
call FlushChildHashtable(udg_GPOR_Hash,id)
endif
set light=null
set id=0
set U=null
set u=null
endfunction
function Trig_Portal_System_Actions takes nothing returns nothing
set udg_GPOR_Count=0
call ForGroup(udg_GPOR_Portals,function Trig_Portal_System_Loop)
if udg_GPOR_Count<1then
call DisableTrigger(gg_trg_Portal_System)
endif
endfunction
function InitTrig_Portal_System takes nothing returns nothing
set gg_trg_Portal_System=CreateTrigger()
call DisableTrigger(gg_trg_Portal_System)
call TriggerRegisterTimerEvent(gg_trg_Portal_System,.25,true)
call TriggerAddAction(gg_trg_Portal_System,function Trig_Portal_System_Actions)
endfunction