设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 98|回复: 0

[制作教程] Shop With Limited Quantity - Eventing

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    慵懒
    3 天前
  • 签到天数: 207 天

    连续签到: 1 天

    [LV.7]常住居民III

    3646

    主题

    862

    回帖

    2万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    21262
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    25800

    灌水之王

    发表于 前天 19:36 | 显示全部楼层 |阅读模式
    I have seen many requests around for this but yet to find a Plugin that actually accomplishes this. However it is possible to take care of this via Eventing.

    You can even set this up in a CommonEvent to share it across your game.

    I use Yanfly's MessageCore plugin so some tags that I use are not available if you don't have that plugin. Namely the namebox and the icon drawing,

    How it works. This will set up the "Shop" inventory when you first speak to the person and express interest in buying their materials. Once you speak to them again they "Shop" will be active and will track what is purchased and what remains in its "Inventory."

    Starting Point
    1. Create your items. Don't worry to much about the price of the items since you can modifiy that within the events.
    2. Once the items are created go ahead and make your event.\
    Make your event look like this screenshot and we step through each part. The \n<Tamara> is another MessageCore command that creates a NameBox with the name Tamara over the MessageWindow.
    Spoiler






    The show choices will let you start the whole thing. As you notice I am using two variables for two different items. These variables control the stocks of the items. Namely Unrefined Iron has 20 in stock and Stone has 50 in stock. By selecting Yes we intilize these variables and then move into the second event page which is only activated after the SelfSwitch is turned on.

    See this next screenshot.
    Spoiler





    This the inner workings of the actual shop. Not many people realize you can actually use variables in your choices window. They work the same as MessageWindows but you have the added feature of selecting an option, thus using certain chat commands works in the choices box just as it would in a ShowText box.

    3. So here the choices are unrefined iron and stone. Unrefined iron is writte as Unrefined Iron x\v[7] which translates too Unrefined Iron xValue. The Value is whatever you set the stock up to be on the previous event page. The same setup is used for the Stone.

    4. Now we have our choices that show what we want to buy and how much the shopkeeper has in stock. We then add another Show Choices when the player selects either the Stone or the Unrefined Iron and this takes care of the "processing" of actually purchasing the item.

    5. You will note that if the player selects Unrefined Iron then will then be presented with the option to Puchase it or "Go Back." Lets break down what happens when each choice is selected. If they select "Purchase" we will first check if they have enough gold. Do note we check the box that says "add else." Why? Becasue if the player does not have enough gold we trigger the "Sorry this costs this amount of money" and then end the event.

    This is why whatever the database says with respect to Price is irrelevant because you are actually predetermining the value here in the Event. (So say you head to a mining town that has an abundance of this item, the price might be cheaper there).

    6. Once we check the gold and the Party has enough we initate another check to see if the variable is not equal to 0. Becasue if the the "stock" (variable) is equal to zero then how can you sell it? If it is equal to zero we once again use the Exit Event processing to just cut the whole event off.

    7. Once all our checks are done and pass you will then see we remove the Gold from Inventory as well as subtract a value from the "Stock" variable. Now becasue we actually used the \v[x] in our message box it automatically updates the new value of our "stock" and when presented with the option to Purchase the Unrefined Iron or the Stone it will now show Unrefined Iron x19 indicating that there are only 19 left in stock becasue you just purchased one.

    8. That is really how the whole "Shop" works. It is pretty awesome becasue you don't need to use just gold. You can even have the vendor accept other items and use it as a trading post or whatever fits your theme.

    EXTRA NOTES
    a) You may be curios as to what the whole Label and Jump To Label does. You can think of it like this. When I set up my first Label, called "Start" this was essentially a "checkpoint" for the event processing system. So you will note when you select the "Go Back" option it "Jumps to Label" which simply means the event processing system brings you right back up to where "Start" is and then continues from there. It is a really easy way to make Menus "Go back" and stuff like that.

    b) What perks does using the YanflyMessageCore give me? It allows me to use the \I[832] which draws the icon for index number 832 which in my game is the Gold Coin. This way the player can see it costs X amount of Gold instead of having to type out Gold all the time. Granted that is all I am using it for in this specific vendor. You can use it for a TON of other commands as well like the namebox and everything like that. But this Event can work just as easy without the MessageCore.

    ADVANCED NOTE: You can easily condense this if you use the Script in your event pages, but I decided to keep this incredibly basic. You can also prevent choices from showing if you add in some Flow Control checks once the variables reach 0. But once again, the goal of this example is to be as basic as possible. Maybe in the future I will do a more advanced version of this utilizing the script commands.


    FINAL NOTES: I decided to make this tutorial becasue honestly it is a pretty nifty little setup. I personally have mine set up as a Common Event and he is a "Wandering Merchant" and his whole stock is stored within the variables and then everytime you get to a town with the "Wandering Merchant" you just call the common event and you dont need to set anything else up. Plus you can easily use other Events to "reset the stock" of the vendor.

    The screenshots on how to set them up are attached to this thread. Have fun!


    本贴来自国际rpgmaker官方论坛作者:HalestormXV处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/shop-with-limited-quantity-eventing.97507/

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-7-10 02:10 , Processed in 0.141338 second(s), 53 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表