Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

9 Pages V   1 2 3 > »   
Closed TopicStart new topic
> Shopoholic v 2.0, Advanced Shopping features (v 2.0 Since June 25)
cmpsr2000
post May 18 2008, 07:52 PM
Post #1


Keeper of the Ruby Code of DOOM!
Group Icon

Group: Revolutionary
Posts: 355
Type: Scripter
RM Skill: Masterful




Shopoholic

Version: 2.0
Author: Cmpsr2000
Release Date: June 25 2008

Introduction
Shopoholic is a modification that adds more features and functionality to the RMVX shopping system.


Features
  • Items sold to a shop may be repurchased.
  • Shops can have custom markup (or markdown!)
  • Shops can sell "used" items back to the player at a discount
  • Shops can charge tax
  • See modification to ALL attributes when hovering over an item
  • New in v 1.0!
    • Tax can be disabled
    • Shops can sell Skills, Classes, and Actors.
    • Shops can have a limited amount of items in stock
    • Shops can restock items.
    • Several new customization options available
  • New in v 2.0!
    • Shops can raise their prices once inventory hits a certain level.
    • Banking and Vault Storage!
    • Banks can have an unlimited number of accounts.
    • Accounts can be Savings (high interest), Checking(low interest, allows debit purchasing) or Loans.
    • Loans can be limited to a dollar amount per bank or globally.
    • Banks can have vaults with up to 64 slots of storage!
    • Slots(Safety Deposit Boxes) can be purchased, or given to the player freely.
    • Various other bank-related customizations.


Script
Attached File  Redefinitions.txt ( 23.52K ) Number of downloads: 886

Attached File  Account.txt ( 2.18K ) Number of downloads: 591

Attached File  Storage_Slot.txt ( 2.04K ) Number of downloads: 629

Attached File  Game_Banking.txt ( 7.88K ) Number of downloads: 632

Attached File  Game_Shopping.txt ( 22.43K ) Number of downloads: 610

Attached File  Window_Bank_Account.txt ( 4.44K ) Number of downloads: 509

Attached File  Window_Bank_Number.txt ( 8.74K ) Number of downloads: 498

Attached File  Window_Bank_Vault.txt ( 5.96K ) Number of downloads: 511

Attached File  Window_Shop_Details.txt ( 14.71K ) Number of downloads: 499

Attached File  Window_Shop_Gold.txt ( 1.56K ) Number of downloads: 459

Attached File  Window_Shop_Message.txt ( 2.17K ) Number of downloads: 463

Attached File  Scene_Bank.txt ( 17.61K ) Number of downloads: 529



Customization

To call the shopping interface (Changed in V 2.0!):
CODE

#-------------------------------------------------------------------------------
#
# IMPORTANT CUSOMIZATION INFORMATION:
# There are 2 ways to call the shopping interface. Both are demonstrated
# in the attached demo game.
#
# Method #1: Built-in Shop Proccessing (easiest for non-scripters)
#
# METHOD #1 ONLY WORKS FOR BASIC SHOPS!
#
# In order to use the preexisting shop interface call from an event, you
# must first provide values to the following fields:
#
# $game_shopping.currentShopID:
# Integer representing the ID number of the shop (starts at 0)
#
# $game_shopping.currentDiscountRate
# Float point representing the discount on used items. (e.g.if the shop
# sells used items at 80% of cost, the value is 0.8 )
#
# $game_shopping.currentSellRate
# Float point representing the percentage of the value the shopkeeper pays
# the player for items. (e.g. If the shopkeeper pays 50% of the item's
# worth, the value is 0.5)
#
# $game_shopping.currentMarkupRate
# Float point representing the shopkeeper's markup (or markdown) of the
# selling prices. For example, If the shopkeeper is greedy and wants to
# markup his items 20% (120% of the item's price in the DB) then the value
# is 1.2. If he is generous and sells his items 10% under cost (90% of the
# item's price in the DB) then the value is 0.9
#
# $game_shopping.currentTaxRate
# Float point representing the tax rate of the shop. (e.g. if the shop has
# a 3% tax rate, the value is 0.03)
#
# $game_shopping.currentInflationRate
# Float point representing the price increase given to items in high demand.
# (e.g. if the shop keeper marks up items 20% when the stock runs low, the
# value is 0.2)
#
# After you have set these variables, you can then use the shop processing
# button from the event wizard.
#
# Method #2: Calling the shopping scene manually (easiest for scripters)
#
# METHOD #2 IS REQUIRED FOR ADVANCED SHOPS!
#
# You can call the shopping scene manually by passing all the above values
# in the constructor. You MUST first define the values of the items in the
# shop before making the shop call!
#
# The format for the shop_goods are:
# $game_temp.shop_goods = [ [ITEM_TYPE1, ITEM_ID1, ITEM_LIMIT1],
# [ITEM_TYPE2, ITEM_ID2, ITEM_LIMIT2],
# etc...]
# ITEM_TYPE: 0 for RPG::Item
# 1 for RPG::Weapon
# 2 for RPG::Armor
# 3 for RPG::Skill <----advanced shops only
# 4 for RPG::Class <----advanced shops only
# 5 for RPG::Actor <----advanced shops only
# ITEM_ID: The ID number of the item in the DB
# ITEM_LIMIT: The max the shop can sell to the player. Set to -1 for no
# limit.
#
# The format for the scene call is:
# $scene = Scene_Shop.new(shopID, discountRate, sellRate,
# markupRate, taxRate, InflationRate,
# restockRate, continuousRestock)
#
# (all the type rules from method #1 apply to this constuctor as well!)
#
# restockRate: How long, in minutes, to wait before the store
# "restocks" its items. (e.g. a value of 90 is 1 hour
# and 30 minutes of playtime) Set to 0 to disable
# restocking completely!
#
# continuousRestock: Boolean (true/false) that determines whether the shop
# restocks continuously. Setting this to true causes a
# shop to restock at the restockRate regardless of the
# player's actions. Setting this to false causes the
# shop to "call" for a restock after the player visits
# a fully stocked store.
#
# If your restockRate is 30 minutes and
# continuousRestock is true:
# When the player visits the shop for the first time
# the timer will start. If the player visits again in
# 45 minutes, The store will be restocked. If the
# player comes back 15 minutes after that, the store
# will be restocked again.
#
# But, if your restockRate is 30 minutes and
# continuousRestock is false:
# When the player visits the shop for the first time
# the timer will start. If the player visits again in
# 45 minutes, the store will be restocked, but the
# timer will reset to 30 minutes! If the player comes
# back 15 minutes later, there will still be 15
# minutes left on the restock timer! This is akin to
# the shopkeeper calling in an order for more stock
# when the player shows up to shop.
#
#-------------------------------------------------------------------------------


Set the number of shopkeepers in your game in Game_Shopping:
CODE

#---------------------------------------------------------------------------
# IMPORTANT:
# You will get an error when buying or selling used items if you try to
# pass a shopID that is higher than the number of @totalShopkeepers - 1.
# Set this to the number of shops in your game, or HIGHER! Setting higher
# will waste memory, but you can always count up the number of shops you
# have before shipping your finished game and change it back to the
# correct number!
#---------------------------------------------------------------------------
@totalShopkeepers = 2


Icon customization is in Game_Shopping:
CODE

#---------------------------------------------------------------------------
# Change these if you need to use different atribute up/down icons
#---------------------------------------------------------------------------
@atkIconUp = 1916
@atkIconDown = 1932
@atkIconSame = 1948
@defIconUp = 1917
@defIconDown = 1933
@defIconSame = 1949
@spiIconUp = 1918
@spiIconDown = 1934
@spiIconSame = 1950
@agiIconUp = 1919
@agiIconDown = 1935
@agiIconSame = 1951


Item "pool" labels are in Redefinitions:
CODE

#---------------------------------------------------------------------------
# Change these if you want to label the item pools differently
#---------------------------------------------------------------------------
@headings = ["New Items", "Used Items"]


New in v1.0!

New customization options in Game_Shopping:
To control restocking while the player is visiting a store:
CODE

#---------------------------------------------------------------------------
# Set this to true if you would like the shops to restock themselves while
# the player is currently shopping (this will throw up a message to the
# player to notify him of the restock)
#---------------------------------------------------------------------------
@allowRestockWhileShopping = true


To control the display of tax calculations in the detail window:
CODE

#---------------------------------------------------------------------------
# Set this to false if you do not wish to use tax. Make sure to set your
# tax rates to 0!
#---------------------------------------------------------------------------
@allowTax = true


To define a single icon for all Classes and Actors:
CODE

#---------------------------------------------------------------------------
# If you want a single icon for all classes or actors, you can set that
# here. If you want to assign icons on a per-class or per-actor basis, set
# the universal to nil, and define the individual ones below.
#---------------------------------------------------------------------------
@universalClassIcon = nil
@universalActorIcon = 1903


To set prices for your actors and classes:
CODE

#-----------------------------------------------------------------------------
# Sets price data for advanced shop objects.
#
# PLEASE NOTE: Skills, classes and actors cannot be sold, only bought!
#-----------------------------------------------------------------------------
def initPrices
#---------------------------------------------------------------------------
# Set prices for skills here. Start at position 1. Each number corresponds
# to the ID number of the skill in the database. If you don't wish to sell
# a skill, use 'nil' in its place. These skills will be discovered the
# usual way instead of being unlocked from purchasing.
#---------------------------------------------------------------------------
@skillPrices = [ #DON'T TOUCH THIS ONE!
nil,

#Skills 1-10
100, 200, 300, nil, nil, nil, nil, nil, nil, nil,

#Skills 11-20
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,

#Skills 21-30
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,

#Skills 31-40
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,

#Skills 41-50
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,

#Skills 51-60
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,

#Skills 61-70
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,

#Skills 71-80
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,

#Skills 81-82
nil, nil
]
#---------------------------------------------------------------------------
# Set prices for classes here. Start at position 1. Each number corresponds
# to the ID number of the class in the database. If you don't wish to sell
# a class, use 'nil' in its place. These classes will be discovered the
# usual way instead of being unlocked from purchasing.
#---------------------------------------------------------------------------
@classPrices = [ #DON'T TOUCH THIS ONE!
nil,

#Classes 1-8
nil, 2000, 3000, 4000, 5000, 6000, 7000, 8000
]
#---------------------------------------------------------------------------
# Set prices for actors here. Start at position 1. Each number corresponds
# to the ID number of the actor in the database. If you don't wish to sell
# an actor, use 'nil' in its place. These actors will be discovered the
# usual way instead of being unlocked from purchasing.
#---------------------------------------------------------------------------
@actorPrices = [ #DON'T TOUCH THIS ONE!
nil,

#Actors 1-8
nil, 2000, 3000, 4000, 5000, 6000, 7000, 8000
]
end


