ID:171431
 
I have tryed to many times but alas my newbish coding skills fail me again....

I am trying to make this simple kill a mosnter once monster is dead monster gets deleted while in the process of droping gold....But it wont work...so i cant get the amout to of the gold to work It's this G thing i tryed from zilas tutorial

here is the problem

Del()
var/obj/gold/G = new(loc)
G.amount = rand(1,100)
..()

Test.dm:33:error:G.amount:undefined type: G.amount
Test.dm:32:error:G :unknown variable type

And i have the amount var and all ....
obj
gold
icon = 'Gold.dmi'
var
amount
verb
Get()
set src in view(1)
usr << "you pick up [amount]"
usr.wealth += amount
del(src)



Please and thank you
In the code you posted, you have obj and everything below it indented over too far. The way you have it now, obj is part of something else (like /mob/obj).
In response to Jon88
This is what my full code looks like im starting from the good old basics so tell me if im doing something wrong

mob

icon = 'Player.dmi'
var
HP = 10
var
wealth

Bug
icon = 'Player.dmi'
icon_state = "Bug"

Login()
..()
usr.name = input("What is your name?","Name selection")
usr.icon_state = input("What do you want to be?","Class selection")in list("Man","Bug")
usr.Move (locate (1,1,1))
world << "[usr] has logged in!"

Logout()
..()
world << "[src] has logged out!"

proc
DeathCheck()
if(HP <= 0)
world << "[src] died!"
del(src)
usr.Move(locate(1,1,1))

Del()
var/obj/gold/G = new(loc)
G.amount = rand(1,100)
..()

verb

Attack(mob/M in oview(1))
view() << "[usr] attacks [M]!!!"
var/damage = rand(1,5)
M.HP -= damage
M.DeathCheck()

Say(msg as text)
world << "[usr] Says: [msg]"

obj
gold
icon = 'Gold.dmi'
var
amount
verb
Get()
set src in view(1)
usr << "you pick up [amount]"
usr.wealth += amount
del(src)


turf
Grass
icon = 'Turf.dmi'
icon_state = "Grass"

world
name = "Test"
turf = /turf/Grass
In response to Xaphan
Look at this part:
        obj
gold
icon = 'Gold.dmi'
var
amount
verb
Get()
set src in view(1)
usr << "you pick up [amount]"
usr.wealth += amount
del(src)



Due to the way you've indented it, that ends up being:
mob
obj
gold
icon = 'Gold.dmi'
var
amount
verb
Get()
set src in view(1)
usr << "you pick up [amount]"
usr.wealth += amount
del(src)



You need to unindent obj and everything part of it, so that your "obj" isn't /mob/obj
In response to Jon88
OK i just tryed that and i got 21 errors So then i removed the obj from all the other coding created anothe code file and stuck the obj in there by it's self but it still does not work ??? i'm really confused
In response to Xaphan
obj
gold
icon = 'Gold.dmi'



--Goz
In response to Goz
Thanks for the help but i fixed the problem it was with the verb ... Get() not the obj my bad....Sorry for wasting your guys times and acting like a compelete idiot when it was right infront of my face.

Thanks so much for you help.
In response to Xaphan
There's nothing wrong with your Get() verb. As Jon said, your making it seem like your making it be like /mob/obj/ when it's supposed to be /obj/. An example of what you're doing would be this:
mob
obj
gold
icon = 'Gold.dmi'
var
amount
verb
Get()
set src in view(1)
usr << "you pick up [amount]"
usr.wealth += amount
del(src)


Don't do that. I had the same problem when I used that code for the first time. Now, an example of what it's supposed to be wouild be this:
obj
gold
icon = 'Gold.dmi'
var
amount
verb
Get()
set src in view(1)
usr << "you pick up [amount]"
usr.wealth += amount
del(src)


As you can see. In my second example, it's showing the code as /obj/, instead of /mob/obj/.
As for you var/obj/gold/G problem, indent it one more time so it looks like this:
mob
bug
icon = 'bug.dmi'
icon_state = "bug"
Del()
var/obj/gold/G = new(loc)
G.amount = rand(1,3)
..()


And there you have it!

~Tikey