Hey. I'm having trouble making enemies drop gold. What I want to do is have the enemy drop the gold when you kill them, but the icon_state of the gold depends on how much gold there is. How could I do something like this?
Thanks,
Omnislashx4
ID:173112
![]() Feb 16 2004, 5:06 am
|
|
Dropping gold is covered in Zilal's Beginner Tutorial (ZBT, found at BYONDscape).
If you want to make the gold icon change depending on how much there is, you could use a switch statement when the gold is created like this: <code>obj/gold amount = 10 New(location, amount) loc = location switch(amount) if(0) del(src) // don't want players finding large piles of nothing now do we? if(1) icon_state = "coin" if(2 to 5) icon_state = "coins" if(6 to 20) icon_state = "small pile" if(21 to 100) icon_state = "big pile" else icon_state = "great riches"</code> To use that, when creating a new gold object, just set the desired value for the gold inside the new() proc, like this: <code>new/obj/gold(location, amount)</code> So if I wanted a monster to die and drop from 1 to 100 gold, I'd do something like this this: <code>monster Die() new/obj/gold(src.loc, rand(1, 100)) del(src)</code> |
You'll probably want a check to delete the pile if it's 0 or less, just in case you mess something up.
"WOO! A big pile of gold! I'm rich now! Hey... what happened to all the gold?" |
Thank you. I got it to work. It wasn't as hard as I thought it would be. I just wasn't looking at it the right way. If anyone wants to help me out with this game that would be really nice. I posted about it in the classified section. I'm having some troubles with a turned base fighting system. So any help would be great.
Thanks, Omnislashx4 |
If you haven't tried that tutorial you should try it, it's really good for learning the basics, and if you've already done Rcet's or someone else's tutorial Zilals is good for reremersing the basic skills you've learned.
- Tash