• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

[JASS] How to pick all Heroesfor a player?

Status
Not open for further replies.

ytod

Y

ytod

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!
 
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.
Back
Top