src not being called as a mob? in Developer Help
|
|
Code:
if(istype(src,/mob/)) if(D.pixel_y >= 22) if(D.pixel_x >= 11&&D.pixel_x <= 21) view() << "[usr] just made headshot!" var/random = rand(1,2) if(random == 1) src.health = 0 view() << "[usr] just made headshot on [src] and it was fatal!" src.death() else var/damage = rand(100,120) view() << "[usr] just made headshot on [src] for [damage] damage!" src.death() else return
|
Problem description: Thats not the whole code but thats everything that has to do with why its not working, it says health and death are undefined procs and variables because src is not being called as a mob, any ideas?
EDIT: I know that in the second part of the code I didn't subtract src's health, I just did that right now and it still doesn't have any effect on the code so that has nothing to do with it.
Incase you just HAVE to see the whole code here it is:
atom Click(location,info,infot) var/n = 0 var/ix = "" var/iy = "" var/simb = 0 var/tx = "[infot]" var/textcommand = "" if(textcommand == "") while(n <= length(tx)) n += 1 var/p = "[copytext(tx,n,n+1)]" if(isnum(text2num("[p]"))) if(simb == 0) ix = "[ix][p]" else if(simb == 1) iy = "[iy][p]" else if(p == ";") simb += 1 if(simb > 1) break if(istype(src,/obj/planes/)||istype(src,/obj/tank/)||istype(src,/obj/sand/)||istype(src,/obj/grass/)||istype(src,/obj/flags/)||istype(src,/obj/snow/)||istype(src,/obj/red/)||istype(src,/obj/crhud/)) ..() return if(usr.weapon) var/obj/Pickup/Guns/G=usr.weapon if(G.ACapacity >= 1) G.ACapacity -= 1 var/obj/Dot/D=new /obj/Dot D.loc=location D.pixel_x=text2num("[ix]")-2 D.pixel_y=text2num("[iy]")-2 D.pixel_x += src:pixel_x D.pixel_y += src:pixel_y if(istype(src,/obj/)) D.loc = src.loc if(istype(src,/mob/)) if(D.pixel_y >= 22) if(D.pixel_x >= 11&&D.pixel_x <= 21) view() << "[usr] just made headshot!" var/random = rand(1,2) if(random == 1) src.health = 0 view() << "[usr] just made headshot on [src] and it was fatal!" src.death() else var/damage = rand(100,120) src.health -= damage view() << "[usr] just made headshot on [src] for [damage] damage!" src.death() else return if(D.pixel_y >= 19&&D.pixel_y <= 22) if(D.pixel_x >= 11&&D.pixel_x <= 21) var/damage = rand(50,80) src.health -= damage view() << "[usr] just made chestshot on [src] for [damage]!" src.death() if(D.pixel_y >= 2&&D.pixel_y <= 19) if(D.pixel_x >= 11&&D.pixel_x<=21) view() << "[usr] just made a legshot!" var/damage = rand(20,30) src.health -= damage src.death() else usr<<"<b>You need more ammo!" return else usr<<"<b>You do not have a weapon equipped!" return
|
DISCLAIMER: This is NOT my code, however it was edited by me to work as a manual aimer for guns, incase someone preferred manual accuracy over unaccurate auto.
|
Scratch that, it worked.