mob
var/Bounty = 100
var/hasbounty = 0
Stat()
statpanel("Bounty")
verb/switchbounty()
if(src.hasbounty == 0)
src.hasbounty = 1
else if(src.hasbounty == 1)
src.hasbounty = 0
mob/proc/HasBounty()
for()
if(src.Bounty>0)
src.hasbounty = 1
sleep(100)
..()
mob/proc/BountyCheck()
for()
if(src.hasbounty == 1)
statpanel("Bounty") << "<BIG>\icon[usr]</BIG> Bounty:[src.Bounty]"
sleep(300)
..()
else if(src.hasbounty == 0)
return
ID:157423
![]() Mar 13 2010, 5:46 pm
|
|
I am trying to make a bounty system so that when I open up the tab it will show me and respawn in a certain amount of time but it shows nothing (and it isnt the icon or icon_state being masked/not there). Advice/comments please!
|
I was trying to get it to not display if the person didn't have a bounty at all. I'll try to set up a list, they are a pain I havn't really got the jist of them yet!
|
/=...Still broken.
world/New() |
Yes, that is because you are looping through every mob in the world once, at startup, then checking if they're a mob (hint: they are), and then blah blah blah abusing usr whatever point is: you do not need a loop for this. Ever. At any point. Let me repeat what I said earlier:
Have a list. Call it "duders". When a player has their Bounty changed, if the bounty was 0, add them to the duders list. Now, in mob/Stat(), display the duders list. That's it. |
I am getting a runtime error with null.Add()
mob Edit-Finished. I am still calling it in move just for testing but I am going to make a deathcheck one. Right now it doesn't update but I will fix that. var/BL[0] |
That is because BL is null, because you never assigned it a value.
Additionally, you should not be constantly checking bounty. The only time you ever need to check bounty is when it changes. As gremlins are not screwing around with your damn game, you are in complete control of when the variable changes, so you can just throw in the check THERE. |
Additionally, statpanel() is invalid outside of Stat(), and the syntax you're using there is DEFINITELY not correct.
Also, why would you even have that HasBounty() proc? If hasbounty is to always be 1 if Bounty isn't 0, then why bother having it at all? Just use Bounty instead.
Really, there's no reason for you to have any loops here whatsoever. Whenever you change somebody's Bounty variable, and it was previously 0, add them to some list. Have Stat() display that list. Done.