In almost every game, you see:
usr<<"You killed [enemy], so you gain [number] overall experience!" |
Keyword there: overall.
In games, you mainly see 3-4 bars. Health, Stamina, and Experience being the main three. You kill someone, the experience bar moves a little bit. What many developers fail to see is that BYOND is much more powerful than that: they can take it so far as to give each stat it's own experience. You can even make the same procedure handle the person "leveling up" as well. Here, I will walk you through it.
Let's start off by making a 'Level' procedure.
mob |
There we go. Now, let's define that procedure a little more with some named arguments.
mob |
Alright. With this, we now have some arguments for the procedure. Whenever we call the Level procedure, we will have to define these arguments.
stat as text:
This is going to be the stat we will be giving experience to. The as text part means just as it says. The value used here has to be in the form of text.
mod as num:
This is how much experience will be added to the stat. It has to be a number.
DisplayText=1:
This is here to make it optional to show whether the stat gained anything or not. This will be explained more later.
max=500,min=1:
All this does is limit the experience gained. This prevents any sort of cheating, such as someone who used a bug in the game to his/her advantage and got some Administrator verbs, one of which changes the world experience mod. So if the experience they gain is over 500, it is set to 500. And the min=1 prevents people from gaining negative experience. This could be taken out as well, and you could use this procedure to take experience away from players as punishment.
Alright. We have a procedure, and arguments for it. Now we need to make it do something.
mob |
And that is the whole procedure, simplified.
I really hope this helps those aspiring programmers out there, hope it opened their eyes to some of the power that BYOND has, that they never saw. I would love to see more games with this concept. It could really spice up the game-play.
Please take all questions, comments, and concerns here.