HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

bla bla random unit no array etc. etc.

02-19-2004, 04:24 PM#1
cangrejo
Is there any way to create a random unit of all units.. u know what i'm saying? instead of making a bloody array with all units in it??????????????

alsO i'd like to say somehting "????"
Clearly, i'm making a STUPID map that's why I need this.. like a madness map with random units.. wow it's going to be pure luck :f well

======??????####(these are spam)((((55555485
02-19-2004, 08:14 PM#2
DescX
Short answer: Yes.

Long answer: It's a JASS loop set. Declare a local string, and loop through every character in the alphabet in 4 loops to manually build a raw unit ID. Check if that ID is valid - if it is, spawn the unit using that ID.

(Note: NONE of this works. What you're asking for is insanely long... all I'm doing is giving you a general *idea* of the type of logic you'd need to use)

Code:
[Pseudocode]
local integer cnt1,cnt2,cnt3,cnt4 = 0
local string UnitString

loop exitwhen cnt1 > 26
  set cnt2,cnt3,cnt4 = 0
  loop exitwhen cnt2 > 26
    set cnt3,cnt4 = 0
    loop exitwhen cnt3 > 26
      set cnt4 = 0
      loop exitwhen cnt4 > 26
      set UnitString = itoa(cnt1) + itoa(cnt2) + itoa(cnt3) + itoa(cnt4)
       CreateUnit( UnitString )
        PolledWait( 5.00 )
        set cnt4 = cnt4 + 1
      endloop
      set cnt3 = cnt3 + 1
    endloop
  set cnt2 = cnt2 + 1
  endloop
set cnt1 = cnt1 + 1
endloop
[/Pseudocode]

Anyway, as far as I know, doing some very huge (but very doable) JASS stuff would be the only way to go about doing what you want.

P.S. I realize you're Sweedish and so English is probably not your first language... but trying to be funny on forums in a language that you have trouble with can make you sound, err, unintelligent :). That's probably why your post got bumped down so far actually ;).
02-19-2004, 10:09 PM#3
Vexorian
It would be easier for you to use an array though.
02-20-2004, 10:04 AM#4
AIAndy
@DescX: The probability to hit a valid id that way is much too low since there are 36^4 different ids with digits and characters.
02-20-2004, 02:46 PM#5
Vexorian
Quote:
Originally posted by Esoteric Potentate
Code:
Unit - Create 1 (Random level (Random integer number between 1 and 10) creep unit-type) for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees


That is broken since it only works for creep units of the tileset, I say use arrays, it is better.
02-22-2004, 10:05 PM#6
cangrejo
i'm stupid also, did i mention that? I'm trying to make this map.. can i delete the region playable map area? it's spamming my variable choices.. ;( i hate it

ok well this map owns, i played it in a LAN party and i won. hehe good map.. i made it with random creep cos i was lazy