Últimos temas
» [Ace]Movimiento Libre
por brrt Ayer a las 3:57 pm

» Virtual Kingom (Old Version)
por NinjaLOL Ayer a las 3:22 am

» Concurso de relatos - Septiembre/Octubre 2018 [Inscripción]
por raffael_0 Ayer a las 3:18 am

» Laminación [VXACE] [PROYECTO EN CURSO]
por Pocari Vie Oct 12, 2018 12:08 pm

» QUITAR VENTANA DEL MENU (VX ACE)
por THESHINYMISTERXD Sáb Oct 06, 2018 7:46 pm

» Condición para saber si el jugador está caminando
por Sonik Sáb Oct 06, 2018 5:03 pm

» ¿Tileset de un futbolín?
por MCarlos15 Jue Oct 04, 2018 9:07 pm

» RPG Maker VX Ace en MAC
por Er1ck_92 Mar Oct 02, 2018 8:42 am

» Distrito 0 [VXACE]
por BREAK93 Mar Oct 02, 2018 6:08 am

» Necesito taileset modernos pero que no tengan estilo anime por favor
por Doble D Mar Oct 02, 2018 12:36 am

» Fantasy World XP (+ de 200 para o grupo)
por DecinBR Sáb Sep 29, 2018 6:28 pm

» Problemas con un archivo
por AetherIssei Dom Sep 23, 2018 4:08 am


[ACE] Script CSCA Skill Shop (Tienda de habilidades)

Ir abajo

[ACE] Script CSCA Skill Shop (Tienda de habilidades)

Mensaje por ClousTrife el Dom Ene 03, 2016 2:34 pm

Nunca has pensado en poder comprar las habilidades para los miembros de tu equipo al más puro estilo final fantasy.
Pues ahora podras hacerlo
Primero deberas copiar estos dos script en material.
Core Script CSCA(Este el primero de todos)
Spoiler:
=begin
CSCA Core Script
version: 1.0.7
Created by: Casper Gaming (http://www.caspergaming.com/)

Scripts that REQUIRE this script to work:
CSCA Colosseum
CSCA Dungeon Tools
CSCA Achievements
CSCA Encyclopedia
CSCA Treasure Maps
CSCA Menu MOD
CSCA SaveFile Plus
CSCA Vehicle System
CSCA Sidequests
CSCA Professions

Version History:
1.0.1 - Adds CSCA_Item class, used by scripts to get information about an item.
1.0.2 - Adds CSCA_Fish class, used by Vehicle System to get fishing data.
1.0.3 - Adds Window_HorzCommand fix to allow unlimited horizontal commands.
1.0.4 - Adds CSCA_Core class, used for csca script data that needs to be saved.
1.0.5 - Adds shorter access to variables/switches in Event script command.
1.0.6 - Adds troubleshooting error/warning reports.
1.0.7 - Adds vowel detection for strings.

COMPATIBILITY
PLACE THIS SCRIPT ABOVE ALL OTHER CSCA SCRIPTS!
Compatible only for VXAce.
IMPORTANT: ALL CSCA Scripts should be compatible with each other unless
otherwise noted.

FFEATURES
This script includes classes and functions used by other CSCA Scripts.

SETUP
Plug n play. Make sure this script is ABOVE all other CSCA Scripts.

CREDIT:
Free to use in noncommercial games if credit is given to:
Casper Gaming (http://www.caspergaming.com/)

To use in a commercial game, please purchase a license here:
http://www.caspergaming.com/licenses.html

TERMS:
http://www.caspergaming.com/terms_of_use.html
=end
$imported = {} if $imported.nil?
$imported["CSCA-Core"] = true
#==============================================================================
# ** DataManager
#------------------------------------------------------------------------------
# Handles csca class data.
# Aliases: make_save_contents, create_game_objects, extract_save_contents
#==============================================================================
module DataManager
  #--------------------------------------------------------------------------
  # alias method
  #--------------------------------------------------------------------------
  class <  def self.create_game_objects
    csca_core_create_game_objects
    $csca = CSCA_Core.new
  end
  #--------------------------------------------------------------------------
  # overwrite method
  #--------------------------------------------------------------------------
  class <  def self.make_save_contents
    contents = csca_core_save_contents
    contents[:csca] = $csca
    contents
  end
  #--------------------------------------------------------------------------
  # alias method
  #--------------------------------------------------------------------------
  class <  def self.extract_save_contents(contents)
    csca_core_extract_save_contents(contents)
    $csca = contents[:csca]
  end
end
#==============================================================================
# ** CSCA_Window_Header
#------------------------------------------------------------------------------
# This window displays the header window, used by many CSCA Scripts.
#==============================================================================
class CSCA_Window_Header < Window_Base
  #--------------------------------------------------------------------------
  # Object Initialization
  #--------------------------------------------------------------------------
  def initialize(x, y, width = Graphics.width, height = line_height*2, text)
    super(x, y, width, height)
    refresh(text)
  end
  #--------------------------------------------------------------------------
  # Refresh
  #--------------------------------------------------------------------------
  def refresh(text)
    contents.clear
    draw_text(0, 0, contents.width, line_height, text, 1)
  end
end
#==============================================================================
# ** Game_Map
#------------------------------------------------------------------------------
# Easy csca access to the map's note.
#==============================================================================
class Game_Map
  #--------------------------------------------------------------------------
  # Get Map Note
  #--------------------------------------------------------------------------
  def csca_map_note; @map.note; end
end
#==============================================================================
# ** Window_HorzCommand
#------------------------------------------------------------------------------
# Allow unlimited horizontal commands.
# Overwrites: top_col=
#==============================================================================
class Window_HorzCommand < Window_Command
  #--------------------------------------------------------------------------
  # Overwrite Method
  #--------------------------------------------------------------------------
  def top_col=(col)
    col = 0 if col < 0
    self.ox = col * (item_width + spacing)
  end
end
#==============================================================================
# ** Game_Interpreter
#------------------------------------------------------------------------------
#  Shorter access to variables and switches.
#==============================================================================
class Game_Interpreter
  #--------------------------------------------------------------------------
  # Get variables
  #--------------------------------------------------------------------------
  def csca_v(var)
    $game_variables[var]
  end
  #--------------------------------------------------------------------------
  # Get switches
  #--------------------------------------------------------------------------
  def csca_s(swi)
    $game_switches[swi]
  end
end
#==============================================================================
# ** CSCA_Item
#------------------------------------------------------------------------------
# CSCA Items, used as rewards/wagers in various scripts.
#==============================================================================
class CSCA_Item
  attr_reader :id
  attr_reader :amount
  attr_reader :type
  #--------------------------------------------------------------------------
  # Initialize
  #--------------------------------------------------------------------------
  def initialize(amount,id,type)
    @id = id
    @amount = amount
    @type = type
  end
end
#==============================================================================
# ** CSCA_Fish
#------------------------------------------------------------------------------
# CSCA Fish, used to specify data about fish.
#==============================================================================
class CSCA_Fish
  attr_reader :item_id
  attr_reader :water_type
  attr_reader :weight
  attr_reader :region
  #--------------------------------------------------------------------------
  # Initialize
  #--------------------------------------------------------------------------
  def initialize(id, water, weight, region = 0)
    @item_id = id
    @water_type = water
    @weight = weight
    @region = region
  end
end
#==============================================================================
# ** CSCA_Core
#------------------------------------------------------------------------------
# Used to provide global methods for csca scripts. Data is included in save.
#==============================================================================
class CSCA_Core
  #--------------------------------------------------------------------------
  # Initialize
  #--------------------------------------------------------------------------
  def initialize
  end
  #--------------------------------------------------------------------------
  # Report wrong setup
  #--------------------------------------------------------------------------
  def report_error(error, script, suggestion, warning = false)
    string1 = warning ? "Warning: " : "Error: "
    msgbox(string1 + error + "\nOccurred in: " + script + "\nRecommended fix: " + suggestion)
  end
  #--------------------------------------------------------------------------
  # Split number into millions, thousands, hundreds
  #--------------------------------------------------------------------------
  def split_number(start)
    number = []
    number[0] = start / 1000 / 1000
    number[1] = start / 1000 % 1000
    number[2] = start % 1000
    return number
  end
  #--------------------------------------------------------------------------
  # Split number into hours, minutes, seconds
  #--------------------------------------------------------------------------
  def split_playtime(start)
    number = []
    number[0] = start / 60 / 60
    number[1] = start / 60 % 60
    number[2] = start % 60
    return number
  end
  #--------------------------------------------------------------------------
  # Determine if letter is a vowel or not
  #--------------------------------------------------------------------------
  def is_a_vowel(letter, space = false)
    letter.upcase
    return letter == "A" || letter == "E" || letter == "I" || letter == "O" || letter == "U" || (letter == "X" && space == true)
  end
end
Y luego este otro debajo del primero.
CSCA Menu Organizer
Spoiler:
=begin
CSCA Menu Organizer
version: 1.0.6 (Released: July 20, 2013)
Created by: Casper Gaming (http://www.caspergaming.com/)

This version supports:
CSCA Encyclopedia w/ Bestiary (all versions)
CSCA Dungeon Tools (v1.3b +)
CSCA Treasure Maps (all versions)
CSCA Achievements (all versions)
CSCA SideQuests (all versions)
CSCA Professions (all versions)
CSCA Quest System (all versions)

COMPATIBILITY
Note: If you are using a version of any CSCA script that adds itself to the menu,
you'll need to turn that option off to be compatible with this script.

Should be compatible with almost any script. Compatible only for VXAce.
IMPORTANT: ALL CSCA Scripts should be compatible with each other unless
otherwise noted.

FFEATURES
This script will allow you to easily add any CSCA Scripts to your main menu. It
also allows you to change the default commands easily, as well as add an option
to open the debug menu from the main menu during playtest mode.

SETUP
Setup options below.

CREDIT:
Free to use in noncommercial games if credit is given to:
Casper Gaming (http://www.caspergaming.com/)

To use in a commercial game, please purchase a license here:
http://www.caspergaming.com/licenses.html

TERMS:
http://www.caspergaming.com/terms_of_use.html
=end
module CSCA
  module MENU
   
    #Main Menu Options - changing these to true may increase compatibility with
    #custom menu scripts
    MAIN_COMMANDS = true     # Add item, skill, equip, status to the menu?
    FORMATION_COMMAND = true # Add the formation command to the menu?
    ORIGINAL_COMMANDS = true # Add custom script commands to the menu?
    SAVE_COMMAND = true      # Add the save command to the menu?
    END_COMMAND = true       # Add the game end command to the menu?
   
    # Leaving these as true may increase compatibility with custom menu scripts.
    # These only have an effect if MAIN_COMMANDS above is set to true.
    ITEM_ENABLED = true     # Add Item to the menu?
    SKILL_ENABLED = true    # Add Skill to the menu?
    EQUIP_ENABLED = true    # Add Equip to the menu?
    STATUS_ENABLED = true   # Add Status to the menu?
   
    DEBUG = true # Add debug option to menu in playtest mode?
   
    #Setting this to 0 may increase compatibility with custom menu scripts.
    LINES = 10  #Amount of commands to show before scrolling to show.
               #If set to 0, the window will show all commands without scrolling.
   
   
    #CSCA Script Setup
   
    #The following commands require CSCA Encyclopedia
    #http://www.rpgmakervxace.net/topic/2775-csca-encyclopedia-w-bestiary-v20/
    ENCYCLOPEDIA = "Encyclopedia"
    INCLUDE_ENC = true # Include the CSCA Encyclopedia in the menu?
    ENC_SWITCH = 0 # Switch that shows/hides Encyclopedia in menu. 0 = always show
   
    #The following commands require CSCA Dungeon Tools
    #http://www.rpgmakervxace.net/topic/2275-csca-dungeon-tools/
    DUNGEON_TOOLS = "Dungeon Tools"
    INCLUDE_DUN = true # Include the CSCA Dungeon Tools in the menu?
    DT_SWITCH = 0 # Switch that shows/hides Dungeon Tools in menu. 0 = always show
   
    #The following commands require CSCA Treasure Maps
    #http://www.rpgmakervxace.net/topic/5388-csca-treasure-maps/
    TREASURE_MAPS = "Treasure Maps"
    INCLUDE_MAP = true # Include the CSCA Treasure Maps in the menu?
    MAP_SWITCH = 0 # Switch that shows/hides Treasure Maps in menu. 0 = always show
   
    #The following commands require CSCA Achievements
    #http://www.rpgmakervxace.net/topic/5554-csca-achievements/
    ACHIEVEMENTS = "Achievements"
    INCLUDE_ACH = true # Include the CSCA Achievements in the menu?
    ACH_SWITCH = 0 # Switch that shows/hides Achievements in menu. 0 = always show
   
    # The following commands require CSCA SideQuests
    #http://www.rpgmakervxace.net/topic/7837-csca-sidequestbulletin-board-system/
    SIDEQUESTS = "Sidequests"
    INCLUDE_SQ = true # Include CSCA SideQuests in the menu?
    SQ_SWITCH = 1 # Switch that shows/hides Sidequess in menu. 0 = always show
   
    # The following commands require CSCA Professions
    #http://www.rpgmakervxace.net/topic/14734-csca-professions/
    PROFESSIONS = "Professions"
    INCLUDE_PRF = true # Include CSCA Professions in the menu?
    PRF_SWITCH = 0 # Switch that shows/hides Professions in menu. 0 = always show
   
    # The following commands require CSCA Quest System
    #coming soon
    QUESTS = "Quests"
    INCLUDE_QSY = true # Include CSCA Quest System in the menu?
    QSY_SWITCH = 0 # Switch that shows/hides Quest System in menu. 0 = always show
   
    # NOTE:
    #
    # This script will be updated consistently to include future CSCA scripts
    # that can go in the menu, however support for all custom scripts is not
    # planned. Yanfly already has a script for that, if that's what you want:
    # http://yanflychannel.wordpress.com/rmvxa/menu-scripts/ace-menu-engine/
    #
    # This script is just meant for those who just want to easily add CSCA
    # Scripts to the menu without all of the other features.
   
  end
end
$imported = {} if $imported.nil?
$imported["CSCA-MenuOrganizer"] = true
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
# Adds commands for CSCA Scripts.
#==============================================================================
class Scene_Menu < Scene_MenuBase
  #--------------------------------------------------------------------------
  # Alias Method; create command window
  #--------------------------------------------------------------------------
  alias :csca_create_command_window :create_command_window
  def create_command_window
    csca_create_command_window
    @command_window.set_handler(:cscadebug, method(:csca_debug_select)) if $TEST && CSCA::MENU::DEBUG
    @command_window.set_handler(:encyclopedia, method(:csca_encyclopedia_select))  if $imported["CSCA-Encyclopedia"] &&
    CSCA::MENU::INCLUDE_ENC
    @command_window.set_handler(:dungeontools, method(:csca_dt_select)) if $imported["CSCA-DungeonTools"] &&
    CSCA::MENU::INCLUDE_DUN
    @command_window.set_handler(:treasuremaps, method(:csca_tmap_select)) if $imported["CSCA-TreasureMaps"] &&
    CSCA::MENU::INCLUDE_MAP
    @command_window.set_handler(:achievements, method(:csca_ach_select)) if $imported["CSCA-Achievements"] &&
    CSCA::MENU::INCLUDE_ACH
    @command_window.set_handler(:sidequests, method(:csca_sq_select)) if $imported["CSCA-SideQuests"] &&
    CSCA::MENU::INCLUDE_SQ
    @command_window.set_handler(:professions, method(:csca_prf_select)) if $imported["CSCA-Professions"] &&
    CSCA::MENU::INCLUDE_PRF
    @command_window.set_handler(:quests, method(:csca_qsys_select)) if $imported["CSCA-QuestSystem"] &&
    CSCA::MENU::INCLUDE_QSY
  end
  #--------------------------------------------------------------------------
  # Processing when Encyclopedia is selected
  #--------------------------------------------------------------------------
  def csca_encyclopedia_select
    SceneManager.call(Scene_CSCA_Encyclopedia)
  end
  #--------------------------------------------------------------------------
  # Processing when Dungeon Tools is selected
  #--------------------------------------------------------------------------
  def csca_dt_select
    SceneManager.call(CSCA_Scene_DungeonToolSelect)
  end
  #--------------------------------------------------------------------------
  # Processing when Treasure Maps is selected
  #--------------------------------------------------------------------------
  def csca_tmap_select
    SceneManager.call(Scene_CSCA_TreasureMaps)
  end
  #--------------------------------------------------------------------------
  # Processing when Debug is selected
  #--------------------------------------------------------------------------
  def csca_debug_select
    SceneManager.call(Scene_Debug)
  end
  #--------------------------------------------------------------------------
  # Processing when Achievements is selected
  #--------------------------------------------------------------------------
  def csca_ach_select
    SceneManager.call(CSCA_Scene_Achievements)
  end
  #--------------------------------------------------------------------------
  # Processing when Side Quests is selected
  #--------------------------------------------------------------------------
  def csca_sq_select
    SceneManager.call(CSCA_Scene_SidequestMenu)
  end
  #--------------------------------------------------------------------------
  # Processing when Professions is selected
  #--------------------------------------------------------------------------
  def csca_prf_select
    SceneManager.call(CSCA_Scene_Professions)
  end
  #--------------------------------------------------------------------------
  # Processing when Quest System is selected
  #--------------------------------------------------------------------------
  def csca_qsys_select
    SceneManager.call(CSCA_Scene_Quest)
  end
end
#==============================================================================
# ** Window_MenuCommand
#------------------------------------------------------------------------------
# Displays commands for CSCA Scripts.
#==============================================================================
class Window_MenuCommand < Window_Command
  #--------------------------------------------------------------------------
  # Alias Method; make command list
  #--------------------------------------------------------------------------
  alias :csca_make_command_list :make_command_list
  def make_command_list
    if CSCA::MENU::MAIN_COMMANDS && CSCA::MENU::FORMATION_COMMAND &&
      CSCA::MENU::ORIGINAL_COMMANDS && CSCA::MENU::SAVE_COMMAND &&
      CSCA::MENU::END_COMMAND
      csca_make_command_list
    else
      add_main_commands if CSCA::MENU::MAIN_COMMANDS
      add_formation_command if CSCA::MENU::FORMATION_COMMAND
      add_original_commands if CSCA::MENU::ORIGINAL_COMMANDS
      add_save_command if CSCA::MENU::SAVE_COMMAND
      add_game_end_command if CSCA::MENU::END_COMMAND
    end
  end
  #--------------------------------------------------------------------------
  # Alias Method; add main commands
  #--------------------------------------------------------------------------
  alias :csca_main_commands :add_main_commands
  def add_main_commands
    if CSCA::MENU::ITEM_ENABLED && CSCA::MENU::SKILL_ENABLED && CSCA::MENU::EQUIP_ENABLED &&
      CSCA::MENU::STATUS_ENABLED
      csca_main_commands
    else
      add_command(Vocab::item,   :item,   main_commands_enabled) if CSCA::MENU::ITEM_ENABLED
      add_command(Vocab::skill,  :skill,  main_commands_enabled) if CSCA::MENU::SKILL_ENABLED
      add_command(Vocab::equip,  :equip,  main_commands_enabled) if CSCA::MENU::EQUIP_ENABLED
      add_command(Vocab::status, :status, main_commands_enabled) if CSCA::MENU::STATUS_ENABLED
    end
  end
  #--------------------------------------------------------------------------
  # Alias Method; add original commands
  #--------------------------------------------------------------------------
  alias :csca_commands :add_original_commands
  def add_original_commands
    add_command("Debug", :cscadebug) if $TEST && CSCA::MENU::DEBUG
    add_command(CSCA::MENU::ENCYCLOPEDIA, :encyclopedia) if $imported["CSCA-Encyclopedia"] &&
      CSCA::MENU::INCLUDE_ENC && csca_check_switch(CSCA::MENU::ENC_SWITCH)
    add_command(CSCA::MENU::DUNGEON_TOOLS, :dungeontools, csca_dt_enabled) if $imported["CSCA-DungeonTools"] &&
      CSCA::MENU::INCLUDE_DUN && csca_check_switch(CSCA::MENU::DT_SWITCH)
    add_command(CSCA::MENU::TREASURE_MAPS, :treasuremaps) if $imported["CSCA-TreasureMaps"] &&
      CSCA::MENU::INCLUDE_MAP && csca_check_switch(CSCA::MENU::MAP_SWITCH)
    add_command(CSCA::MENU::ACHIEVEMENTS, :achievements) if $imported["CSCA-Achievements"] &&
      CSCA::MENU::INCLUDE_ACH && csca_check_switch(CSCA::MENU::ACH_SWITCH)
    add_command(CSCA::MENU::SIDEQUESTS, :sidequests) if $imported["CSCA-SideQuests"] &&
      CSCA::MENU::INCLUDE_SQ && csca_check_switch(CSCA::MENU::SQ_SWITCH)
    add_command(CSCA::MENU::PROFESSIONS, :professions) if $imported["CSCA-Professions"] &&
      CSCA::MENU::INCLUDE_PRF && csca_check_switch(CSCA::MENU::PRF_SWITCH)
    add_command(CSCA::MENU::QUESTS, :quests) if $imported["CSCA-QuestSystem"] &&
      CSCA::MENU::INCLUDE_QSY && csca_check_switch(CSCA::MENU::QSY_SWITCH)
    csca_commands
  end
  #--------------------------------------------------------------------------
  # Alias Method; visible line number
  #--------------------------------------------------------------------------
  alias :csca_line_number :visible_line_number
  def visible_line_number
    if CSCA::MENU::LINES > 0
      CSCA::MENU::LINES
    else
      csca_line_number
    end
  end
  #--------------------------------------------------------------------------
  # Check if command's switch is on (or 0)
  #--------------------------------------------------------------------------
  def csca_check_switch(switch_id)
    switch_id == 0 ? true : $game_switches[switch_id]
  end
  #--------------------------------------------------------------------------
  # check if Dungeon Tools are enabled
  #--------------------------------------------------------------------------
  def csca_dt_enabled
    $game_switches[CSCA_DUNGEON_TOOLSON_OFF] && csca_check_tools
  end
  #--------------------------------------------------------------------------
  # Check if player has at least one Dungeon Tool
  #--------------------------------------------------------------------------
  def csca_check_tools
    return $game_switches[CSCA_DUNGEON_TOOLSARROW] ||
    $game_switches[CSCA_DUNGEON_TOOLSBOMB] ||
    $game_switches[CSCA_DUNGEON_TOOLSHOOKSHOT] ||
    $game_switches[CSCA_DUNGEON_TOOLSBOOMERANG] ||
    $game_switches[CSCA_DUNGEON_TOOLSRESET]
  end
end
Y ya por ultimo el script de la tienda de skills
CSCA Skill Shop
Spoiler:
=begin
CSCA Skill Shop
version: 1.0 (Released: May 24, 2012)
Created by: Casper Gaming (http://www.caspergaming.com/)

Compatibility:
Made for RPGVXAce
IMPORTANT: ALL CSCA Scripts should be compatible with each other unless
otherwise noted.

UPDATES:
Version 1.0
-Original Script

FFEATURES:
This script allows you to easily create shops which sell skills to actors.

SETUP
This script is Plug n Play. Please read instructions below.

CREDIT:
Free to use in noncommercial games if credit is given to:
Casper Gaming (http://www.caspergaming.com/)

To use in a commercial game, please purchase a license here:
http://www.caspergaming.com/licenses.html

TERMS:
http://www.caspergaming.com/terms_of_use.html
================================INSTRUCTIONS===================================

INITIATING A SKILL SHOP FROM AN EVENT:
To create a skill shop, you'll need to make a few script calls.
Step 1. Under the event commands, choose tab 3, then under advanced choose Script.
Step 2. In the script window, you'll need to enter 3 lines:

goods = [1,2,3,4]
SceneManager.call(CSCA_Scene_Skill_Shop)
SceneManager.scene.prepare(goods)

The first line you can change the numbers. The numbers correspond to skill ID's.
In this example, skills #1, #2, #3, and #4 will be sold.
The last 2 lines will always be the same.



HOW TO SET SKILL PRICES
The skill's price is set through notetags. In the skill notetag box, enter this
notetag:



Where x will be the price of the skill. For example,

will make the skill cost 100 gold. Do not put commas in this number.



HOW TO SET WHICH SKILLS AN ACTOR CAN LEARN
By default, actors cannot learn any skills through the shop. This needs to be
set through notetags in the actor's notebox. To do this, enter a notetag like
this:



Where x will be the skill ID the actor can learn. You can enter many skill ID's
by separating them with commas such as



Where x will be a skill ID, y will be another skill ID, z will be another skill
ID and so on. For example,

will allow the actor to learn skills #1, #2, and #3.

Actors will never be able to learn skills which they already know.

============================= END INSTRUCTIONS=================================
=end

$imported = {} if $imported.nil?
$imported["CSCA-SkillShop"] = true
class CSCA_Scene_Skill_Shop < Scene_MenuBase

  def prepare(goods)
    @goods = goods
  end

  def start
    super
    create_help_window
    create_gold_window
    create_command_window
    create_dummy_window
    create_status_window
    create_buy_window
  end

  def create_gold_window
    @gold_window = Window_Gold.new
    @gold_window.viewport = @viewport
    @gold_window.x = Graphics.width - @gold_window.width
    @gold_window.y = @help_window.height
  end

  def create_command_window
    @command_window = CSCA_Window_SkillShopCommand.new(@gold_window.x)
    @command_window.viewport = @viewport
    @command_window.y = @help_window.height
    @command_window.set_handler(:buy,    method(:command_buy))
    @command_window.set_handler(:cancel, method(:return_scene))
  end

  def create_dummy_window
    wy = @command_window.y + @command_window.height
    wh = Graphics.height - wy
    @dummy_window = Window_Base.new(0, wy, Graphics.width, wh)
    @dummy_window.viewport = @viewport
  end

  def create_buy_window
    wy = @dummy_window.y
    wh = @dummy_window.height
    @buy_window = CSCA_Window_SkillShopBuy.new(0, wy, wh, @goods)
    @buy_window.viewport = @viewport
    @buy_window.help_window = @help_window
    @buy_window.status_window = @status_window
    @buy_window.hide
    @buy_window.set_handler(:ok,     method(:on_buy_ok))
    @buy_window.set_handler(:cancel, method(:on_buy_cancel))
  end
 
  def create_status_window
    wx = 304
    wy = @dummy_window.y
    ww = Graphics.width - wx
    wh = @dummy_window.height
    @status_window = CSCA_Window_SkillShopStatus.new(wx, wy, ww, wh)
    @status_window.viewport = @viewport
    @status_window.hide
    @status_window.set_handler(:ok,     method(:on_number_ok))
    @status_window.set_handler(:cancel, method(:on_number_cancel))
  end

  def activate_buy_window
    @buy_window.money = money
    @buy_window.show.activate
    @status_window.show.unselect
  end

  def command_buy
    @dummy_window.hide
    activate_buy_window
  end

  def on_buy_ok
    @item = @buy_window.item
    @buy_window.deactivate
    @status_window.set(@item, buying_price)
    @status_window.show.activate.select(0)
  end

  def on_buy_cancel
    @command_window.activate
    @dummy_window.show
    @buy_window.hide
    @status_window.hide
    @help_window.clear
  end

  def on_number_ok
    Sound.play_shop
    do_buy(@status_window.item,@buy_window.item)
    end_input
    @gold_window.refresh
    @status_window.refresh
  end

  def on_number_cancel
    Sound.play_cancel
    end_input
  end

  def do_buy(actor, skill)
    $game_party.lose_gold(buying_price)
    $game_actors[actor.id].learn_skill(skill.id)
  end

  def end_input
    @status_window.unselect
    activate_buy_window
  end

  def money
    @gold_window.value
  end

  def currency_unit
    @gold_window.currency_unit
  end

  def buying_price
    @buy_window.price(@item)
  end
end
class CSCA_Window_SkillShopCommand < Window_HorzCommand

  def initialize(window_width)
    @window_width = window_width
    super(0, 0)
  end

  def window_width
    @window_width
  end

  def col_max
    return 2
  end

  def make_command_list
    add_command(Vocab::ShopBuy,    :buy)
    add_command(Vocab::ShopCancel, :cancel)
  end
end
class CSCA_Window_SkillShopBuy < Window_Selectable

  attr_reader   :status_window

  def initialize(x, y, height, shop_goods)
    super(x, y, window_width, height)
    @shop_goods = shop_goods
    @money = 0
    refresh
    select(0)
  end

  def window_width
    return 304
  end

  def item_max
    @data ? @data.size : 1
  end

  def item
    @data[index]
  end

  def money=(money)
    @money = money
    refresh
  end

  def current_item_enabled?
    enable?(@data[index])
  end

  def price(item)
    @price[item]
  end

  def enable?(item)
    item && item.skill_price <= @money
  end

  def refresh
    make_item_list
    create_contents
    draw_all_items
  end

  def make_item_list
    @data = []
    @price = {}
    for i in 0...@shop_goods.size
      item = $data_skills[@shop_goods[i]]
      if item
        @data.push(item)
        @price[item] = item.skill_price
      end
    end
  end

  def draw_item(index)
    item = @data[index]
    rect = item_rect(index)
    draw_item_name(item, rect.x, rect.y, enable?(item))
    rect.width -= 4
    draw_text(rect, price(item), 2)
  end

  def status_window=(status_window)
    @status_window = status_window
    call_update_help
  end

  def update_help
    @help_window.set_item(item) if @help_window
    @status_window.item = item if @status_window
  end
end
class CSCA_Window_SkillShopStatus < Window_Selectable
 
  def set(skill, price)
    @skill = skill
    @price = price
    refresh
  end

  def initialize(x, y, width, height)
    super(x, y, width, height)
    @skill = nil
    @page_index = 0
    refresh
    select(0)
  end
 
  def item_max
    @data ? @data.size : 1
  end
 
  def item
    @data[index]
  end
 
  def item=(item)
    @skill = item
    refresh
  end

  def current_item_enabled?
    enable?(@data[index])
  end

  def enable?(actor)
    for i in 0...actor.skills.size
      if actor.skills[i] == @skill
        return false
      end
    end
    for i in 0...actor.csca_learnable_skills.size
      unless @skill.nil?
        if actor.csca_learnable_skills[i] == @skill.id
          return true
        end
      end
    end
    return false
  end

  def refresh
    make_item_list
    create_contents
    draw_all_items
  end

  def make_item_list
    @data = []
    $game_party.members.each do |actor|
      item = actor
      if !item.nil?
        @data.push(item)
      end
    end
  end

  def draw_item(index)
    item = @data[index]
    rect = item_rect(index)
    change_color(normal_color, enable?(item))
    draw_text(rect.x, rect.y, contents.width, line_height, item.name)
    change_color(normal_color)
  end
end
class RPG::Skill < RPG::UsableItem
  def skill_price
    if @note =~ //i
      return $1.to_i
    else
      return 0
    end
  end
end
class RPG::Actor < RPG::BaseItem
  def learnable_skills
    if @note =~ //i
      ints = []
      for x in $1.split(",")
        ints.push(x.to_i)
      end
      return ints
    else
      return []
    end
  end
end
class Game_Actor < Game_Battler
  def csca_learnable_skills
    actor.learnable_skills
  end
end
Las instrucciones son las siguientes:
Para poner precio a una skill deberas poner en las notas de la misma en el apartado base de datos y skills en la nota de la skill:

cscaprice: x   deben tener al principio y al final estos dos signos respectivamente < >

Para poner una tienda de skills deberas crear un evento y darle a las opciones y a script:
goods = [x,x,x,x] (X= numero de skill en la base de datos)
SceneManager.call(CSCA_Scene_Skill_Shop)
SceneManager.scene.prepare(goods)
La x es el skill que vendera.
Y por ultimo para los que puedan comprar y aprender la skill va al apartado de actores y pones en las notas del actor:

csca_ss_skills: x      deben tener al principio y al final estos dos signos respectivamente < >

La x tiene la misma función que la anterior vez.



Todos los derechos los tiene CasperGaming.
Si es para un proyecto de no venta puedes usarlos gratuitamente
Si es para venderlo debes comprar antes los derechos a CasperGaming


Última edición por ClousTrife el Dom Ene 03, 2016 2:44 pm, editado 1 vez (Razón : Traducir el titulo)
avatar
ClousTrife
PJ Recurrente
PJ Recurrente

Masculino
España
RPG Maker : Ace
Mensajes : 75
Monedas : 138
Reputación : 0
Edad : 18
Localización : Normelia :D

Volver arriba Ir abajo

Re: [ACE] Script CSCA Skill Shop (Tienda de habilidades)

Mensaje por valiago el Sáb Ago 06, 2016 2:12 am

Sos un mounstruo estaba buscando esto Gracias =)

valiago
PJ de Relleno
PJ de Relleno

Venezuela
RPG Maker : Ace
Mensajes : 1
Monedas : 1
Reputación : 0

Volver arriba Ir abajo

Volver arriba

- Temas similares

 
Permisos de este foro:
No puedes responder a temas en este foro.