Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
7fe061a
Update MakeOptVER.bat
jzy-chitong56 Apr 25, 2025
c1f1b44
Update BuildSequence.ai
jzy-chitong56 Apr 25, 2025
5b72f23
Update BuildSequence.ai
jzy-chitong56 Apr 25, 2025
7f35b1b
Update BuildSequence.ai
jzy-chitong56 Apr 25, 2025
08f241b
Update BuildSequence.ai
jzy-chitong56 Apr 25, 2025
0573850
Update BuildSequence.ai
jzy-chitong56 Apr 25, 2025
1b9c484
Update BuildSequence.ai
jzy-chitong56 Apr 25, 2025
f6faa2e
Update BuildSequence.ai
jzy-chitong56 Apr 25, 2025
92a37da
Update BuildSequence.ai
jzy-chitong56 Apr 25, 2025
ed6e941
Update Blizzard.eai
jzy-chitong56 Apr 25, 2025
871d702
Update Blizzard3.eai
jzy-chitong56 Apr 25, 2025
bddd5d3
Update Blizzard3VAI.eai
jzy-chitong56 Apr 25, 2025
f4ba2fe
更新 BuildSequence.ai
jzy-chitong56 Apr 27, 2025
a6f36ce
更新 BuildSequence.ai
jzy-chitong56 Apr 27, 2025
80a9fd8
Update StandardUnits.txt
jzy-chitong56 Apr 30, 2025
534eb9a
Update StandardUnits.txt
jzy-chitong56 Apr 30, 2025
b6b05dc
Update BuildSequence.ai
jzy-chitong56 May 3, 2025
0ce8b08
Update BuildSequence.ai
jzy-chitong56 May 9, 2025
238ae43
Update Blizzard.eai
jzy-chitong56 May 12, 2025
8b7469d
Update Blizzard.eai
jzy-chitong56 May 12, 2025
447d54f
Update BuildSequence.ai
jzy-chitong56 Jun 14, 2025
badf68c
Update BuildSequence.ai
jzy-chitong56 Jun 14, 2025
77a5dcb
Update BuildSequence.ai
jzy-chitong56 Jun 14, 2025
116d1bf
Update BuildSequence.ai
jzy-chitong56 Jun 14, 2025
c28b11b
Update BuildSequence.ai
jzy-chitong56 Jun 14, 2025
9459970
Update BuildSequence.ai
jzy-chitong56 Jun 14, 2025
726dfe2
Update BuildSequence.ai
jzy-chitong56 Jun 14, 2025
a86b20c
Update BuildSequence.ai
jzy-chitong56 Jun 14, 2025
f7ea375
Update BuildSequence.ai
jzy-chitong56 Jun 15, 2025
0325c55
Update BuildSequence.ai
jzy-chitong56 Jun 15, 2025
763e7a2
Update BuildSequence.ai
jzy-chitong56 Jun 15, 2025
1f7a3a3
Update BuildSequence.ai
jzy-chitong56 Jun 15, 2025
c6cc2ed
Update BuildSequence.ai
jzy-chitong56 Jun 15, 2025
3e370f4
Update BuildSequence.ai
jzy-chitong56 Jun 15, 2025
bd6a332
Update BuildSequence.ai
jzy-chitong56 Jun 19, 2025
e5d1a45
Update BuildSequence.ai
jzy-chitong56 Jun 19, 2025
e053aa7
Update BuildSequence.ai
jzy-chitong56 Jun 19, 2025
380d1e9
Update BuildSequence.ai
jzy-chitong56 Jun 19, 2025
b7874f2
Update BuildSequence.ai
jzy-chitong56 Jun 19, 2025
cb5f70b
Update BuildSequence.ai
jzy-chitong56 Jun 19, 2025
b505ebc
Update BuildSequence.ai
jzy-chitong56 Jun 19, 2025
38ffa7b
Update BuildSequence.ai
jzy-chitong56 Jun 19, 2025
ab68e54
no need
jzy-chitong56 Jun 19, 2025
6aa50a8
Update BuildSequence.ai
jzy-chitong56 Jun 20, 2025
ce75ab0
Update BuildSequence.ai
jzy-chitong56 Jun 20, 2025
c835fe0
Update BuildSequence.ai
jzy-chitong56 Jun 20, 2025
05b37f2
Update BuildSequence.ai
jzy-chitong56 Jun 20, 2025
f5c8248
Update BuildSequence.ai
jzy-chitong56 Jun 20, 2025
20e3bc2
Update BuildSequence.ai
jzy-chitong56 Jun 20, 2025
ac553e4
Update BuildSequence.ai
jzy-chitong56 Jun 20, 2025
71c4a7f
Update BuildSequence.ai
jzy-chitong56 Jun 20, 2025
74d3b25
Update Blizzard.eai
jzy-chitong56 Jul 1, 2025
56886c8
2.0.3
jzy-chitong56 Jul 19, 2025
ae3d672
Update common_original.eai
jzy-chitong56 Jul 19, 2025
0f08377
fix
jzy-chitong56 Aug 3, 2025
c111cdc
更新 README.md
jzy-chitong56 Aug 11, 2025
d0f1e3d
Update common_original.eai
jzy-chitong56 Sep 11, 2025
8790ce1
Update Blizzard.eai
jzy-chitong56 Oct 8, 2025
254b86b
Update Blizzard.eai
jzy-chitong56 Oct 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
220 changes: 220 additions & 0 deletions Blizzard.eai
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,16 @@
button %1_button = null
#ENDINCLUDE

