Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
25 changes: 25 additions & 0 deletions HeroSkin.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
SKINTOTAL HERO_ID(SKIN0) SKIN1 SKIN2 SKIN3 SKIN4 SKIN5 SKIN6 SKIN7
7 Hpal Huth Hlgr Hpb1 Hpb2 Hapm Hart Harf
4 Hamg Hgam Hant Haah Hjai nmed Hjas 0
1 Hmkg Hmbr 0 0 0 0 0 0
1 Hblm Hkal 0 0 0 0 0 0
4 Obla Osam Opgh Ogrh Nbbc 0 0 0
3 Ofar Odrt Oths Othr odkt Ogld Ofth 0
0 Otch 0 0 0 0 0 0 0
1 Oshd Orkn 0 0 0 0 0 0
1 Udea Harf Udef Uart 0 0 0 0
2 Ulic uktg Uktl uktn Uclc 0 0 0
6 Udre Ubal Utic Uvar Uvng Udth Umal 0
1 Ucrl Uanb 0 0 0 0 0 0
5 Ekee Ecen Ekgg Emfr Efur Emns Ekce 0
1 Emoo Etyr 0 0 0 0 0 0
1 Edem Eevi Edef 0 0 0 0 0
1 Ewar Ewrd 0 0 0 0 0 0
0 Nalc 0 0 0 0 0 0 0
1 Nngs Hvsh 0 0 0 0 0 0
0 Ntin 0 0 0 0 0 0 0
1 Nbst Orex 0 0 0 0 0 0
3 Nplh Nmag Npld Nman 0 0 0 0
0 Nfir 0 0 0 0 0 0 0
1 Npbm Nsjs 0 0 0 0 0 0
3 Nbrn Usyl uswb Hvwd 0 0 0 0
4 changes: 4 additions & 0 deletions REFORGED/custom_common.eai
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,8 @@ boolean AatpAbility = true
function VersionCheck takes nothing returns nothing

endfunction

function BlzSetUnitSkinAMAI takes unit u, integer i returns nothing
call BlzSetUnitSkin(u, i)
endfunction
#ENDIF
6 changes: 5 additions & 1 deletion ROC/custom_common.eai
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ function VersionCheck takes nothing returns nothing
endif
endfunction

function BlzSetUnitSkinAMAI takes unit u, integer i returns nothing

endfunction

function GetBJMaxPlayers takes nothing returns integer
return bj_MAX_PLAYERS_AMAI
endfunction
Expand Down Expand Up @@ -119,4 +123,4 @@ function BlzGroupGetSize takes group whichGroup returns integer
set g = null
return i
endfunction
#ENDIF
#ENDIF
4 changes: 4 additions & 0 deletions TFT/custom_common.eai
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ function VersionCheck takes nothing returns nothing
endif
endfunction

function BlzSetUnitSkinAMAI takes unit u, integer i returns nothing

endfunction

function GetBJMaxPlayers takes nothing returns integer
return bj_MAX_PLAYERS_AMAI
endfunction
Expand Down
85 changes: 60 additions & 25 deletions common.eai
Original file line number Diff line number Diff line change
Expand Up @@ -9280,6 +9280,57 @@ function GetExistingHero takes nothing returns integer
endfunction

