ID:142382
 
Code:
proc/s_damage(ref, num, colour)
if(!findtext(colour,"#"))
colour = colour2html(colour)

//Create a new icon copy and set its colour.
var/icon = S_DAMAGE_ICON
icon += colour

num = round(num,1)

if(num > 9999)
num = 9999

var/string = num2text(num)
var/first_char
var/second_char
var/third_char
var/fourth_char
var/obj/s_damage_num/first
var/obj/s_damage_num/second
var/obj/s_damage_num/third
var/obj/s_damage_num/fourth

if(lentext(string) == 1)
first_char = copytext(string,1,2)
first = new

if(lentext(string) == 2)
second_char = copytext(string,1,2)
second = new
first_char = copytext(string,2,3)
first = new

if(lentext(string) == 3)
third_char = copytext(string,1,2)
third = new
second_char = copytext(string,2,3)
second = new
first_char = copytext(string,3,4)
first = new

if(lentext(string) == 4)
fourth_char = copytext(string,1,2)
fourth = new
third_char = copytext(string,2,3)
third = new
second_char = copytext(string,3,4)
second = new
first_char = copytext(string,4,5)
first = new

var/target = ref
if(ismob(ref) || isobj(ref)) target = ref:loc

if(first) first.loc = target
if(second) second.loc = target
if(third) third.loc = target
if(fourth) fourth.loc = target

if(first)
first.icon = icon
flick("---[first_char]",first)
if(second)
second.icon = icon
flick("--[second_char]-",second)
if(third)
third.icon = icon
flick("-[third_char]--",third)
if(fourth)
fourth.icon = icon
flick("[fourth_char]---",fourth)

spawn(10)
if(first) del(first)
if(second) del(second)
if(third) del(third)
if(fourth) del(fourth)


Problem description:


Whenever i attack a monster the damage I am hitting is going over my head, how would i make it appear over the enemys head?
I see you're using Spuzzum's s_damage library/ I'm not too experienced with that library. Is there a demo or documentation there you could read to learn how to use it?
In response to Kaiochao
Yea there is one, but it does not show me how to precisly put the damage over the enemies icon, and not mine.
You're not using the library correctly. To use a library, you expand the red "Lib" folder in Dream Maker, then put a checkbox next to whatever the library is you want to use. Then, you call its functions: most libraries will provide a demo or documentation on how to do that.

What you do NOT do is copy-and-paste from the library to your own source files.

As for making it appear over a different object: read the library's documentation. It's the huge block comment at the top of the s_damage2 code file, in this case.