Common Event Shop

Last Updated: 2012.01.13
Download Link
Github Link

Sometimes, being able to buy items just isn’t enough. With the common event shop, you can set anything to be sold as long as you can event it. Expanded upon the original Yanfly Engine ReDux version, the Ace version gives more options such as using custom switches to enable/disable common events from being bought or even appearing. And if that wasn’t enough, advanced users can use eval strings for more conditional common events.

To open up the common event shop, use this script call to call the desired shop.

common_event_shop(x)

This will call common event shop x. x will the shop ID used from the SHOPS hash in the script’s module. Any items placed within the array assigned to the shop ID will be sold as common events.

Set which common events can be sold for each of the shop ID’s. Insert the common event ID’s into the array pertaining to each of the shop ID.

And as such, the player will be taken to this menu where the common events are listed and sold. When a common event is bought, it will run inside of the common event shop without leaving.

You can have the common events send the player outside the shop by inserting <exit shop> inside of a comment within the common event.

<exit shop>

When this event is bought, the player will automatically exit the shop before the common event will take place. If this tag is not used, the common event’s contents will take place inside of the common event shop.

You can modify the help description, the icon, the cost, the variables shown to the right, and the data window text through comment tags.

<cost: x>

Sets the gold cost of the common event to x gold. If this notetag is not used the default gold cost will be whatever DEFAULT_COST is in the script module.

<icon: x>

Changes the icon used for the common event to x icon index. If this notetag is not used, the icon used for the common event will be whatever DEFAULT_ICON is in the script module.

<image: string>

Changes the image used for the common event to filename “string” found in the Graphics\Pictures\ folder. Requires Ace Shop Options to use. If this tag is not used, the image displayed will be the common event’s expanded icon.

<help description>
  string
</help description>

Sets the text used for the help window in the shop scene. Multiple lines in the notebox will be strung together. Use | for a line break. Text codes may be used inside of the help description.

<shop data>
  string
</shop data>

Can be used if you have Yanfly Engine Ace – Ace Shop Options installed. Sets the string as the text shown inside the data window the shop. Use | for a line break. Text codes may be used inside of the shop data text.

<shop variables: x>
<shop variables: x, x>

This sets the variable x displayed in the status window in the lower right corner of the screen. Insert multiples of this notetag to display more variables inside of the status window.

Enable, disable, show, and hide common events through the use of switches.

<shop enable switch: x>
<shop enable switch: x, x>

This notetag will cause the common event item to require switch x to be ON before the common event can be bought. Insert multiples of these notetags to require more switches to be ON before the common event item can be gouth.

<shop enable eval>
  string
  string
</shop enable eval>

Advanced users can enable and disable common events from being bought through this notetag. Replace string with lines of code to check for whether or not the common event can be sold. If multiple lines are used, they are considered to be a part of the same line.

<shop show switch: x>
<shop show switch: x, x>

This notetag will cause the common event item to be hidden unless switch x is ON. Insert multiple of these notetags to require more switches to be ON before the common event item will be shown in the shop.

<shop show eval>
  string
  string
</shop show eval>

Advanced users can show and hide common events from being listed in the buy list through this notetag. Replace string with lines of code to check for whether or not the common event will be shown. If multiple lines are used, they are considered to be a part of the same line.

And that’s all, folks!

