Originally Posted by p3lim
Nope, that's the point of the function, it's random, and still unlikely you might get the same number over and over again.
Mind if I ask what you need this for?
|
A little addon that summon a random mount.
The problem is that I press the key and summon mount A, I don't want it and repress A (got same mount :-), again ... again until it changes :-) Ok, it is intended to be random, but what I'd like to remove is the effect to have a lot of times the same number picked ...
The relevant part of code is this:
Lua Code:
local number=random(1,#MyCatMount_mrc[category]);
local picked=MyCatMount_mrc[category][number]:lower();
local msg=prgname .. " error: unable to summon \"" .. picked .. "\" from \"" .. category .. "\" category.";
for index=1,GetNumCompanions("MOUNT") do
local _,name=GetCompanionInfo("MOUNT",index);
if name:lower()==picked then
msg = prgname .. " is summoning... " .. picked;
CallCompanion("MOUNT",index);
break;
end
end
Thanks for your answer anyway.