ID:141688
 
Code:
mob
verb
Exploding_Tag(mob/M as mob in oview(2))
set category = "Spells"
var/obj/ExplodingTag/Tag1=new/obj/ExplodingTag/Tag1(locate(usr.x,usr.y,usr.z))
sleep(10)
del(Tag1)
var/obj/ExplodingTag/ExpTag/A=new/obj/ExplodingTag/ExpTag(locate(usr.x-1,usr.y,usr.z))
var/obj/ExplodingTag/ExpTag/B=new/obj/ExplodingTag/ExpTag(locate(usr.x-2,usr.y,usr.z))
var/obj/ExplodingTag/ExpTag/C=new/obj/ExplodingTag/ExpTag(locate(usr.x,usr.y-1,usr.z))
var/obj/ExplodingTag/ExpTag/D=new/obj/ExplodingTag/ExpTag(locate(usr.x,usr.y-2,usr.z))
var/obj/ExplodingTag/ExpTag/E=new/obj/ExplodingTag/ExpTag(locate(usr.x-1,usr.y-1,usr.z))
var/obj/ExplodingTag/ExpTag/F=new/obj/ExplodingTag/ExpTag(locate(usr.x-2,usr.y-1,usr.z))
var/obj/ExplodingTag/ExpTag/G=new/obj/ExplodingTag/ExpTag(locate(usr.x-1,usr.y-2,usr.z))
var/obj/ExplodingTag/ExpTag/H=new/obj/ExplodingTag/ExpTag(locate(usr.x-2,usr.y-2,usr.z))
var/obj/ExplodingTag/ExpTag/I=new/obj/ExplodingTag/ExpTag(locate(usr.x+1,usr.y,usr.z))
var/obj/ExplodingTag/ExpTag/J=new/obj/ExplodingTag/ExpTag(locate(usr.x+2,usr.y,usr.z))
var/obj/ExplodingTag/ExpTag/K=new/obj/ExplodingTag/ExpTag(locate(usr.x,usr.y+1,usr.z))
var/obj/ExplodingTag/ExpTag/L=new/obj/ExplodingTag/ExpTag(locate(usr.x,usr.y+2,usr.z))
var/obj/ExplodingTag/ExpTag/Z=new/obj/ExplodingTag/ExpTag(locate(usr.x+1,usr.y+1,usr.z))
var/obj/ExplodingTag/ExpTag/N=new/obj/ExplodingTag/ExpTag(locate(usr.x+2,usr.y+1,usr.z))
var/obj/ExplodingTag/ExpTag/O=new/obj/ExplodingTag/ExpTag(locate(usr.x+1,usr.y+2,usr.z))
var/obj/ExplodingTag/ExpTag/P=new/obj/ExplodingTag/ExpTag(locate(usr.x+2,usr.y+2,usr.z))
var/obj/ExplodingTag/ExpTag/Q=new/obj/ExplodingTag/ExpTag(locate(usr.x-1,usr.y+1,usr.z))
var/obj/ExplodingTag/ExpTag/R=new/obj/ExplodingTag/ExpTag(locate(usr.x-1,usr.y+2,usr.z))
var/obj/ExplodingTag/ExpTag/S=new/obj/ExplodingTag/ExpTag(locate(usr.x-2,usr.y+1,usr.z))
var/obj/ExplodingTag/ExpTag/T=new/obj/ExplodingTag/ExpTag(locate(usr.x-2,usr.y+2,usr.z))
var/obj/ExplodingTag/ExpTag/U=new/obj/ExplodingTag/ExpTag(locate(usr.x+1,usr.y-1,usr.z))
var/obj/ExplodingTag/ExpTag/V=new/obj/ExplodingTag/ExpTag(locate(usr.x+2,usr.y-1,usr.z))
var/obj/ExplodingTag/ExpTag/W=new/obj/ExplodingTag/ExpTag(locate(usr.x+1,usr.y-2,usr.z))
var/obj/ExplodingTag/ExpTag/X=new/obj/ExplodingTag/ExpTag(locate(usr.x+2,usr.y-2,usr.z))
var/damage = mpower * rand(1,3)
if(M.x == usr.x-1 || M.y == usr.y || M.z == usr.z)
M.health -= damage
view() << "[M] was just hit for [damage] by [usr]"
M.deathcheck()
if(M.x == usr.x-2 || M.y == usr.y || M.z == usr.z)
M.health -= damage
view() << "[M] was just hit for [damage] by [usr]"
M.deathcheck()
if(M.x == usr.x || M.y == usr.y-1 || M.z == usr.z)
M.health -= damage
view() << "[M] was just hit for [damage] by [usr]"
M.deathcheck()
if(M.x == usr.x || M.y == usr.y-2 || M.z == usr.z)
M.health -= damage
view() << "[M] was just hit for [damage] by [usr]"
M.deathcheck()
if(M.x == usr.x-1 || M.y == usr.y-1 || M.z == usr.z)
M.health -= damage
view() << "[M] was just hit for [damage] by [usr]"
M.deathcheck()
if(M.x == usr.x-1 || M.y == usr.y-2 || M.z == usr.z)
M.health -= damage
view() << "[M] was just hit for [damage] by [usr]"
M.deathcheck()
if(M.x == usr.x-2 || M.y == usr.y-1 || M.z == usr.z)
M.health -= damage
view() << "[M] was just hit for [damage] by [usr]"
M.deathcheck()
if(M.x == usr.x-2 || M.y == usr.y-2 || M.z == usr.z)
M.health -= damage
view() << "[M] was just hit for [damage] by [usr]"
M.deathcheck()
if(M.x == usr.x+1 || M.y == usr.y || M.z == usr.z)
M.health -= damage
view() << "[M] was just hit for [damage] by [usr]"
M.deathcheck()
if(M.x == usr.x+2 || M.y == usr.y || M.z == usr.z)
M.health -= damage
view() << "[M] was just hit for [damage] by [usr]"
M.deathcheck()
if(M.x == usr.x-1 || M.y == usr.y || M.z == usr.z)
M.health -= damage
view() << "[M] was just hit for [damage] by [usr]"
M.deathcheck()
if(M.x == usr.x || M.y == usr.y+1 || M.z == usr.z)
M.health -= damage
view() << "[M] was just hit for [damage] by [usr]"
M.deathcheck()
if(M.x == usr.x || M.y == usr.y+2 || M.z == usr.z)
M.health -= damage
view() << "[M] was just hit for [damage] by [usr]"
M.deathcheck()
if(M.x == usr.x+1 || M.y == usr.y || M.z == usr.z)
M.health -= damage
view() << "[M] was just hit for [damage] by [usr]"
M.deathcheck()
if(M.x == usr.x+2 || M.y == usr.y || M.z == usr.z)
M.health -= damage
view() << "[M] was just hit for [damage] by [usr]"
M.deathcheck()
if(M.x == usr.x+1 || M.y == usr.y+1 || M.z == usr.z)
M.health -= damage
view() << "[M] was just hit for [damage] by [usr]"
M.deathcheck()
if(M.x == usr.x+1 || M.y == usr.y+2 || M.z == usr.z)
M.health -= damage
view() << "[M] was just hit for [damage] by [usr]"
M.deathcheck()
if(M.x == usr.x+2 || M.y == usr.y+1 || M.z == usr.z)
M.health -= damage
view() << "[M] was just hit for [damage] by [usr]"
M.deathcheck()
if(M.x == usr.x+2 || M.y == usr.y+2 || M.z == usr.z)
M.health -= damage
view() << "[M] was just hit for [damage] by [usr]"
M.deathcheck()
if(M.x == usr.x-1 || M.y == usr.y+1 || M.z == usr.z)
M.health -= damage
view() << "[M] was just hit for [damage] by [usr]"
M.deathcheck()
if(M.x == usr.x-1 || M.y == usr.y+2 || M.z == usr.z)
M.health -= damage
view() << "[M] was just hit for [damage] by [usr]"
M.deathcheck()
if(M.x == usr.x-2 || M.y == usr.y+1 || M.z == usr.z)
M.health -= damage
view() << "[M] was just hit for [damage] by [usr]"
M.deathcheck()
if(M.x == usr.x-2 || M.y == usr.y+2 || M.z == usr.z)
M.health -= damage
view() << "[M] was just hit for [damage] by [usr]"
M.deathcheck()
if(M.x == usr.x+1 || M.y == usr.y-1 || M.z == usr.z)
M.health -= damage
view() << "[M] was just hit for [damage] by [usr]"
M.deathcheck()
if(M.x == usr.x+2 || M.y == usr.y-1 || M.z == usr.z)
M.health -= damage
view() << "[M] was just hit for [damage] by [usr]"
M.deathcheck()
if(M.x == usr.x+1 || M.y == usr.y-2 || M.z == usr.z)
M.health -= damage
view() << "[M] was just hit for [damage] by [usr]"
M.deathcheck()
if(M.x == usr.x+2 || M.y == usr.y-2 || M.z == usr.z)
M.health -= damage
view() << "[M] was just hit for [damage] by [usr]"
M.deathcheck()
sleep(10)
del(A)
del(B)
del(C)
del(D)
del(E)
del(F)
del(G)
del(H)
del(I)
del(J)
del(K)
del(L)
del(Z)
del(N)
del(O)
del(P)
del(Q)
del(R)
del(S)
del(T)
del(U)
del(V)
del(W)
del(X)


