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//atom = mob, obj, and turf(maybe area, idk...)
Click(location,info,infot)
var/n = 0//jsut a variable
var/ix = ""//ix = icon_x
var/iy = ""//iy = icon_y(just names I desided to name the commen variables
var/simb = 0
var/tx = "[infot]"//this turns the infot into a text
var/textcommand = ""
if(textcommand == "")//If you had the right mouse butten held down
while(n <= length(tx))//this is a while
n += 1//adds 1 to the n variable
var/p = "[copytext(tx,n,n+1)]"//makes p = the letter its on(basicly, scans threw to set the ix, and iy
if(isnum(text2num("[p]")))//if its a number....
if(simb == 0)//this is basicly just to make sure its at the right location >.<
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//makes object
D.loc=location//sends object to that location inwhich was clicked
D.pixel_x=text2num("[ix]")-2//-2 because the icon isnt exactly in the left bottem corner
D.pixel_y=text2num("[iy]")-2//same for this
D.pixel_x += src:pixel_x//adds the object's pixels to the Point being made
D.pixel_y += src:pixel_y
if(istype(src,/obj/))//if you click an object
D.loc = src.loc//Will make the location, the obj's location
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.