I can't believe I missed that :facepalm: It works now.
A part I still don't understand is
-- If we got here, no program has been chosen, so go ahead and chose one!
iBuildProgram2 = iBuildProgram1 + iBuildProgram2 -- =55
iBuildProgram3 = iBuildProgram2 + iBuildProgram3 -- =55
iBuildProgram4 = iBuildProgram3 + iBuildProgram4 -- =55
iBuildProgram5 = iBuildProgram4 + iBuildProgram5 -- =68
If these build programs have the same value, (in this case 55) doesn't that mean only the first one of the 3 can be chosen? For example if iRandom chooses a number between 27 and 55 won't it stop at
elseif (iRandom <= iBuildProgram2) then
g_iHarassingLeader = 2
return 2
therefor preventing program 3 and 4 from being considered? Maybe I'm reading this wrong but it looks like program 3 and 4 can never be chosen.