To set individual icons for Classes or Actors:
CODE

#-------------------------------------------------------------------------
# If you have individual icons for each class, define them here!
#-------------------------------------------------------------------------
classIcons = [ #DON'T TOUCH THIS ONE!
nil,

#Classes 1-8
1154, 1897, 1682, 1899, 549, 547, 1898, 1630
]

and
CODE

#-------------------------------------------------------------------------
# If you have individual icons for each actor, define them here!
#-------------------------------------------------------------------------
actorIcons = [ #DON'T TOUCH THIS ONE!
nil,

#Actors 1-8
1, 2, 3, 4, 5, 6, 7, 8
]


To customize descriptions of classes and actors:
CODE

#---------------------------------------------------------------------------
# Define the text that will appear in the shop help window for classes here:
#---------------------------------------------------------------------------
classDescriptions = [ #DON'T TOUCH THIS ONE!
nil,

#Class 1 (Paladin)
"Stout defender and holy warrior.",

#Class 2 (Warrior)
"Me hit things hard!",

#Class 3 (Priest)
"Has anyone seen my alterboy?",

#Class 4 (Magician)
"Poof! You're a spider!",

#Class 5 (Knight)
"Yea, I smiteth mine enemies.",

#Class 6 (Dark Knight)
"None shall pass!",

#Class 7 (Grappler)
"My chi is bigger than yours.",

#Class 8 (Thief)
"I can haz ur gold?"
]
#---------------------------------------------------------------------------
# Define the text that will appear in the shop help window for classes here:
#---------------------------------------------------------------------------
actorDescriptions = [ #DON'T TOUCH THIS ONE!
nil,

#Actor 1
"Actor info goes here!",

#Actor 2
"Actor info goes here!",

#Actor 3
"Actor info goes here!",

#Actor 4
"Actor info goes here!",

#Actor 5
"Actor info goes here!",

#Actor 6
"Actor info goes here!",

#Actor 7
"Actor info goes here!",

#Actor 8
"Actor info goes here!",
]


If you are an ADVANCED scripter, and you would like to plug shopoholic into your "exhaustible" skill system (i.e. Final Fantasy 8 magic system) so that you can buy multiples of skills, you will need to make edits in several places. They are marked in the code, but here's a rundown:

In Redefinitions:
CODE

if @item.is_a?(RPG::Skill) and $game_shopping.exhaustableSkills
#-------------------------------------------------------------------------
#If you are building a game with exhaustable skills, add code here
#to increase the specific skill by the purchased amount.
# Note: @item is a skill object in this context!
#
# The next version of shopoholic may implement this if there is
# enough desire for the feature.
#-------------------------------------------------------------------------
end

and
CODE

elsif item.is_a?(RPG::Skill) and $game_shopping.exhaustableSkills
#number = the current amount of that skill possessed.
else


In Game_Shopping:
CODE

#---------------------------------------------------------------------------
# If you want to be able to restock skills, set this to true. For example,
# if you are building a game where a skill can only be used a certain number
# of times before being replenished(e.g. Final Fantasy VIII), set this to
# true.
#---------------------------------------------------------------------------
@exhaustableSkills = false


depending on your system, you may need to make further modifications. If this is a heavily desired functionality, I will program a system to work directly with shopoholic.

New in v2.0!

To create a bank:
CODE

#-------------------------------------------------------------------------------
#
# IMPORTANT CUSOMIZATION INFORMATION:
# To call a bank, use the script call:
# $scene = Scene_Bank.new(bankID, rates, slotCost, loanMax, hasVault)
# bankID: The ID of the bank to be shown. (you can show the same bank
# In various events throughout your game, just as you can with
# shops. This way, you can have 1 bank for your entire game
# if you chose)
# rates: An array of interest rates: [savings, checking, loan]
# savings: interest rate for savings accounts at this
# instance of this bank.
# checking: interest rate for checking accounts at this
# instance of this bank.
# loan: interest rate for checking accounts at this
# instance of this bank.
# NOTE: If you have more than one event per bankID you can
# set different interest rates at each one! (sort of like
# branches of a real bank)
# slotCost: Cost for each new Saftey Deposit Box in the vault
# loanMax: The max amount the bank will issue in a single loan. This
# overrides the global setting for max loan if it is lower.
# hasVault Boolean indicating whether or not this instance of this bank
# has a vault. Again if you have multiple events for a bankID
# Then you can enable the vault in some while disabling it in
# others and the players items will persist.
#-------------------------------------------------------------------------------


