ID:175658
 
Well everything works fine except Im getting 1 error
O.HP:undefined var
obj
Fireball
icon = 'Fireball.dmi'
density = 1//make it dense
Bump(atom/O)//bumps an obstacle
if(ismob(O))//if its a mob
oview(O)<<"[O] is hit for 15 Damage!"
O.HP -= 15
Have you defined HP somewhere else in your code for that mob?
In response to Jotdaniel
Yeah every mob has an HP var
In response to Jem
Maybe you should try mob/M instead of atom/O and take out the ismob. If you dont want to do that, show me where you have defined HP for the mobs.
In response to Jotdaniel
Jotdaniel wrote:
Maybe you should try mob/M instead of atom/O and take out the ismob. If you dont want to do that, show me where you have defined HP for the mobs.

If you do that and take out the ismob(), any obj entering will cause a runtime error. Just because you use mob/M does not mean its only triggered when a mob is sent as a reference, it simply means that it assumes what is entering is a mob.
In response to Alathon
Erm, right. I should know that, I use this a lot. Ok, I'm just not sure hes defined HP correctly still.
In response to Jotdaniel
This is where i define the vars
mob

Stat()
statpanel("Stats")
stat("Level: [src.Level]")
stat("Health: [src.HP]/[src.MAXHP]")
stat("MP: [src.MP]/[src.MAXMP]")
stat("Gold: [src.Gold]")
stat("Experience: [src.Experience]")
stat("Max Experience: [src.MaxExperience]")
stat("Strength: [src.Strength]")
stat("Defense: [src.Defense]")

if(src == usr) statpanel("Inventory",src.contents)

var
HP= 20
MAXHP= 20
Experience = 0
MaxExperience = 100
MP =0
MAXMP =0
Strength = 4
Defense =5
Level = 1
Gold = 0
expgive = 0
BankGold = 0