ID:190629
 
Has anyone, ever, tried to attempt or create a Status Check other than the one found in my Login() Tutorial?

I am just wondering, because if there hasn't I may create one so game creators don't get the little trouble of having stats that go over the max or under the minimum status vars that are set, such as health going below naught (0) and into the minus region, or even going over the max health, IE:
mob/var
HP = 100
MaxHP = 100

Say like as shown above the players max health is set to 100, it kind of goes 'over' that by some wierd coincident, say it is now at 103, if not more.

With a StatCheck() being used all the time while the game is up you will find out that HP will never go over or under its set ammount. Same with anything else suchs as Mana Points.

Anyway, I just thought I would ask if it has ever been tried other than me doing it.

If there is already a tutorial out about it, as of this moment I could not find any, I thought I may ask about it first and if one is necessary I may re-create one so it can be used and edited by anyone.

--Lee
Humm, normaly i just keep it from ever happining, but i never thought of a stat check, its a good idea, ill make sure to add it to my game.
I don't ever change a stat or anything of the sort without putting in a min() or max() to be sure it won't go outside its proper limit.

Lummox JR
In response to Lummox JR
Lummox JR wrote:
I don't ever change a stat or anything of the sort without putting in a min() or max() to be sure it won't go outside its proper limit.

Lummox JR

I have never used or even attempted min() and max() before because I have never come accross it.

But, for those who are not familiar with min() and max() or for those who have never come accross them, would it be advisable for new-comers and/or new game designers?

My actual point here is, would it be a good/bad idea for those who don't know how to stop certain stats from going over/under the set max/min var?

Not to mention, would it be a waste of time or worth-while doing?

--Lee
In response to Mellifluous
Mellifluous wrote:
I have never used or even attempted min() and max() before because I have never come accross it.

If you haven't, you should have. min() and max() are exceptionally useful, particularly with the intelligent way they're implemented in BYOND. Whenever cutting down HP for example, you can just do this:
HP=max(HP-damage,0)     // don't let HP become negative

But, for those who are not familiar with min() and max() or for those who have never come accross them, would it be advisable for new-comers and/or new game designers?

If by "it" you mean the use of min() and max(), then yes, extremely. These are not only wonderfully handy procs to get familiar with, but the HP example I showed above is the absolute correct way to code such a thing.

If you mean the stat check, I could still see that being valuable. It's probably a good idea even just as a debugging tool, for showing game authors where stats "jumped the rails" for lack of control.

My actual point here is, would it be a good/bad idea for those who don't know how to stop certain stats from going over/under the set max/min var?

Not to mention, would it be a waste of time or worth-while doing?

The extra redundancy over and above what was already repeated is addling my confusion.

Lummox JR
In response to Lummox JR
Ok, I will have to get to know the min() and max() more hehe.

I can see from your little example that the min() and max() seems to be alot shoter than my StatCheck(), as my StatCheck() currently is at 5 lines long.

As you can see here:

mob/proc/StatCheck()
if(src.HP < 0) src.HP = 0
if(src.HP > src.MHP) src.HP = src.MHP
if(src.MP < 0) src.MP = 0
if(src.MP > src.MMP) src.MP = src.MMP


To make sure that the above works though, you would have to insert a the following; StatCheck() under the mob/Stat() panel, at the very end. As you will see here:

mob/Stat()
statpanel("Status")
stat(src)
stat("Health Points: ","[src.HP / src.MHP]")
stat("Mana Points: ","[src.MP / src.MMP]")
stat("Defense: ",src.Def)
stat("Intelligence: ",src.Int)
stat("Strength: ",src.Str)
StatCheck()


--Lee