trying to make my first SC2 map, but I'm having issues :). Been trying for 6 hours now but a few things are not working. I'll start with my main problem.
Integers increase in value on events.
1) I'm trying to order units to attack the player with the lowest integer number.
2) After the first event is completed, I want it to look at the integers again, then attack that number.
Not too sure what you want. Do you want player 15 to attack player 0, then player 1, 2, 3 etc or assign each player a number, then get player 15 to attack the player with the lowest number? Or something completely different?
find lowest integer, if more than one integer is lowest, pick a random of the lowest, and set playerY = player with lowest integer. (in this case int1 and int4 are lowest and I randomly want to chose one)
do attack playerY location "or region, point, either of these would work"
after playerY is dead repeat the above and find a new suitable target to attack.
I want this to happen untill all players are eliminated.
I hope this doesn't confuse more.. but I've been trying to figure it out.
Something like this would find the lowest number. but not if 2 numbers are the lowest. Also it wouldn't chose one of the lowest randomly.
Hi,
trying to make my first SC2 map, but I'm having issues :). Been trying for 6 hours now but a few things are not working. I'll start with my main problem. Integers increase in value on events.
1) I'm trying to order units to attack the player with the lowest integer number.
2) After the first event is completed, I want it to look at the integers again, then attack that number.
Hope you can help me guys.
Not too sure what you want. Do you want player 15 to attack player 0, then player 1, 2, 3 etc or assign each player a number, then get player 15 to attack the player with the lowest number? Or something completely different?
@wOlfLisK
Hi, thanks for replying.
What I need is something like this:
int1 = 0
int2 = 3
int3 = 2
int4 = 0
int5 = 1
find lowest integer, if more than one integer is lowest, pick a random of the lowest, and set playerY = player with lowest integer. (in this case int1 and int4 are lowest and I randomly want to chose one)
do attack playerY location "or region, point, either of these would work"
after playerY is dead repeat the above and find a new suitable target to attack.
I want this to happen untill all players are eliminated.
@wOlfLisK
I hope this doesn't confuse more.. but I've been trying to figure it out.
Something like this would find the lowest number. but not if 2 numbers are the lowest. Also it wouldn't chose one of the lowest randomly.
X = 0
lowestint1 = 0
lowestint2 = 0
lowestint3 = 0
lowestint4 = 0
lowestint5 = 0
int1 = 0
int2 = 1
Int3 = 2
Int4 = 0
Int5 = 3
if (int1 < int2 && int1 < int3 && int1 < int4 && int1 < int5) lowestint1 = 1
else lowestint1 = 0
endif
if (int2 < int1 && int2 < int3 && int2 < int4 && int2 < int5) lowestint2 = 1
else lowestint2 = 0
endif
if (int3 < int1 && int3 < int2 && int3 < int4 && int3 < int5) lowestint3 = 1
else lowestint3 = 0
endif
if (int4 < int1 && int4 < int3 && int4 < int2 && int4 < int5) lowestint4 = 1
else lowestint4 = 0
endif
if (int5 < int1 && int5 < int3 && int5 < int4 && int5 < int2) lowestint5 = 1
else lowestint5 = 0
endif
if (lowestint1 = 1 && lowerstint2 = 0 && lowerstint3 = 0 && lowerstint4 = 0 && lowerstint5 = 0) X = 1
if (lowestint2 = 1 && lowerstint1 = 0 && lowerstint3 = 0 && lowerstint4 = 0 && lowerstint5 = 0) X = 2
if (lowestint3 = 1 && lowerstint2 = 0 && lowerstint1 = 0 && lowerstint4 = 0 && lowerstint5 = 0) X = 3
if (lowestint4 = 1 && lowerstint2 = 0 && lowerstint3 = 0 && lowerstint1 = 0 && lowerstint5 = 0) X = 4
if (lowestint5 = 1 && lowerstint2 = 0 && lowerstint3 = 0 && lowerstint4 = 0 && lowerstint1 = 0) X = 5
You want the Minimum (Integer) function. :)
@RileyStarcraft:
the minl function only supports 2 values.
Anyone got any ideas on how to do this ?
@theystolemynick: Go
I've set the values of the array just for the example. The debug line at the end simply outputs the lowest integer found.
Thanks, thats real pretty.
Now, how do I return an array index "or indices". So I can match the lowest up against it ?.
You can nest as many as you want together, i.e. Min(Min(A,B),Min(C,D)) would return the lowest of A, B, C, or D. It's simpler than the array thing.
I got the lowest thing figured out. Now I need to return the array index.
arr[0] 2
arr[1] 4
arr[2] 3
If I want to return arr[3]
@theystolemynick: Go
Do it like Huesy said but use two Variables, LowestInteger and LowestIntegerIndex. Then set them like this:
BTW: You can use the For Each Action. It doas the same like the While (in this case) but is much better to read... ;)
Cheers Then
Thanks loads :). I'll be sure to add a thanks to all that helped me with this on my first map :).