mob
icon = 'player.dmi'
var
level = 1
maxhp = 50
hp = 50
str = 10
def = 2
exp = 0
nexp = 10
Login()
loc = locate(/turf/start)
..()
Problem description:This is the code I have for the player.
mob
enemy
badguy
New()
..()
spawn() Wander()
icon = 'badguy.dmi'
var
maxhp = 40
hp = 40
str = 3
def = 1
..()
This is where the problem begins. I want to create a different set of stats for the enemy making them slightly weaker than the player. It won't let me name the stats the same as the player stats even though they are variables under different mobs. The error comes up saying duplicate definition
mob
verb
Attack(mob/M as mob in oview(1))
var/damage = usr.str - M.def
if(damage <= 0)
usr << "Your attack does not hurt [M] at all!"
M << "You are unhurt by [usr]'s attack."
else
M.hp -= damage
M:deathcheck()
M:levelup()
This is the attack code. Would I have to name the variables on badguy something different and make a new attack code for him? or is there an easier way to have mobs have different stats but fall under the same attack code?
I'm still learning and new to dm. I would like tips and suggestions. Please don't do it all for me :).
As for the Attack verb change the usr(You should really avoid using usr and : if you can, they can cause all sorts of bugs) in it to src and make deathcheck() and levelup() mov procs like this:
Then just after after the deduction for hp do this:
And then you can just call the Attack() verb for the enemy npc as if it were a proc:
Should all work, I haven't actually tested it but I hope it helps you.