trigger Random_Hero = null
triggeraction Random_Hero_Action = null
integer array RandomHeroNum
integer array RandomHero_Max
sound array RandomHeroSound
boolean RandomHero = true // if do not want random hero, set this to false
boolean RandomHeroRun = false // do not change this
trigger Random_HireUnit = null
triggeraction Random_HireUnit_Action = null

string chat_no_ally = ""
string you_no_gold = ""
string i_no_gold = ""
Expand Down Expand Up @@ -561,6 +571,215 @@ function ShowBoard takes nothing returns nothing
call LeaderboardDisplay(color_board, not IsLeaderboardDisplayed(color_board))
endfunction

//===========================================================================
// Random Hero and Hire Unit
//===========================================================================
function RandomHireUnit takes nothing returns nothing
local unit s = GetSellingUnit()
local unit u = GetSoldUnit()
local player p = GetOwningPlayer(u)
local integer i = GetUnitTypeId(s)
if GetPlayerController(p) == MAP_CONTROL_USER then
if i == 'nmr5' then
elseif i == 'nmr4' then
elseif i == 'nmrf' then
elseif i == 'nmr8' then
elseif i == 'nmr9' then
elseif i == 'nmrb' then
elseif i == 'nmr6' then
elseif i == 'nmrd' then
elseif i == 'nmr2' then
elseif i == 'nmer' then
elseif i == 'nmr3' then
elseif i == 'nmr7' then
elseif i == 'nmre' then
elseif i == 'nmrc' then
elseif i == 'nmra' then
elseif i == 'nmr0' then
elseif i == 'ndrk' then
elseif i == 'ndru' then
elseif i == 'ndrz' then
elseif i == 'ndrg' then
elseif i == 'ndro' then
elseif i == 'ndrr' then
else
set s = null
set u = null
set p = null
return
endif
set i = ChooseRandomCreep(GetRandomInt(1, 20))
if i > 0 then
if i < GetUnitLevel(u) then
call AdjustPlayerStateBJ(i * 25, p, PLAYER_STATE_RESOURCE_GOLD)
call AdjustPlayerStateBJ(i * 5, p, PLAYER_STATE_RESOURCE_LUMBER)
endif
call ReplaceUnitBJ(u, ChooseRandomCreep(i), bj_UNIT_STATE_METHOD_DEFAULTS)
endif
endif
set s = null
set u = null
set p = null
endfunction

