ID:1627162
 
(See the best response by Zecronious.)
Code:
mob
var
Chidori = 0
Rasengan = 0
mob
verb
Chidori()
if(src.Chidori == 0)
src.overlays += 'Power.dmi'
src.Chidori = 1
else
src.Chidori = 0
src.overlays -= 'Power.dmi'
mob
Move()
if(!usr.canmove)
usr<<"You cannot move"
return
if(usr.Chidori == 1)
..()
del src.loc
..()
else
..() //insert the rest of your move things here, whatever it is you may have
mob
Bump(var/mob/A)
..()
new /obj/Fusion(src.loc)
walk_away(src,A,5)
walk_away(A,src,5)
mob
verb
Help()
src.loc = locate(1,1,1)


Problem description:
So when i bump to the mob, i get teleported to a dark area and it doesn't continue. After i take the ..() from the bottom of the Move() for the chidori it works. Just that when i try to use the chidori on the grass i disappear.

How do you expect it to work:So my chidori destroys the turf when the mob walks over it with the chidori. Since there is a world/turf = /turf/Dirt it doesn't leave dark spots. I want it to leave dirt behind and when it clashes with a mob with rasengan i want it to make a new obj called Fusion which is just a big black circle and for both of them to walk away from each other.
Problem only happens when i have chidori btw.
You should display the proc walk_away(), I suppose the problem is there.
Best response
Haven't compiled this but does it work?

mob
var
Chidori = 0
Rasengan = 0
mob
verb
Chidori()
if(usr.Chidori == 0)
usr.overlays += 'Power.dmi'
usr.Chidori = 1
else
usr.Chidori = 0
usr.overlays -= 'Power.dmi'
mob
Move()
if(!src.canmove)
src << "You cannot move"
return
if(src.Chidori == 1)
del loc
..()

mob
Bump(var/atom/A)
if(istype(A, /mob))
var/mob/M = A
if(M.Rasengan)
new/obj/Fusion(loc)
walk_away(src,M)
walk_away(M,src)
..()

mob
verb
Help()
src.loc = locate(1,1,1)


My understanding is that while Chidori is on, delete all turf behind you as you walk and when you bump into someone with Rasengan then you want Fusion to be created at the location of the player and they walk away from each other for 5 tiles.
In response to Eternal_Memories
Eternal_Memories wrote:
You should display the proc walk_away(), I suppose the problem is there.

I thought this too but it doesn't even make a fusion and when I do without chidori it works totally fine. (Wrote this in phone)
This code comes up with the same result.
Try to eliminate
del loc
part and test it again.
it works, but if i delete the del loc it'll take off the effect of the chidori
Is there a way to keep del loc and have the effect?
Bump
You can always set the del loc condition check when the user tries to move by having it under client/Move()

Just be sure to reference the usr as src.mob (src being the /client)
I'm not understanding can you show me this in a cm tag where I could understand it
Nevermind my previous post, misread the intent.

Perhaps it may be easier to just replace the turf by doing new/turf/Dirt(src.loc) rather then 'del loc' to avoid any issues that may be caused.

Or, if you plan to have different destructive turfs, maybe have a Destroy() function on the turf which is called when a person walks with Chidori
turf
proc/Destroy() // Creates a new Dirt turf by default on the destroyed turf
new/turf/Dirt(src)

Pond
icon_state = "water"
Destroy() // When this /turf is destroyed, change the icon to a muddy icon instead of making dirt.
src.icon_state = "mud"

mob/Move()
... if chidori = 1 ...
var/turf/T = src.loc
T.Destroy()
return ..()
Hm now that I ate and thought about it, I think I got what happened.

When you deleted the /turf, the usr's loc - initially that turf - got nulled and sent you to THE VOID.

It may be better if you modified the /turf by changing the density + icon state through the Destroy() method

Or I suppose spawn() a check after the ..() and check if the usr is in THE VOID (usr.z == 0). If it is, warp it back to that location.
Huh, you're a genius i already knew it was a void. But the Destroy() proc is it built in.

EDIT:
i'm dumb thank you so much i get what you are saying :) i totally understand.

Turning things to dirt totally works.

The code doesn't seem to be working i'm doing something wrong.
mob
Bump(var/atom/A)
var/BeforeZ = src.z
var/BeforeX = src.x
var/BeforeY = src.y
..()
if(istype(A, /mob))
var/mob/M = A
if(src.Chidori)
if(M.Rasengan)
if(z == 0)
src.loc = locate(BeforeX,BeforeY,BeforeZ)
new/obj/Fusion(loc)
walk_away(src,M,5)
walk_away(M,src,5)
..()
I'm now a fan. :)