ID:170038
 
How do I make it so when I kill something it drops money...
MonkeyNamedEric wrote:
How do I make it so when I kill something it drops money...

Something like this should work.

 
obj/money
var/value //each money object has a monetary value


mob
var/minMoneyDrop = 1
var/maxMoneyDrop = 5


proc/Die()
//create a new money object and set its value,
//then put it where the newly dead mob is standing
var/obj/money/O = new()
O.value = rand(minMoneyDrop, maxMoneyDrop)
O.loc = src.loc
del src


actor //this mob type drops lots of money!
minMoneyDrop = 20
maxMoneyDrop = 100
In response to Gughunter
Oh, thanks.
In response to Gughunter
didn't work...
In response to MonkeyNamedEric
MonkeyNamedEric wrote:
didn't work...

Well, there could be lots of reasons for that. Did you give the money obj an icon? If not, it's going to be invisible when it drops. When all else fails, try debugging statements, like so:

 
obj/money
var/value //each money object has a monetary value


mob
var/minMoneyDrop = 1
var/maxMoneyDrop = 5


proc/Die()
//create a new money object and set its value,
//then put it where the newly dead mob is standing
var/obj/money/O = new()
O.value = rand(minMoneyDrop, maxMoneyDrop)
O.loc = src.loc

world << "[src] is dying, and dropped money worth [O.value] at location [O.x], [O.y], [O.z]!"

del src


actor //this mob type drops lots of money!
minMoneyDrop = 20
maxMoneyDrop = 100
In response to MonkeyNamedEric
Heh. I like how the actor drops lots of money, Gug. That is so not happening in real life! =)

Unless he's a famous movie actor, in which case you should use a subtype. =P

Anyway, back on topic... Eric, the first thing that comes to my mind is are you calling the Die() proc when mobs die?
In response to Crispy
I don't think so...