MeleeGrantHeroItems
- comment
- note
It is called directly by the default "Melee Initialization" trigger.
- patch
1.00
- Source
- Blizzard.j (raise an issue to discuss on Github or submit a PR)
- return type
nothing- Source code
function MeleeGrantHeroItems takes nothing returns nothing local integer index local trigger trig // Initialize the twinked hero counts. set index = 0 loop set bj_meleeTwinkedHeroes[index] = 0 set index = index + 1 exitwhen index == bj_MAX_PLAYER_SLOTS endloop // Register for an event whenever a hero is trained, so that we can give // him/her their starting items. set index = 0 loop set trig = CreateTrigger() call TriggerRegisterPlayerUnitEvent(trig, Player(index), EVENT_PLAYER_UNIT_TRAIN_FINISH, filterMeleeTrainedUnitIsHeroBJ) call TriggerAddAction(trig, function MeleeGrantItemsToTrainedHero) set index = index + 1 exitwhen index == bj_MAX_PLAYERS endloop // Register for an event whenever a neutral hero is hired, so that we // can give him/her their starting items. set trig = CreateTrigger() call TriggerRegisterPlayerUnitEvent(trig, Player(PLAYER_NEUTRAL_PASSIVE), EVENT_PLAYER_UNIT_SELL, filterMeleeTrainedUnitIsHeroBJ) call TriggerAddAction(trig, function MeleeGrantItemsToHiredHero) // Flag that we are giving starting items to heroes, so that the melee // starting units code can create them as necessary. set bj_meleeGrantHeroItems = true endfunction