Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ╔══════════════════════════════════════════════════════╤═══════╤═══════════╗
- # ║ Tactics Ogre PSP Crafting System │ v2.03 │ (5/11/13) ║
- # ╚══════════════════════════════════════════════════════╧═══════╧═══════════╝
- # Script by:
- # Mr. Bubble ( http://mrbubblewand.wordpress.com/ )
- # Thanks:
- # Mithran, regexp references
- # estriole, assistance with scene interpreter
- #--------------------------------------------------------------------------
- # This item crafting script is modeled after the crafting system implemented
- # in the PSP remake of Tactics Ogre: Let Us Cling Together. It's a very
- # simple crafting system with a very simple GUI which I also used as
- # a model.
- #
- # Players must have recipe books in their inventory when entering the
- # crafting scene. Any recipe books owned by the player will be displayed
- # in a list. When a recipe book is selected, all possible items, armors,
- # and weapons in the recipe book will be listed and you will be able to
- # craft them provided that the player has the necessary ingredients.
- #
- # The script "Info Pages Window" is required.
- #
- # Feel free to reguest custom information to be added to item info pages
- # in the crafting scene.
- #--------------------------------------------------------------------------
- # Changelog
- #--------------------------------------------------------------------------
- # v2.03 : Compatibility Update: "TH_SceneInterpreter"
- # : Bugfix: Fixed bug where selecting the number to craft
- # : ignores the amount of ingredients available. (5/11/2013)
- # v2.02 : Bugfix: Fixed categories nil error.
- # v2.01 : Bugfix: Fixed ingredient numbers in info window.
- # : New tag: <craft result>. See comments for more info.
- # : You can now run a common event after crafting an item.
- # : You can now change how many of an item you gain per
- # : set of ingredients. (5/02/2013)
- # v2.00 : Now requires script: "Info Pages Window".
- # : This script will now check if any required scripts are
- # : missing. If any are missing, the game will be exited.
- # : Many crafting customization options related to the info
- # : pages window have been removed.
- # : Changed version number format.
- # : $imported variable now uses version number.
- # : Changed some methods, add-ons/patches may not work anymore.
- # : Removed about 700+ lines of code. (5/02/2013)
- # v1.14 : Calling the crafting scene directly with SceneManager will
- # : no longer crash the game. (4/28/2013)
- # v1.13 : Bugfix: Custom craft result sound effects should no longer
- # : crash the game.
- # : Equippable members info page added.
- # : Cleaned up some code. (3/26/13)
- # v1.12 : Quick compatibility update with Tsukihime's TO Crafting Shop
- # : script. (3/13/13)
- # v1.11 : You can now require specific actors in the party as a crafting
- # : requirement.
- # : New ingredient notetag added.
- # : New options in the customization module added.
- # : Slight code efficiency update. (2/06/2013)
- # v1.10 : TP Recovery now displays the correct value.
- # : Recipebook images are now centered by default. (9/04/2012)
- # v1.09 : State resistance item info is now viewable.
- # : Footer text is now properly aligned. (8/28/2012)
- # v1.08 : Compatibility: "YEA-AceMenuEngine" support added.
- # : You can now view item details in the crafting scene if the
- # : script "Reader Functions for Features/Effects" is installed.
- # : Info window style has changed.
- # : Any amount of ingredients can now be displayed, not just 6.
- # : Configuration module has many new settings.
- # : Some method names have changed.
- # : Removed a chunk of redundant code.
- # : Efficiency update. (8/25/2012)
- # v1.07 : Fixed issue where you can still craft from a recipebook even if
- # : you have zero left as a result of using it in a crafting recipe.
- # : Script call for the crafting scene has changed. The old one can
- # : still be used though.
- # : New Notetag for recipebooks added.
- # : You can now choose which recipebooks can be included in the
- # : crafting scene by category.
- # : Efficiency update. (8/18/2012)
- # v1.06 : Compatibility: "XAS VX Ace" support added. (8/08/2012)
- # v1.05 : You can now change the recipebook pictures directory.
- # : You can now assign sound effects for crafted items.
- # : Slight code efficiency update. (7/29/2012)
- # v1.04 : Added the option to use images as recipebook covers.
- # : New Notetag for recipebooks added.
- # : New option in customization module for book images. (7/27/2012)
- # v1.03 : Colon between type and ID no longer needed.
- # : Updated comments to reflect changes.
- # : Tool regexp updated. (7/27/2012)
- # v1.02 : You can now change the Gold icon in the customization module.
- # : You can now change the name of Gold in windows. (7/27/2012)
- # v1.01 : Fixed issue with long item names getting cut off in windows.
- # : Confirm window removed.
- # : Quantity selection window implemented.
- # : Crafting Gold fee implemented.
- # : Crafting tool requirement implemented.
- # : New options added in customization module. (7/26/2012)
- # v1.00 : Initial release. (7/25/2012)
- #--------------------------------------------------------------------------
- # Installation & Requirements
- #--------------------------------------------------------------------------
- # Install this script in the Materials section in your project's
- # script editor BELOW the script "Info Pages Window".
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # Notetags
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # Note: Some tags are given shorter tags for typing convenience. You only
- # need to use one <tag> from a given group for a notebox.
- # Use common sense.
- #
- # The following Notetags are for Items, Weapons, and Armors only:
- #
- # <recipebook>
- # setting
- # setting
- # </recipebook>
- # This tag allows you define a recipe book. You can add as many
- # settings between the <recipebook> tags as you like. Only items with
- # this tag will appear in the recipes window in the crafting scene.
- # The following settings are available:
- #
- # item: id
- # item: id, id, id ...
- # i: id
- # i: id, id, id ...
- # This setting defines the items that can be crafted from the
- # recipe book where id is the Item ID number found in your database.
- # You can list multiple id numbers on the same line separated by commas.
- # This setting can be used multiple times within the <recipebook> tags.
- #
- # weapon: id
- # weapon: id, id, id ...
- # w: id
- # w: id, id, id ...
- # This setting defines the weapons that can be crafted from the
- # recipe book where id is the Weapon ID number found in your database.
- # You can list multiple id numbers on the same line separated by commas.
- # This setting can be used multiple times within the <recipebook> tags.
- #
- # armor: id
- # armor: id, id, id ...
- # armour: id
- # armour: id, id, id ...
- # a: id
- # a: id, id, id ...
- # This setting defines the armors that can be crafted from the
- # recipe book where id is the Armor ID number found in your database.
- # You can list multiple id numbers on the same line separated by commas.
- # This setting can be used multiple times within the <recipebook> tags.
- #
- # picture: filename
- # pic: filename
- # cover: filename
- # This setting defines the image used to represent the recipe book
- # in the crafting scene where filename is the name of a picture
- # located in the Graphics/Pictures/ folder of your project. Do
- # not include the filename's extension. Recommended picture
- # resolutions are [width: 248, height: 320] for default resolutions
- # and [width: 296, height: 384] for 480x640 resolutions.
- #
- # category: name
- # This setting defines the recipebook's category label. Category
- # labels are used by developers to determine which recipebooks
- # they want included in the crafting scene. If a category label is
- # not defined, the default category is "none". This is a completely
- # optional setting.
- #
- # <ingredients>
- # setting
- # setting
- # </ingredients>
- # This tag allows you define the ingredients required to craft an item.
- # You can add as many settings between the <ingredients> tags as you like.
- # If an item, weapon, or armor has no ingredients, you can still craft it.
- # The following settings are available:
- #
- # item: id
- # item: id xN
- # i: id
- # i: id xN
- # This setting defines the item ingredients required to craft the
- # item, weapon, or armor where id is the Item ID number found in
- # your database. xN is total number of that ingredient required if
- # it is included after the id number where N is a whole number
- # (ex. x2, x3, x4, etc.). If xN is not included, the script will
- # automatically assume x1. You can list multiple id numbers on the
- # same line separated by commas. This setting can be used multiple
- # times within the <ingredients> tags.
- #
- # weapon: id
- # weapon: id xN
- # w: id
- # w: id xN
- # This setting defines the weapon ingredients required to craft the
- # item, weapon, or armor where id is the Weapon ID number found in
- # your database. xN is total number of that ingredient required if
- # it is included after the id number where N is a whole number
- # (ex. x2, x3, x4, etc.). If xN is not included, the script will
- # automatically assume x1. You can list multiple id numbers on the
- # same line separated by commas. This setting can be used multiple
- # times within the <ingredients> tags.
- #
- # armor: id
- # armor: id xN
- # armour: id
- # armour: id xN
- # a: id
- # a: id xN
- # This setting defines the armor ingredients required to craft the
- # item, weapon, or armor where id is the Weapon ID number found in
- # your database. xN is total number of that ingredient required if
- # it is included after the id number where N is a whole number
- # (ex. x2, x3, x4, etc.). If xN is not included, the script will
- # automatically assume x1. You can list multiple id numbers on the
- # same line separated by commas. This setting can be used multiple
- # times within the <ingredients> tags.
- #
- # gold: amount
- # This setting defines the amount of Gold required to craft
- # the item, armor, or weapon where amount is any amount of gold.
- # If this setting is omitted, it will use the default fee defined
- # in the customization module.
- #
- # tool: item id
- # tool: i id
- # tool: weapon id
- # tool: w id
- # tool: armor id
- # tool: armour id
- # tool: a id
- # This setting defines the tools required to craft the item, weapon,
- # or armor where id is the item, weapon, or armor ID number found in
- # your database. Tools are not consumed in the crafting process.
- # This setting can be used multiple times within the <ingredients>
- # tags.
- #
- # actor: actor_id
- # This setting defines the actor required to craft the item, weapon,
- # or armor where actor_id is the actor ID number from your database.
- # Currently, nothing happens to the actor after crafting an item
- # that requires one. This setting can be used multiple times within
- # the <ingredients> tags.
- #
- # <craft result>
- # setting
- # setting
- # </craft result>
- # This tag allows you to define what happens after an item is
- # crafted. You can add as many settings between the <craft result>
- # tags as you like.
- # The following settings are available:
- #
- # se: filename, volume, pitch
- # This setting defines the custom sound effect played when the
- # item is crafted. filename is a sound effect filename found in
- # the Audio/SE/ folder. volume is a value between 0~100. pitch is
- # a value between 50~150. If this setting is omitted, the default
- # crafting sound effect defined in the customization module will
- # play instead.
- #
- # amount: n
- # This setting defines the amount that is produced from one
- # set of ingredients, where n is a number. By default, the
- # amount produced from one set of ingredients is 1.
- #
- # common event: id
- # cev: id
- # This setting defines a common event that runs right after an
- # item is crafted where id is a common event ID number
- # from your database.
- #
- # Here are some examples of proper <recipebook> tags and <ingredients> tags:
- #
- # <recipebook>
- # weapon: 1, 2, 7, 8, 13, 14, 19, 20
- # weapon: 25, 37, 38
- # armor: 1, 2, 3, 4, 5
- # item: 40
- # </recipebook>
- #
- # It is important to know that Note boxes have iffy word wrap distinction.
- # If a line is too long and overflows into the next line, that next line
- # might be treated as a new line in the Note box. To stay on the safe side,
- # if you have a long list of ids for a single item type setting, you
- # should start the next line with the similar type setting. See the
- # "weapon:" settings in this example tag.
- #
- # <ingredients>
- # item: 29 x3
- # item: 30 x2
- # item: 31
- # </ingredients>
- #
- # Each ingredient id must be on its own line, unlike the recipebook tag.
- # More than 6 ingredients are possible, but the Required Ingredients
- # window will not display more than 6. The last setting tag "item: 31" does
- # not have an "xN" multiplier which means the script will automatically
- # assume "x1".
- #
- # <ingredients>
- # fee: 30
- # se: Bell3, 80, 100
- # tool: item 40
- # item: 21
- # item: 22 x2
- # </ingredients>
- #
- # This tag is an example of how to use the "fee" and "tool" setting tags.
- # Item ID 40 is required to craft the item, but it will not be consumed.
- # Each item crafted costs 30 gold. The sound effect Bell3 will play
- # when the item is crafted.
- #
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # Script Calls
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # The following Script Calls are meant to be used in "Script..." event
- # commands found under Tab 3 when creating a new event.
- #
- # call_tocrafting_scene
- # This script call opens up a Tactics Ogre Crafting scene with all
- # recipebooks the player has in their inventory.
- #
- # call_tocrafting_scene( :category, :category, ...)
- # This script call opens up the Tactics Ogre Crafting scene with
- # only recipebooks that have the category included in one of the
- # script call's arguments. You can list as many categories in the
- # script call's arguments separated by commas as you like. Category
- # names must always be preceeded by a colon (:).
- #
- # Here is an example of a script call using call_tocrafting_scene with
- # category arguments:
- #
- # call_tocrafting_scene( :smithing )
- #
- # This script call will open up the crafting scene with only recipebooks
- # that have the category of "smithing".
- #
- #--------------------------------------------------------------------------
- # FAQ
- #--------------------------------------------------------------------------
- # --Why am I allowed to craft items that have no required ingredients?
- #
- # This was done on purpose to ease game development. I assumed that
- # when people finalize a game, they will have an appropriate list of
- # ingredients for each craftable item defined by then.
- #
- # --Can an item/armor/weapon have a <recipebook> tag AND an <ingredients>
- # tag?
- #
- # Yes.
- #
- # --Why isn't "Success Rate" also implemented in this script from
- # Tactics Ogre PSP?
- #
- # Because I think Success Rate on crafting in single-player games
- # is annoying and pointless due to save and load. But if there is
- # demand for it, I can implement it.
- #--------------------------------------------------------------------------
- # Compatibility
- #--------------------------------------------------------------------------
- # This script aliases the following default VXA methods:
- #
- # DataManager#load_database
- #
- # There are no default method overwrites.
- #
- # This script has built-in compatibility with the following scripts:
- #
- # -Xiderwong Action System (XAS) VX Ace
- # -Yanfly Engine Ace - Ace Menu Engine by YF
- # -Scene Interpreter by Tsukihime
- #
- # Requests for compatibility with other scripts are welcome.
- #--------------------------------------------------------------------------
- # Terms and Conditions
- #--------------------------------------------------------------------------
- # Please do not repost this script elsewhere without permission.
- # Free for non-commercial use. For commercial use, contact me first.
- #
- # Newest versions of this script can be found at
- # http://mrbubblewand.wordpress.com/
- #=============================================================================
- $imported ||= {}
- $imported["BubsTOCrafting"] = 2.03
- #==========================================================================
- # ++ START OF USER CUSTOMIZATION MODULE ++
- #==========================================================================
- module Bubs
- #==========================================================================
- # ++ TO Crafting Settings
- #==========================================================================
- module TOCrafting
- #--------------------------------------------------------------------------
- # Ingredients List Display Settings
- #--------------------------------------------------------------------------
- INGREDIENTS_HEADER_TEXT = "Ingredients" # Header text
- INGREDIENTS_PAGE_SIZE = 5 # 6 is recommended for 640x480 resolutions
- NOT_ENOUGH_INGREDIENTS_COLOR = 10 # Windowskin color index, default 10 (red)
- #--------------------------------------------------------------------------
- # Ingredients Info Page Footer Text
- #--------------------------------------------------------------------------
- # Recommended length: 22 characters " "
- INGREDIENTS_VIEW_MORE_FOOTER_TEXT = "←A Shift: More... S→"
- #--------------------------------------------------------------------------
- # Tools Display Settings
- #--------------------------------------------------------------------------
- TOOL_AVAILABLE_TEXT = "Available"
- TOOL_AVAILABLE_TEXT_COLOR = 3 # Windowskin color index, default 3 (green)
- TOOL_UNAVAILABLE_TEXT = "Unavailable"
- TOOL_UNAVAILABLE_TEXT_COLOR = 10 # Windowskin color index, default 10 (red)
- #--------------------------------------------------------------------------
- # Faded Requirement Not Met Display Settings
- #--------------------------------------------------------------------------
- # true : Ingredient quantity and Tool requirement text will be faded
- # out like the item name if the requirement isn't met
- # false : Ingredient quantity and Tool requirement text will not be faded
- FADED_REQUIREMENT_QUANTITY = false
- #--------------------------------------------------------------------------
- # Crafting Gold Fee Default Markdown/Markup Rate
- #--------------------------------------------------------------------------
- # If a "gold: amount" setting is not included in an <ingredients> tag,
- # it will use the item's Price in the database by default. This setting
- # allows you to automatically increase or decrease that item, armor
- # or weapon price by a specified rate where 100.0 is normal price and
- # 0.0 is free.
- CRAFTING_FEE_PRICE_RATE = 0.0
- #--------------------------------------------------------------------------
- # Gold Window Settings
- #--------------------------------------------------------------------------
- # true : Gold window appears in crafting scene
- # false : Gold crafting fees appear in ingredients list, no gold window
- USE_GOLD_WINDOW = true
- GOLD_WINDOW_ICON_INDEX = 361 # Icon Index number
- GOLD_WINDOW_TEXT = "Gold"
- #--------------------------------------------------------------------------
- # Crafting Result Header Text
- #--------------------------------------------------------------------------
- RESULT_WINDOW_HEADER_TEXT = "You Received"
- #--------------------------------------------------------------------------
- # Stretch Recipebook Pictures Setting
- #--------------------------------------------------------------------------
- # Recommended width and height for book covers images:
- #
- # width: 248, height: 320 (default resolutions)
- # width: 296, height: 384 (480x640 resolutions)
- #
- # true : Book cover pics are stretched to fit the contents of the window.
- # false : Book cover pics are drawn normally.
- STRETCH_RECIPEBOOK_PICTURES = false
- #--------------------------------------------------------------------------
- # Recipebook Images Folder Directory
- #--------------------------------------------------------------------------
- # Project folder where recipebook pictures are located.
- #
- # Default: "Graphics/Pictures/"
- RECIPEBOOK_PICTURES_DIRECTORY = "Graphics/Pictures/"
- #--------------------------------------------------------------------------
- # Default Crafting Result Sound Effect
- #--------------------------------------------------------------------------
- # Filename : SE filename in Audio/SE/ folder
- # Volume : Between 0~100
- # Pitch : Between 50~150
- #
- # Filename, Volume, Pitch
- CRAFTING_RESULT_SE = [ "Bell2", 80, 100]
- #--------------------------------------------------------------------------
- # Actor Requirement Display Settings
- #--------------------------------------------------------------------------
- ACTOR_AVAILABLE_TEXT = "Available"
- ACTOR_AVAILABLE_TEXT_COLOR = 3 # Windowskin color index, default 3 (green)
- ACTOR_UNAVAILABLE_TEXT = "Unavailable"
- ACTOR_UNAVAILABLE_TEXT_COLOR = 10 # Windowskin color index, default 10 (red)
- #--------------------------------------------------------------------------
- # Change Ingredident Page Button
- #--------------------------------------------------------------------------
- # This setting determine which gamepad button changes the ingredient
- # window page. Possible buttons include :LEFT, :RIGHT, :UP, :DOWN,
- # :A, :B, :C, :X, :Y, :Z, :L, :R
- NEXT_INGREDIENT_PAGE_BUTTON = :A
- #--------------------------------------------------------------------------
- # YEA Ace Menu Engine - Custom Menu Command Setting
- #--------------------------------------------------------------------------
- # This setting only takes effect when YEA - Ace Menu Engine is installed
- # in the same project.
- #
- # To add the TOCrafting scene to Ace Menu Engine, look for a
- # configuration setting called "- Main Menu Settings -". There is a
- # variable called COMMANDS that has an array of orange symbols. Add
- # the symbol :tocrafting to the COMMANDS array to add the crafting
- # command to your menu.
- #
- # The setting here working exactly the same as the CUSTOM_COMMAND
- # setting in Ace Menu Engine. For more information, please refer to
- # the Ace Menu Engine script.
- TOCRAFTING_CUSTOM_COMMAND = {
- # ["Display Name", EnableSwitch, ShowSwitch, Handler Method],
- :tocrafting => [ "Crafting", 0, 0, :command_tocrafting],
- } # <- Do not delete.
- end # module TOCrafting
- end # module Bubs
Advertisement
Add Comment
Please, Sign In to add comment