ID:159453
 
I am trying to get the damage you do to another Mob to appear over that mob. Maybe like the numbers rise from bottom to top and then dissapear. How would I do that?
It involves building the number through icons and displaying it with an overlay. Search around, there is at least one library that does this and surely numerous topics where this has been asked and discussed before.
mob
var
hasattacked = 0
obj
damage
icon = 'damage.dmi'
mob
verb
attack(mob/M in oview())
set category = "Fighting"
if(usr.hasattacked)
return
else
usr.hasattacked = 1
var/damage1 = rand(1,20)
flick("attack",usr)
M.damage("[damage1]")
view()<<"[src] attacked [M] for [damage1] damage!"
spawn(7)
usr.hasattacked = 0
mob/proc
damage(var/text)
sleep(1)
var/leftspot=round((length(text)/2)*-3.65)
for(var/i=1,i<=length(text),i++)
src.overlays -= typesof(/obj/damage)
var/obj/N=new/obj/damage
N.pixel_x=leftspot
N.icon_state="[copytext(text,i,i+1)]"
src.overlays+=N
leftspot+=4
spawn(7)
src.overlays -= N


It needs a few things to match with your game and you still have to icon the numbers (name the icon_states 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 and put them all in the same spot on the icon file) it doesnt make it move but it does show up on the other mob until you can attack again..

NOTE: Most of the code that adds the numbers onto them was created by Darker Emerald and I do not claim it as my own.
In response to SadoSoldier
In response to Ephemerality
Bah my idea wouldve worked too ^.^ just not as well
In response to Ephemerality
I have tried using that but its only for damage up to 9999. Secondly when i tested it it wouldnt show
In response to RobertEldon666
Oh, nvm, i figured it out. Thank you!!!!!!!!