- Joined
- Aug 16, 2007
- Messages
- 884
Hello. What's wrong with this script?
It's supposed to store five taverns into an unit array and randomize an integer to a number between 0 and 5 (0, 1, 2, 3, 4). Then it will remove all taverns, except the tavern that got the randomized numbers ID.
The problem is that none of the taverns is removed, all five is still there, visible and alive...
And by the way, will this function randomize to one of those numbers: 0, 1, 2, 3, 4?
or is it supposed to be 5 and not 4?
One more question. How to remove the BJ?
Thanks.
It's supposed to store five taverns into an unit array and randomize an integer to a number between 0 and 5 (0, 1, 2, 3, 4). Then it will remove all taverns, except the tavern that got the randomized numbers ID.
The problem is that none of the taverns is removed, all five is still there, visible and alive...
JASS:
function LoadRandomTavernMode takes nothing returns nothing
local integer i = GetRandomInt(0, 4)
local integer j = 0
local unit array tempTavern
set tempTavern[0] = gg_unit_n000_0012
set tempTavern[1] = gg_unit_n006_0027
set tempTavern[2] = gg_unit_n001_0013
set tempTavern[3] = gg_unit_n00V_0115
set tempTavern[4] = gg_unit_n02F_0153
loop
exitwhen (j >= 5)
if (j != i) then
call ShowUnit( tempTavern[j], false )
call KillUnit( tempTavern[j] )
endif
set j = j + 1
endloop
set tempTavern[0] = null
set tempTavern[1] = null
set tempTavern[2] = null
set tempTavern[3] = null
set tempTavern[4] = null
endfunction
And by the way, will this function randomize to one of those numbers: 0, 1, 2, 3, 4?
JASS:
local integer i = GetRandomInt(0, 4)
One more question. How to remove the BJ?
Thanks.
Last edited: