Charas-Project
Game Creation => Requests => Tutorials => Topic started by: AsakuraHao2004 on June 01, 2005, 11:07:25 PM
-
This idea just occured to me, so I thought I'd share it. First off, all you need is a pretty basic understanding of variables.
Lets say you have a CBS, and theres a monster that drops an item, however, the chances of getting this item is very rare. So what we could do is
<> Set Variable "Rare Item Drop" to a random number between 1-5
<> Branch if variable "Drop Item" is 1
<> Add item "Rare Item" +1
<> wait 0.1 sec
<> Set Variable "Rare Item Drop" to 0
<> Else Case>
<> End
(The wait and Set Variable to 0 will set it so that you can use the variable again)
Now, there's a 1-in-5 chance of dropping that item will occur. For even higher rarity, you can set the random number range to even higher levels. I don't reccomend going over 20. Also, instead of making an else case, you could do this:
<> Set Variable "Item Drop" to a random number between 1-10
<> Branch if variable "Drop Item" is 1
<> Add item "Rare Item" +1
<> wait 0.1 sec
<> Set Variable "Rare Item Drop" to 0
<> End
<> Set Variable "Item Drop" to a random number between 1-10
<> Branch if variable "Drop Item" is 2
<> Add item "NON-Rare Item" +1
<> wait 0.1 sec
<> Set Variable "Rare Item Drop" to 0
<> End
And so on. This will make it so that a monster usually drops a regular item, but might drop a rarer item occasionally. You can also put in different items several times over (to increase chances of getting it), or leave a few blank.
A good way to set up, would be to have about 10 numbers set. make 5-6 numbers blank (so the monster wont drop anything sometimes), have 3-4 of the numbers with a "normal" item (the same, or different ones), and only have the rare item assigned to 1 number. This is a good range that will probably provide fair item span.
Hope this helps :)
-
Hmm. Concievably, this could also be applied to the DBS using the same code; you'd just need to activate it by the monster having no HP. I think I'll play around with that.
Nice tutorial, well-written and understandable. The only thing is, if you had a CBS, you'd probably already know how to code an item drop system ;)
-
Your code is kinda screwy. You would not need to re-randomize the number when dealing with the non-rare stuff.
Here is another way to do it probably involves less code:
<> Variable Operation [001: Item Drop] Set, Rnd 1-10
<> Branch if Var [001: Item Drop] is 5 less
<> Branch if Var [001: Item Drop] is 1
<> Change Items: Rare Item +1
<>
<> Else Handler
<> Change Items: Non-rare Item +1
<>
: End
<>
: End
<>
The "inside" branch has the else condition. After seeing if the items drop is less then 5 (1-5 means that something will drop) we see if it exactly 1. If it is, we give the rare item. If not, we give the non-rare item.
Avoids having to copy a bunch of code a lot of times.
Nice idea, though you would need a CMS for it. In the DBS after the last enemy dies the battle ends, so there is no time for custom code.
-
Worked for me.
I'm kinda weary of using your method, because I used a smiliar one for something else, which caused massive problems. And that method would really limit custimization, although it is effective for decreasing/increasing chances.