ID:272685   Dec 3 2008, 10:07 am I wasn't sure if this would go somewhere else, so I picked the one I thought it would mostly go under. My question is pretty much said in the Topic name. obj/Weaponry density = 1 layer = MOB_LAYER Kunai name = "Kunai" icon = 'Kunai.dmi' Bump(A) var/mob/O = src.Owner if(istype(A,/mob/)) var/mob/M = A var/dmg = round(O.KunaiSkill + O.Taijutsu) M.Health -= dmg view(M)<<"[M] was hit by a [src] for [dmg]" M.Death(O) if(istype(A,/obj/)) var/obj/X = A if(X.density) del(src) if(istype(A,/turf/)) var/turf/T = A if(T.density) del(src) verb Drop() for(var/obj/Weaponry/Kunai/K in usr.contents) if(K.Amount < 1) del(src) else var/drop = input("How many do you want to drop?\nYou have [src.Amount] [src]","Drop") as num|null if(drop < 1 || drop > src.Amount) return src.Amount -= drop var/obj/Weaponry/Kunai/D = new/obj/Weaponry/Kunai D.loc = locate(usr.x,usr.y,usr.z) D.Amount = drop if(src.Amount == 0) del(src) usr.AutoSave() Get() set src in oview(1) for(var/obj/Weaponry/Kunai/K in usr.contents) Amount += 1 if(Amount < 1) Move(usr) else for(var/obj/Weaponry/Kunai/X in usr.contents) X.Amount = src.Amount X.name = "[src] ([X.Amount])" del(src) usr.AutoSave()
 <-> Dec 3 2008, 10:38 am Code what, exactly ? I noticed a few things just by skimming through it. var/obj/Weaponry/Kunai/D = new/obj/Weaponry/Kunai D.loc = locate(usr.x,usr.y,usr.z)// should bevar/obj/Weaponry/Kunai/D = new(usr.loc) Lack of boolean variables.(DROP() verb)
 <-> Dec 3 2008, 10:43 am In response to Andre-g1 Is that the only improvement I could make to this snippet?
 <-> Dec 3 2008, 10:56 am In response to Mizukouken Ketsu You can also avoid all of the typecasting(except the mob one) by making the Bump() argument, atom/A.
 <-> Dec 3 2008, 10:59 am In response to Andre-g1 Like that? Bump(atom/A) var/mob/O = src.Owner if(istype(A,/mob/)) var/dmg = round(O.KunaiSkill + O.Taijutsu) A.Health -= dmg view(A)<<"[A] was hit by a [src] for [dmg]" A.Death(O) if(istype(A,/obj/)) if(A.density) del(src) if(istype(A,/turf/)) if(A.density) del(src)
 <-> Dec 3 2008, 11:01 am In response to Mizukouken Ketsu It should error you on the mob if I'm not mistaken.
 <-> Dec 3 2008, 11:03 am In response to Andre-g1 Oh okay I reread your previeous post and I got it. Thanks.
 <-> Dec 3 2008, 3:25 pm ([link]) Ended up with 2 topics with the same code, eh. >,>
 <-> Dec 3 2008, 3:56 pm In response to Kaioken Ha. Yeah, I guess. Only the other one is the one where I had a coding problem. The one on here is for "improvements" xD. Looks like you did both in one post and just posted in the thread you happened to be in ;p