I am trying to implement a randomizer so the script randomly picks one of the group members to cast a particular spell.
I got the following code:
The problem I am having is that
Any insights please? Thanks!
I got the following code:
Code:
local RandomIndex = mq.TLO.Math.Rand(1, 6) --- Generate a random number from 1 to 6
local RandomMember = "Character1" --- This is just a default to declare the varible
if RandomIndex == 1 then
RandomMember = "Character1"
elseif RandomIndex == 2 then
RandomMember = "Character2"
elseif RandomIndex == 3 then
RandomMember = "Character3"
elseif RandomIndex == 4 then
RandomMember = "Character4"
elseif RandomIndex == 5 then
RandomMember = "Character5"
elseif RandomIndex == 6 then
RandomMember = "Character6"
end
print(RandomIndex)
print(RandomMember)
The problem I am having is that
print(RandomIndex) does indeed print a random number from 1 to 6, but print(RandomMember) always prints the default "Character1". That means that the If / Elseif rules are ignored altogether. I cannot figure out where my syntax is wrong.Any insights please? Thanks!



but only if you do the same random calls on each toon.