Thank you very much smallg. However, the entities are still moving at the same time and I don't think the timer is being used at all. I am sure I must have implemented your script snippet wrong. Here is the latest version of the script in its entirity:
function cannonshot_init(e)
if g_killcount == nil then
g_killcount = 0
end
if closeenough == nil then
closeenough = 0
end
local randomtime = {}
local game_timer_started = nil
local posx = {}
local posy = {}
local targetmoveup30 = {}
function cannonshot_init(e)
randomtime[e] = math.random(500,5000)
game_timer_started = nil
targetmoveup30[e] = 0
end
function cannonshot_main(e)
if game_timer_started == nil then
if GetPlayerDistance( e ) < 1400 then
game_timer_started = 1
StartTimer(e)
end
elseif targetmoveup30[e] == 0 and GetTimer(e) > randomtime[e] then
targetmoveup30[e] = 1
elseif targetmoveup30[e] == 1 and GetTimer(e) > randomtime[e] then
posy[e] = GetEntityPositionY(e)
posy[e] = posy[e] + 10
SendMessageF("resetpositiony",e,posy[e])
--MoveUp(e,100)
posx[e] = GetEntityPositionX(e)
posx[e] = posx[e] + 8
SendMessageF("resetpositionx",e,posx[e])
end
end
if g_Entity[e]['health'] < 1 and GetEntityPositionY(e) < 3000 and targetmoveup30[e] == 1 and closeenough == 1 then
g_killcount = g_killcount + 1
targetmovingup30[e] = 0
end
if GetEntityPositionY(e) > 3000 and g_Entity[e]['health'] > 0 and targetmoveup30[e] == 1 then
Destroy(e)
targetmovingup30[e] = 0
end
end
Julian - increasingly disillusioned and jaded