diff --git a/HeroSkin.txt b/HeroSkin.txt new file mode 100644 index 000000000..09d749b1d --- /dev/null +++ b/HeroSkin.txt @@ -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 \ No newline at end of file diff --git a/REFORGED/custom_common.eai b/REFORGED/custom_common.eai index 1f7f7aa5e..15476a345 100644 --- a/REFORGED/custom_common.eai +++ b/REFORGED/custom_common.eai @@ -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 diff --git a/ROC/custom_common.eai b/ROC/custom_common.eai index 8205e2009..5391be836 100644 --- a/ROC/custom_common.eai +++ b/ROC/custom_common.eai @@ -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 @@ -119,4 +123,4 @@ function BlzGroupGetSize takes group whichGroup returns integer set g = null return i endfunction -#ENDIF \ No newline at end of file +#ENDIF diff --git a/TFT/custom_common.eai b/TFT/custom_common.eai index 0df32ee77..232b4c6c2 100644 --- a/TFT/custom_common.eai +++ b/TFT/custom_common.eai @@ -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 diff --git a/common.eai b/common.eai index defe26e0b..f266bf540 100644 --- a/common.eai +++ b/common.eai @@ -11444,20 +11444,38 @@ 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]) +#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 #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 hero_ally_loc[hn] != null then - call RemoveLocation(hero_ally_loc[hn]) + 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 + set hero_loc[hn] = GetUnitLoc(hero_unit[hn]) + set hero_dir[hn] = Location(0,0) 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 HeroReviver takes nothing returns nothing