37 comments on “Common Event Shop

  1. Seiryuki: If YF doesn’t add that in (it currently doesn’t, I believe), I have to do that for my own project, so I’ll release an add-on that allows for variables as currency soon enough.

      • I wouldn’t use this script, at least in my current project, but I just wanted to share my thoughts instead of keeping it in.
        I was also actually wondering why Yanfly didn’t include the JP as a cost option as that would’ve been useful for those utilising the JP system.

  2. I was adding a “Craft” command inside of the Common Event Shop and I was wondering why there is a sell command but no option to select “sell” inside of the C.E.S.
    [IMG]http://i871.photobucket.com/albums/ab271/ChimeraFO/ScreenHunter_08Feb211654.jpg[/IMG]

  3. Pingback: First of many Icon Sets « Candy Coded Response

  4. I hate to post this here, but I see in many of YanFly’s screenshots: Quests, Mining level, fishing level, etc… I don’t see any scripts for a Quest Journal… I assume the others are just skills? I am very interested in the Quest Journal and adding a menu option etc.

  5. Ok, separate question :)

    Should I use this for a skill shop? I have been trying to mod the Learn Skill script into a skill shop but I seriously suck at scripting though I am trying to learn. Any thoughts?

  6. Man I’m so stumped I wanted to make the cost scale more you buy and I have Idea on how to do some of it the problem lies in telling the script to Read a variable and if Constant is 0 it will be and if Constant is 1 it will be a different
    And so on.

    If you don’t get what I’m saying I provide an image of how it would look like if I could just event the action http://img.photobucket.com/albums/v321/DDayDark/Eventfucked.png So can anyone provide some help.

    • To be honest, I’m surprised Yanfly didn’t implement his JP script in more of his scripts. Like his skill cost manager too. JP would be great in more than just to buy skills. :P
      That said, his scripts are still amazing either way~

  7. Wonderfull but…I just can’t see a way to put a Limit to the sold event, isn’t there a way to put a limit to this?

  8. I’m a script noob… But how do I do something like this:

    Go to common event shop
    Item is called (Increase JP +100) or something
    Choose a party member
    raise said party member’s JP +100

    But how do I get it to where you can choose ANY party member not just 1 of 4 using Choices? Know what I mean? Like how to select actor 5 when only actors 1-4 are currently in the active party?

    Please help. Be specific dont say “use variable duh” lol idk what that means

  9. Is there a way to use this with Yanfly’s Class System to level specific subclasses?
    I tried to get it to work, but I can only get it to level whatever the Primary Class is…

  10. I’ve set it up so the common event shop is called exclusively from the menu. Is there a simple way I can edit the script so that the “cancel” button in the shop directs back to the menu. It’s a small quality-of-life inconvenience to have to reopen the menu after hitting “cancel,” but I’d like to be able to change it if possible.

    Also, if I could have certain common event shops “cancel” to other common event shops, that would be great too; however, I don’t want to ask too much.

    Thanks!

  11. Is there a way to make this work with YEA Class Specifics?

    I kinda wish to make a class shop and was unsure where to look.

    Then on the internet I came across this lovely thing but was curious if there was a way to change it from comment-Events to Classes used by the YEA Class Specific script?

  12. Is there a way to make this shop event into more of a tent event?
    Because if so, how? I’m new to this and can’t get it to work for the life of me ;w;

  13. What does an example section look like?
    Does it need to be written as something returning a value or is the code in here just treated as an expression?

  14. Switches affecting CE appearance can trigger a crash when they eliminate
    Common Events’s from the shop’s display.
    The error occurs at line 875:

    Script ‘Common Event Shop’ line 875: NoMethodError occurred.
    undefined method `event_type’ for nil:NilClass

    I’ve narrow this to situations where the running of a common event changes the switch affecting its display in the shop.

    Background: My game uses Szyu’s crafting script. A script command
    is needed to teach a recipe (by adding it to the appropriate inventoried
    recipe book key item).

    Long story short: I create common events to trigger these script commands.

    So far so good. In the context I’m using the Common Event Shop is to have a teacher that can teach crafting patterns. So you buy the Common Event and when it runs it triggers the script (as I explained above).

    Now these are learned so they should then disappear from the shop.
    For that I use the switches aha! but the built-in switch tags are “disable
    when off” for clearing learned patterns I need the inverse: “disable when ON” (so when game is started all patterns==unlearned==switch off) when learned==switch on then the teacher would stop offering that skill. For this I use ([]s for angle brackets otherwise WP eats them):
    [shop show eval]
    $game_switches[x]==false
    [/show show eval]

    So the error then occurs:
    go to the teacher (whose shop array has a single teach-pattern Common Event)
    buy the pattern (runs the Common Event fully I’ve confirmed with a text message at the end
    which displays before the error crash)
    (a switch will have changed altering the # of displayed Common Events)
    the error occurs following completion of the Common Event and control returning to the Common Event Shop script.

    • Yeah you can boot the player from the shop as a workaround but in doing so it becomes inconvenient for a player to learn several patterns in succession.

Leave a comment