You can shot the monsters clicking with your mouse(what else it could be?) and by pressing F.
The damage is based in which pixel of the zombie you hit.
Now the problem:
I decide to make 2 vars(pixelx and pixely) and use pick to make the shot, but I realize that will not work.
If I shot the pixel 7,21 of the zombie it's a head shot and the pixel 3,11 it's a normal-damage shot.
If I do this:
pixelx = pick(3,7)
pixely = pick(11,21)
I have a chance of shot the pixel 3,21, which is nothing. But it's worse. Because of my shot proc:
shot(mob/m,dire,pixelx,pixely)
if(dire == SOUTH || dire == NORTH)
if((pixelx>8 && pixelx<12) && (pixely>20 && pixely<28))
damage(m,0,50) // This second number is a damage that ignore target's defense
else if((pixelx>4 && pixelx<12) && (pixely>2 && pixely<10))
damage(m,rand(5,10))
if(prob(70)) m.move_speed = 1 //I'm using F_A's pixel movement
else damage(m,rand(7,15))
else if(dire == EAST || dire == SOUTHEAST || dire == NORTHEAST)
if((pixelx>2 && pixelx<10) && (pixely>20 && pixely<28)) damage(m,0,50)
else if((pixelx>4 && pixelx<9) && (pixely>2 && pixely<9))
damage(m,rand(5,10))
if(prob(70)) m.move_speed = 1
else damage(m,rand(7,15))
else
if((pixelx>7 && pixelx<15) && (pixely>20 && pixely<28)) damage(m,0,50)
else if((pixelx>8 && pixelx<9) && (pixely>2 && pixely<13))
damage(m,rand(5,10))
if(prob(70)) m.move_speed = 1
else damage(m,rand(7,15))
It will counted as a headshot and kill the monster.
The only way to avoid this is assign the 3,11 or 7,11 together. I thought about using a list, but I don't know how to do this.
...I just notice I didn't need to make this whole text just to ask that...
Another alternative would be to rewrite your shot process to handle both contexts:
For an actual click, use the pixel_x/y locations.
For shots fired with 'F', use probabilities.