Well, I don't know if it's a bug with the code (I couldn't find one), or just rand(#,#) doesn't work in while loops, but anyways.
I have while(src) for the AI loop, but for some reason, I have rand(1,2) (1 being AI uses Taijutsu/melee, 2 being a jutsu), and problem being is, they work, but, for some reason once the AI uses a Jutsu, he keeps using a jutsu over and over. I don't think it's luck of the draw as it happened like 30 times in a row.
Could someone tell me how to make it random inside of the While Loop, for two options?
ID:159395
Mar 18 2009, 7:54 am
|
|
Mar 18 2009, 9:29 am
|
|
For two options with an equal chance of occurring, try if(prob(50)). prob(N) is a proc that returns true based on an N% chance.
|
In response to Kaiochao
|
|
I actually fixed it, but thank you. I ended up making a proc to do Random while in loops. So I do var/R1 = Random(1,2) for example, and it'll return a new number each time. xD
|
In response to Asellia
|
|
<s>You could just change the variable with each iteration of the loop..</s>
You could just not use a variable... I'm not sure how you managed to mess that up. while(blah) Or just do what I said. while(blah) |
In response to Kaiochao
|
|
I ended up taking a different path, and I used a variable as it uses the same random number multiple times. I made a proc to pick the random number, instead of picking it inside the while loop.
|