The magnetization proc (the walk_towards will probably be replaced with a step towards):
obj/proc
Magnetization()
LOOP
for(var/mob/M in oview(8,src))
if(M.Magnetized)
walk_towards(src,M)
sleep(5)
goto LOOP
In the object:
New()
src.Magnetization()
Problem description:
So I'm trying to make it so I can Magnetize a person (that part is done already) and have a metal object be pulled towards them mid-movement by having the object as a projectile check to see if there's anything magnetic near it. I haven't 100% figured out what the problem is, and I don't know why it doesn't work. Its as if the proc isn't triggering? Any help?
You should also be spawning the Magnetization() call in New(), so New() can return to the caller.
view() is not the correct call here, since magnets should work through opacity, so you'd want range() instead.
Looking ahead, though, it would be better not to move toward the first object in range but instead to get a directional vector based on all of the objects in range, and work with that.
This can be adjusted to allow for step offsets.