Problem description:
When i use the tag it attacks but attacks the same target about 10 times, i know i'm using the || operator wrong but i dont remember what to put instead since i just started coding for the first time in 3 years.
Agh, my eyes! >_<
In response to Kaiochao
yea i know lol i've gotten horrible :D
In response to Scarymonkeys623
*Bump*
mob
verb
Exploding_Tag(mob/M as mob in oview(2))
set category = "Spells"
var/obj/ExplodingTag/Tag1=new/obj/ExplodingTag/Tag1(locate(usr.x,usr.y,usr.z))
sleep(10)
del(Tag1)
var/obj/ExplodingTag/ExpTag/A=new/obj/ExplodingTag/ExpTag(locate(usr.x-1,usr.y,usr.z))
var/obj/ExplodingTag/ExpTag/B=new/obj/ExplodingTag/ExpTag(locate(usr.x-2,usr.y,usr.z))
var/obj/ExplodingTag/ExpTag/C=new/obj/ExplodingTag/ExpTag(locate(usr.x,usr.y-1,usr.z))
var/obj/ExplodingTag/ExpTag/D=new/obj/ExplodingTag/ExpTag(locate(usr.x,usr.y-2,usr.z))
var/obj/ExplodingTag/ExpTag/E=new/obj/ExplodingTag/ExpTag(locate(usr.x-1,usr.y-1,usr.z))
var/obj/ExplodingTag/ExpTag/F=new/obj/ExplodingTag/ExpTag(locate(usr.x-2,usr.y-1,usr.z))
var/obj/ExplodingTag/ExpTag/G=new/obj/ExplodingTag/ExpTag(locate(usr.x-1,usr.y-2,usr.z))
var/obj/ExplodingTag/ExpTag/H=new/obj/ExplodingTag/ExpTag(locate(usr.x-2,usr.y-2,usr.z))
var/obj/ExplodingTag/ExpTag/I=new/obj/ExplodingTag/ExpTag(locate(usr.x+1,usr.y,usr.z))
var/obj/ExplodingTag/ExpTag/J=new/obj/ExplodingTag/ExpTag(locate(usr.x+2,usr.y,usr.z))
var/obj/ExplodingTag/ExpTag/K=new/obj/ExplodingTag/ExpTag(locate(usr.x,usr.y+1,usr.z))
var/obj/ExplodingTag/ExpTag/L=new/obj/ExplodingTag/ExpTag(locate(usr.x,usr.y+2,usr.z))
var/obj/ExplodingTag/ExpTag/Z=new/obj/ExplodingTag/ExpTag(locate(usr.x+1,usr.y+1,usr.z))
var/obj/ExplodingTag/ExpTag/N=new/obj/ExplodingTag/ExpTag(locate(usr.x+2,usr.y+1,usr.z))
var/obj/ExplodingTag/ExpTag/O=new/obj/ExplodingTag/ExpTag(locate(usr.x+1,usr.y+2,usr.z))
var/obj/ExplodingTag/ExpTag/P=new/obj/ExplodingTag/ExpTag(locate(usr.x+2,usr.y+2,usr.z))
var/obj/ExplodingTag/ExpTag/Q=new/obj/ExplodingTag/ExpTag(locate(usr.x-1,usr.y+1,usr.z))
var/obj/ExplodingTag/ExpTag/R=new/obj/ExplodingTag/ExpTag(locate(usr.x-1,usr.y+2,usr.z))
var/obj/ExplodingTag/ExpTag/S=new/obj/ExplodingTag/ExpTag(locate(usr.x-2,usr.y+1,usr.z))
var/obj/ExplodingTag/ExpTag/T=new/obj/ExplodingTag/ExpTag(locate(usr.x-2,usr.y+2,usr.z))
var/obj/ExplodingTag/ExpTag/U=new/obj/ExplodingTag/ExpTag(locate(usr.x+1,usr.y-1,usr.z))
var/obj/ExplodingTag/ExpTag/V=new/obj/ExplodingTag/ExpTag(locate(usr.x+2,usr.y-1,usr.z))
var/obj/ExplodingTag/ExpTag/W=new/obj/ExplodingTag/ExpTag(locate(usr.x+1,usr.y-2,usr.z))
var/obj/ExplodingTag/ExpTag/X=new/obj/ExplodingTag/ExpTag(locate(usr.x+2,usr.y-2,usr.z))
var/damage = mpower * rand(1,3)
if(M.loc == A.loc)
M.health -= damage
view() << "[M] was just hit for [damage] by [usr]"
M.deathcheck()
if(M.loc == B.loc)
M.health -= damage
view() << "[M] was just hit for [damage] by [usr]"
M.deathcheck()
if(M.loc == C.loc)
M.health -= damage
view() << "[M] was just hit for [damage] by [usr]"
M.deathcheck()
if(M.loc == D.loc)
M.health -= damage
view() << "[M] was just hit for [damage] by [usr]"
M.deathcheck()
if(M.loc == E.loc)
M.health -= damage
view() << "[M] was just hit for [damage] by [usr]"
M.deathcheck()
if(M.loc == F.loc)
M.health -= damage
view() << "[M] was just hit for [damage] by [usr]"
M.deathcheck()
if(M.loc == G.loc)
M.health -= damage
view() << "[M] was just hit for [damage] by [usr]"
M.deathcheck()
if(M.loc == H.loc)
M.health -= damage
view() << "[M] was just hit for [damage] by [usr]"
M.deathcheck()
if(M.loc == I.loc)
M.health -= damage
view() << "[M] was just hit for [damage] by [usr]"
M.deathcheck()
if(M.loc == J.loc)
M.health -= damage
view() << "[M] was just hit for [damage] by [usr]"
M.deathcheck()
if(M.loc == K.loc)
M.health -= damage
view() << "[M] was just hit for [damage] by [usr]"
M.deathcheck()
if(M.loc == L.loc)
M.health -= damage
view() << "[M] was just hit for [damage] by [usr]"
M.deathcheck()
if(M.loc == Z.loc)
M.health -= damage
view() << "[M] was just hit for [damage] by [usr]"
M.deathcheck()
if(M.loc == N.loc)
M.health -= damage
view() << "[M] was just hit for [damage] by [usr]"
M.deathcheck()
if(M.loc == O.loc)
M.health -= damage
view() << "[M] was just hit for [damage] by [usr]"
M.deathcheck()
if(M.loc == P.loc)
M.health -= damage
view() << "[M] was just hit for [damage] by [usr]"
M.deathcheck()
if(M.loc == Q.loc)
M.health -= damage
view() << "[M] was just hit for [damage] by [usr]"
M.deathcheck()
if(M.loc == R.loc)
M.health -= damage
view() << "[M] was just hit for [damage] by [usr]"
M.deathcheck()
if(M.loc == S.loc)
M.health -= damage
view() << "[M] was just hit for [damage] by [usr]"
M.deathcheck()
if(M.loc == T.loc)
M.health -= damage
view() << "[M] was just hit for [damage] by [usr]"
M.deathcheck()
if(M.loc == U.loc)
M.health -= damage
view() << "[M] was just hit for [damage] by [usr]"
M.deathcheck()
if(M.loc == V.loc)
M.health -= damage
view() << "[M] was just hit for [damage] by [usr]"
M.deathcheck()
if(M.loc == W.loc)
M.health -= damage
view() << "[M] was just hit for [damage] by [usr]"
M.deathcheck()
if(M.loc == X.loc)
M.health -= damage
view() << "[M] was just hit for [damage] by [usr]"
M.deathcheck()
sleep(10)
del(A)
del(B)
del(C)
del(D)
del(E)
del(F)
del(G)
del(H)
del(I)
del(J)
del(K)
del(L)
del(Z)
del(N)
del(O)
del(P)
del(Q)
del(R)
del(S)
del(T)
del(U)
del(V)
del(W)
del(X)

