ID:263155
 
Code:
mob
proc
Wander()
if(usr.client)//Makes it so you don't wander
return
else
walk_rand(src,8)//The enemy randomly will walk
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))//This makes it so you have to be facing your opponent to attack
if(!M.client)//Checks to see if the opponent is a npc or player
if(M.mon)//Checks to see if the opponent is an enemy
if(!M.dead)//Checks to see if the enemy is dead or not
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
//the problem is the monster attack mostly
MonsterAttack(var/mob/Player/P.mob/monsters/C)
var/damage = Attack - P.Defense
P.Health += damage//If you actually know how to code you would think this would add hp to the mob, but for some reason it doesn't it does dmg
P<<"The enemy did [damage] damage to you"
if(P.Health <= 0)
P.Health = P.Maxhealth
P.loc = locate(1,1,1)
else
..()

// the mob code is this
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 the monster bumps into you it will attack
if(!M.client)
if(M.player)//Checks to see if the opponent is a player
if(!M.dead)//Checks to see if the player is dead or not
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
No put usr in proc. Ungh.

You also should lose the separate attack procs; there should be only one.

Lummox JR
In response to Lummox JR
Lummox JR wrote:
No put usr in proc. Ungh.

(for more on that, see the bwicki page UsrLecture =P)