ID:177582
 
I'm having some problems with my code...

mob
PC
verb
Attack(mob/M in oview(1))
set category = "Combat"
var/Random_Hit = rand(1,2)
if(Random_Hit == 1)
var/Damage = rand(1,5)
if(M.Agility - usr.Agility > 0)
usr << "You punch [M] for [Damage]."
M.HP = M.HP - Damage
usr.Level_Up()
usr.Death_Check()
else
M << "You dodge [src]'s attack!"
usr << "[M] dodges your attack!"
if(Random_Hit == 2)
var/Damage = rand(1,5)
if(M.Agility - usr.Agility > 0)
usr << "You kick [M] for [Damage]."
M.HP = M.HP - Damage
usr.Level_Up()
usr.Death_Check()
else
M << "You dodge [src]'s attack!"
usr << "[M] dodges your attack!"

mob/NPC
Monster
icon = 'monsters.dmi'
Level = 1
HP = 5
Max_HP = 5
MP = 2
Max_MP = 2
New()
.=..()
spawn()
Wander()
Bump(mob/M)
if(istype(M,mob/PC))
Attack(M)

mob
proc
Level_Up()
if(usr.Exp >= usr.Max_Exp)
usr << "You Level Up!"
usr.Max_HP = usr.Max_HP * 2
usr.Max_MP = usr.Max_MP * 2
usr.Strength = Strength * 2
usr.Max_Exp = usr.Max_Exp * 2
usr.Exp = 0
usr.Level = usr.Level + 1
Death_Check()
if(usr.HP <= 0)
usr << "You have died!"
usr.loc = locate(1,1,1)
usr.HP = usr.Max_HP
usr.MP = usr.Max_MP
Wander()
while(src)
if(P in oview(5))
step_towards(P,src)
for(P in oview(1))
break
for(P in oview(2))
break
for(P in oview(3))
break
for(P in oview(4))
break
for(P in oview(5))
break
else
step_rand(src)
sleep(10)
for(P in oview(5))
break
sleep(5)
spawn(5)
Wander()
Bump(mob/M)
if(istype(M,mob/PC))
Attack(M)
Attack()
sleep(2)
var/Damage = rand(1,Strength)
M.HP -= Damage
view(src) << "[src] attacks [M]!"
view(src) << "[damage] damage!"
Death_Check()

var/mob/PC/P
var/mob/M

mob
var
//Physical Stats
Level
HP
Max_HP
MP
Max_MP
Strength
Defense
Magic
Magic_Defense
Agility
Exp
Max_Exp
Gil
Random_Hit

And here are my errors...

combat.dm:41:error:mob:undefined var
combat.dm:41:error:PC:undefined var
procs.dm:41:error:mob:undefined var
procs.dm:41:error:PC:undefined var
procs.dm:48:error:damage:undefined var
combat.dm:4:error:Attack :duplicate definition
procs.dm:43:error:Attack :previous definition
procs.dm:40:error:Bump :duplicate definition

Thanx,
Punkrock546
Punkrock546 wrote:
I'm having some problems with my code...

mob
PC
verb
Attack(mob/M in oview(1))
set category = "Combat"
var/Random_Hit = rand(1,2)
if(Random_Hit == 1)
var/Damage = rand(1,5)
if(M.Agility - usr.Agility > 0)
usr << "You punch [M] for [Damage]."
M.HP = M.HP - Damage
usr.Level_Up()
usr.Death_Check()
else
M << "You dodge [src]'s attack!"
usr << "[M] dodges your attack!"
if(Random_Hit == 2)
var/Damage = rand(1,5)
if(M.Agility - usr.Agility > 0)
usr << "You kick [M] for [Damage]."
M.HP = M.HP - Damage
usr.Level_Up()
usr.Death_Check()
else
M << "You dodge [src]'s attack!"
usr << "[M] dodges your attack!"

mob/NPC
Monster
icon = 'monsters.dmi'
Level = 1
HP = 5
Max_HP = 5
MP = 2
Max_MP = 2
New()
.=..()
spawn()
Wander()
Bump(mob/M)
if(istype(M,mob/PC))
Attack(M)

