| 02-22-2004, 06:25 PM | #1 |
Hi there! I am running a For loop for creating sheeps in every 0.5 sek. But Half of the times I want to create another kind of sheep. I was thinking that maybe I could use modulus and divied in 2 to get to see if the integer being "for-looped" is currently Even or Odd. But it doesn't seem to work.. PHP Code:
thats how it loks right now... thanks. |
| 02-22-2004, 06:47 PM | #2 |
Please don't use those colors again, thats too hard to read. Create a loop, for your if then use a IF integer > 40 THEN Create sheep (type1) Else (it'd be < 40) Create sheep (type2) That's a basic outline, the specifics I believe you can handle. [edit] Er... This should work for your purposes. Modify the values as needed. Actiobs: For each (Integer A) from 0 to 80, do (Actions) If ((Random Integer number between 1 and 2) Equal to 1) then do (Unit - Create 1 Footman for Player 1 (Red) at (Center of (Playable map area)) facing Default building degrees) else do (Unit - Create 1 Rifleman for Player 1 (Red) at (Center of (Playable map area)) facing Default building degrees) Change values as needed. |
| 02-22-2004, 07:15 PM | #3 |
Hmm.. that could work.. but it wouldn't serve my purpose 100%. I wan the "Evil Sheeps" to be created at a specifik time. Which is every time Integer A is an even number. I use to to like this in PHP when I want every second row in a table in another color for example. I think that it should work^^ |
| 02-22-2004, 07:26 PM | #4 |
Mighty, Use [code] instead. But your problem lies in the modulo Comarison: 3 % 2 = 1 4 % 2 = 0 It's never "2", so compare it with either 0 or 1. Cubasis |
| 02-22-2004, 07:30 PM | #5 |
Oh.. Hmm.. You'r right! I think I didn't think enough :P |
