ID:2415353
 
Code:
mob/verb


snowball_toss(mob/M)

set hidden = 1

if(!M) return

world << "Throwing Snowball at [M.name]..."

var/obj/S = new
S.icon = 'items_obj.dmi'
S.icon_state = "SBALL"
S.layer = M_LAYER + 20
S.mouse_opacity = 0

missile(S, usr, locate(M.x,M.y,M.z))

del S

var/obj/H = new

H.Move(locate(M.x,M.y,M.z))

H.icon = 'items_obj.dmi'
H.icon_state = "SBALL_HIT"
H.layer = M_LAYER + 20
H.mouse_opacity = 0

world << "...Hit [M.name]"

spawn(10) del H

return


Problem description:

So I'm trying to add a little snowball gimmick in to my game for the holidays. I don't really use the missile proc though so I'm kinda stumbling my way through this.

Basically I'm trying to create a snowball at the user's location, have it travel to the other player, turn in to the hit animation, then delete itself.

My code above is creating the missile and instantly displaying the hit animation at the location before the missile arrives at its target.

Is there a way to prevent this? I was planning on making a little sound effect and a slow blotch to the target's screen when it hits but I can't get the timing to function correctly.
The missile() proc is 100% visual, it doesn't actually cause an object to travel, it just uses the visual information for a type/object and has it travel from A to B visually.

You'd likely want to create an actual object (as you're already doing) and use something like step() in a loop or walk() to make it physically travel to the target location, then you can use things like Cross()/Crossed() and Bump() to handle collision.