ID:267307
 
ok, using the Home button (7 numpad) to attack...makes sword mob..works ok, but how do i make the mob under it take damage? basically the Home proc sets the new weapon's atk var to the attacker's atk and then takes the mob under it's def and subtracts them and reduces it from the defenders hp..but i dont know how to make the mob under it take damage.
You might find that it's much simpler to just determine which mob is in the desired direction using get_dir(). Then if a victim is found, you can damage them based on the attacker's stats and not have to worry about any sword mob.
In response to Triste
So, the mothball is still alive eh? Well anyway, I would use an Obj as the sword, then just call a bump proc so that if anything bumps the sword, you take away what ever ammount of Hp, assuming you use Hp =)
In response to Erdrickthegreat2
Or, you could do this..

obj/sword
icon = 'Boring.dmi'
icon_state = "Talk"
New()
var/whatever = rand(2,5)
sleep(2) // Just a little processing time.
for(var/mob/M in src.loc)
M.Health -= whatever
sleep(2) // More processing time, it's always helped me out because if I use del() after a for() proc, and not used a sleep, it often deletes before it finishes looping.
del(src)
In response to Hanns
that works too =)