Only three or four of my array values work, and i don't know why. If i switch the order the ones that are in the front three or four work, while the rest don't.
Has the ability to issue warnings to users, edit and remove posts from the forum and to move topics to other boards. Upholds the rules of the forum. Moderates Chat Rooms.
Treyarch commented in the box function that its from 1-value, but i tried this anyway and it didn't work. Post Merge: April 30, 2014, 03:51:15 amNVM! i fixed it!
The issue was
Code Snippet
Plaintext
level.random = randomint(level.rm.size);
randomint does one less than the actual size, in which case is 4. This caused the last powerup to not be registered. I fixed it by doing this:
Code Snippet
Plaintext
level.random = randomint(level.rm.size + 1);
HOWEVER, the iscaused still isn't working. Could someone help me out with that?
Last Edit: April 30, 2014, 03:51:16 am by daedra descent
The iscurrent is to stop the powerup from showing up twice, but it doesn't work.
You only ever store the most recent one, to make sure you don't pick it again right afterwards. However, the iteration after that, it can be picked again, as iscurrent now holds the new last powerup. Also: start_randomize() is currently useless. current_watch() is useless, too. model_cycle() could be made a lot shorter.
You only ever store the most recent one, to make sure you don't pick it again right afterwards. However, the iteration after that, it can be picked again, as iscurrent now holds the new last powerup. Also: start_randomize() is currently useless. current_watch() is useless, too. model_cycle() could be made a lot shorter.
- Phil.
The issue is that it will randomly select the same powerup 2, 3, or even 4 times before randomizing again.
I have got rid of the unneeded functions, but what would i use to make model_cycle() shorter?
So how do i make sure it doesn't give the same value twice?
Well, change your logic so that it handles this case properly. That's the challenge of programming. Commonly, if you want a random number, but exclude a specific one in the range, you generate random numbers, until you get one that is not equal to the one you don't want. You could also be using a randomized array in your case. Etc. etc.