• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Give 1000 experience to all heroes on the map?

Status
Not open for further replies.
Level 14
Joined
Apr 20, 2009
Messages
1,543
GUI version:

  • Simple
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area) matching (((Matching unit) is A Hero) Equal to True)) and do (Actions)
        • Loop - Actions
          • Hero - Add 1000 experience to (Picked unit), Hide level-up graphics
Jass version (faster and more optimized then the GUI version):

JASS:
function Trig_Simple_Actions takes nothing returns nothing
    local unit u
    call GroupEnumUnitsInRect(bj_lastCreatedGroup, bj_mapInitialPlayableArea, null)
    loop
        set u = FirstOfGroup(bj_lastCreatedGroup)
        exitwhen u == null
        if IsUnitType(u, UNIT_TYPE_HERO) == true then
            call AddHeroXP(u,1000,false)
        endif
        call GroupRemoveUnit(bj_lastCreatedGroup, u)
    endloop
endfunction

//===========================================================================
function InitTrig_Simple takes nothing returns nothing
    local trigger T = CreateTrigger(  )
    call TriggerRegisterTimerEvent( T, 0.00, false )
    call TriggerAddAction( T, function Trig_Simple_Actions )
    set T = null
endfunction

If you want to use the Jass version, simply copy this, create a new trigger, go to edit -> Convert to custom text, remove all the code in there and paste this.
Make sure your trigger is called Simple
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
selecting all heroes in particular is not an option.

gui version:

  • simple
    • events
      • time - elapsed game time is 0.00 seconds
    • conditions
    • actions
      • unit group - pick every unit in (units in (playable map area) matching (((matching unit) is a hero) equal to true)) and do (actions)
        • loop - actions
          • hero - add 1000 experience to (picked unit), hide level-up graphics

lol...
 
Status
Not open for further replies.
Top