ID:263165
 
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.Attack(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






Problem description:

you can attack the mobs but they don't fight back and you can't attack other players.
No put usr in proc, ungh.
In response to Mysame
what dose that mean?
In response to Archfiend Master
In a proc, usr won't work like it will in a verb.
In this case you'll want to use src instead of usr.
In response to Artekia
well i changed it and it still don't work
In response to Archfiend Master
Thats not going to fix your problem maybe if you coded this battle system yourself you would understand it..