//============================================================================
#DEFINE $SKINSTART$ 3
#DEFINE $SKINEND$ 9
function GetHeroSkin takes integer hn returns nothing
local integer i = 0
local integer array skin
if p_rare[profile] < 1 or GetRandomInt(0, 100) < 20 then // not fully use new skin , random int use original skin - 0 : change skin will change proper name (AI Scripts cannot use GetHeroProperName and BlzSetHeroProperName)
return
#INCLUDETABLE <HeroSkin.txt> #EFR
elseif old_id[hero[hn]] == '%2' then
#FOR $X$ FROM $SKINSTART$ TO $SKINEND$
set skin[#EVAL{$X$-2}] = '%$X$'
#ENDFOR
set i = GetRandomInt(1, %1)
#AFTERINCLUDE
#ENDINCLUDE
else
return // unknow hero
endif
if skin[i] != '0' then
call BlzSetUnitSkinAMAI(hero_unit[hn], skin[i]) // set skin API at 1.33+ and some unit at 1.32+ , old WE make map cannot use - so just in case check max player num
endif
endfunction
#UNDEF $SKINSTART$
#UNDEF $SKINEND$

function InitHeroInfo takes integer hn returns nothing
if hero_loc[hn] != null then
call RemoveLocation(hero_loc[hn])
endif
set hero_loc[hn] = GetUnitLoc(hero_unit[hn])
if hero_enemy_loc[hn] != null then
call RemoveLocation(hero_enemy_loc[hn])
endif
if hero_ally_loc[hn] != null then
call RemoveLocation(hero_ally_loc[hn])
endif
set hero_enemy_loc[hn] = Location(0,0)
set hero_ally_loc[hn] = Location(0,0)
set hero_hp[hn] = 1
call GetHeroSkin(hn)
endfunction

function SetHeroUnit takes integer hn returns nothing
set hero_unit[hn] = GetOneOfId(hero_unit[hn], ai_player, old_id[hero[hn]])
if hero_unit[hn] != null then
set hero_built[hn] = true
call InitHeroInfo(hn)
call TQAddJob(1, MICRO_HERO, hn)
endif
endfunction

function ChooseFirstHero takes nothing returns integer
local integer i = 0
if hero_built[1] and recalculate_heros then
Expand All @@ -9293,8 +9344,8 @@ function ChooseFirstHero takes nothing returns integer
endloop
endif
if IsMapFlagSet(MAP_RANDOM_HERO) and hero[1] == null then
// call DisplayToAll("Map flag set")
set hero[1] = GetExistingHero()
call SetHeroUnit(1)
else
call make_hero_rp_positive()
set chosen = ChooseHero()
Expand Down Expand Up @@ -11444,34 +11495,13 @@ endif
endfunction

//============================================================================
function InitHeroInfo takes integer hn returns nothing
if hero_loc[hn] != null then
call RemoveLocation(hero_loc[hn])
endif
set hero_loc[hn] = GetUnitLoc(hero_unit[hn])
if hero_enemy_loc[hn] != null then
call RemoveLocation(hero_enemy_loc[hn])
endif
if hero_ally_loc[hn] != null then
call RemoveLocation(hero_ally_loc[hn])
endif
set hero_enemy_loc[hn] = Location(0,0)
set hero_ally_loc[hn] = Location(0,0)
set hero_hp[hn] = 1
endfunction

function HeroReviver takes nothing returns nothing
local integer i = 1
loop
exitwhen i > 3
if GetUnitCountDone(old_id[hero[i]]) > 0 then
if not hero_built[i] then
set hero_unit[i] = GetOneOfId(hero_unit[i], ai_player, old_id[hero[i]])
if hero_unit[i] != null then
set hero_built[i] = true
call InitHeroInfo(i)
call TQAddJob(1, MICRO_HERO, i)
endif
call SetHeroUnit(i)
endif
elseif hero_built[i] then
call BuildUnit(1, hero[i], hero_revive_prio[i])
Expand Down Expand Up @@ -13414,8 +13444,13 @@ function SkillArraysAM takes nothing returns integer
if level > max_hero_level then
set max_hero_level = level
endif
if skillfix == true and hero_unit[hn] != null and UnitAlive(hero_unit[hn]) then //Assisted Hero Learning Skills , for war3 1.31 bug
call SelectHeroSkill(hero_unit[hn], skills[(hn - 1) * HERO_LEVEL_NUMBER + level])
if skillfix == true then
if hero_unit[hn] == null then
set hero_unit[hn] = GetOneOfId(hero_unit[hn], ai_player, hero_id)
endif
if hero_unit[hn] != null and UnitAlive(hero_unit[hn]) then //Assisted Hero Learning Skills , for war3 1.31 bug
call SelectHeroSkill(hero_unit[hn], skills[(hn - 1) * HERO_LEVEL_NUMBER + level])
endif
endif
return skills[(hn - 1) * HERO_LEVEL_NUMBER + level]
endfunction
Expand Down