ID:2040056
 
Im not fully sure what maptext does but i believe it was used for over a mobs head damage counting in games if so how do i do it?

obj
damageOverlay
maptext_width = 160
maptext_y = 64
maptext_x = -48
alpha = 255
layer = 99

mob
proc
mostrarDamage(var/mob/M, dano, tipo)
var
obj/damageOverlay/Damage = new(M.loc)

switch(tipo)
if("Damage")
Damage.maptext ="<b><center><font color = red> -[dano]"

if("Miss")
Damage.maptext ="<b><center><font color = red> MISS"

if("Critical")
Damage.maptext ="<b><center><font color = #9400D3> CRITICAL\n-[dano]"

if("RestoreHp")
Damage.maptext ="<b><center><font color = green> [dano]"

if("RestoreMp")
Damage.maptext ="<b><center><font color = blue> [dano]"


sleep(3)
animate(Damage, pixel_y = rand(10, 30), alpha = 0, time = 5)
sleep(5)
Damage.loc = null


I worked on it yesterday haha.

Hope it helps you!
Maptext shows text on the map, hence the name. You can do a bit of CSS styling to it by editing your map control's "Style" section, or using inline tags.

obj
some_object
maptext = "This is Maptext"
maptext_width = 96
maptext_height = 32
maptext_x = 8
mptext_y = -8


In the case you want to use it for showing damage, you would simply use objects or images (because images can use maptext too) to hold the maptext, combined with pixel_x/y offsets, alpha animation, and so on. If you don't know about animate(), get familiar with it a bit.

It is simple to do, so I'll let you give it a try before I write anything else.
it works great but only problem i have is it seems to spam the damage even though projectiles only hit 1 time and afterwords it doesnt always dissapear
It should work like this :



Show us your code and we can help you.