HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

JASS: Pick every unit in group.

12-14-2009, 11:19 AM#1
SmileyJeff
How do i write the below code:
Trigger:
Actions
Collapse Unit Group - Pick every unit in immolate_victimGroup and do (Actions)
Collapse Loop - Actions
-------- a --------

in JASS within 1 Function. Because when i converted it to custom script, it will split to 2 functions

Here is what happen:
Collapse JASS:
function Trig_test_Func001A takes nothing returns nothing
    // a
endfunction

function Trig_test_Actions takes nothing returns nothing
    call ForGroupBJ( udg_immolate_victimGroup, function Trig_test_Func001A )
endfunction

I want to write the call ForGroupBJ( udg_immolate_victimGroup, function Trig_test_Func001A ) in function [/b]Trig_test_Func001A[b] instead of a separate one. How can i do that?

Help would be much appreciated
12-14-2009, 11:41 AM#2
Anachron
Doesn't work, since the function call ForGroup(BJ) only picks every unit and executes a function with it.
12-14-2009, 12:06 PM#3
Hans_Maulwurf
Ofc you can do it.
Collapse JASS:
function Trig_test_Actions takes nothing returns nothing
        local unit u
        local group g = CreateGroup()
        call GroupAddGroup(udg_immolate_victimGroup, g)
        loop
            set u = FirstOfGroup(g)
            exitwhen u == null
            // a
            call GroupRemoveUnit(g, u)
        endloop
        call DestroyGroup(g)
endfunction

However using ForGroup and a second function would be better, especially if theres a chance that there could be a null unit in your group

edit: made it use a copy of the group
12-14-2009, 12:22 PM#4
SmileyJeff
Thanks for the quick reply. Is there any good tutorial on how to make periodic spells in JASS? for example i want to make Immolate which burns unit over time. Can't find them in tutorials. And i have no idea how to make 2 events in JASS in a single trigger for a unit starts the effect for an ability and periodic timer
12-14-2009, 12:52 PM#5
Tot
for periodic things, always use timer-utils (floating around here)
12-14-2009, 02:08 PM#6
Rising_Dusk
Quote:
Originally Posted by Hans_Maulwurf
However using ForGroup and a second function would be better, especially if theres a chance that there could be a null shadow reference to a removed unit in your group
Fixed.