| 06-28-2007, 02:58 PM | #1 |
Hey guys, I made a spell which randomly creates units on a certain line. It uses For each Integer A from 0 to no.of units - 1 do: Create a unit at location..... Now my trigger makes it logically appear in a line, but I want it to appear in the line, but not like ordered, but random, to increase effect. Now I could say For each Integer Random from 0 to no. of units - 1 do: Create a unit at location... Set Integer Random to Random Number from 0 to no. of units... But then I'd have the problem, that it would always create units who are created on the same spot, destroying the line, since a random number can occur twice. So I need help, how can I make a Random Number, but so that when I do it again, it picks a random number, it didnt pick yet? Well, if anyone gets it you are a genius, cause I sat 2 hours on it and didnt... +Rep for the person who solves it ![]() |
| 06-28-2007, 03:19 PM | #2 |
One solution would require to change your spawn triggers: JASS:function Spawn takes nothing returns nothing // some stuff call TriggerSleepAction(GetRandomReal(0,n)) call CreateUnit(p,id,x,y,f) // some stuff endfunction function Actions takes nothing returns nothing // some stuff loop exitwhen i>n call ExecuteFunc("Spawn") set i =i+1 endloop // some stuff endfunction This would cause the units to spawn after a random amount of time which would give you the desired effect. |
| 06-28-2007, 03:20 PM | #3 |
seriously I don't understand what you trying to do, can you make it more easier to understand that what you are trying to do ? |
| 06-28-2007, 03:55 PM | #4 |
You call the CreateUnit function after a random delay to avoid spawning them all at the same time. So you'll get the impression that they're spawned in a random order. ( this concept is taken from one of vexorians spell demos ) Else you could do check if there's already a unit before creating one: |
| 06-30-2007, 09:20 AM | #7 |
hey thanks for the great help, but now ive already found a good way to do it, but hey thanks anyway, for the effort +rep i did it with this: Trigger: Trigger: For each Integer A from 0 to (N-1), do actions:
![]() Set alpha = ((delta*((Real(RandomNumber[((Integer A]))
![]() ...rest of formula |
