Hello! Sorry for my poor English. First of all, I'm pretty new to programming... BUT... I have a strange problem... the following code simply randomly removes objects at the start of a mission. BUT ONLY FULLY WORKS if the "for...end" goes from 1 to 3... otherwise (for example from 1 to 10), the lines that come AFTER the End of the For are NOT EXECUTED... What am I doing wrong?
The code:
local nroObjeto = 1
local strObjeto = "Static" .. nroObjeto
for i=1, 10 do
if math.random(1,100) > 50 then
Unit.getByName(strObjeto):destroy()
trigger.action.outText("Erased".. strObjeto,5)
end
nroObjeto = nroObjeto + 1
strObjeto = "Static" .. nroObjeto
end
trigger.action.outText("End Random process...",15) -- NOT EXECUTED WITH for i=1, 10
Unit.getByName("Static7"):destroy() -- NOT EXECUTED WITH for i=1, 10