Anyone know how to change where it says “unit 1” from unit group to make it ANY units in that group instead? I feel like that should be a preset but its not. I need to do this for both an event and a condition.
Anyone know how to change where it says “unit 1” from unit group to make it ANY units in that group instead? I feel like that should be a preset but its not. I need to do this for both an event and a condition.
there is a function "random unit from unitgroup". nevertherless you could also use unit (random integer from 1 to number of units in unitgroup) from unit group
Hmm... the event that I want to make is for the trigger to fire if any unit of one specific unit type on the whole map gets a move command. The condition will check the unit types of the "selected units" group and return true if ANY units in selected units are of a certain type. Is this possible?
pick all units in units group (units in region:(entire map)) matching conditions(biological, armored, alive, etc) at most (any amount).
then add conditions: if unit type of (picked unit) == (Zergling)
add another condition: if picked unit is in unit group (desired unit group)
then: do what you want with every zergling in that desired unit group
Thanks Joey. But doesn't it still want you to specify a unit index even with "units in region matching condition"? And I don't think using the "pick each unit" would work because then the action would ultimately only be applied if the last unit it picks is the unit type that its looking for. The THEN action that results is a change in movement speed for the triggering unit. The ELSE action is for the movement speed of the triggering unit to be reset. If the last unit it picks isn't a zergling, then the triggering unit speed will be normal even if it had previously picked zerglings in that group. What I am trying to do here is make it so one type of unit that is faster than the others will move at the same speed as 2 other types of units if it as moved in a group with them.
There's just two things I see in that trigger that makes me think you need some help understanding how things work:
1. The "Pick each unit" loop will run for every unit the player has selected, even after you found a matching unit (set the variable to true). That's not necessary, is it? You can just "Break" out of the loop after the first "Variable - Set Infantry or Artillery in group = True".
2. At the very end of the trigger you do "Variable - Set Infantry or Artillery in group = False" as what I assume is the last action before the trigger ends. This is not necessary. The next time the trigger runs, it creates a new variable at the top under Local Variables and sets it to false: "Infantry or Artillery in group = False <Boolean>". If that variable was a global variable (declared in the folder-type pane on the left side), it would not be reset between events.
Thanks for the feedback Rabbit! Yeah I am completely new at this. I did not realize that local variables reset to the default every time the trigger runs. That is good to know. How would I stop the pick each unit loop once the boolean is set to true?
Anyone know how to change where it says “unit 1” from unit group to make it ANY units in that group instead? I feel like that should be a preset but its not. I need to do this for both an event and a condition.
pick all units in entire map with unit is in unit group as a condition?
there is a function "random unit from unitgroup". nevertherless you could also use unit (random integer from 1 to number of units in unitgroup) from unit group
Unit is in unit group function.
You can't use a unit group variable in an event, if the units in it aren't pre-placed. You'd have to add the event with the unit as the game goes on.
Still alive and kicking, just busy.
My guide to the trigger editor (still a work in progress)
Hmm... the event that I want to make is for the trigger to fire if any unit of one specific unit type on the whole map gets a move command. The condition will check the unit types of the "selected units" group and return true if ANY units in selected units are of a certain type. Is this possible?
pick all units in units group (units in region:(entire map)) matching conditions(biological, armored, alive, etc) at most (any amount).
then add conditions: if unit type of (picked unit) == (Zergling)
add another condition: if picked unit is in unit group (desired unit group)
then: do what you want with every zergling in that desired unit group
Thanks Joey. But doesn't it still want you to specify a unit index even with "units in region matching condition"? And I don't think using the "pick each unit" would work because then the action would ultimately only be applied if the last unit it picks is the unit type that its looking for. The THEN action that results is a change in movement speed for the triggering unit. The ELSE action is for the movement speed of the triggering unit to be reset. If the last unit it picks isn't a zergling, then the triggering unit speed will be normal even if it had previously picked zerglings in that group. What I am trying to do here is make it so one type of unit that is faster than the others will move at the same speed as 2 other types of units if it as moved in a group with them.
This is what it looks like at the moment:
http://peeeq.de/gui.php?id=3753
so do something whenever a specific unit is told to move?
event: any unit is issued move command
conditions: owner of triggering unit == X; unit type of triggering unit == X
action: whatever
But how do you do "any unit is issued move command"? You have to do unit from unit group and I'm back to the same problem.
@AjaxTheNoob737: Go
Is this what you are looking for?
http://peeeq.de/gui.php?id=3754
Yes Knallertton that is perfect. Thanks so much.
And joey...any IS a preset for that event, silly me.
erm...well Knallertton wouldn't that not work because then whether the speed is reduced or reset would depend only on the last unit that it picks?
I found a solution using a Boolean variable:
http://peeeq.de/gui.php?id=3757
It works! Thanks for pushing me in the right direction guys.
@AjaxTheNoob737: Go
There's just two things I see in that trigger that makes me think you need some help understanding how things work:
1. The "Pick each unit" loop will run for every unit the player has selected, even after you found a matching unit (set the variable to true). That's not necessary, is it? You can just "Break" out of the loop after the first "Variable - Set Infantry or Artillery in group = True".
2. At the very end of the trigger you do "Variable - Set Infantry or Artillery in group = False" as what I assume is the last action before the trigger ends. This is not necessary. The next time the trigger runs, it creates a new variable at the top under Local Variables and sets it to false: "Infantry or Artillery in group = False <Boolean>". If that variable was a global variable (declared in the folder-type pane on the left side), it would not be reset between events.
Thanks for the feedback Rabbit! Yeah I am completely new at this. I did not realize that local variables reset to the default every time the trigger runs. That is good to know. How would I stop the pick each unit loop once the boolean is set to true?
Add a "General - Break" action directly underneath "Variable - Set Infantry or Artillery in group = True" at the same level (inside the loop).
Thanks!