• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

JASS: Pick every unit in group.

Status
Not open for further replies.
Level 9
Joined
Sep 28, 2004
Messages
365
How do i write the below code:
  • Actions
    • Unit Group - Pick every unit in immolate_victimGroup and do (Actions)
      • 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:
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 Trig_test_Func001A instead of a separate one.

Help would be much appreciated
 
Last edited:
How do i write the below code:
  • Actions
    • Unit Group - Pick every unit in immolate_victimGroup and do (Actions)
      • 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:
Code:
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 instead of a separate one.

Help would be much appreciated



well they would separate if you will use ForGroup.... to make it one use something like this....
JASS:
local group a = CreateGroup
local unit b
local location c
call GroupEnumUnitsInRange(blahblah)//forgot the parameters
loop
 set c = FirstOfGroup(a) //then If you would just copy paste the actions replace all EnumUnit with the unit variable c
 exitwhen c = null
 //Put your actions here
 call GroupRemoveUnit(blahblah)
endloop
sorry for the blahblahss... as always I dont have my editor... (I dont have internet at my dorm)....
 
Level 8
Joined
Mar 23, 2007
Messages
302
Here is a way how to loop for Groups:

JASS:
function Trig_Example_Actions takes nothing returns nothing
local group G = CreateGroup()
local unit g
local real x = 0
local real y = 0
local real x_gate = 300
local real y_gate = 300
local real x_base = 500
local real y_base = 500

call GroupEnumUnitsInRange(G,x,y,radius,null)
loop
set g = FirstOfGroup(G)
exitwhen g == null
if GetUnitTypeId(g) == 'h00E'  then
call SetUnitPosition(g,x_gate,y_gate)
else
call SetUnitPosition(g,x_base,y_base)
endif
call GroupRemoveUnit(G,g)
endloop

call DestroyGroup(G)
set G = null
set g = null 
endfunction

whenever this action is triggerd, it picks all units (no matter if dead or not)
and checks if those units are a unit of the type 'h00E' what could be a soldier. so and if the condition is true, it puts the unit to the gate, if its not a 'h00E' then the unit is put into base.

dont forget to first destroy and the null used variables.
integer and reals have no need to be nulled.
hope this helped, ask whatever u want.

greets equal
 
Status
Not open for further replies.
Top