problem with battle system
|
|
Code:
mob proc Wander() if(usr.client) return else walk_rand(src,8) MonRun() spawn(10) Wander() MonRun() if(usr.client) return else for(var/mob/M in oview(5,usr)) if(M.client) if(get_dist(usr,M) <= 5 && usr.Health < usr.Maxhealth/2) walk_away(usr,M,5,7) else MonWalk() else continue MonWalk() if(usr.client) return 0 else for(var/mob/M in oview(5,usr)) if(M.client) if(get_dist(usr,M) <= 5) walk_to(usr,M,1,7) MonCheck(M) break else continue else continue MonCheck(var/mob/Player/) if(get_dist(usr,Player) <= 1 && get_step(usr,src.dir)) if(!usr.client) sleep(5) if(Player.dead) usr.Wander() else usr.MonsterAttack(Player) else return mob verb Attack() set category = "Combat" for(var/mob/M in get_step(usr,usr.dir)) if(!M.client) if(M.mon) if(!M.dead) var/dmg = usr.Attack - M.Defense usr<<"You did [dmg] damage to [M]" M.Health -= dmg if(M.Health <= 0) usr.Exp += M.ExpG usr.Gold += M.GoldG usr<<"<b>You gained [M.ExpG] exp and [M.GoldG] gold!!!!</b>" usr.LevelUp() del(M) return ..() proc LevelUp() if(usr.Exp >= usr.Maxexp) usr.Level += 1 var/s = rand(1,3) usr.Attack += s var/d = rand(1,5) usr.Defense += d var/e = rand(25,50) usr.Maxexp += e usr<<"<b>You leveled up</b>" usr<<"You gained [s] Attack" usr<<"You gained [d] Defense" usr.Exp = 0
MonsterAttack(var/mob/Player/P.mob/monsters/C) var/damage = Attack - P.Defense P.Health += damage P<<"The enemy did [damage] damage to you" if(P.Health <= 0) P.Health = P.Maxhealth P.loc = locate(1,1,1) else ..()
mob monsters mon = 1 Slime icon = 'Earth.dmi' icon_state = "" density = 1 Health = 5 Maxhealth = 5 Attack = 100 Defense = 0 ExpG = 10 GoldG = 20 New() sleep(10) Wander() ..() Bump(mob/M) if(!M.client) if(M.player) if(!M.dead) MonsterAttack() return ..()
|
Problem description:
i keep getting these errors
Battle_Skills\battle system.dm:81:error:P.Defense:undefined type: P.Defense
Battle_Skills\battle system.dm:82:error:P.Health:undefined type: P.Health
Battle_Skills\battle system.dm:83:error:P:undefined type: P
Battle_Skills\battle system.dm:84:error:P.Health:undefined type: P.Health
Battle_Skills\battle system.dm:85:error:P.Health:undefined type: P.Health
Battle_Skills\battle system.dm:85:error:P.Maxhealth:undefined type: P.Maxhealth
Battle_Skills\battle system.dm:86:error:P.loc:undefined type: P.loc
|
You also should lose the separate attack procs; there should be only one.
Lummox JR