Code:
mob
var
Wild
wandering
mob
proc
Pokemon_Spawn()
for(var/mob/client in oview())
if(usr.Wild==1)
return
if(prob(15))
var/mob/Pokemon/Poochyena/S=new()
S.loc=(locate(src.x, src.y-1, src.z))
S.wandering=1
S.Wander()
var/H=rand(30,200)
var/St=rand(30,100)
var/D=rand(20,100)
var/L=rand(2,20)
S.hp=H
S.str=St
S.def=D
S.maxhp=H
S.level=L
usr<<"Wild [S] poped up out of no where!"
sleep(150)
usr.Wild=0
if(S.owner==usr)
return
else
del(S)
return
return
mob
proc
Wander()
if(src.wandering==0)
return
else
var/w=rand(1,6)
if(w==1)step(src,NORTH)
if(w==2)step(src,SOUTH)
if(w==3)step(src,EAST)
if(w==4)step(src,WEST)
spawn(15)src.Wander()
Problem description:
Okay i fixed the inconsistent errors i just wasnt looking lol
now i got some new problems thos
Spawn.dm:31:error: S.owner: undefined var
Spawn.dm:34:error: S: undefined var
Spawn.dm:14:error: : invalid expression
ID:138973
Aug 21 2011, 11:34 pm
|
|
In response to Lugia319
|
|
My Two Cents : Don't use usr in proc's. You'll soon release that usr and src are not always interchangeable in processes. In processes everything without a tag is by default interpreted to be from the src so no tag is required.
|
Dazzer wrote:
Code: > mob Problem description:Please use DM Tags. |
Your errors occur because you are using S in a way that can be reached without S actually being defined.
The code above is similar to what you're doing. M was defined in an if statement. When I try to compile this it'll say M undefined in the else. M was not defined for the else, only the if. So the variable is undefined.