local spawn_notes = nil local notes_to_spawn = 3 --how many notes to spawn in the level (doesn't have to match notes_to_collect if you want to spawn more than needed) notes_to_collect = 3 --number of notes needed to win the game notes_collected = 0 pressed = 0 isanote = {} function random_note_spawner_init(e) end function random_note_spawner_main(e) if spawn_notes == nil then spawn_notes = 0 return elseif spawn_notes == 0 then notes_spawned = 0 repeat for a,_ in pairs (isanote) do if math.random(1,100) >= 50 and g_Entity[a]['activated'] == 0 then Spawn(a) SetActivated(a,1) notes_spawned = notes_spawned+1 if notes_spawned >= notes_to_spawn then break end end end until notes_spawned >= notes_to_spawn spawn_notes = 1 elseif spawn_notes == 1 then Text(1,1,3,"Notes collected: "..notes_collected) end end function random_note_spawner_exit(e) end