ID:1686145
 
Code:


Problem description: Basically I'm pretty much making a object teleporting onto a mob. I'd like a loop to repeat when this object is still on the a mob. I know this doesnt work with crossed and cross isnt working either.

So i basically want to do the opposite of crossed. Instead of a mob moving into me to call crossed, i want something to be called when a obj is moved into a mob. I could set crossed in a mob, but id prefer not to do that just for organizations. Is it possible or Any suggestions?


oh nvm i found my problem, stupid mistake.
i knew cross should have been working for this, but i was using cross in a bad way. had a while loop that i didnt need at all inside of cross that was messing things up
FYI, you shouldn't be using Cross(), you should be using Crossed(). Cross() is for determining whether one object can overlap another. Crossed() is to define what happens when one object overlaps another.
actually nope still have issues. So the issue is the move only works if the enemy moves into it. How do i change this while still keeping the coding linked with the obj and not the mob
In response to Kaiochao
i should be using crossed, but both are showing same results. Basically its only working when the mob moves, crossed or cross. heres my code

damageCrossed
density=0
icon_state="bloodWhip"
layer=10
var/owner
var/multi=1
Crossed(var/mob/m)
var/mob/attacker=owner
if(attacker!=m)
walk(m,src.dir,0,5)
attacker.damage(m,src.multi)
return 1
Uncrossed(var/mob/m)
walk(m,0)
In response to Kaiochao
nvm that has no identations that sucks
In response to Kaiochao
mob/proc/lineAttack(var/length,var/multi)
--var/newLoc=src.loc
--for(var/i=0;i<length;i++)
----var/obj/power/damageCrossed/o=new(src.loc)
----o.Move(get_step(newLoc,src.dir),
----src.dir,src.step_x,src.step_y)
----newLoc=o.loc;o.multi=multi;o.owner=src
In response to Anthonytyran
You need to wrap your code in <dm> tags in order to make it render properly.
    damageCrossed
density=0
icon_state="bloodWhip"
layer=10
var/owner
var/multi=1
Crossed(var/mob/m)
var/mob/attacker=owner
if(attacker!=m)
walk(m,src.dir,0,5)
attacker.damage(m,src.multi)
return 1
Uncrossed(var/mob/m)
walk(m,0)



mob/proc/lineAttack(var/length,var/multi)
var/newLoc=src.loc
for(var/i=0;i<length;i++)
var/obj/power/damageCrossed/o=new(src.loc)
o.Move(get_step(newLoc,src.dir),src.dir,src.step_x,src.step_y)
newLoc=o.loc;o.multi=multi;o.owner=src
so basically i want the mob to be hurt until knocked out of crossed zone. Problem is crossed only works if enemy steps in, I want it to work when an object simply moves into the mobs space. Hope this helps, thanks a lot for any help