[solved] UnitPool vs RandomDist (placing units)

Status
Not open for further replies.
Level 13
Joined
May 11, 2008
Messages
1,198
i was curious about something so i went to make a random creep, and stumbled across this after exporting the script:

call RandomDistReset( )
call RandomDistAddItem( 'n02G', 50 )
call RandomDistAddItem( 'n02F', 50 )
set unitID = RandomDistChoose( )
if (unitID != -1) then
set u = CreateUnit( p, unitID, 10128.4, 3328.2, 180.180 )
endif

now i'm really curious. we have UnitPool, but the editor uses RandomDist...why is that? they seem like same thing...
although, with unitpools you can have many pools at a time, but with this other thing can you only have one at a time? does that mean you can only use it at map init? and since you can only use it at map init doesn't that sound like it's better to use it at map init than to use unit pool at map init?

ok, this begged another question, one that surely was easyto solve.

what i was pondering was...why even bother with local unitpools? aren't global unitpools a lot more efficient? why bother recreating them unless you want to keep altering the weights or units in the pools?

so i ran a quick test put 2 units in a unitpool i used to suppose you keep making new unitpools because otherwise you will run out of units.

then i tell it to give me 5 units. and i ran the test and it worked.

lol...so with all those
call RandomDistReset( )
call RandomDistAddItem( 'n02G', 50 )
call RandomDistAddItem( 'n02F', 50 )
calls, i'm thinking making a few unitpools would be the best choice.
i can cut out all those extra function calls and just do place random unit from unit pool.

yeah, this seems good. using global unitpools. same goes for itempools. local pools doesn't make a whole lot of sense, at least for the maps i'm making.
 
Last edited:
Status
Not open for further replies.
Top