ID:264420
 
Code:
    else
var/found=0
var/turf/grabturret=locate(src.x+src.truedir,src.y,src.z)
for(var/mob/Turret2/T in grabturret)
if(T.truedir==src.truedir)
T.WeaponShoot(round(6*usr.damagefactor),'Turret2Shot.dmi','sfx-softfire.wav',6,8,0,8,bowner=usr.key)
found=1
break
if(found==0)

mob/proc
WeaponShoot(pdamage=round(src.damage*src.damagefactor),picon='Shot 1.dmi',var/sound/sound=null,soundfalloff=6,wrng=12,cost=0,pattern=0,speed=1,w_attribute="",var/bowner="")
if(src.Fight == 1) // THIS Line is the one generating the error


runtime error: Cannot read null.Fight
proc name: WeaponShoot (/mob/proc/WeaponShoot)
source file: Weapons.dm,4
usr: Mista-mage123 (/mob)
src: Defence Turret (/mob/Turret2/Aim_Left)
call stack:




Problem description:

For some reason, when calling this proc, anytime i use 'src', it bugs out. However, using 'usr' seems to work, just 'usr' couldn't be used in this scenario because the proc has to be performed by the NPC


Good luck, dude. >_> This is pretty much a BYOND problem.
Try:
-Looking for New() overrides related to the object in question (type /mob/Turret2/Aim_Left) that might've been clogged up. Preventing a New() from returning can lead to Random Misc Badness.
-Try sticking a[n] if(!src)* check before the culprit line, perhaps include a debug line there.
*Uhm, if that doesn't help, putting ASSERT(src) instead might. Or if not, at least it will make you feel better.
-For the hell of it, change your proc to use less or no arguments, at least temporarily. This shouldn't be a problem, but might as well give it a shot.
-Scan your code for random, miscellaneous bad code, mistakes, or Bad Things, and fix them. Might solve the problem (even if not, it still benefits you).

When I encountered such a problem, it basically took arbitrary changes to the relevant code and as such to get rid of it; I don't really know exactly what patterns or actions can cause it (other than the New() thing, anyway), so yeah, good luck. Maybe someone else will be able to help more.