ID:141766
 
Code:
#define DEBUG
mob
var
HP = 30 //declares a new variable called HP, with a value of 30
Wealth

icon = 'person.dmi'
icon_state = "male"

verb
attack(mob/M as mob in oview(1)) //attack a mob within 1 tile of you
usr << "You attack [M]!" //send this message to the usr
oview() << "[usr] attacks [M]!" //send this message to everybody else
var/damage = rand(1,10) //assign a random # to a new variable
world << "[damage] damage!" //tell the damage to the world
M.HP -= damage //take away the damage from M
M.DeathCheck() //check for death with a proc
Say(msg as text)
view() << "[usr] says: [msg]"
OOC(msg as text)
world << "[usr] OOC: [msg]"
Emote(msg as text)
world << "*[usr] [msg]*"
Whisper(msg as text)
oview(3) << "[usr] whispers: ]msg]"

obj
gold //define a "gold" prototype, which is a kind of obj
icon = 'Gold.dmi' //set the default icon
icon_state = "Gold"



turf
icon = 'turfs.dmi'
Grass
icon_state = "grass"
Water
icon_state = "water"
density = 1
Path
icon_state = "Path"
Wall
icon_state = "wall"
density = 1
Roof
icon_state = "roof"
density = 1
Cliff
icon_state = "cliff"
density = 1
Cliff2
icon_state = "cliff2"
density = 1
Water2
icon_state = "Water2"
density = 1
Rock
icon_state = "rock"
density = 1

mob
proc
DeathCheck() //checks to see if an attack is deadly
if (HP <= 0) //if the defender's HP is low enough...
world << "[src] dies!" //do the death messaging


Del()
var/obj/Gold/G = new(loc) //create a new obj from the gold blueprint
G.amount = rand(1,100) //set its amount variable randomly
..() //call the parent

icon = 'person.dmi' //makes it so all mobs will be created with the person icon

bug //new prototype
icon = 'Bug.dmi' //override the parent's icon, which was 'person.dmi'
icon_state = "Bug"


Login()
icon_state = gender //when a player logs in, make their icon's state
..() //the gender of their key. Then call the parent!


attack(mob/M as mob in oview(1))
if (M.HP <= 0) //if M's HP are at or below 0...
usr << "[M] is already dead!"
else //otherwise...
usr << "You attack [M]!"
oview() << "[usr] attacks [M]!"
var/damage = rand(1,10)
world << "[damage] damage!"
M.HP -= damage
M.DeathCheck()

DeathCheck()
if (HP <= 0)
world << "[src] dies!"
del(src) //delete whatever just died

obj
gold
icon = 'gold.dmi'
var
amount
verb
get() //obj/gold/verb/get()
set src in view(1) //src must be close
usr << "You pick up [amount] gold."
usr.wealth += amount //add to usr.wealth
del(src) //delete the gold


Problem description:

3 errors that all involve the gold
We'll need more info to help you. What are the particular errors you're getting, and where?

Lummox JR
This may not be related to your problem but from what I can see is that you have put obj as a child to the mob atom, which is clearly not how it goes. try indenting back 4 times with the obj. Also why are there 2 obj/golds?

Haywire
In response to Lummox JR
ok im getting these errors:

error:usr.wealth:undefined var, where it says wealth at the top un HP.

error:G.amount:undefined type: G.amount, where it says G.amount = rand(1,100.

error:G :unknown variable type, where it says var/obj/Gold/G = new(loc)
In response to Russelisthebestever2
You have /obj/gold defined in two places (it should ideally be in just one place), and in both places you have the "obj" line indented when it shouldn't be. That's probably most of the problem there.

Also, look out for capitalization issues. /obj/Gold is not the same as /obj/gold. I tend to prefer lowercase letters for type paths like this, because then you never have to remember which one you used.

Lummox JR