ID:264312
 
Code:
obj/projectile
var/damage=0
var/owner
var/odir
var/delay=3
proc/Effect(mob/A)
A.hp -= damage
A.mhp += damage/2
viewers(A) << "[A] has been hit by [src.owner]'s spell!"
A.Deathcheck()

Incendio
icon='attacks.dmi'
icon_state = "fireball"
oicon='attacks.dmi'
oiconstate="fireball"


density=1
damage=15
luminosity=3

Bump(A)
if(ismob(A))
Effect(A)
if(A.cfire==1)
src.damage=0
if(A.hice==1)
src.damage=30
..()
del src
else
viewers(A) << "[A] has been hit by a poorly aimed spell!"
del src
mob/var
cfire=0
hice=0


Problem description: Okay, when I compile I get the following error:

Programming\Objects-Turf.dm:369:error:A.cfire:undefined var
Programming\Objects-Turf.dm:371:error:A.hice:undefined var

Around the:

if(A.cfire==1)
src.damage=0
if(A.hice==1)
src.damage=30


And am not completely sure why. Can somebody please tell me what I'm doing wrong?
The variable A contains a mob at that point, but you aren't using it like a mob. Basically, things can happily be of a particular type (Say ... /mob/Player for example) however you treat them as the type of the variable (Say ... var/mob/P).

So in your case, var/A is a variable of no particular type. ismob(A) returns true because it does contain a /mob, but you can only use A as the type it is (un-typed). You can get around this by type-casting:

if (ismob(A))
var/mob/M = A
if (M.cfire == 1)
src.damage = 0


Basically, we're not changing that actual 'thing' at all by doing this, we're just changing the way we look at it. It was a /mob all along (hence ismob(A) returns true), the code just never looked at it as a /mob until we type-casted it.
In response to Stephen001
I see. I thought it would be something along those lines, I just wasn't completely sure how to fix it without putting in too much - and at the same time I didn't want it to be true, so I sent it up here. Thanks for your help!