I was following this ZBT tutorial, and what im trying to do is make "gold" appear in place of a mob that gets deleted and then I also want to Respawn that mob within 30 seconds, the way he described doesn't work, I keep getting the error cannot have a proc Def. inside another proc, am I doing something wrong?
mob
proc
DeathCheck(mob/M)
if (HP <= 0)
world << "[usr] killed [src]!"
del(src) //delete w.e just died
Del()
var/obj/gold/G = new(loc)
G.amount = rand(1,10)
..()
ID:264888
Jan 31 2011, 6:08 pm
|
|
In response to Shadow813
|
|
Ok so I tried to impliment your code and also edited some stuff in it and my own code to try to Narrow down the 13 errors it gave me but now im stumped. I Narrowed this down to 6 errors which is mainly I'm entirely having trouble with the whole "race" issue, I havent read a tutorial that teaches anything regarding races such as
if(src.race == "Monster") ////The race of whatever you killed I was thinking I have to do this with a variable? could you nudge me in the right direction? ^^ thank you in advance oh another issue im having which would probably be solved if u can nudge me with the first one is regarding src.gold, I've made an obj of gold, got the icon's made, all that good stuff. but I realize it says it is an undefined Var, that much I do understand, and also before I forget Mob/Monster, Undefined path, which as I Said I can probably fix if I just get a tiny point in the right direction ^^ |
In response to Silver_Gohan
|
|
Okay, the first problem your having is something most people add in to have multiple enemies. The way I used to show you isn't the only way, but it's a very common method.
Basically you need to add it in your varible list. You'll also have to add gold into your variable list. If a error says something is an undefined var, it's because it is not defined within the code itself, meaning it has no purpose. You should have variables listed in your code like this. Something similar at least. atom/movable Now as for the Mob/Monster error, that is because your mob or whatever it is your killing might not be labeled as such in your code. Here is an example you can learn from, this is not a fully coded snippet (Not all code included to make it function)! mob ///This is what IT is, instead of obj or turf This like I said is not all the code needed to make this work properly. That is up to you, this is basic stuff...I hope it helps. |
In response to Shadow813
|
|
thank you so much for your Guidance, I messed around with what you gave me and got it to work, now im left with another dilima, the mob does drop gold this problem isnt from the code you gave me to work with however from the tutorial coding I picked it up from, this is the code, The gold the mob drops is always 0, never adds to it. which I assumed it would seeing as usr.gold += amount, May I have your opinion on this? Also for some odd reason, the respawn isn't working correctly..
obj gold icon = 'gold.dmi' var amount verb get() set src in view(1) usr << "You pickup [amount] gold." usr.Gold += amount del(src) |
You're trying to override the built-in Del() procedure inside another proc. The way Dream Maker knows what's inside of what is by your indentations.
monkey In your case: mob Also, use <dm> tags on this website to show syntax-highlight your code. It looks better. |
Your Code:
My Code: