Here is the runtime error
runtime error: Cannot read null.HP
proc name: attrand (/mob/proc/attrand)
source file: RPG.dm,341
usr: DBZFreak (/mob/man)
src: DBZFreak (/mob/man)
call stack:
DBZFreak (/mob/man): attrand(null)
DBZFreak (/mob/man): randbattle(null)
the grass (10,7,1) (/turf/randbattle/grass): Entered(DBZFreak (/mob/man), the grass (10,8,1) (/turf/randbattle/grass))
runtime error: Cannot execute null.attrand().
proc name: randbattle (/mob/proc/randbattle)
source file: RPG.dm,348
usr: DBZFreak (/mob/man)
src: DBZFreak (/mob/man)
call stack:
DBZFreak (/mob/man): randbattle(null)
the grass (10,7,1) (/turf/randbattle/grass): Entered(DBZFreak (/mob/man), the grass (10,8,1) (/turf/randbattle/grass))
Here is the code with the lines 341 and 348 highlighted
turf/randbattle/grass
icon='turfs.dmi'
icon_state="grass"
Entered()
if(battle==0)
var/random=rand(1,20)
if(random==20)
new/mob/jester(5,6,2)
usr.loc=locate(6,6,2)
usr.Lock(usr)
usr.dir=WEST
usr.randbattle()
mob/proc/attrand(mob/M in oview(1))
M.HP-=usr.str
var/battle=0
mob/var/list/randbattle=list("Attack","Weapon","Run","Item")
mob/proc/randbattle(mob/M in oview(5))
switch(input("What to do")in randbattle)
if("Attack")
usr.attrand(M)
M.attrand(usr)
spawn(3)
randbattle()
ID:261520
Jun 5 2002, 5:34 pm
|
|
In response to Zagreus
|
|
Thanks, but no thanks I figured it out a couple minutes ago. But thanks anyways
|
also, even if it's not the solution (should be), it's still good practice to pass arguments to your procs instead of doing M.blah() usr.blech() try using blah(M) and then defining your proc as mob/proc/blah(mob/attacker).
The order of things is based on the order you send em in to, so if you had a proc/blech(mob/attacker, mob/defender)
and called blech(M, usr), then M would be atatcker usr would be defender.