ID:139704
 
Code:


Problem description:

So yeah. I was just reading through Zilal's tutorial on Action/RPG games. I did everything it told me to do, and I learned alot. But than I got stuck on the gold part. IT compiles and everything, but it when I play the game and kill the bug. It won't drop Here's the code.


mob

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

icon = 'person.dmi' //make it so all mobs will be created with the person icon
var
HP = 30 //define a new variable called HP, with a value of 30
var
Durability=1


Login()
icon_state = gender //when a player logs in, get them the right icon state for
..() //the gender of their key. Then call the parent!

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


verb
Attack(mob/D as mob in oview(1)) //attack a mob within 1 tile of you
usr << "You attack [D]!" //send this message to the usr
oview() << "[usr] attacks [D]!" //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
D.HP -= damage //take away the damage from M
D.DeathCheck()

Say(msg as text) //what the usr says is passed into "msg" as text
world << "[usr]: [msg]" //the world sees chatroom-like output

turf
grass //define a "grass" prototype, which is a kind of turf...
icon = 'grass.dmi' //that has an icon named 'grass.dmi'. In single quotes!

world //set one of our world's characteristics:
turf = /turf/grass //its default turf is the grass turf.


turf
tree
icon='tree.dmi'
density=1

turf
wall
icon='wall.dmi'
density=1
mob
verb
Intangible()
density = 0
world << "[usr] is able to move through walls!"

mob
verb
Tangible()
density= 1
world << "[usr] is not able to move through walls!"

mob/verb/Wink()
set src in view()
view() << "[usr] winks at [src]."

mob/bug/Wink()
..()
usr << "[src] shouts, 'I'll have my revenge!'"



obj
gold //define a "gold" prototype, which is a kind of obj
icon = 'gold.dmi' //set the default icon
var
amount //declare a new variable called "amount"
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

<dm>
That's because you put Del() under obj, so gold is only created when objs are deleted. It's supposed to be under /mob/bug.
In response to Garthor (#1)
Thx. I don't think that was in the guide. If it was, than I didn't see it.