timer = {} counted = {} blood_number = {} local b = 0 local tempcount = 0 function blood_for_enemies_control_init(e) Hide(e) CollisionOff(e) end function blood_for_enemies_control_main(e) Hide(e) CollisionOff(e) if GetTimer(e) > 100 then math.randomseed(g_Time) StartTimer(e) for a,_ in pairs(ai_bot_state) do if counted[a] == nil then counted[a] = 0 elseif counted[a] == 0 then if g_Entity[a]['health'] < 1 then tempcount = 0 repeat b = math.random(0,9999) tempcount = tempcount + 1 until (blood[b] ~= nil and blood[b] == 1) or tempcount >= 999 if blood[b] ~= nil then counted[a] = 1 blood[b] = 2 blood_number[a] = b Show(b) end end elseif counted[a] == 1 then if blood_number[a] ~= nil then new_y = math.rad(g_Entity[a]['angley']) pos_x = g_Entity[a]['x'] + (math.sin(new_y) * 1) pos_z = g_Entity[a]['z'] + (math.cos(new_y) * 1) SetPosition(blood_number[a],pos_x,g_Entity[a]['y']+1,pos_z) SetRotation(blood_number[a],g_Entity[blood_number[a]]['anglex'],g_Entity[a]['angley']+180,g_Entity[blood_number[a]]['anglez']) end end end end --time end