New customization options in Game_Shopping:

You can configure globally whether shops accept debit transactions or not:
CODE

#---------------------------------------------------------------------------
# Set this to false if you do not want shops to accept debit (IE, checks,
# Debit Card or whatever item is linked to checking accounts)
#---------------------------------------------------------------------------
@shopsAcceptDebit = true


You need to configure the debit item ID as well:
CODE

#---------------------------------------------------------------------------
# Set this to the item ID of the item required to enable debit purchases.
#---------------------------------------------------------------------------
@debitItemID = 21


You can globally configure the amount of an item left in stock that triggers a demand crunch and the inflated prices:
CODE

#---------------------------------------------------------------------------
# Shopkeepers will start raising their prices on new items when they have
# this number or LESS in their inventory (for limited items)
#---------------------------------------------------------------------------
@demandAmount = 10


New options in redefinitions:

I added Vocab for banking terms so that you can change them easily. I will probably update this soon and add shopping vocab as well:
CODE

module Vocab
BankAccounts = "Accounts"
BankVault = "Vault"
BankCancel = "Cancel"
BankDeposit = "Deposit"
BankWithdraw = "Withdraw"
BankTransfer = "Transfer"
#-----------------------------------------------------------------------------
# The variables below probably belong in a banking module, I'll update it
# when I'm not feeling so lazy!
#-----------------------------------------------------------------------------
# Icon indexes for each account type.
#-----------------------------------------------------------------------------
BankAccountIcons = [ #Savings Icon
1631,

#Checking Icon
1666,

#Loan Icon
1630
]
#-----------------------------------------------------------------------------
# Help window text for accounts.
#-----------------------------------------------------------------------------
BankDescriptions = [ #Savings Description
"A high yield savings account.",

#Checking Description
"Provides credit for shopkeepers.",

#Loan Description
""
]
#-----------------------------------------------------------------------------
# Account names.
#-----------------------------------------------------------------------------
BankAccountNames = [ #Savings
"Savings",

#Checking
"Checking",

#Loan
"Loan"
]
end


In Storage_Slot, you can configure the icon index, though I forgot to comment it:
CODE
@icon_index = 1947


Options in Game_Banking:

Set the max number of banks you have!
CODE

#---------------------------------------------------------------------------
# IMPORTANT:
# You will get an error when managing accounts and vaults if you try to
# pass a bankID that is higher than the number of @totalBanks - 1. Set
# this to the number of *different* banks in your game, or HIGHER! Setting
# higher will waste memory, but you can always count up the number of
# banks you have before shipping your finished game and change it back to
# the correct number!
# Note, if you want one "central" bank, just use the same bankID in each
# bank event.
#---------------------------------------------------------------------------
@totalBanks = 1


You can set how many minutes must pass for interest to be accumulated. All banks proccess interest at the same time in the real world, so if you have a day/night system in your game make sure to set this to the same length as your day:
CODE

#---------------------------------------------------------------------------
# How many minutes must pass before the bank compounds interest.
#---------------------------------------------------------------------------
@interestTerm = 2


Set the universal max for loans here:
CODE

#---------------------------------------------------------------------------
# You can set a universal maximum for all loans here.
#---------------------------------------------------------------------------
@loanMax = 100000


Set the types of accounts you will allow:
CODE

#---------------------------------------------------------------------------
# All banks are created allowing the same account types. if you want to
# disable an account type for your game, change it's value below to false
#---------------------------------------------------------------------------
@allowSavings = true
@allowChecking = true
@allowLoans = true


Set the max saftey deposit boxes a bank can have in its vault. Any more than 64 will break the vault page:
CODE

#---------------------------------------------------------------------------
# Number of saftey deposit boxes in the vault. (multiples of 8 look best)
#---------------------------------------------------------------------------
@maxSlots = 64


Set the starting free(open) slots in each bank's vault here:
CODE

#---------------------------------------------------------------------------
# Number of starting "free" slots per bank.
#---------------------------------------------------------------------------
@freeSlots = 4


You can change the labels in the Window_Bank_Account:
CODE

#---------------------------------------------------------------------------
# Change these if you want to label the list differently.
#---------------------------------------------------------------------------
@headings = ["Account", "Interest Rate", "Balance"]



Compatibility
Requires RGSS2. Redefines Scene_Title, Scene_Shop, Window_ShopBuy, Game_Actor


Screenshot



New in v1.0!






New in v2.0!









DEMO
Attached File  Shopoholic.zip ( 951.03K ) Number of downloads: 3213


Installation
Copy the script files into your game under the materials section.


Todo List:
  1. Add sorting for used items
  2. Address possible script incompatibilities, clean up logic in various places