function SetStartHero_d takes player p, race r, location l returns nothing
local unit u = null
if GetPlayerController(p) == MAP_CONTROL_COMPUTER then
if r == RACE_NIGHTELF then
set u = CreateUnit(p, RandomHeroNum[GetRandomInt(8, 11)], GetLocationX(l), GetLocationY(l) - GetRandomInt(350, 450), bj_UNIT_FACING)
elseif r == RACE_ORC then
set u = CreateUnit(p, RandomHeroNum[GetRandomInt(12, 15)], GetLocationX(l), GetLocationY(l) - GetRandomInt(350, 450), bj_UNIT_FACING)
elseif r == RACE_UNDEAD then
set u = CreateUnit(p, RandomHeroNum[GetRandomInt(16, 19)], GetLocationX(l), GetLocationY(l) - GetRandomInt(350, 450), bj_UNIT_FACING)
elseif r == RACE_HUMAN then
set u = CreateUnit(p, RandomHeroNum[GetRandomInt(20, 23)], GetLocationX(l), GetLocationY(l) - GetRandomInt(350, 450), bj_UNIT_FACING)
endif
else
set u = CreateUnit(p, RandomHeroNum[GetRandomInt(0, 23)], GetLocationX(l), GetLocationY(l) - GetRandomInt(350, 450), bj_UNIT_FACING)
endif
call UnitAddItemById(u, 'stwp')
set bj_meleeTwinkedHeroes[GetPlayerId(p)] = bj_meleeTwinkedHeroes[GetPlayerId(p)] + 1
call RemoveLocation(l)
set u = null
endfunction

function SetOtherHero takes nothing returns nothing
local unit u = GetTrainedUnit()
local unit t = GetSoldUnit()
local unit x = null
local location l = null
local player p = null
local integer c = GetRandomInt(0, 23)
local integer i = 0
if u == null then
set u = t
endif
set p = GetOwningPlayer(u)
set i = GetPlayerId(p)
if GetPlayerController(p) == MAP_CONTROL_COMPUTER or RandomHero_Max[i] > 2 then
set u = null
set t = null
set p = null
return
endif
call ShowUnit(u, false)
call SetUnitOwner(u, Player(PLAYER_NEUTRAL_PASSIVE), false)
set x = u
set u = CreateUnit(p, RandomHeroNum[c], GetUnitX(x), GetUnitY(x), bj_UNIT_FACING)
call KillUnit(x) // Prevent the unit from continuing to exist
call RemoveUnit(x)
if GetLocalPlayer() == p then
call PlaySoundOnUnitBJ(RandomHeroSound[c], 100, u)
endif
set c = GetBJMaxPlayers()
set RandomHero_Max[i] = RandomHero_Max[i] + 1
set RandomHero_Max[c] = RandomHero_Max[c] - 1
if t == null then
set l = GetUnitRallyPoint(GetTriggerUnit())
if l != null then
call IssuePointOrderLocBJ(u, "move", l)
call RemoveLocation(l)
set l = null
endif
endif
set u = null
set t = null
set x = null
set p = null
if RandomHero_Max[i] == 2 then
call SetPlayerTechMaxAllowed(p, 'HERO', 4)
endif
if RandomHero_Max[c] < 1 then
call TriggerRemoveAction(Random_Hero, Random_Hero_Action)
call DestroyTrigger(Random_Hero)
set Random_Hero = null
endif
endfunction

function InitRandomHeroAndHireUnit takes nothing returns nothing
local integer i = 0
local integer c = GetBJMaxPlayers()
local player p = null
if IsMapFlagSet(MAP_RANDOM_HERO) then
if RandomHero and Random_Hero == null then
set Random_HireUnit = CreateTrigger()
set Random_Hero = CreateTrigger()
set RandomHeroRun = true
call SetMapFlag(MAP_RANDOM_HERO, false)
set RandomHeroNum[0] = 'Nngs'
set RandomHeroNum[1] = 'Nbst'
set RandomHeroNum[2] = 'Nbrn'
set RandomHeroNum[3] = 'Nplh'
set RandomHeroNum[4] = 'Npbm'
set RandomHeroNum[5] = 'Ntin'
set RandomHeroNum[6] = 'Nfir'
set RandomHeroNum[7] = 'Nalc'
set RandomHeroNum[8] = 'Edem'
set RandomHeroNum[9] = 'Ekee'
set RandomHeroNum[10] = 'Emoo'
set RandomHeroNum[11] = 'Ewar'
set RandomHeroNum[12] = 'Obla'
set RandomHeroNum[13] = 'Ofar'
set RandomHeroNum[14] = 'Otch'
set RandomHeroNum[15] = 'Oshd'
set RandomHeroNum[16] = 'Udea'
set RandomHeroNum[17] = 'Udre'
set RandomHeroNum[18] = 'Ulic'
set RandomHeroNum[19] = 'Ucrl'
set RandomHeroNum[20] = 'Hamg'
set RandomHeroNum[21] = 'Hpal'
set RandomHeroNum[22] = 'Hmkg'
set RandomHeroNum[23] = 'Hblm'
set RandomHeroSound[0] = CreateSound("Units\\Naga\\LadyVashj\\LadyVashjReady1.wav", false, true, true, 10, 10, "HeroAcksEAX")
set RandomHeroSound[1] = CreateSound("Units\\Creeps\\Beastmaster\\OgreBeastMasterReady1.wav", false, true, true, 10, 10, "HeroAcksEAX")
set RandomHeroSound[2] = CreateSound("Units\\Creeps\\BansheeRanger\\DarkRangerReady1.wav", false, true, true, 10, 10, "HeroAcksEAX")
set RandomHeroSound[3] = CreateSound("Units\\Demon\\HeroPitLord\\HPitLordReady1.wav", false, true, true, 10, 10, "HeroAcksEAX")
set RandomHeroSound[4] = CreateSound("Units\\Creeps\\PandarenBrewmaster\\PandarenBrewmasterReady1.wav", false, true, true, 10, 10, "HeroAcksEAX")
set RandomHeroSound[5] = CreateSound("Units\\Creeps\\HeroTinker\\HeroTinkerReady1.wav", false, true, true, 10, 10, "HeroAcksEAX")
set RandomHeroSound[6] = CreateSound("Units\\Creeps\\HeroFlameLord\\HeroFireLordReady1.wav", false, true, true, 10, 10, "HeroAcksEAX")
set RandomHeroSound[7] = CreateSound("Units\\Creeps\\HEROGoblinALCHEMIST\\HeroAlchemistReady1.wav", false, true, true, 10, 10, "HeroAcksEAX")
set RandomHeroSound[8] = CreateSound("Units\\NightElf\\HeroDemonHunter\\HeroDemonHunterReady1.wav", false, true, true, 10, 10, "HeroAcksEAX")
set RandomHeroSound[9] = CreateSound("Units\\NightElf\\HeroKeeperOfTheGrove\\KeeperOfTheGroveReady1.wav", false, true, true, 10, 10, "HeroAcksEAX")
set RandomHeroSound[10] = CreateSound("Units\\NightElf\\HeroMoonPriestess\\HeroMoonPriestessReady1.wav", false, true, true, 10, 10, "HeroAcksEAX")
set RandomHeroSound[11] = CreateSound("Units\\NightElf\\HeroWarden\\HeroWardenReady1.wav", false, true, true, 10, 10, "HeroAcksEAX")
set RandomHeroSound[12] = CreateSound("Units\\Orc\\HeroBladeMaster\\HeroBladeMasterReady1.wav", false, true, true, 10, 10, "HeroAcksEAX")
set RandomHeroSound[13] = CreateSound("Units\\Orc\\HeroFarseer\\HeroFarseerReady1.wav", false, true, true, 10, 10, "HeroAcksEAX")
set RandomHeroSound[14] = CreateSound("Units\\Orc\\HeroTaurenChieftain\\HeroTaurenChieftainReady1.wav", false, true, true, 10, 10, "HeroAcksEAX")
set RandomHeroSound[15] = CreateSound("Units\\Orc\\HeroShadowHunter\\ShadowHunterReady1.wav", false, true, true, 10, 10, "HeroAcksEAX")
set RandomHeroSound[16] = CreateSound("Units\\Undead\\HeroDeathKnight\\DeathKnightReady1.wav", false, true, true, 10, 10, "HeroAcksEAX")
set RandomHeroSound[17] = CreateSound("Units\\Undead\\HeroDreadLord\\HeroDreadlordReady1.wav", false, true, true, 10, 10, "HeroAcksEAX")
set RandomHeroSound[18] = CreateSound("Units\\Undead\\HeroLich\\HeroLichReady1.wav", false, true, true, 10, 10, "HeroAcksEAX")
set RandomHeroSound[19] = CreateSound("Units\\Undead\\HeroCryptLord\\NerubianCryptLordReady1.wav", false, true, true, 10, 10, "HeroAcksEAX")
set RandomHeroSound[20] = CreateSound("Units\\Human\\HeroArchMage\\HeroArchMageReady1.wav", false, true, true, 10, 10, "HeroAcksEAX")
set RandomHeroSound[21] = CreateSound("Units\\Human\\HeroPaladin\\HeroPaladinReady1.wav", false, true, true, 10, 10, "HeroAcksEAX")
set RandomHeroSound[22] = CreateSound("Units\\Human\\HeroMountainKing\\HeroMountainKingReady1.wav", false, true, true, 10, 10, "HeroAcksEAX")
set RandomHeroSound[23] = CreateSound("Units\\Human\\HeroBloodElf\\BloodElfMageReady1.wav", false, true, true, 10, 10, "HeroAcksEAX")
set RandomHero_Max[c] = 0
loop
exitwhen i >= c
set p = Player(i)
if GetPlayerSlotState(p) == PLAYER_SLOT_STATE_PLAYING then
if GetPlayerController(p) != MAP_CONTROL_COMPUTER then
set RandomHero_Max[i] = 1
set RandomHero_Max[c] = RandomHero_Max[c] + 2
call DisplayTimedTextToPlayer(p, 0, 0, 7, "AMAI Real Player Random Hero and Random Hire Unit: |cff00ff00[on]|r")
call TriggerRegisterPlayerUnitEvent(Random_Hero, p, EVENT_PLAYER_UNIT_TRAIN_FINISH, filterMeleeTrainedUnitIsHeroBJ)
endif
call SetStartHero_d(p, GetPlayerRace(p), GetStartLocationLoc(GetPlayerStartLocation(p))) // include AI
endif
set i = i + 1
endloop
call TriggerRegisterPlayerUnitEvent(Random_Hero, Player(PLAYER_NEUTRAL_PASSIVE), EVENT_PLAYER_UNIT_SELL, filterMeleeTrainedUnitIsHeroBJ)
call TriggerRegisterPlayerUnitEventSimple(Random_HireUnit, Player(PLAYER_NEUTRAL_PASSIVE), EVENT_PLAYER_UNIT_SELL)
set Random_Hero_Action = TriggerAddAction(Random_Hero, function SetOtherHero)
set Random_HireUnit_Action = TriggerAddAction(Random_HireUnit, function RandomHireUnit)
set p = null
endif
elseif RandomHero then
call DisplayToAll("Enable Random Hero on room options can use |cff00ff00ATR|r !")
endif
endfunction

//===========================================================================
// Zoom
//===========================================================================
Expand Down Expand Up @@ -2014,4 +2233,5 @@ endfunction
call InitHCL()
call InitCommander()
call InitZoom()
call InitRandomHeroAndHireUnit()
#INCLUDE <$VER$\tmp\Blizzard6.j>
11 changes: 7 additions & 4 deletions Blizzard3.eai
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@ endfunction

//===========================================================================
function MeleeStartingAI takes nothing returns nothing
local integer index
local integer index = 0
local player indexPlayer
local race indexRace

set index = 0
if RandomHeroRun then
call SetMapFlag(MAP_RANDOM_HERO, true)
endif
loop
set indexPlayer = Player(index)
if (GetPlayerSlotState(indexPlayer) == PLAYER_SLOT_STATE_PLAYING) then
Expand Down Expand Up @@ -71,6 +72,8 @@ function MeleeStartingAI takes nothing returns nothing
endif

set index = index + 1
exitwhen index == GetBJMaxPlayers()
exitwhen index >= GetBJMaxPlayers()
endloop
set indexPlayer = null
set indexRace = null
endfunction
9 changes: 5 additions & 4 deletions Blizzard3VAI.eai
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,12 @@ endfunction

//===========================================================================
function MeleeStartingAI takes nothing returns nothing
local integer index
local integer index = 0
local player indexPlayer
local race indexRace

set index = 0
if RandomHeroRun then
call SetMapFlag(MAP_RANDOM_HERO, true)
endif
loop
set indexPlayer = Player(index)
if (GetPlayerSlotState(indexPlayer) == PLAYER_SLOT_STATE_PLAYING) then
Expand Down Expand Up @@ -76,7 +77,7 @@ function MeleeStartingAI takes nothing returns nothing
endif

set index = index + 1
exitwhen index == GetBJMaxPlayers()
exitwhen index >= GetBJMaxPlayers()
endloop
set indexPlayer = null
set indexRace = null
Expand Down
11 changes: 10 additions & 1 deletion MakeOptVER.bat
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ COPY Scripts\%VER%\vsai\Blizzard.j Scripts\OPT%VER%\vsai\Blizzard.j

ECHO _____________________________
ECHO Disable Debug

perl -i -pe"s#(call TraceN)#//$1#g" Scripts/OPT%VER%/common.ai
perl -i -pe"s#(call TraceN)#//$1#g" Scripts/OPT%VER%/Blizzard.j
perl -i -pe"s#(call TraceN)#//$1#g" Scripts/OPT%VER%/elf.ai
perl -i -pe"s#(call TraceN)#//$1#g" Scripts/OPT%VER%/human.ai
perl -i -pe"s#(call TraceN)#//$1#g" Scripts/OPT%VER%/orc.ai
perl -i -pe"s#(call TraceN)#//$1#g" Scripts/OPT%VER%/undead.ai
perl -i -pe"s#(call TraceN)#//$1#g" Scripts/OPT%VER%/vsai/Blizzard.j

perl -i -pe"s#(debug call Trace)#//$1#g" Scripts/OPT%VER%/common.ai
perl -i -pe"s#(debug call Trace)#//$1#g" Scripts/OPT%VER%/Blizzard.j
perl -i -pe"s#(debug call Trace)#//$1#g" Scripts/OPT%VER%/elf.ai
Expand Down Expand Up @@ -142,4 +151,4 @@ if "%RESULTOPTVER%"=="1" (
)
) else (
ECHO Optimization %VER% successful
)
)
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Improvements and fixes to the core AI engine will improve the older scripts as w

| AMAI Scripts | Optimal Version | Supported Version |
| ----------------- | ------------------- | ------------------|
| **REFORGED** | **2.0.2** | 1.33+ |
| **REFORGED** | **2.0.3** | 2.03+ |
| **TFT** | **1.24-1.28** | 1.24+ |
| **ROC** | **1.24-1.28** | 1.24 - 1.31 |

Expand Down
9 changes: 8 additions & 1 deletion REFORGED/Elf/BuildSequence.ai
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
function global_init_strategy takes nothing returns nothing
call SetTierBlock(1, 0.75, 60, true)
call SetTierBlock(2, 0.75, 90, true)
if not IsMapFlagSet(MAP_RANDOM_HERO) then
if IsMapFlagSet(MAP_RANDOM_HERO) then
call AddBlock(1, TREE_AGES, false, 0, ELF_ALTAR, 36)
call AddBlock(1, ANCIENT_WAR, true, 0, DEN_OF_WONDERS, 36)
call AddBlock(1, ANCIENT_WAR, false, 0, MOON_WELL, 16)
else
call AddBlock(1, ELF_ALTAR, false, 0, ANCIENT_WAR, 16)
call AddBlock(1, ELF_ALTAR, true, 0, DEN_OF_WONDERS, 36)
call AddBlock(1, ELF_ALTAR, false, 0, MOON_WELL, 16)
Expand Down Expand Up @@ -67,6 +71,9 @@ function global_init_strategy takes nothing returns nothing

endfunction
function global_build_sequence takes nothing returns nothing
if IsMapFlagSet(MAP_RANDOM_HERO) then
call BuildUnit(1, ELF_ALTAR, 56)
endif
if GetGold() > 800 then
call BuildFront(2, ANCIENT_PROTECT, 35)
endif
Expand Down
Loading