Hey there, I've been trying to find the answer myself on this site but failed at it... I'm trying something simple where zerglings unburrow if marines get close to them. So at the moment I got the following lines in Triggers.
Events:Unit-AnyUnitEntersadistanceof2.0from(Unit1fromZerglings)//Zerglings being the group of zerglings (5 in total)Unit-AnyUnitEntersadistanceof2.0from(Unit2fromZerglings)Unit-AnyUnitEntersadistanceof2.0from(Unit3fromZerglings)Unit-AnyUnitEntersadistanceof2.0from(Unit4fromZerglings)Unit-AnyUnitEntersadistanceof2.0from(Unit5fromZerglings)Conditions:((Triggeringunit)isinMarines)==true//Marines being the group of marines (5 in total)Actions:Unit-OrderallunitsinZerglingsto(Zergling-Unburrow)(ReplaceExistingOrders)
Now, this works. But I was unable to use something like 'All units from Marines/Zerglings' in the events. So I had to work around it. I made a condition to check if the triggering unit was in Marines. But I still have to make a seperate line for every unit in Zerglings and I was wondering how to do this faster, something like the following.
Because I figured it would get very retarded to do this if I had say 150 zerglings. So I'm sure there's a quicker way to do this out there, anybody who knows about it and can explain it to me?
Thx
I'm not at my computer w/ the galaxy editor atm (I'm at work :p) But have you tried just something like:
Events:Unit-AnyUnitEntersadistanceof2.0fromAnyUnitConditions:((Triggeringunit)isinmarines)==trueLocalVariables:a(unit)=(None)Actions:foreachunitainZerglings-ifconditions((Triggeringunit)isadistanceof2.0fromunita)ThenUnit-OrderallunitsinZerglingsto(Zergling-Unburrow)(ReplaceExistingOrders)// Breaks out of the loop since we found a satisfying conditionBreakElse
Again, this is pseudo-code-ish, but it might be something along the lines of what you're looking for?
There may be better ways of doing it. Someone else, feel free to chime in :)
Seems like a fair solution! I was hoping that it was able to use unit group names in the events themselves but doesn't seem that easy ;) But I'll have no problems figuring it out with the loops, thanks for the help nZifnab!
EDIT: Doesn't seem to work. You'll probably need the galaxy editor to work it out, but in a for loop I can't seem to use the local variable a and if I try it with an if I'm gettingsoemthing like
if a == Value , where value has to be "In group Zerglings" And again same story here: can only say unit x of group y and not take the whole group y
Hey there, I've been trying to find the answer myself on this site but failed at it... I'm trying something simple where zerglings unburrow if marines get close to them. So at the moment I got the following lines in Triggers.
Now, this works. But I was unable to use something like 'All units from Marines/Zerglings' in the events. So I had to work around it. I made a condition to check if the triggering unit was in Marines. But I still have to make a seperate line for every unit in Zerglings and I was wondering how to do this faster, something like the following.
Because I figured it would get very retarded to do this if I had say 150 zerglings. So I'm sure there's a quicker way to do this out there, anybody who knows about it and can explain it to me?
Thx
I'm not at my computer w/ the galaxy editor atm (I'm at work :p) But have you tried just something like:
Again, this is pseudo-code-ish, but it might be something along the lines of what you're looking for?
There may be better ways of doing it. Someone else, feel free to chime in :)
Seems like a fair solution! I was hoping that it was able to use unit group names in the events themselves but doesn't seem that easy ;) But I'll have no problems figuring it out with the loops, thanks for the help nZifnab!
EDIT: Doesn't seem to work. You'll probably need the galaxy editor to work it out, but in a for loop I can't seem to use the local variable a and if I try it with an if I'm gettingsoemthing like
if a == Value , where value has to be "In group Zerglings" And again same story here: can only say unit x of group y and not take the whole group y
@winZasteR: Go
Ya, as far as I can tell you can't have multiple units in the same event parameter...it's a bit weird.
Maybe you can use something like
This assumes, of course, that your marine and zergling arrays have all of the marines and zerglings on your map...and may not be the best solution.
It also assumes that an event like that exists, which I'm not 100% sure about.