exVar[9]={0,0,0,0,0,0,0,0,0};
player[9]={0,'PLAYER_1','PLAYER_2','PLAYER_3','PLAYER_4','PLAYER_5','PLAYER_6','PLAYER_7','PLAYER_8'};
function infiniteTurn(set)
local enabled=0;
if set~=nil then enabled=1;
while not nil do
if enabled==1 then
for i=1,8 do
checkExist(i);
sleep(200);
if exVar==1 then
AddMPtoAllHeroesForPlayer(player[pid]);
end;
end;
end;
end;
end;
end;
function checkExist(pid)
local x=GetPlayerHeroes(player[pid]);
if x~=nil then
for i=0, length(x) do
if IsObjectExist(x) then
exVar[pid]=1;
end;
end;
end;
end;
function AddMPtoAllHeroesForPlayer(pid)
local x=GetPlayerHeroes(pid);
for i=0,length(x) do
ChangeHeroStat(x, STAT_MOVE_POINTS, 10000);
end;
end;
this is the whole script, the error i get is: Value was NIL when getting variable with 'exVar'
I have tried changing variable names, but it didn't help, the script is for HoMM V:ToTE