ID:144911
 
Code:
mob/enemies/Cannodumb
icon='enemies.dmi'
name = "Cannodumb"
icon_state = "cannodum"
hp = 55
maxhp = 55
player = 0
var/mob/you/P
invisshot()





area/MonsterBlock
Enter(mob/M)
if(ismob(M))
if(M.client) return ..()
else return 0
else return ..()






mob
proc
invisshot()
set background=1
var/obj/H = new/obj/invisshot
if(src.fired == 0)
src.fired = 1
spawn()
src.fired = 0
H.dir = src.dir
H.loc = src.loc
while(H)
walk(H,H.dir)
var/turf/T = H.loc
if(T.density == 1)
del(H)
break
for(var/mob/M as mob in T)
if(M == src)
cannodumattack()




mob
proc
cannodumattack()
set background=1
var/obj/K = new/obj/cannodumattack
if(src.fired == 0)
src.fired = 1
spawn()
src.fired = 0
K.dir = src.dir
K.loc = src.loc
var/damage = 60
while(K)
walk(K,K.dir)
var/turf/F = K.loc
if(F.density == 1)
del(K)
break
for(var/mob/M as mob in F)
if(M == src)
continue
if(M.client)
M.hp -= damage
src <<"Cannodum hits [M] for [damage]!"
M <<"You are being attacked by [src]!"
src.level_up()
M.death_check(src)


Problem description:it doesnt work it has no errors or warnings but the invisshot proc doesnt work and if that dont work then cannodumattack proc wont work

i think its the if(src.fired == 0)
i want it to shoot automattically
but how??
In response to Dazz513
get rid of the src == 0 and src == 1

if(var==1) // Wrong

if(var) // Right
In response to Talion Knight
And for 0
if(var==0)//wrong


if(!var)//right


You should look up boolean? variables.
In response to Talion Knight
No. Well, technically, in this case, yes -- it is correct. But, why, did you, just why, did you tell him that whenever you need to check if the var is 1 he should do <code>if(var)</code>? And why did you only tell a third of the story? For FALSE vars, you need to do <code>if(!var)</code>, and why didn't you tell that these things should be used when dealing with boolean variables(vars that never get to contain an amount higher than 1. TRUE or FALSE, in other words)? If you are helping, then do it properly. If you're too lazy for the entire story or you lack DM knowledge of what you explained(not offensively meant), then be sure not to explain.

O-matic
In response to O-matic
no offense taken, but I was just skimming over his code and that stood out.