Antares
Spell Reviewer
- Joined
- Dec 13, 2009
- Messages
- 982
Hi,
currently, in the hero selection part of my map, I have a copy of each hero as a neutral building. These buildings have dummy abilities that are just used to show the actual abilities of the respective hero, so they inherit the ability tooltip, name, and icon of the hero ability. This required about ~150 such abilities which all have to be loaded at the start of the game. Therefore, the loading time is increased drastically; by about 5-8 seconds.
I was thinking about adding the abilities to the selecter building only when a player selects it, but that would cause a ~0.5 second lag each time a new building is selected. That would probably be just as annoying as the increased loading time.
So I had instead the idea that all buildings have the same ~5 dummy abilities and whenever a player selects a new building, the tooltips, names, and icons of all those abilities are changed locally to the respective hero.
Would this work or could it cause desyncs? Does anyone have suggestions for improvement? I want to make sure I'm getting this right because it will be quite some work to implement.
Cheers
currently, in the hero selection part of my map, I have a copy of each hero as a neutral building. These buildings have dummy abilities that are just used to show the actual abilities of the respective hero, so they inherit the ability tooltip, name, and icon of the hero ability. This required about ~150 such abilities which all have to be loaded at the start of the game. Therefore, the loading time is increased drastically; by about 5-8 seconds.
I was thinking about adding the abilities to the selecter building only when a player selects it, but that would cause a ~0.5 second lag each time a new building is selected. That would probably be just as annoying as the increased loading time.
So I had instead the idea that all buildings have the same ~5 dummy abilities and whenever a player selects a new building, the tooltips, names, and icons of all those abilities are changed locally to the respective hero.
JASS:
function ChangeSelecterAbilities_Conditions takes nothing returns boolean
//Point value is what I use to list the different buildings. So building 1 has point value 1, building 2 has point value 2 etc.
return GetUnitPointValue(GetTriggerUnit()) > 0
endfunction
function ChangeSelecterAbilities takes nothing returns nothing
local integer H = GetUnitPointValue(GetTriggerUnit())
local integer A = 1
if GetLocalPlayer() == GetTriggerPlayer() then
loop
exitwhen A > 7
if heroAbility[A] != 0 then
call BlzSetAbilityTooltip( selecterAbility[A], GetAbilityName(heroAbility[H][A]), 1 )
call BlzSetAbilityExtendedTooltip( selecterAbility[A], BlzGetAbilityResearchExtendedTooltip(heroAbility[H][A], 1), 1 )
call BlzSetAbilityIcon( selecterAbility[A], BlzGetAbilityIcon(heroAbility[H][A]) )
endif
set A = A + 1
endloop
endif
endfunction
//===========================================================================
function InitTrig_ChangeSelecterAbilities takes nothing returns nothing
local integer N = 0
set gg_trg_ChangeSelecterAbilities = CreateTrigger( )
loop
exitwhen N > 9
call TriggerRegisterPlayerSelectionEventBJ( gg_trg_ChangeSelecterAbilities, Player(N), true )
set N = N + 1
endloop
call TriggerAddAction( gg_trg_ChangeSelecterAbilities, function ChangeSelecterAbilities )
call TriggerAddCondition( gg_trg_ChangeSelecterAbilities, function ChangeSelecterAbilities_Conditions )
endfunction
Would this work or could it cause desyncs? Does anyone have suggestions for improvement? I want to make sure I'm getting this right because it will be quite some work to implement.
Cheers