FAQ
None yet!

Terms and Conditions
Feel free to use this in your game, but please give me a shout in the credits! Also, feel free to edit this for your own personal purposes but please do not repost an edited version without my consent first.

Thanks ^^/

Also, mad props to whoever threw together the original icon set I worked from. (DLed it from the resource section before the site went down and I can't remember who made the file!)

This post has been edited by cmpsr2000: Jun 26 2008, 07:11 AM


__________________________
Go to the top of the page
 
+Quote Post
   
woratana
post May 18 2008, 07:57 PM
Post #2


Looking for scripter to hire? PM me *O*
Group Icon

Group: +Gold Member
Posts: 1,038
Type: Scripter
RM Skill: Undisclosed




Sounds pretty good. smile.gif

Though, in script part 'Redefinition'.
Why do you alias but not use it. tongue.gif


__________________________
Check out my NEW blog!!!



MVP (Most Valuable Poster) Award 2008


Go to the top of the page
 
+Quote Post
   
cmpsr2000
post May 18 2008, 08:12 PM
Post #3


Keeper of the Ruby Code of DOOM!
Group Icon

Group: Revolutionary
Posts: 355
Type: Scripter
RM Skill: Masterful




QUOTE (woratana @ May 18 2008, 10:11 PM) *
Sounds pretty good. smile.gif

Though, in script part 'Redefinition'.
Why do you alias but not use it. tongue.gif



Which one? In general I use alias so that I can redefine the existing method. That way, when the game calls a method, it goes to the new "edited" version I built instead of the preexisting method.


__________________________
Go to the top of the page
 
+Quote Post
   
woratana
post May 18 2008, 08:19 PM
Post #4


Looking for scripter to hire? PM me *O*
Group Icon

Group: +Gold Member
Posts: 1,038
Type: Scripter
RM Skill: Undisclosed




Well, it seems like you misunderstood on how to use alias tongue.gif

It's long, so I'll describe in spoiler smile.gif
[Show/Hide] description~

You can just do this:
CODE
  def create_game_objects
    $game_temp          = Game_Temp.new
    $game_message       = Game_Message.new
    $game_system        = Game_System.new
    $game_switches      = Game_Switches.new
    $game_variables     = Game_Variables.new
    $game_self_switches = Game_SelfSwitches.new
    $game_actors        = Game_Actors.new
    $game_party         = Game_Party.new
    $game_troop         = Game_Troop.new
    $game_map           = Game_Map.new
    $game_player        = Game_Player.new
    $game_shopping      = Game_Shopping.new
  end


And it will work same as:
CODE
  alias oldCreateGameObj create_game_objects
  def create_game_objects
    $game_temp          = Game_Temp.new
    $game_message       = Game_Message.new
    $game_system        = Game_System.new
    $game_switches      = Game_Switches.new
    $game_variables     = Game_Variables.new
    $game_self_switches = Game_SelfSwitches.new
    $game_actors        = Game_Actors.new
    $game_party         = Game_Party.new
    $game_troop         = Game_Troop.new
    $game_map           = Game_Map.new
    $game_player        = Game_Player.new
    $game_shopping      = Game_Shopping.new
  end


And what is the alias for? it's basically for shorten the script, and make the script compatible with others.
so, if you use alias in right way, it will be like this:

CODE
alias oldCreateGameObj create_game_objects
  def create_game_objects
    oldCreateGameObj
    $game_shopping      = Game_Shopping.new
  end


Read puppeto's alias tutorial may help you understand more about this. smile.gif
http://www.rpgrevolution.com/forums/?showtopic=13319


__________________________
Check out my NEW blog!!!



MVP (Most Valuable Poster) Award 2008


Go to the top of the page
 
+Quote Post
   
cmpsr2000
post May 18 2008, 08:27 PM
Post #5


Keeper of the Ruby Code of DOOM!
Group Icon

Group: Revolutionary
Posts: 355
Type: Scripter
RM Skill: Masterful




QUOTE (woratana @ May 18 2008, 10:33 PM) *
Well, it seems like you misunderstood on how to use alias tongue.gif

It's long, so I'll describe in spoiler smile.gif
[Show/Hide] description~

You can just do this:
CODE
  def create_game_objects
    $game_temp          = Game_Temp.new
    $game_message       = Game_Message.new
    $game_system        = Game_System.new
    $game_switches      = Game_Switches.new
    $game_variables     = Game_Variables.new
    $game_self_switches = Game_SelfSwitches.new
    $game_actors        = Game_Actors.new
    $game_party         = Game_Party.new
    $game_troop         = Game_Troop.new
    $game_map           = Game_Map.new
    $game_player        = Game_Player.new
    $game_shopping      = Game_Shopping.new
  end


And it will work same as:
CODE
  alias oldCreateGameObj create_game_objects
  def create_game_objects
    $game_temp          = Game_Temp.new
    $game_message       = Game_Message.new
    $game_system        = Game_System.new
    $game_switches      = Game_Switches.new
    $game_variables     = Game_Variables.new
    $game_self_switches = Game_SelfSwitches.new
    $game_actors        = Game_Actors.new
    $game_party         = Game_Party.new
    $game_troop         = Game_Troop.new
    $game_map           = Game_Map.new
    $game_player        = Game_Player.new
    $game_shopping      = Game_Shopping.new
  end


And what is the alias for? it's basically for shorten the script, and make the script compatible with others.
so, if you use alias in right way, it will be like this:

CODE
alias oldCreateGameObj create_game_objects
  def create_game_objects
    oldCreateGameObj
    $game_shopping      = Game_Shopping.new
  end


Read puppeto's alias tutorial may help you understand more about this. smile.gif
http://www.rpgrevolution.com/forums/?showtopic=13319


That's what I was used to as well, but I was getting compiler errors when redefining certain RGSS methods without first aliasing.


__________________________
Go to the top of the page
 
+Quote Post
   
woratana
post May 18 2008, 08:39 PM
Post #6


Looking for scripter to hire? PM me *O*
Group Icon

Group: +Gold Member
Posts: 1,038
Type: Scripter
RM Skill: Undisclosed




What did you do that return error?

try not to use the capitalize text as new name
e.g.
CODE
alias old_method method


__________________________
Check out my NEW blog!!!



MVP (Most Valuable Poster) Award 2008


Go to the top of the page
 
+Quote Post
   
cmpsr2000
post May 19 2008, 06:01 AM
Post #7


Keeper of the Ruby Code of DOOM!
Group Icon

Group: Revolutionary
Posts: 355
Type: Scripter
RM Skill: Masterful




QUOTE (woratana @ May 18 2008, 10:53 PM) *
What did you do that return error?

try not to use the capitalize text as new name
e.g.
CODE
alias old_method method


I was getting the error from redefining a method, not from using alias. Camel-casing is supported in ruby, only all-caps names are inferred constants (as it should be).

It was so long ago I can't remember the error I was getting. It was back when I first started working with RMVX, I found that if I first aliased the method, I no longer received the error so I simply adopted it as a best-practice for RMVX coding(rather that tracking down the actual cause of the error).

If I have time, I'll try and replicate the error.


__________________________
Go to the top of the page
 
+Quote Post
   
woratana
post May 19 2008, 12:33 PM
Post #8


Looking for scripter to hire? PM me *O*
Group Icon

Group: +Gold Member
Posts: 1,038
Type: Scripter
RM Skill: Undisclosed




Well, the problem is that other scripts that alias methods you aliased in that script will not compatible. sad.gif

So I hope you will find the solution soon. smile.gif


__________________________
Check out my NEW blog!!!



MVP (Most Valuable Poster) Award 2008


Go to the top of the page
 
+Quote Post
   
YanXie
post May 19 2008, 12:46 PM
Post #9


Because Tomorrow Will Surely Come...
Group Icon

Group: Revolutionary
Posts: 1,137
Type: None
RM Skill: Skilled




Well, sometimes when using alias method, the positioning of the alias line could also play a role in scripting.

Say,for example I want to alias this method from Scene_Map :

CODE
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
    $game_map.interpreter.update      # Update interpreter
    $game_map.update                  # Update map
    $game_player.update               # Update player
    $game_system.update               # Update timer
    @spriteset.update                 # Update sprite set
    @message_window.update            # Update message window
    unless $game_message.visible      # Unless displaying a message
      update_transfer_player
      update_encounter
      update_call_menu
      update_call_debug
      update_scene_change
    end
  end


I'd do this :

CODE
  #--------------------------------------------------------------------------  
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    if $game_bank.gold != 0 or $game_bank.loan != 0
     $game_bank.step                     # Add $game_bank.step
    end
    puppet_bank_update                  # The usual.
  end
end


Rather than this :

CODE
  
  #--------------------------------------------------------------------------  
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    puppet_bank_update                  # The usual.
    if $game_bank.gold != 0 or $game_bank.loan != 0
     $game_bank.step                     # Add $game_bank.step
    end
  end
end


The later sometimes can cause problem.

I can't really verify the cause, but it seem it is conflicting with the "unless" variable.

btw, this is big example of how I use alias :

CODE
#==============================================================================
# ** Alias Start
#==============================================================================
#==============================================================================
# ** Scene_Title
#------------------------------------------------------------------------------
#  This class performs the title screen processing.
#==============================================================================
class Scene_Title < Scene_Base
  #--------------------------------------------------------------------------
  # * Create Game Objects
  #--------------------------------------------------------------------------
  alias puppet_bank_create_game_objects create_game_objects # Alias method
  def create_game_objects
    puppet_bank_create_game_objects    # The usual.
    $game_bank = Game_Bank.new         # Create $game_bank.
  end
end
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
#  This class performs the map screen processing.
#==============================================================================
class Scene_Map < Scene_Base
  #--------------------------------------------------------------------------  
  # * Alias Listing
  #--------------------------------------------------------------------------  
  alias puppet_bank_terminate terminate # Alias method
  alias puppet_bank_update update       # Alias method
  #--------------------------------------------------------------------------  
  # * Termination Processing
  #--------------------------------------------------------------------------
  def terminate
    snapshot_for_clearback              # Create clear snapshot.
    puppet_bank_terminate               # The usual.
  end  
  #--------------------------------------------------------------------------  
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    if $game_bank.gold != 0 or $game_bank.loan != 0
     $game_bank.step                     # Add $game_bank.step
    end
    puppet_bank_update                  # The usual.
  end
end
#==============================================================================
# ** Scene_File
#------------------------------------------------------------------------------
#  This class performs the save and load screen processing.
#==============================================================================

class Scene_File < Scene_Base
  #--------------------------------------------------------------------------
  # * Alias Listing
  #--------------------------------------------------------------------------
  alias puppet_bank_write_save_data write_save_data # Alias method  
  alias puppet_bank_read_save_data read_save_data # Alias method  
  #--------------------------------------------------------------------------
  # * Write Save Data
  #     file : write file object (opened)
  #--------------------------------------------------------------------------
  def write_save_data(file)
    puppet_bank_write_save_data(file)       # The usual.
    Marshal.dump($game_bank,         file)  # Create dump for $game_bank.
  end
  #--------------------------------------------------------------------------
  # * Read Save Data
  #     file : file object for reading (opened)
  #--------------------------------------------------------------------------
  def read_save_data(file)
    puppet_bank_read_save_data(file)        # The usual.
    $game_bank         = Marshal.load(file) # Load $game_bank
  end
end  
#==============================================================================
# ** End of Alias
#==============================================================================
################################################################################


It works well for me, no error at all.

cheers,puppeto4. wink.gif



__________________________
how make teleport to graveyard then your character die?

AWAY FOR VACATION.
NOT HERE UNTIL JAN/FEB 2010 -w-/
Go to the top of the page
 
+Quote Post
   
The Wizard 007
post May 19 2008, 02:15 PM
Post #10


Jack of all trades
Group Icon

Group: Revolutionary
Posts: 118
Type: Developer
RM Skill: Skilled




This is a great idea for a script and I see many uses for it. I do have a problem though when I set weapons in the shop. I get a 'Window_Shop_Details' line 150: NoMethod Error. It says undefined method 'atk' for nil:NilClass. Any idea what it could be and how to fix it? Your help would be greatly appreciated.


__________________________
Currently working on:

Underground Syndicate (mafioso/modern type RPG)
Mind Maze (old school dungeon crawler with a different feel)
Dragon Adventure (Dragon Quest type fangame with more customization)
Dark Grind (Survival horror RPG)
Go to the top of the page
 
+Quote Post
   
dragondp1
post May 21 2008, 03:39 PM
Post #11


Level 2
Group Icon

Group: Member
Posts: 20
Type: Musician
RM Skill: Undisclosed




Well it is cool and all but when i play the game and go to a shop, it says error line 347...


__________________________


But I'm a guy...
Go to the top of the page
 
+Quote Post
   
cmpsr2000
post May 21 2008, 04:07 PM
Post #12


Keeper of the Ruby Code of DOOM!
Group Icon

Group: Revolutionary
Posts: 355
Type: Scripter
RM Skill: Masterful




QUOTE (puppeto4 @ May 19 2008, 03:00 PM) *
btw, this is big example of how I use alias :

It works well for me, no error at all.

cheers,puppeto4. wink.gif


Right, I understand how it's supposed to work. (see redefinitions of ACS, I use aliases to allow for menu customization)

Thank you guys for trying to help though, I appreciate the sentiment! biggrin.gif

I did actually manage to track down my previous error to the hacked version of RMVX I was using prior to the stateside release! This is great, since I can go back and remove all the extra aliases I added in to help get around it. So far this script and ACS are working without them. Woot!

QUOTE (The Wizard 007 @ May 19 2008, 04:29 PM) *
This is a great idea for a script and I see many uses for it. I do have a problem though when I set weapons in the shop. I get a 'Window_Shop_Details' line 150: NoMethod Error. It says undefined method 'atk' for nil:NilClass. Any idea what it could be and how to fix it? Your help would be greatly appreciated.


This is probably because one of your actors is not wearing a weapon in the primary slot. I have fixed this bug in the current version I'm working on, so the next release should fix it for ya ^^

QUOTE (dragondp1 @ May 21 2008, 05:53 PM) *
Well it is cool and all but when i play the game and go to a shop, it says error line 347...


Make sure to read the instructions up above for calling the shop. You have to set some variables in each shopkeeper event or it won't work! If you still have problems, post some more detailed information on the error for me.


__________________________
Go to the top of the page
 
+Quote Post
   
woratana
post May 21 2008, 04:43 PM
Post #13


Looking for scripter to hire? PM me *O*
Group Icon

Group: +Gold Member
Posts: 1,038
Type: Scripter
RM Skill: Undisclosed




I suggest you not to mention about illegal copy of RMVX. tongue.gif
(If I'm not misunderstood)


__________________________
Check out my NEW blog!!!



MVP (Most Valuable Poster) Award 2008


Go to the top of the page
 
+Quote Post
   
The Wizard 007
post May 21 2008, 09:28 PM
Post #14


Jack of all trades
Group Icon

Group: Revolutionary
Posts: 118
Type: Developer
RM Skill: Skilled




Cool thanks, that would be great.


__________________________
Currently working on:

Underground Syndicate (mafioso/modern type RPG)
Mind Maze (old school dungeon crawler with a different feel)
Dragon Adventure (Dragon Quest type fangame with more customization)
Dark Grind (Survival horror RPG)
Go to the top of the page
 
+Quote Post
   
gend0
post May 24 2008, 10:12 PM
Post #15


Level 1
Group Icon

Group: Member
Posts: 14
Type: Artist
RM Skill: Skilled




Great ! cmpsr2000

But shop menu does not support for single character sprite
Ex. $ralph.png

Can you fix it ? happy.gif

This post has been edited by gend0: May 24 2008, 10:14 PM


__________________________
Go to the top of the page
 
+Quote Post
   
The Wizard 007
post May 25 2008, 06:52 PM
Post #16


Jack of all trades
Group Icon

Group: Revolutionary
Posts: 118
Type: Developer
RM Skill: Skilled




Yeah I noticed that too plus if you have any negative stat modifiers to equipment it doesn't show correctly in the box to the right, it'll show the color change as down but the number stays the same. This really is a great script and I would hate to not be able to use it.


__________________________
Currently working on:

Underground Syndicate (mafioso/modern type RPG)
Mind Maze (old school dungeon crawler with a different feel)
Dragon Adventure (Dragon Quest type fangame with more customization)
Dark Grind (Survival horror RPG)
Go to the top of the page
 
+Quote Post
   
cmpsr2000
post May 28 2008, 08:29 PM
Post #17


Keeper of the Ruby Code of DOOM!
Group Icon

Group: Revolutionary
Posts: 355
Type: Scripter
RM Skill: Masterful




QUOTE (gend0 @ May 25 2008, 12:26 AM) *
Great ! cmpsr2000

But shop menu does not support for single character sprite
Ex. $ralph.png

Can you fix it ? happy.gif


Yes, this is already fixed in the next version actually ^^b

QUOTE (The Wizard 007 @ May 25 2008, 09:06 PM) *
Yeah I noticed that too plus if you have any negative stat modifiers to equipment it doesn't show correctly in the box to the right, it'll show the color change as down but the number stays the same. This really is a great script and I would hate to not be able to use it.


This is also already fixed in the version I'm working on ^^b

Hold tight, it should be done by tomorrow!


__________________________
Go to the top of the page
 
+Quote Post
   
The Wizard 007
post Jun 2 2008, 03:31 PM
Post #18


Jack of all trades
Group Icon

Group: Revolutionary
Posts: 118
Type: Developer
RM Skill: Skilled




Awesome glad you are making an update. Not to be a pain but is it almost done?


__________________________
Currently working on:

Underground Syndicate (mafioso/modern type RPG)
Mind Maze (old school dungeon crawler with a different feel)
Dragon Adventure (Dragon Quest type fangame with more customization)
Dark Grind (Survival horror RPG)
Go to the top of the page
 
+Quote Post
   
cmpsr2000
post Jun 2 2008, 08:36 PM
Post #19


Keeper of the Ruby Code of DOOM!
Group Icon

Group: Revolutionary
Posts: 355
Type: Scripter
RM Skill: Masterful




QUOTE (The Wizard 007 @ Jun 2 2008, 05:45 PM) *
Awesome glad you are making an update. Not to be a pain but is it almost done?


Yes biggrin.gif

New in v 1.0
  • Tax can be disabled
  • Shops can sell Skills, Classes, and Actors.
  • Shops can have a limited amount of items in stock
  • Shops can restock items.
  • Several new customization options available


and, bug-fixes galore.

Try it out and let me know if you find any bugs or want anything extra ^^b


__________________________
Go to the top of the page
 
+Quote Post
   
The Wizard 007
post Jun 3 2008, 02:19 PM
Post #20


Jack of all trades
Group Icon

Group: Revolutionary
Posts: 118
Type: Developer
RM Skill: Skilled




Oh thanks a million cmpsr2000. You really went all out on the update. I was expecting a couple fixes but this is just great!!! A nice bonus of selling skills, classes, and actors(that almost seems wrong). Great work, the demo works great but still have to test it on my project but it should be ok. I'll let you know if I find any bugs or inconsistencies. You are one hardcore scripter.


__________________________
Currently working on:

Underground Syndicate (mafioso/modern type RPG)
Mind Maze (old school dungeon crawler with a different feel)
Dragon Adventure (Dragon Quest type fangame with more customization)
Dark Grind (Survival horror RPG)
Go to the top of the page
 
+Quote Post
   

9 Pages V   1 2 3 > » 
Closed TopicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 19th May 2013 - 10:59 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker