mob/verb
attack()
var/mob/enemy/E
if (E in view(0)-usr) //as i said it has to be in your loc
E.hp -= usr.dmg
E.deathcheck()
so what happens is, i want the player to attack one enemy at a time, but if there is a plurality of enemies in its location, it attacks them all together in one click (this wouldn't happen in a project were the mob's density is 1, unfortunately that's not the case)
how do i make it so that only 1 enemy is attacked every time i click the attack verb, when there are 2 or more enemies in usr.loc?
The shortened version of your code does no looping and can in no way do what you are describing, so it doesn't follow the same theory of your original function as you said.
Without seeing your original function, I can't offer much better advice, but in theory the above code should work for you provided you adapt it to the particulars of your game.