• 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.

[JASS] How to pick all Heroesfor a player?

Status
Not open for further replies.
Level 1
Joined
Oct 29, 2004
Messages
1
A friend of mine had asked me to write some JASS codes for him. My problem is how to pick all heroes for a player?
His code requires to add the mana of computer player's heroes every 60 seconds elapsed in game time. Can anyone help me? Thanks!
 
Level 2
Joined
Apr 13, 2004
Messages
29
IsUnitType(u, UNIT_TYPE_HERO) returns true if u is a hero.

function IsUnitHeroFilter takes nothing returns boolean
return IsUnitType(GetFilterUnit(), UNIT_TYPE_HERO)
endfunction

function GetHeroGroup takes player p returns group
local filterfunc f = Filter(function IsUnitHeroFilter)
local group g = CreateGroup()
call GroupEnumUnitsOfPlayer(g, p, f)
call DestroyFilter(f)
return g
endfunction
 
Status
Not open for further replies.
Top