- Joined
- Feb 9, 2009
- Messages
- 1,800
(7 ratings)
TasStr
TasAgi
TasInt
TasLife
TasLifeReg
TasMana
TasManaReg
TasArmor
TasDamage
TasAttackSpeed
TasTurnSpeed
TasCastPoint
TasCastBackswing
local choice
-- create a choice
choice = TalentHeroCreateChoiceEx()
-- set TasStat - TasLife to 200
choice.TasLife = 200
choice.TasMana = 100
choice.TasArmor = 1
-- Set Title
choice.Head = "Sustain Healer"
-- set icon
choice.Icon = "ReplaceableTextures\\CommandButtons\\BTNForestTrollShadowPriest.blp"
-- autocalc Text
TalentTasStatsGetText()
choice = TalentHeroCreateChoiceEx()
choice.TasSpellField = {
-- change Ability Anh1
Anh1 = {
-- reduce manacosts of all levels by 2
ABILITY_ILF_MANA_COST = -2
-- reduce cooldown by 0.1 seconds
,ABILITY_RLF_COOLDOWN = -0.1
}
}
Ability Fields support Level specific changes, instead of a number use a table
choice.TasSpellField = {
-- holy Light
AHhb = {
-- reduce cooldown of Level 3 (object Editor Level 3)
ABILITY_RLF_COOLDOWN = {-0, -0, -5}
-- Instead of Listing the 0s you could write to an int index. Don't forget the [], if you plan to use this feature.
ABILITY_RLF_COOLDOWN = {[3] = -5}
}
integer array udg_TalentTasStatStr
integer array udg_TalentTasStatAgi
integer array udg_TalentTasStatInt
integer array udg_TalentTasStatLife
integer array udg_TalentTasStatMana
real array udg_TalentTasStatLifeReg
real array udg_TalentTasStatManaReg
real array udg_TalentTasStatArmor
integer array udg_TalentTasStatDamage
real array udg_TalentTasStatAttackSpeed
real array udg_TalentTasStatCastPoint
real array udg_TalentTasStatCastBackswing
Thanks for that Feedback. The glitch happens cause the Tooltip-Frame of that button was created even when the reset button is not created."constant function TalentBoxUseUnlearnButton takes nothing returns boolean
return false"
bit... But there's a weird UI glitch with the UI where it's still trying to show up.
Might be better without the border and background for the description.As a web developer I am rather annoyed by the fact that the body panel (the one beneath the title) kinda collides with the bottom border of the parent.
local fh = BlzCreateFrame("TalentBoxTextArea", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), 0, 0)
BlzFrameSetSize(fh, 0.22, 0.22)
BlzFrameSetAbsPoint(fh, FRAMEPOINT_TOPRIGHT, 0.8, 0.5)
BlzFrameSetText(fh, "Text goes here")
BlzFrameSetEnable(fh, true)
Done, also happens when selecting an choice and not beeing able to do further choices. This is a Setting which can be disabled. In Lua it is a variable hence one could change it, probably also for only one Player using GetLocalPlayer(). In jass it is a constant function.Once a unit or Hero has learned all of its' talents, the talent box should have the option to immediately close.
An trigger was added that runs on any unit death when the current observed target us the dying unit TalentBox Closes.When a unit "dies" (physically dead but has not yet fired the death event), the talent box should immediately close.
DoneWhen throwing events, try adding a line that sets Talent__Event to 0.00 before the desired value, in case recursions occur with the system.
Yes, Tiers and choices can be added and removed during the game, Removing breaks the unlearning and it is not recommented to add a tier between 2 already learned tiers.Can Talent add Tiers on a later time?
function BloodMageAdd()
local heroTypeId = FourCC('H005')
local choice = nil
TalentHeroCreateTier(heroTypeId, Talent[heroTypeId].MaxLevel + 1)
choice = TalentChoiceCreateStats(6, 3, 3)
choice.Head = "Magic Power: Str"
choice.Icon = "ReplaceableTextures\\CommandButtons\\BTNHelmOfValor.blp"
choice = TalentChoiceCreateStats(3, 6, 3)
choice.Head = "Magic Power: AGI"
choice.Icon = "ReplaceableTextures\\CommandButtons\\BTNHoodOfCunning.blp"
choice = TalentChoiceCreateStats(3, 3, 6)
choice.Head = "Magic Power: Int"
choice.Icon = "ReplaceableTextures\\CommandButtons\\BTNPipeOfInsight.blp"
ForForce(bj_FORCE_ALL_PLAYERS, function()
local player = GetEnumPlayer()
local target = TalentBox.Control[player].Target
-- Uses the current players Talent Target of that Talent?
if TalentGetUnitCode(GetUnitTypeId(target)) == heroTypeId then
-- show & update the box
TalentBoxShow(target, player)
-- tell Talent to recheck for new Tiers
TalentAddSelection(target)
end
end)
end
-- Create the chat command
TimerStart(CreateTimer(),0,false, function()
local trigger = CreateTrigger()
TriggerAddAction(trigger, BloodMageAdd)
TriggerRegisterPlayerChatEvent(trigger, Player(0), "add", true)
DestroyTimer(GetExpiredTimer())
end)
function Trig_Talent_BloodMageAdd_Actions takes nothing returns nothing
local integer choice
local integer heroTypeId = 'H005'
local integer playerIndex = 0
call TalentHeroSetFinalTier(heroTypeId, TalentHeroGetFinalTier(heroTypeId) + 1)
call TalentHeroTierCreate(heroTypeId, TalentHeroGetFinalTier(heroTypeId))
set choice = TalentChoiceCreateStats(6, 3, 3)
set udg_TalentChoiceHead[choice] = "Magic Power: Str"
set udg_TalentChoiceIcon[choice] = "ReplaceableTextures\\CommandButtons\\BTNHelmOfValor.blp"
set choice = TalentChoiceCreateStats(3, 6, 3)
set udg_TalentChoiceHead[choice] = "Magic Power: AGI"
set udg_TalentChoiceIcon[choice] = "ReplaceableTextures\\CommandButtons\\BTNHoodOfCunning.blp"
set choice = TalentChoiceCreateStats(3, 3, 6)
set udg_TalentChoiceHead[choice] = "Magic Power: Int"
set udg_TalentChoiceIcon[choice] = "ReplaceableTextures\\CommandButtons\\BTNPipeOfInsight.blp"
loop
if TalentGetUnitTypeId(udg_TalentControlTarget[playerIndex]) == heroTypeId then
call TalentBoxShow(udg_TalentControlTarget[playerIndex], Player(playerIndex))
call TalentAddSelection(udg_TalentControlTarget[playerIndex])
endif
set playerIndex = playerIndex + 1
exitwhen playerIndex == bj_MAX_PLAYERS
endloop
endfunction
//===========================================================================
function InitTrig_Talent_BloodMageAdd takes nothing returns nothing
set gg_trg_Talent_BloodMageAdd = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_Talent_BloodMageAdd, Player(0), "add", true )
call TriggerAddAction( gg_trg_Talent_BloodMageAdd, function Trig_Talent_BloodMageAdd_Actions )
endfunction
TalentBox.Control[player].Target
is the current Talent Target, one would have to stop the system from changing it and select it manualy.udg_TalentControlTarget[GetPlayerId(p)]
.function TalentShowUI takes nothing returns nothing
call TalentBoxShow(udg_TalentControlTarget[GetPlayerId(GetTriggerPlayer())], GetTriggerPlayer())
endfunction
udg_TalentControlTarget[0]
is expected to be Player red. [1] Player blue ...TalentBox.Trigger.Select = CreateTrigger()
TriggerRegisterAnyUnitEventBJ(TalentBox.Trigger.Select, EVENT_PLAYER_UNIT_SELECTED)
TriggerAddAction(TalentBox.Trigger.Select, function()
-- TalentBoxShow(GetTriggerUnit(), GetTriggerPlayer())
TalentBoxShow(TalentBox.Control[GetTriggerPlayer()].Target, GetTriggerPlayer())
end)
This was not planed as feature. Therefore you need to do custom UI stuff regarding Frames. One could place a BACKDROP over the Default Button, replace the TextButton with an proper IconButton or for Reforged Modder one also can change the Displayed Textures in each Button-State.Hey @Tasyen Wondering if there is a way to replace the "Show Talent" text with an icon? How would I do that with this system? (Using the LUA version btw)
LastSelected
with multiple players disable MUI?function Trig_Demo_LastSelect_Conditions takes nothing returns boolean
if ( not ( GetOwningPlayer(GetTriggerUnit()) == GetTriggerPlayer() ) ) then
return false
endif
return true
endfunction
function Trig_Demo_LastSelect_Actions takes nothing returns nothing
set udg_LastSelected = GetTriggerUnit()
endfunction
//===========================================================================
function InitTrig_Demo_LastSelect takes nothing returns nothing
set gg_trg_Demo_LastSelect = CreateTrigger( )
call TriggerRegisterPlayerSelectionEventBJ( gg_trg_Demo_LastSelect, Player(0), true )
call TriggerRegisterPlayerSelectionEventBJ( gg_trg_Demo_LastSelect, Player(1), true )
call TriggerAddCondition( gg_trg_Demo_LastSelect, Condition( function Trig_Demo_LastSelect_Conditions ) )
call TriggerAddAction( gg_trg_Demo_LastSelect, function Trig_Demo_LastSelect_Actions )
endfunction
Shared Control allows to pick/reset talents, like shared Heroes can pick Hero skills.So looking over the code/demo of this it seems any player can modify the talents of any unit, EVEN IF they do not own that unit
I haven't added an option to turn of the shared control Talent picking, One would have to change the UI's code inside Grid/Box.My question is how can I make this MUI such that users can only modify the talents of the units they own?
GetPlayerAlliance
and replace them with IsUnitOwnedByPlayer
. I could make an update if you really want that feature, it would than be an additional setup in the UI Scripts.Well was hoping to use this as an actual HotS style talent system for a Hero Arena map. Which would mean just one talent tree per player set for only one hero, which looks like it's not quite able to do right now without some modification. So if you don't add it in, I will certainly try myself but I think it would be nice to have as an added feature for this system.I haven't added an option to turn of the shared control Talent picking, One would have to change the UI's code inside Grid/Box.
One would have to search forGetPlayerAlliance
and replace them withIsUnitOwnedByPlayer
. I could make an update if you really want that feature, it would than be an additional setup in the UI Scripts.
function TalentGridUpdate takes player p returns nothing
local integer playerId = GetPlayerId(p)
local integer rows = RowsAmount
local integer cols = ColsAmount
local unit u = udg_TalentControlTarget[playerId]
local integer unitHandle = GetHandleId(u)
local integer unitCode = TalentGetUnitTypeId(u)
local integer offset = Offset[playerId]
local integer y = -1
local integer x
local integer tierCount = 0
local integer choice
local integer tier
local integer frameIndex
local integer colsMax = 0
local integer rowsMax = 0
local integer level = 0
local integer buttonUsed
if GetLocalPlayer() != p then
//set u = null <- should set u = null here but is not
return
endif
if not TalentHas(u) then
//set u = null <- should set u = null here but is not
return
endif