• 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.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Get your art tools and paintbrushes ready and enter Hive's 34th Texturing Contest: Void! Click here to enter!

What is it in JASS

Status
Not open for further replies.
This thread is about functions in GUI and their equivalent in JASS, although, I cant say its equivalent because there are natives and BJs functions.

What is the native equivalents of the following in JASS:

1)
  • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
    • Loop - Actions
2)
  • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Do nothing)
3)units in region matching condition AND units in region owned by player

If I remeber anything else I'll post it and thanks for any help in advance.
 
Level 14
Joined
Nov 23, 2008
Messages
187
All group picking functions starts with GroupEnum***. There are few of them:

JASS:
    call GroupEnumUnitsInRange(pick_group, x, y, radius, FilterFunc)
    call GroupEnumUnitsInRect(pick_group, your_rect, FilterFunc)
    call GroupEnumUnitsOfPlayer(pick_group, Player(num), FilterFunc)

1. >>

JASS:
globals
  group gr = CreateGroup()
endglobals

// . . .
function Actions takes nothing returns nothing
  // some actions with GetEnumUnit()
endfunction

// . . .
call GroupEnumUnitsInRect(gr, bj_mapInitialPlayableArea, null)
call ForGroup(gr, function Actions)

2. >>

JASS:
globals
  group gr = CreateGroup()
endglobals

// . . .
call GroupEnumUnitsInRect(gr, bj_mapInitialPlayableArea, null)
// . . .

3. >>

JASS:
globals
  group gr = CreateGroup()
endglobals

// . . .
// picking all units of player 0 (equal to Player 1 Red in GUI)...
// ...and with custom value equal to 0 (this is custom condition)
function FilterFunc takes nothing returns boolean
  return GetOwningPlayer(GetFilterUnit()) == Player(0) and GetUnitUserData(GetFilterUnit()) == 0
endfunction

// . . .
local rect my_rect = Rect(-192, -192, 192, 192)
// . . .
call GroupEnumUnitsInRect(gr, my_rect, Filter(function FilterFunc))
// . . .
call RemoveRect(my_rect)
set my_rect = null

>> EDIT <<

Oh, by the way, use TESH or JassCraft to display code of BJ functions. Unwrapping BJs is the way to natives.
 
Level 7
Joined
Oct 14, 2008
Messages
340
a boolexpr is a function that returns a boolean, for example:

JASS:
function someFunction takes nothing returns boolean
    return true
endfunction

And how you use it:
JASS:
call GroupEnumUnitsOfTypeCounted(yourGroup, "string", Condition(function someFunction), 5)
 
Level 11
Joined
Apr 6, 2008
Messages
760
BJ functions are usally functions who calls native functions

eg.

JASS:
function UnitAddAbilityBJ takes integer abilityId, unit whichUnit returns boolean
    return UnitAddAbility(whichUnit, abilityId)
endfunction

which just calls

JASS:
native UnitAddAbility takes unit whichUnit, integer abilityId returns boolean
 
Status
Not open for further replies.
Top