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!
In my map I need to make a trigger that picks every unit within a 50 radius of every destructible of a certain type, and add the picked units to a certain unit group. I could find any function that does "Pick every destructible of type", does anyone know how I could do this?
In my map I need to make a trigger that picks every unit within a 50 radius of every destructible of a certain type, and add the picked units to a certain unit group. I could find any function that does "Pick every destructible of type", does anyone know how I could do this?
and that why problem? if i do action only in ,,if'' then all other desctructible leave alone what dont fit to if condition.
i dont understand what u mean, when u do pick than its count every unit/destructible who fit the condition in picked function (so all destructible around a point) then make a loop(example if 5 tree have around the point then from tree 1->tree5) and do action with each unit.
see the unit group by player do also same, filter the unit with a function, every pick unit do filtering with function where u give more condition than 1 just its do when WE convert the trigger to jass at save map so u can use the if since game also do it, since at pick all destructible dont have that much option than at pick all unit .
JASS:
function GetUnitsInRectOfPlayer takes rect r, player whichPlayer returns group
local group g = CreateGroup()
set bj_groupEnumOwningPlayer = whichPlayer
call GroupEnumUnitsInRect(g, r, filterGetUnitsInRectOfPlayer)
return g
endfunction
and that why problem? if i do action only in ,,if'' then all other desctructible leave alone what dont fit to if condition.
i dont understand what u mean, when u do pick than its count every unit/destructible who fit the condition in picked function (so all destructible around a point) then make a loop(example if 5 tree have around the point then from tree 1->tree5) and do action with each unit.
see the unit group by player do also same, filter the unit with a function, every pick unit do filtering with function where u give more condition than 1 just its do when WE convert the trigger to jass at save map so u can use the if since game also do it, since at pick all destructible dont have that much option than at pick all unit .
JASS:
function GetUnitsInRectOfPlayer takes rect r, player whichPlayer returns group
local group g = CreateGroup()
set bj_groupEnumOwningPlayer = whichPlayer
call GroupEnumUnitsInRect(g, r, filterGetUnitsInRectOfPlayer)
return g
endfunction
Its a problem because when you say
"Pick Every Destructable in Region A"
and then
"If Destructable Type of Picked Destructable is equal to X"
then
"Then Put Picked Destructable into Group Y"
Then it puts EVERY destructable in Region A into Group Y, not only the destructable of type X.
Assuming that X = Tree
So if there is a Tree and two Rocks in Region A, then the only thing it does is detect that one of the destructables is equal to Tree, and then instead of only putting the Tree into Group Y, it puts the rocks into Group Y too.
Understand? If you dont feel free to let me know so that I can cater further to your broken english
Its a problem because when you say
"Pick Every Destructable in Region A"
and then
"If Destructable Type of Picked Destructable is equal to X"
then
"Then Put Picked Destructable into Group Y"
Then it puts EVERY destructable in Region A into Group Y, not only the destructable of type X.
Assuming that X = Tree
So if there is a Tree and two Rocks in Region A, then the only thing it does is detect that one of the destructables is equal to Tree, and then instead of only putting the Tree into Group Y, it puts the rocks into Group Y too.
Understand? If you dont feel free to let me know so that I can cater further to your broken english
Its a problem because when you say
"Pick Every Destructable in Region A"
and then
"If Destructable Type of Picked Destructable is equal to X"
then
"Then Put Picked Destructable into Group Y"
Then it puts EVERY destructable in Region A into Group Y, not only the destructable of type X.
Nope, this is not the case. All actions that you put in the loop get together in an outsourced function.
Pseudocode:
JASS:
function Enum takes nothing returns nothing
if (GetEnumValue() == X) then
call BJDebugMsg(GetEnumValue())
endif
endfunction
ForEach(<group>, function Enum)
The Enum function gets consecutively run for each element in <group>. This means that every new call of Enum gains another GetEnumValue() return value. The first element runs its function call to the end, the second does after, then the third etc. GetEnumValue() does not provide a whole array, jass cannot handle array arguments anyway.
Nope, this is not the case. All actions that you put in the loop get together in an outsourced function.
Pseudocode:
JASS:
function Enum takes nothing returns nothing
if (GetEnumValue() == X) then
call BJDebugMsg(GetEnumValue())
endif
endfunction
ForEach(<group>, function Enum)
The Enum function gets consecutively run for each element in <group>. This means that every new call of Enum gains another GetEnumValue() return value. The first element runs its function call to the end, the second does after, then the third etc. GetEnumValue() does not provide a whole array, jass cannot handle array arguments anyway.
map what i posted work in gui if u want convert to jass u can filter it easily but in gui like i said if u pick every unit in 600 range who is enemy is enemy to group y, then its put everyunit in 600 range just filter function remove from group when it filter each unit
Its a problem because when you say
"Pick Every Destructable in Region A"
and then
"If Destructable Type of Picked Destructable is equal to X"
then
"Then Put Picked Destructable into Group Y"
Then it puts EVERY destructable in Region A into Group Y, not only the destructable of type X.
Assuming that X = Tree
So if there is a Tree and two Rocks in Region A, then the only thing it does is detect that one of the destructables is equal to Tree, and then instead of only putting the Tree into Group Y, it puts the rocks into Group Y too.
Understand? If you dont feel free to let me know so that I can cater further to your broken english
For each destructable that is picked it performs the actions.
So for example:
"Pick Every Destructable in Region A"
and then
(So the first destructable is picked inside Region A and then the following action get's performed)
"If Destructable Type of Picked Destructable is equal to X"
then
"Then Put Picked Destructable into Group Y"
(In this case the Picked Destructable would be the first detructable that is picked from all destructables in region A)
When this action is done executing it starts over for the second, third, fourth of the group and so on. Till everything has been picked inside Region A.
And since these actions get executed in split seconds it looks as if it picks all the destructables at the same time, which it in fact does not...
It happens one by one.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.