ID:263073
 
obj
icon='ship.dmi'
missile
homing_missile
icon_state="h missile"
density=1
New()
while(src)
sleep(5)
var/a=locate(/obj/barrel) in view(src)
if(a)
walk_to(src,a,1,1)
Bump(var/atom/A)
if(istype(A,/obj/barrel))
flick("explosion",A)
barrel
icon_state="barrel"
density=1
New()
while(src)
sleep(10)
walk_rand(src)


Problem description:

Okay, what I read from the reference was that walk() and other automated moving functions call Move(), so they can use Bump(). However, this simple code is not working for me, and it is only for testing purposes, so you can nitpick away at it, but remember my problem is with Bump().

Additionally, any type of mob/Bump() works for me but not any type of obj/Bump() like so:
obj
Bump(var/atom/A)
world<<"[src] bumps [A]"

mob
Bump(var/atom/A)
world<<"[src] bumps [A]"


I just realized something, is it something stupid like I didn't put in a ..()?
Well, your problem lies in walk_to(). It will never bump anything because it's whole purpose is to walk around things. Try using walk_towards().

*Edit*
Also, you set the minimum distance to one, so when it gets close to it, it stops and doesn't bump into it.
In response to DarkCampainger
DarkCampainger wrote:
Well, your problem lies in walk_to(). It will never bump anything because it's whole purpose is to walk around things. Try using walk_towards().

Ungh, why is the reference so misleading like that? It said all the automated walk functions call Move(), and then people tell me "No, that only goes into tiles that it can." So it only works with ones that say "To halt walking, call walk(Ref,0)."?

What's the difference between walk_to() and walk_towards()? They both don't seem to work with Bump(). The missile just sits there next to the target and nothing happens.
In response to Justin Knight
walk_to() will go around objects that are in the way, which is why at first I believed it wouldn't work. If you didn't have the minimum distance set, it would circle the object it was walking to trying to get to the same location. However, since you do, it stops infront of the barrel without even trying to walk into it. To test if this is a cause, set the barrel's density to zero. If it walks through it, then there's a problem with Bump(). If not, then it's stopping infront of it and you need to drop the minimum distance.

What walk_towards() does differently, is that it pretty much just steps in the direction of the destination, walking into brick walls on the way. The reason some people choose walk_to() instead is because where walk_towards would keep on face planting into the wall, walk_to() would walk around it.
In response to DarkCampainger
Ok, that makes sense, but you didn't explain why neither of them are working with Bump().
In response to Justin Knight
Did you try just "walk_toward(src,a)"?
In response to DarkCampainger
Well, yeah what else would I have done? "walk_toward(a,src)"? It just moves up to it and stays there.
In response to Justin Knight
Well, this works fine completely on its own for me:
mob/verb/T() new/obj/missile/homing_missile(loc)

obj
icon='ship.dmi'
missile
homing_missile
icon_state="M"
density=1
New()
var/a=locate(/obj/barrel) in view(src)
if(a)
walk_towards(src,a)
else del(src)
Bump(var/atom/A)
if(istype(A,/obj/barrel))
flick("E",A)
del(src)
barrel
icon_state="B"
density=1
New()
while(src)
sleep(10)
walk_rand(src)