local hookEvent = true -- Hook into Learn Event Triggers and Throw them? Only read at init
-- when you don't use hookEvent then you need to fill TasHeroLearnEx.Action with actionFunctions(unit, abiCode, abilityLevel, owner, unitCode)
-- TasHeroLearnEx.Action[FourCC('AHbz')] = function(unit, abiCode, abilityLevel, owner, unitCode) end
-- TasHeroLearnEx.Action[0] allways runs (hookEvent = false)
local AutoRun = true --(true) will create Itself at 0s, (false) you need to TasHeroLearnEx.Init()
local action
if CreateFourCCTable then action = CreateFourCCTable() else action = {} end
-- the none hookEvent approach runs for any skill learned by TasHeroLearnEx
action[0] = function(unit, abiCode, abilityLevel, owner, unitCode)
print("Action 0", GetUnitName(unit), GetAbilityName(abiCode))
end
TasHeroLearnEx = {
-- Where is the TOCFile in your map?
TocPath = "war3mapImported\\TasHeroLearnEx.toc"
,HookEvent = hookEvent
,Action = action
-- Data for each UnitCode
,HeroData = {
-- supported Keys unit, unitCode, Player, 0; unit > unitCode > Player > 0
-- [0] is used by everyone, if not one of the others is used currently.
-- [bj_lastCreatedUnit] = "AHfs,AHbn,AHdr,AHpx,AHhb,AHds,AHre,AHad"
-- [FourCC('Hblm')] = "AHfs,AHbn,AHdr,AHpx,AHhb,AHds,AHre,AHad"
-- [Player(0)] = "AHfs,AHbn,AHdr,AHpx,AHhb,AHds,AHre,AHad"
-- [0] = "AEmb,AEim,AEev,AEme,AEer,AEfn,AEah,AEtq"
-- you can set a field from outside of this system, But if you do you should use TasHeroLearnEx.UpdateHeroData() after setting your wanted data.
-- TasHeroLearnEx.HeroData[FourCC('Hblm')] = "AHfs,AHbn,AHdr,AHpx,AHhb,AHds,AHre,AHad"
[FourCC('Hblm')] = "AHfs,AHbn,AHdr,AHpx,AHhb,AHds,AHre,AHad,AHbz,AHab,AHwe,AHmt,AHtc,AHtb,AHbh,AHav,AOwk,AOcr,AOmi,AOww,AOfs,AOsf,AOcl,AOeq"
,[Player(1)] = "AUim,AUts,AUcb,AUls,AUfn,AUfu,AUdr,AUdd,AUav,AUsl,AUcs,AUin,AUdc,AUdp,AUau,AUan"
}
,HeroAbilityLevelSkip = 2 -- should match the map gameplay constant
,Filter = function(unit) -- used for HeroData[0]
if IsUnitIllusion(unit) then return false end
-- if not IsUnitType(unit, UNIT_TYPE_HERO) then return false end
--return true if this unit is allowed to use HeroData[0] HeroData[player]
return true
end
,Cols = 8 --amout of buttons in one Row
,Rows = 1 -- amount of Rows
,ShowEnemy = true -- can look into enemy builts false/true?
,HideMaxLevelSlot = false -- true shows empty slots for max Leveld skills.
,UserControl = false -- Show the Buttons to toggle ShowEnemy & HideMaxLevelSlot
,HideWithoutUser = true -- hide TasHeroLearnEx UI when currently nothing would be displayed.
,UseUIScale = true
--ToolTip
,ToolTipSizeX = 0.2
,ToolTipPosX = 0.79
,ToolTipPosY = 0.165
,ToolTipPos = FRAMEPOINT_BOTTOMRIGHT
--Happens once at creation, decides how TasHeroLearnEx is posed
,PosBox = function(frame)
--BlzFrameSetAbsPoint(frame, FRAMEPOINT_BOTTOMLEFT, 0.195, 0.135)
BlzFrameSetPoint(frame, FRAMEPOINT_BOTTOMLEFT, BlzGetFrameByName("SimpleInfoPanelUnitDetail", 0), FRAMEPOINT_TOPLEFT, -0.1, 0.02)
end
-- ShowButton
,OpenButtonTexture = "ReplaceableTextures\\CommandButtons\\BTNSkillz.blp"
--Happens once at creation, decides where Open Button is posed
,PosOpen = function(frame)
--BlzFrameSetAbsPoint(frame, FRAMEPOINT_TOPRIGHT, 0.6, 0.15)
--BlzFrameSetPoint(frame, FRAMEPOINT_BOTTOMRIGHT, BlzGetFrameByName("SimpleInfoPanelUnitDetail", 0), FRAMEPOINT_TOPRIGHT, 0.1, 0.015)
BlzFrameSetPoint(frame, FRAMEPOINT_BOTTOMRIGHT, BlzGetFrameByName("SimpleInfoPanelUnitDetail", 0), FRAMEPOINT_TOPLEFT, 0.0, -0.01)
end
-- ParentFunc who you want as parent, this runs at InitBlizzard, if you need more control you need to modify the part that calls local function Init()
,ParentFunc = function() return BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0) end
-- how many LearnPoints an unit has to spent
,GetLearnPoints = function(unit)
return GetHeroSkillPoints(unit)
--return GetPlayerState(GetOwningPlayer(unit), PLAYER_STATE_RESOURCE_GOLD)//100
end
-- pay costs function is called inside TasHeroLearnEx.CustomUnitLearnAbility
,Costs = function(unit, abiCode)
-- can't pay return false
if TasHeroLearnEx.GetLearnPoints(unit) <= 0 then return false end
--SetPlayerState(GetOwningPlayer(unit), PLAYER_STATE_RESOURCE_GOLD, GetPlayerState(GetOwningPlayer(unit), PLAYER_STATE_RESOURCE_GOLD) - 100)
UnitModifySkillPoints(unit, -1)
return true
end
-- System stuff below
...
}