Code:
// Ok, let's make the variables firstly.
mob
var
hp=100 // Health var, define it to 100
mhp=500 /// as above except the MAX hp.
str=1000// strength var
mstr=99999999//max strength
def=100//defence
mdef=99999999/// max defence
npc=0//npc var for npc mobs
exp=0//exp for lvling
mexp=10//max exp.
level=1///level var
Gold = 0
/// variables finished.
/// onto the verbs!
mob
verb
Attack(mob/M as mob in get_step(src,src.dir)) // the mob has to be facing you to attack
set category="Fighting"/// you all know wut this is.
if(istype(M,/mob/)) // if it a Mob they we're attacking continue.
var/damage=round(usr.str-M.def/2) /// define a damage var. user's str vs. M's defence divided by two. you can edit this to your liking.
if(damage <= 0)// if the damage is less or equal to 0 make it 1 damage.
damage = 1//change it :P
M.hp-=damage//remove the damage from M's HP.
range()<<"[usr] attacked [M]! inflicting <font color=red>[damage]</font> damage!"/// tell the people in ranged M's being attacked.
usr.DeathCheck(M)//see if M is dead.
else
return
// thats the attack verb. now onto the death proc and level proc.
mob
proc
DeathCheck(mob/M)
if(M.hp<=0&&M.npc)// if the hp's 0 and its a NPC.
world<<"[src] has killed [M]"/// say theyve killed M
del(M) //delete the npc frm the world cuz its dead
src.exp+=rand(10,30) // give exp :)
src.Level()// call the lvl proc
return/// stop runtime errors =D
if(M.hp<=0&&M.client) // if hp 0 and its a client.
world<<"[src] has killed [M]"// same as before
M.hp=M.mhp//give them full hp back.
M.loc=locate(1,1,1)//take them to spawn point, dont DEL them.
src.exp+=rand(10,30)// give them exp!!
src.Level()/// call lvl proc
Level()
if(src.exp >= src.mexp)
src.level+=1
src.mstr+=rand(1,3)
src.mdef+=rand(1,3)
src.mhp+=rand(10,15)
src.mexp+=rand(10,20)
src.exp=src.mexp
src.exp=0
src.hp=src.mhp
src.def=src.mdef
src.str=src.mstr
src<<"You gained a level and are now level [src.level]!"
/// okay procs done, now the stat panel.
mob
Stat()
statpanel("Stats")
stat("Name: [usr]")
stat("Gold: src.Gold")
stat("Level: [level]")
stat("Health: [hp]/[mhp]")
stat("Str: [str]/[mstr]")
stat("Def: [def]/[mdef]")
stat("EXP: [exp]/[mexp]")
/// AND NOW THE ACTUAL NPC TO ATTACK!
mob
npc
wasp
icon='wasp.dmi'
name="Wasp"
npc=1
hp=950
def=5</b>
Problem description: The wasp wont die, it just stays there and disnt say that it dies even tho the char is hitting 950 and the wasps hp is only 950
the other problem is, where would i put a line to say that it has to drop gold when it dies
also how would i get the gold into the stat area of the code, it only comes up as src.Gold in the game