| 08-07-2006, 12:14 AM | #1 |
Hi: I'm a beginner in JASS and i have one question. How can I use a function who has values of entrance?? somenthing like that JASS:function Function1 takes location CastingPoint, real AoE returns nothing ... //Code of the subfunction goes here endfunction function Trig_MyTrigger_Starts_Actions takes nothing returns nothing ... //Code call ForGroupBJ( Tentacles, function Function1 ) ... //Code endfunction I tried writing in this way: JASS:
call ForGroupBJ( Tentacles, function Function1(My point, 200) )
endfunctionBut ovbiosly it doesn't work, I suppose there's another way. How can I do it??? |
| 08-07-2006, 12:18 AM | #2 |
The code argument in the ForGroup() function cannot take arguments. This means you'll either have to attach variables to something or use globals to store your values. For something like this, I recommend FirstOfGroup() iterations. JASS:loop set UnitVar = FirstOfGroup(SomeGroup) exitwhen UnitVar == null //Do your stuff to or relative to the unit call GroupRemoveUnit(SomeGroup, UnitVar) endloop |
| 08-07-2006, 12:19 AM | #3 |
You can use global variables temporarily, or you can use something like CSCache (check the Caster System) or the local handle variables (search for this at www.wc3jass.com) system to attach them to an object. Edit: Rising_Dusk is fast. |
| 08-07-2006, 12:23 AM | #4 |
Well, the idea with the usage of ForGroupBJ or ForGroup functions is to apply one function to all units in a unit group. is there some way to get the "picked unit"?? I'm thinking in a loop but how can I get the units in the group?? is there any function or functions for that?? |
| 08-07-2006, 12:27 AM | #5 |
You can use GetEnumUnit() in the function executed by ForGroup to get the "picked unit". Else you can do something like this (note: it will remove all units from the group, so if you want to use the group multiple times, you will have to create a new group and add all units from the old group to it). JASS:... local group g = <Your Group> local unit f loop set f = FirstOfGroup(g) exitwhen f == null // Put your actions here - Use 'f' for "picked unit". call GroupRemoveUnit(g, f) endloop call DestroyGroup(g) // Destroys the group because it is empty, only do these actions on a copy of the group, or if you don't need the original anymore. set g = null set f = null ... |
| 08-07-2006, 12:33 AM | #6 |
Thank you very Much!!!! I'll work with it and as soon as I have a question I'll post here. Thanks :) +rep for everybody :) |
