Name | Type | is_array | initial_value |
BackFlacLoc | real | Yes | |
BackLoc | real | No | |
BuildingUnitType | unitcode | No | |
Button1 | button | No | |
Button2 | button | No | |
Button3 | button | No | |
Button4 | button | No | |
Centre | real | Yes | |
ChooseRaceTimer | timer | No | |
Command | unit | Yes | |
DialogBix | dialog | No | |
EnemiesNearby | boolean | No | |
FirstPlayer | player | No | |
Found | boolean | No | |
FrontFlacLoc | real | Yes | |
FrontLoc | real | Yes | |
LargeUnitBaseTime | real | Yes | |
LargeUnitTimer | timer | Yes | |
LargeUnitUpTime | real | Yes | |
LevelingSheet | hashtable | No | |
NoOneAlive | boolean | No | |
PlayerFaceDir | real | Yes | |
PlayerNumber | integer | No | |
PlayerRace | integer | Yes | |
Rand | integer | No | |
SaveKillCount | integer | No | |
SignofCos | real | No | |
SignofSin | real | No | |
SlotTaken | boolean | No | |
SomeoneNotReady | boolean | No | |
SpawnBuildingType | integer | No | |
SpawningPlayer | player | No | |
SpawnUnitType | integer | No | |
TempAbility | abilcode | Yes | |
TempPGroup | force | Yes | |
TempPlayer | player | Yes | |
TempPoint | location | Yes | |
TempUGroup | group | Yes | |
TempUnit | unit | Yes | |
TownHallBaseTime | real | Yes | |
TownHallTimer | timer | Yes | |
TownHallUnitProduce | integer | Yes | |
TownHallUpTime | real | Yes | |
UnitBaseTime | real | Yes | |
UnitCount | integer | No | |
UnitLimit | integer | No | |
UnitTimer | timer | Yes | |
UnitUpTime | real | Yes |
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Leveling_Sheet_SetUp_Actions takes nothing returns nothing
set udg_LevelingSheet = InitHashtableBJ( )
//Footmen
call SaveIntegerBJ( 'hfoo', 0, 0, udg_LevelingSheet )
call SaveIntegerBJ( 'h000', 0, 1, udg_LevelingSheet )
call SaveIntegerBJ( 'h001', 0, 2, udg_LevelingSheet )
call SaveIntegerBJ( 'h002', 0, 3, udg_LevelingSheet )
call SaveIntegerBJ( 'h003', 0, 4, udg_LevelingSheet )
call SaveIntegerBJ( 'h004', 0, 5, udg_LevelingSheet )
//Archers
call SaveIntegerBJ( 'hrif', 1, 0, udg_LevelingSheet )
call SaveIntegerBJ( 'h00M', 1, 1, udg_LevelingSheet )
call SaveIntegerBJ( 'h00L', 1, 2, udg_LevelingSheet )
call SaveIntegerBJ( 'h00N', 1, 3, udg_LevelingSheet )
//Monks
call SaveIntegerBJ( 'hmpr', 2, 0, udg_LevelingSheet )
call SaveIntegerBJ( 'h00H', 2, 1, udg_LevelingSheet )
call SaveIntegerBJ( 'h00I', 2, 2, udg_LevelingSheet )
call SaveIntegerBJ( 'h00J', 2, 3, udg_LevelingSheet )
//Knights
call SaveIntegerBJ( 'hkni', 3, 0, udg_LevelingSheet )
call SaveIntegerBJ( 'h007', 3, 1, udg_LevelingSheet )
call SaveIntegerBJ( 'h006', 3, 2, udg_LevelingSheet )
//Sentries
call SaveIntegerBJ( 'ewat', 4, 0, udg_LevelingSheet )
call SaveIntegerBJ( 'n001', 4, 1, udg_LevelingSheet )
call SaveIntegerBJ( 'n002', 4, 2, udg_LevelingSheet )
call SaveIntegerBJ( 'n003', 4, 3, udg_LevelingSheet )
call SaveIntegerBJ( 'n004', 4, 4, udg_LevelingSheet )
//Archers (Night Elf)
call SaveIntegerBJ( 'earc', 5, 0, udg_LevelingSheet )
call SaveIntegerBJ( 'e003', 5, 1, udg_LevelingSheet )
call SaveIntegerBJ( 'e004', 5, 2, udg_LevelingSheet )
call SaveIntegerBJ( 'e005', 5, 3, udg_LevelingSheet )
call SaveIntegerBJ( 'e006', 5, 4, udg_LevelingSheet )
//Druidess
call SaveIntegerBJ( 'edry', 6, 0, udg_LevelingSheet )
call SaveIntegerBJ( 'e000', 6, 1, udg_LevelingSheet )
call SaveIntegerBJ( 'e001', 6, 2, udg_LevelingSheet )
call SaveIntegerBJ( 'e002', 6, 3, udg_LevelingSheet )
//Huntress
call SaveIntegerBJ( 'esen', 7, 0, udg_LevelingSheet )
call SaveIntegerBJ( 'e007', 7, 1, udg_LevelingSheet )
call SaveIntegerBJ( 'e008', 7, 2, udg_LevelingSheet )
endfunction
//===========================================================================
function InitTrig_Leveling_Sheet_SetUp takes nothing returns nothing
set gg_trg_Leveling_Sheet_SetUp = CreateTrigger( )
call TriggerRegisterTimerEventSingle( gg_trg_Leveling_Sheet_SetUp, 0.00 )
call TriggerAddAction( gg_trg_Leveling_Sheet_SetUp, function Trig_Leveling_Sheet_SetUp_Actions )
endfunction
//TESH.scrollpos=66
//TESH.alwaysfold=0
function GetUnitRaceNo takes unit whichUnit returns integer
if GetUnitRace(whichUnit) == RACE_HUMAN then
return 0
elseif GetUnitRace(whichUnit) == RACE_NIGHTELF then
return 1
else
return 2
endif
endfunction
function GetUnitSpecialization takes unit whichUnit returns integer
//Specialization = 0 means melee
//Specialization = 1 means ranged
//Specialization = 2 means magic
//Specialization = 3 means large melee
return GetUnitPointValue(whichUnit)-(10*R2I(GetUnitPointValue(whichUnit)/10))
endfunction
function GetUnitRank takes unit whichUnit returns integer
return R2I(GetUnitPointValue(whichUnit)/10)
endfunction
function UpgradeUnit takes unit subject, integer UpgradeType, integer KillCount returns nothing
local location Loc
set Loc = GetUnitLoc(subject)
call AddSpecialEffectLocBJ( Loc, "Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl" )
call DestroyEffectBJ( GetLastCreatedEffectBJ() )
call ReplaceUnitBJ( subject, UpgradeType, bj_UNIT_STATE_METHOD_RELATIVE )
call SetUnitUserData( GetLastReplacedUnitBJ(), KillCount )
call SetUnitLifeBJ( GetLastReplacedUnitBJ(), ( GetUnitStateSwap(UNIT_STATE_LIFE, GetLastReplacedUnitBJ()) + 100.00 ) )
call RemoveLocation(Loc)
set Loc = null
endfunction
function Trig_Leveling_Up_Actions takes nothing returns nothing
local unit subject
local integer subjectsKillCount
local integer Specialization
local integer Race
local integer Rank
local integer UpgradeType
set subject = GetKillingUnit()
set subjectsKillCount = GetUnitUserData(subject)
set Specialization = GetUnitSpecialization(subject)
set Race = GetUnitRaceNo(subject)
set Rank = GetUnitRank(subject)
if Race == 0 then
if Specialization == 0 then
if Rank == 0 and subjectsKillCount == 5 then
set UpgradeType = LoadIntegerBJ( Race*4 + Specialization, Rank+1 ,udg_LevelingSheet)
call UpgradeUnit(subject, UpgradeType, subjectsKillCount)
elseif Rank == 1 and subjectsKillCount == 15 then
set UpgradeType = LoadIntegerBJ( Race*4 + Specialization, Rank+1 ,udg_LevelingSheet)
call UpgradeUnit(subject, UpgradeType, subjectsKillCount)
elseif Rank == 2 and subjectsKillCount == 25 then
set UpgradeType = LoadIntegerBJ( Race*4 + Specialization, Rank+1 ,udg_LevelingSheet)
call UpgradeUnit(subject, UpgradeType, subjectsKillCount)
elseif Rank == 3 and subjectsKillCount == 40 then
set UpgradeType = LoadIntegerBJ( Race*4 + Specialization, Rank+1 ,udg_LevelingSheet)
call UpgradeUnit(subject, UpgradeType, subjectsKillCount)
elseif Rank == 4 and subjectsKillCount == 60 then
set UpgradeType = LoadIntegerBJ( Race*4 + Specialization, Rank+1 ,udg_LevelingSheet)
call UpgradeUnit(subject, UpgradeType, subjectsKillCount)
endif
elseif Specialization == 1 then
if Rank == 0 and subjectsKillCount == 8 then
set UpgradeType = LoadIntegerBJ( Race*4 + Specialization, Rank+1 ,udg_LevelingSheet)
call UpgradeUnit(subject, UpgradeType, subjectsKillCount)
elseif Rank == 1 and subjectsKillCount == 20 then
set UpgradeType = LoadIntegerBJ( Race*4 + Specialization, Rank+1 ,udg_LevelingSheet)
call UpgradeUnit(subject, UpgradeType, subjectsKillCount)
elseif Rank == 2 and subjectsKillCount == 40 then
set UpgradeType = LoadIntegerBJ( Race*4 + Specialization, Rank+1 ,udg_LevelingSheet)
call UpgradeUnit(subject, UpgradeType, subjectsKillCount)
endif
elseif Specialization == 2 then
if Rank == 0 and subjectsKillCount == 7 then
set UpgradeType = LoadIntegerBJ( Race*4 + Specialization, Rank+1 ,udg_LevelingSheet)
call UpgradeUnit(subject, UpgradeType, subjectsKillCount)
elseif Rank == 1 and subjectsKillCount == 19 then
set UpgradeType = LoadIntegerBJ( Race*4 + Specialization, Rank+1 ,udg_LevelingSheet)
call UpgradeUnit(subject, UpgradeType, subjectsKillCount)
elseif Rank == 2 and subjectsKillCount == 40 then
set UpgradeType = LoadIntegerBJ( Race*4 + Specialization, Rank+1 ,udg_LevelingSheet)
call UpgradeUnit(subject, UpgradeType, subjectsKillCount)
endif
elseif Specialization == 3 then
if Rank == 0 and subjectsKillCount == 20 then
set UpgradeType = LoadIntegerBJ( Race*4 + Specialization, Rank+1 ,udg_LevelingSheet)
call UpgradeUnit(subject, UpgradeType, subjectsKillCount)
elseif Rank == 1 and subjectsKillCount == 50 then
set UpgradeType = LoadIntegerBJ( Race*4 + Specialization, Rank+1 ,udg_LevelingSheet)
call UpgradeUnit(subject, UpgradeType, subjectsKillCount)
endif
endif
elseif Race == 1 then
if Specialization == 0 then
if Rank == 0 and subjectsKillCount == 6 then
set UpgradeType = LoadIntegerBJ( Race*4 + Specialization, Rank+1 ,udg_LevelingSheet)
call UpgradeUnit(subject, UpgradeType, subjectsKillCount)
elseif Rank == 1 and subjectsKillCount == 16 then
set UpgradeType = LoadIntegerBJ( Race*4 + Specialization, Rank+1 ,udg_LevelingSheet)
call UpgradeUnit(subject, UpgradeType, subjectsKillCount)
elseif Rank == 2 and subjectsKillCount == 31 then
set UpgradeType = LoadIntegerBJ( Race*4 + Specialization, Rank+1 ,udg_LevelingSheet)
call UpgradeUnit(subject, UpgradeType, subjectsKillCount)
elseif Rank == 3 and subjectsKillCount == 51 then
set UpgradeType = LoadIntegerBJ( Race*4 + Specialization, Rank+1 ,udg_LevelingSheet)
call UpgradeUnit(subject, UpgradeType, subjectsKillCount)
endif
elseif Specialization == 1 then
if Rank == 0 and subjectsKillCount == 5 then
set UpgradeType = LoadIntegerBJ( Race*4 + Specialization, Rank+1 ,udg_LevelingSheet)
call UpgradeUnit(subject, UpgradeType, subjectsKillCount)
elseif Rank == 1 and subjectsKillCount == 15 then
set UpgradeType = LoadIntegerBJ( Race*4 + Specialization, Rank+1 ,udg_LevelingSheet)
call UpgradeUnit(subject, UpgradeType, subjectsKillCount)
elseif Rank == 2 and subjectsKillCount == 30 then
set UpgradeType = LoadIntegerBJ( Race*4 + Specialization, Rank+1 ,udg_LevelingSheet)
call UpgradeUnit(subject, UpgradeType, subjectsKillCount)
elseif Rank == 3 and subjectsKillCount == 55 then
set UpgradeType = LoadIntegerBJ( Race*4 + Specialization, Rank+1 ,udg_LevelingSheet)
call UpgradeUnit(subject, UpgradeType, subjectsKillCount)
endif
elseif Specialization == 2 then
if Rank == 0 and subjectsKillCount == 8 then
set UpgradeType = LoadIntegerBJ( Race*4 + Specialization, Rank+1 ,udg_LevelingSheet)
call UpgradeUnit(subject, UpgradeType, subjectsKillCount)
elseif Rank == 1 and subjectsKillCount == 20 then
set UpgradeType = LoadIntegerBJ( Race*4 + Specialization, Rank+1 ,udg_LevelingSheet)
call UpgradeUnit(subject, UpgradeType, subjectsKillCount)
elseif Rank == 2 and subjectsKillCount == 40 then
set UpgradeType = LoadIntegerBJ( Race*4 + Specialization, Rank+1 ,udg_LevelingSheet)
call UpgradeUnit(subject, UpgradeType, subjectsKillCount)
endif
elseif Specialization == 3 then
if Rank == 0 and subjectsKillCount == 18 then
set UpgradeType = LoadIntegerBJ( Race*4 + Specialization, Rank+1 ,udg_LevelingSheet)
call UpgradeUnit(subject, UpgradeType, subjectsKillCount)
elseif Rank == 1 and subjectsKillCount == 40 then
set UpgradeType = LoadIntegerBJ( Race*4 + Specialization, Rank+1 ,udg_LevelingSheet)
call UpgradeUnit(subject, UpgradeType, subjectsKillCount)
endif
endif
endif
set subject = null
endfunction
//===========================================================================
function InitTrig_Leveling_Up takes nothing returns nothing
set gg_trg_Leveling_Up = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Leveling_Up, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddAction( gg_trg_Leveling_Up, function Trig_Leveling_Up_Actions )
endfunction
//TESH.scrollpos=93
//TESH.alwaysfold=0
function SpawnBuildingFilter takes nothing returns boolean
return (IsUnitAliveBJ(GetFilterUnit()) == true) and (GetUnitTypeId(GetFilterUnit()) == udg_SpawnBuildingType)
endfunction
function SpawnBuildingLoopActions takes nothing returns nothing
local unit SpawnUnit
local location SpawnPoint
local location SpawnAttackMove
if udg_UnitCount < udg_UnitLimit then
set SpawnPoint = GetUnitLoc(GetEnumUnit())
set SpawnAttackMove = GetUnitRallyPoint(GetEnumUnit())
set SpawnUnit = CreateUnitAtLoc( udg_SpawningPlayer, udg_SpawnUnitType, SpawnPoint, bj_UNIT_FACING )
call IssuePointOrderLocBJ( SpawnUnit, "attack", SpawnAttackMove )
set udg_UnitCount = ( udg_UnitCount + 1 )
call ConditionalTriggerExecute( gg_trg_Spam_AI )
endif
call RemoveLocation(SpawnPoint)
call RemoveLocation(SpawnAttackMove)
set SpawnUnit = null
set SpawnPoint = null
set SpawnAttackMove = null
endfunction
function SpawnUnitSpam takes group SpawnBuildings, integer whichUnitType returns nothing
set udg_SpawnUnitType = whichUnitType
set udg_UnitCount = GetPlayerState(udg_SpawningPlayer, PLAYER_STATE_RESOURCE_FOOD_USED)
call ForGroupBJ( SpawnBuildings, function SpawnBuildingLoopActions )
endfunction
function TownHallSpawning takes player whichPlayer returns nothing
local group SpawnBuildings
local integer PlayerNo
set udg_SpawningPlayer = whichPlayer
set PlayerNo = GetConvertedPlayerId(udg_SpawningPlayer)
if udg_PlayerRace[PlayerNo] == 1 then
set udg_SpawnBuildingType = 'htow'
set SpawnBuildings = GetUnitsOfPlayerMatching( udg_SpawningPlayer, Condition(function SpawnBuildingFilter) )
if CountUnitsInGroup(SpawnBuildings) != 0 then
if udg_TownHallUnitProduce[PlayerNo] == 0 then
call SpawnUnitSpam(SpawnBuildings, 'hfoo')
elseif udg_TownHallUnitProduce[PlayerNo] == 1 then
call SpawnUnitSpam(SpawnBuildings, 'hrif')
elseif udg_TownHallUnitProduce[PlayerNo] == 2 then
call SpawnUnitSpam(SpawnBuildings, 'hmpr')
endif
call StartTimerBJ( udg_TownHallTimer[PlayerNo], false, ( ( udg_TownHallBaseTime[PlayerNo] / 2.00 ) + ( udg_TownHallUpTime[PlayerNo] * I2R(udg_UnitCount) ) ) )
endif
elseif udg_PlayerRace[PlayerNo] == 2 then
set udg_SpawnBuildingType = 'etol'
set SpawnBuildings = GetUnitsOfPlayerMatching( udg_SpawningPlayer, Condition(function SpawnBuildingFilter) )
if CountUnitsInGroup(SpawnBuildings) != 0 then
if udg_TownHallUnitProduce[PlayerNo] == 0 then
call SpawnUnitSpam(SpawnBuildings, 'nwat')
elseif udg_TownHallUnitProduce[PlayerNo] == 1 then
call SpawnUnitSpam(SpawnBuildings, 'earc')
elseif udg_TownHallUnitProduce[PlayerNo] == 2 then
call SpawnUnitSpam(SpawnBuildings, 'edry')
endif
call StartTimerBJ( udg_TownHallTimer[PlayerNo], false, ( ( udg_TownHallBaseTime[PlayerNo] / 2.00 ) + ( udg_TownHallUpTime[PlayerNo] * I2R(udg_UnitCount) ) ) )
endif
endif
call DestroyGroup(SpawnBuildings)
set SpawnBuildings = null
endfunction
function UnitSpawning takes player whichPlayer returns nothing
local group array SpawnBuildings
local integer PlayerNo
set udg_SpawningPlayer = whichPlayer
set PlayerNo = GetConvertedPlayerId(udg_SpawningPlayer)
if udg_PlayerRace[PlayerNo] == 1 then
set udg_SpawnBuildingType = 'hbar'
set SpawnBuildings[1] = GetUnitsOfPlayerMatching( udg_SpawningPlayer, Condition(function SpawnBuildingFilter) )
set udg_SpawnBuildingType = 'h00O'
set SpawnBuildings[2] = GetUnitsOfPlayerMatching( udg_SpawningPlayer, Condition(function SpawnBuildingFilter) )
set udg_SpawnBuildingType = 'h00K'
set SpawnBuildings[3] = GetUnitsOfPlayerMatching( udg_SpawningPlayer, Condition(function SpawnBuildingFilter) )
if CountUnitsInGroup(SpawnBuildings[1]) != 0 or CountUnitsInGroup(SpawnBuildings[2]) != 0 or CountUnitsInGroup(SpawnBuildings[3]) != 0 then
call SpawnUnitSpam(SpawnBuildings[1], 'hfoo')
call SpawnUnitSpam(SpawnBuildings[2], 'hrif')
call SpawnUnitSpam(SpawnBuildings[3], 'hmpr')
call StartTimerBJ( udg_UnitTimer[PlayerNo], false, ( ( udg_UnitBaseTime[PlayerNo] / 2.00 ) + ( udg_UnitUpTime[PlayerNo] * I2R(udg_UnitCount) ) ) )
endif
elseif udg_PlayerRace[PlayerNo] == 2 then
set udg_SpawnBuildingType = 'eaom'
set SpawnBuildings[1] = GetUnitsOfPlayerMatching( udg_SpawningPlayer, Condition(function SpawnBuildingFilter) )
set udg_SpawnBuildingType = 'eaow'
set SpawnBuildings[2] = GetUnitsOfPlayerMatching( udg_SpawningPlayer, Condition(function SpawnBuildingFilter) )
set udg_SpawnBuildingType = 'eaoe'
set SpawnBuildings[3] = GetUnitsOfPlayerMatching( udg_SpawningPlayer, Condition(function SpawnBuildingFilter) )
if CountUnitsInGroup(SpawnBuildings[1]) != 0 or CountUnitsInGroup(SpawnBuildings[2]) != 0 or CountUnitsInGroup(SpawnBuildings[3]) != 0 then
call SpawnUnitSpam(SpawnBuildings[1], 'nwat')
call SpawnUnitSpam(SpawnBuildings[2], 'earc')
call SpawnUnitSpam(SpawnBuildings[3], 'edry')
call StartTimerBJ( udg_UnitTimer[PlayerNo], false, ( ( udg_UnitBaseTime[PlayerNo] / 2.00 ) + ( udg_UnitUpTime[PlayerNo] * I2R(udg_UnitCount) ) ) )
endif
endif
call DestroyGroup(SpawnBuildings[1])
call DestroyGroup(SpawnBuildings[2])
call DestroyGroup(SpawnBuildings[3])
set SpawnBuildings[1] = null
set SpawnBuildings[2] = null
set SpawnBuildings[3] = null
endfunction
function LargeUnitSpawning takes player whichPlayer returns nothing
local group SpawnBuildings
local integer PlayerNo
set udg_SpawningPlayer = whichPlayer
set PlayerNo = GetConvertedPlayerId(udg_SpawningPlayer)
if udg_PlayerRace[PlayerNo] == 1 then
set udg_SpawnBuildingType = 'h005'
set SpawnBuildings = GetUnitsOfPlayerMatching( udg_SpawningPlayer, Condition(function SpawnBuildingFilter) )
if CountUnitsInGroup(SpawnBuildings) != 0 then
call SpawnUnitSpam( SpawnBuildings, 'hkni')
call StartTimerBJ( udg_LargeUnitTimer[PlayerNo], false, ( ( udg_LargeUnitBaseTime[PlayerNo] / 2.00 ) + ( udg_LargeUnitUpTime[PlayerNo] * I2R(udg_UnitCount) ) ) )
endif
elseif udg_PlayerRace[PlayerNo] == 2 then
set udg_SpawnBuildingType = 'edos'
set SpawnBuildings = GetUnitsOfPlayerMatching( udg_SpawningPlayer, Condition(function SpawnBuildingFilter) )
if CountUnitsInGroup(SpawnBuildings) != 0 then
call SpawnUnitSpam( SpawnBuildings, 'esen')
call StartTimerBJ( udg_LargeUnitTimer[PlayerNo], false, ( ( udg_LargeUnitBaseTime[PlayerNo] / 2.00 ) + ( udg_LargeUnitUpTime[PlayerNo] * I2R(udg_UnitCount) ) ) )
endif
endif
call DestroyGroup(SpawnBuildings)
set SpawnBuildings = null
endfunction
//===================================
function InitTrig_Unit_Spawn_Function takes nothing returns nothing
endfunction