mob
proc
Level_Up()
if(usr.Exp >= usr.Max_Exp)
usr << "You Level Up!"
usr.Max_HP = usr.Max_HP * 2
usr.Max_MP = usr.Max_MP * 2
usr.Strength = Strength * 2
usr.Max_Exp = usr.Max_Exp * 2
usr.Exp = 0
usr.Level = usr.Level + 1
Death_Check()
if(usr.HP <= 0)
usr << "You have died!"
usr.loc = locate(1,1,1)
usr.HP = usr.Max_HP
usr.MP = usr.Max_MP
Wander()
while(src)
if(P in oview(5))
step_towards(P,src)
for(P in oview(1))
break
for(P in oview(2))
break
for(P in oview(3))
break
for(P in oview(4))
break
for(P in oview(5))
break
else
step_rand(src)
sleep(10)
for(P in oview(5))
break
sleep(5)
spawn(5)
Wander()
Bump(mob/M)
if(istype(M,mob/PC))
Attack(M)
Attack()
sleep(2)
var/Damage = rand(1,Strength)
M.HP -= Damage
view(src) << "[src] attacks [M]!"
view(src) << "[damage] damage!"
Death_Check()

var/mob/PC/P
var/mob/M

mob
var
//Physical Stats
Level
HP
Max_HP
MP
Max_MP
Strength
Defense
Magic
Magic_Defense
Agility
Exp
Max_Exp
Gil
Random_Hit

And here are my errors...

combat.dm:41:error:mob:undefined var
combat.dm:41:error:PC:undefined var
procs.dm:41:error:mob:undefined var
procs.dm:41:error:PC:undefined var
procs.dm:48:error:damage:undefined var
combat.dm:4:error:Attack :duplicate definition
procs.dm:43:error:Attack :previous definition
procs.dm:40:error:Bump :duplicate definition

Thanx,
Punkrock546

mob
PC
verb
Attack(mob/M in oview(1))
set category = "Combat"
var/Random_Hit = rand(1,2)
if(Random_Hit == 1)
var/Damage = rand(1,5)
if(M.Agility - usr.Agility > 0)
usr << "You punch [M] for [Damage]."
M.HP = M.HP - Damage
usr.Level_Up()
usr.Death_Check()
else
M << "You dodge [src]'s attack!"
usr << "[M] dodges your attack!"
if(Random_Hit == 2)
var/Damage = rand(1,5)
if(M.Agility - usr.Agility > 0)
usr << "You kick [M] for [Damage]."
M.HP = M.HP - Damage
usr.Level_Up()
usr.Death_Check()
else
M << "You dodge [src]'s attack!"
usr << "[M] dodges your attack!"

mob/NPC
Monster
icon = 'monsters.dmi'
Level = 1
HP = 5
Max_HP = 5
MP = 2
Max_MP = 2
New()
.=..()
spawn()
Wander()
Bump(mob/M)
if(istype(M,/mob/PC))
attack(M)

mob
proc
Level_Up()
if(usr.Exp >= usr.Max_Exp)
usr << "You Level Up!"
usr.Max_HP = usr.Max_HP * 2
usr.Max_MP = usr.Max_MP * 2
usr.Strength = Strength * 2
usr.Max_Exp = usr.Max_Exp * 2
usr.Exp = 0
usr.Level = usr.Level + 1
Death_Check()
if(usr.HP <= 0)
usr << "You have died!"
usr.loc = locate(1,1,1)
usr.HP = usr.Max_HP
usr.MP = usr.Max_MP
Wander()
while(src)
if(P in oview(5))
step_towards(P,src)
for(P in oview(1))
break
for(P in oview(2))
break
for(P in oview(3))
break
for(P in oview(4))
break
for(P in oview(5))
break
else
step_rand(src)
sleep(10)
for(P in oview(5))
break
sleep(5)
spawn(5)
Wander()
bump(mob/M)
if(istype(M,/mob/PC))
attack(M)
attack()
sleep(2)
var/Damage = rand(1,Strength)
M.HP -= Damage
view(src) << "[src] attacks [M]!"
view(src) << "[Damage] damage!"
Death_Check()

var/mob/PC/P
var/mob/M

mob
var
//Physical Stats
Level
HP
Max_HP
MP
Max_MP
Strength
Defense
Magic
Magic_Defense
Agility
Exp
Max_Exp
Gil
Random_Hit