Ok i put it like that so its not attack the same person anymore but now its only attack one, what am i doing wrong?
In response to Scarymonkeys623
Not using a formula, and limiting the attack to only one person.

I strongly recommend reading this
In response to Jeff8500
Yes i know, i suck at coding since i've quitted for more than 2 years, i've forgot alot of the basics, but I have a new problem whenever i made it so taht the tag explodes except for the usr and it doesnt hurt the usr, but if the explosion hits the usr i get a error ingame saying "runtime error: Cannot read null.x
proc name: Exploding Tag (/mob/verb/Exploding_Tag)
source file: magic.dm,241
usr: Tony (/mob)
src: Tony (/mob)
call stack:
Tony (/mob): Exploding Tag()"

mob
verb
Exploding_Tag()
set category = "Spells"
var/obj/ExplodingTag/Tag1=new/obj/ExplodingTag/Tag1(locate(usr.x,usr.y,usr.z))
sleep(10)
Tag1.owner = src.key
var/list/LI = oview(Tag1, 3)
var/damage = mpower * rand(1,3)
for(var/mob/M in LI)
if(M.key!=Tag1.owner)
M.HP -= damage
view() << "[M] was just hit for [damage] by [usr]"
M.deathcheck()
del(Tag1)
var/obj/ExplodingTag/ExpTag/A=new/obj/ExplodingTag/ExpTag(locate(Tag1.x-1,Tag1.y,Tag1.z))
var/obj/ExplodingTag/ExpTag/B=new/obj/ExplodingTag/ExpTag(locate(Tag1.x-2,Tag1.y,Tag1.z))
var/obj/ExplodingTag/ExpTag/C=new/obj/ExplodingTag/ExpTag(locate(Tag1.x,Tag1.y-1,Tag1.z))
var/obj/ExplodingTag/ExpTag/D=new/obj/ExplodingTag/ExpTag(locate(Tag1.x,Tag1.y-2,Tag1.z))
var/obj/ExplodingTag/ExpTag/E=new/obj/ExplodingTag/ExpTag(locate(Tag1.x-1,Tag1.y-1,Tag1.z))
var/obj/ExplodingTag/ExpTag/F=new/obj/ExplodingTag/ExpTag(locate(Tag1.x-2,Tag1.y-1,Tag1.z))
var/obj/ExplodingTag/ExpTag/G=new/obj/ExplodingTag/ExpTag(locate(Tag1.x-1,Tag1.y-2,Tag1.z))
var/obj/ExplodingTag/ExpTag/H=new/obj/ExplodingTag/ExpTag(locate(Tag1.x-2,Tag1.y-2,Tag1.z))
var/obj/ExplodingTag/ExpTag/I=new/obj/ExplodingTag/ExpTag(locate(Tag1.x+1,Tag1.y,Tag1.z))
var/obj/ExplodingTag/ExpTag/J=new/obj/ExplodingTag/ExpTag(locate(Tag1.x+2,Tag1.y,Tag1.z))
var/obj/ExplodingTag/ExpTag/K=new/obj/ExplodingTag/ExpTag(locate(Tag1.x,Tag1.y+1,Tag1.z))
var/obj/ExplodingTag/ExpTag/L=new/obj/ExplodingTag/ExpTag(locate(Tag1.x,Tag1.y+2,Tag1.z))
var/obj/ExplodingTag/ExpTag/Z=new/obj/ExplodingTag/ExpTag(locate(Tag1.x+1,Tag1.y+1,Tag1.z))
var/obj/ExplodingTag/ExpTag/N=new/obj/ExplodingTag/ExpTag(locate(Tag1.x+2,Tag1.y+1,Tag1.z))
var/obj/ExplodingTag/ExpTag/O=new/obj/ExplodingTag/ExpTag(locate(Tag1.x+1,Tag1.y+2,Tag1.z))
var/obj/ExplodingTag/ExpTag/P=new/obj/ExplodingTag/ExpTag(locate(Tag1.x+2,Tag1.y+2,Tag1.z))
var/obj/ExplodingTag/ExpTag/Q=new/obj/ExplodingTag/ExpTag(locate(Tag1.x-1,Tag1.y+1,Tag1.z))
var/obj/ExplodingTag/ExpTag/R=new/obj/ExplodingTag/ExpTag(locate(Tag1.x-1,Tag1.y+2,Tag1.z))
var/obj/ExplodingTag/ExpTag/S=new/obj/ExplodingTag/ExpTag(locate(Tag1.x-2,Tag1.y+1,Tag1.z))
var/obj/ExplodingTag/ExpTag/T=new/obj/ExplodingTag/ExpTag(locate(Tag1.x-2,Tag1.y+2,Tag1.z))
var/obj/ExplodingTag/ExpTag/U=new/obj/ExplodingTag/ExpTag(locate(Tag1.x+1,Tag1.y-1,Tag1.z))
var/obj/ExplodingTag/ExpTag/V=new/obj/ExplodingTag/ExpTag(locate(Tag1.x+2,Tag1.y-1,Tag1.z))
var/obj/ExplodingTag/ExpTag/W=new/obj/ExplodingTag/ExpTag(locate(Tag1.x+1,Tag1.y-2,Tag1.z))
var/obj/ExplodingTag/ExpTag/X=new/obj/ExplodingTag/ExpTag(locate(Tag1.x+2,Tag1.y-2,Tag1.z))
sleep(10)
del(A)
del(B)
del(C)
del(D)
del(E)
del(F)
del(G)
del(H)
del(I)
del(J)
del(K)
del(L)
del(Z)
del(N)
del(O)
del(P)
del(Q)
del(R)
del(S)
del(T)
del(U)
del(V)
del(W)
del(X)
obj/var
owner

i know its really sloppy but can you help a little?

Edit: nevermind, i just noticed that I deleted the Tag1 before the explosions came, very small error =P
Okay, I'm definitely not looking through any of that, lest I get a freakin' migraine or something. What exactly are you trying to do? There's certainly a better way of doing it than that.
In response to Popisfizzy
I believe he wants some form of range() or a similar proc.
Try this:
for(var/turf/T in orange(2,usr.loc))
T.overlays += 'exptag.dmi'
for(var/mob/M in T)
M.Damage()


Remember, kids, for loops are your friends.