じ☆ve冰风 发表于 4 天前

Random Loot Boxes

Do you want your powerful bosses or event enemies to give your player a little something extra?
Maybe a little item that will distribute a random reward to the player upon opening from their inventory?
Then uh, this might be the guide for you.

In many MMORPG's, many bosses drop boxes that contain random gear and items. In RPGMaker (I've only managed to do this in MV, I don't know if this works as well in the other engines), it is very possible to replicate this effect using Common Events.

First, enter your database.
Spoiler
http://www.imgur.com/KpU4ACL.png





Next, go into your Items tab and create the item you wish to give the random reward. For the sake of this tutorial, I shall call mine Reward Box, though it can be called whatever you like.
Spoiler
http://www.imgur.com/nzRECBx.png





Next, set the item type and etc to how you see fit. You likely don't want this item to be used in battle, so I recommend setting it to Menu only. If you want the player to have the ability to sell the box, give it a price. Set the scope to none if you wouldn't like to play an animation when they open your box.

Spoiler
http://www.imgur.com/8vhxtLM.png





Next, we will need to make a Common Event for the box to use when the player opens it. Locate the Common Event tab in your Database and make a new event.

Spoiler
http://www.imgur.com/GKg1J6c.png





Now for the fun part. We are going to assign a variable to our box. Click the empty common event field as if you were making any normal event, and select "Control Variables." Next make a new variable. For the sake of maintaining organization, I like to name my variables after their trigger. So I will name mine Reward Box.
Spoiler: Selecting Control Variables
http://www.imgur.com/p1tHmKy.png

http://blob:http://imgur.com/6fa0af4e-9f61-457a-8bbd-8fe46a15ae99
Spoiler: Naming the Variable
http://www.imgur.com/fzRi70e.png

Once you have your variable made and selected, click okay. Next, go under Operation and make sure the operation is on "set."
Then go to Operand and select random. This will be what generates the item given randomly. Lets say we want to give out 4 items, since in cpu language 0 is still counted as a number, we would select 0-3 if we wish to distribute 4 items. Alternatively you could select 1-4 but for the sake of this tutorial, we will use 0-3.
Spoiler
http://www.imgur.com/3B3GnRE.png





Click "Ok" and return to the event page. On the next line, add a Conditional Branch. Now set the condition for the branch to be your variable. Be sure that "Variable = x" where X represents what item will correspond to the number stored in the variable. For the very first one, we will select 0 as this will be the first item distributed. Copy and paste this branch adding 1 to the constant each time until you have 0-3 as shown below.
Spoiler
http://www.imgur.com/HCGWDdf.png




Spoiler: When the Conditional Branches are set up properly:
http://www.imgur.com/5uedcM4.png

Now for the final part of the common event. In each If: branch, add some text saying something like "You've obtained (Item name)!" and then have it give the player the item!
Spoiler
http://www.imgur.com/viXM18t.png





Next, we need to go back to our item in the Items tab. Select "Effects", other and Common Event. Select the common event we just made.
Spoiler
http://www.imgur.com/frd7Q1b.png




Next, just make the enemy drop the box and you're done
data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
Spoiler
http://www.imgur.com/2x4B9J8.png







本贴来自国际rpgmaker官方论坛作者:DamianCastaway处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/random-loot-boxes.75178/
页: [1]
查看完整版本: Random Loot Boxes