Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[VX] Item Price Changer

Item Price Changer
Version 1.0
by Woratana
Release Date: 27/06/2008


Introduction
This script will allow you to change item/weapon/armor's price easily with call script.

So you can make item that its price can change all the time. :D

Enjoy~  :lol:


Screenshots
-No screenshot-


Script
Place it above main
http://i28.tinypic.com/25thhqt.jpg[/img]
Code:
#===============================================================
# ● [VX] ◦ Item Price Changer ◦ □
# * Change item/weapon/armor's price in-game *
#--------------------------------------------------------------
# â—¦ by Woratana [woratana@hotmail.com]
# â—¦ Thaiware RPG Maker Community
# â—¦ Released on: 26/06/2008
# â—¦ Version: 1.0
#--------------------------------------------------------------

#==================================================================
# ** HOW TO USE **
#-----------------------------------------------------------------
# ** To change item's price, call script:
#  Price_Edit.item(id, price)
#
# * id: ID of item you want to change price
# * price: New price
#
# ** To change weapon's price, call script:
#  Price_Edit.weapon(id, price)
#
# ** To change armor's price, call script:
#  Price_Edit.armor(id, price)
#
# ** You can leave the price blank to reset item's price:
#  Price_Edit.item(id)
#  Price_Edit.weapon(id)
#  Price_Edit.armor(id)
# * This will use default price you set in database.
#===============================================================

module Price_Edit
  def self.item(id, price = nil)
    price ||= $data_items[id].real_price
    $game_system.new_price['item'][id] = price
  end
  
  def self.weapon(id, price = nil)
    price ||= $data_weapons[id].real_price
    $game_system.new_price['weapon'][id] = price
  end
  
  def self.armor(id, price = nil)
    price ||= $data_armors[id].real_price
    $game_system.new_price['armor'][id] = price
  end
end

class Game_System
  def new_price
    if @new_price.nil?
      @new_price = {}
      @new_price['item'] = []
      @new_price['weapon'] = []
      @new_price['armor'] = []
    end
    return @new_price
  end
end

module RPG
  class BaseItem
    def real_price
      return @price
    end
  end
  
  class Item
    def price
      return $game_system.new_price['item'][@id].nil? ? @price :
    $game_system.new_price['item'][@id]
    end
  end
  
  class Weapon
    def price
      return $game_system.new_price['weapon'][@id].nil? ? @price :
    $game_system.new_price['weapon'][@id]
    end
  end
  
  class Armor
    def price
      return $game_system.new_price['armor'][@id].nil? ? @price :
    $game_system.new_price['armor'][@id]
    end
  end
end


Instruction
Place the script above main.

#==================================================================
# ** HOW TO USE **
#-----------------------------------------------------------------
# ** To change item's price, call script:
#  Price_Edit.item(id, price)
#
# * id: ID of item you want to change price
# * price: New price
#
# ** To change weapon's price, call script:
#  Price_Edit.weapon(id, price)
#
# ** To change armor's price, call script:
#  Price_Edit.armor(id, price)
#
# ** You can leave the price blank to reset item's price:
#  Price_Edit.item(id)
#  Price_Edit.weapon(id)
#  Price_Edit.armor(id)
# * This will use default price you set in database.
#===============================================================


Author's Notes
Free for use in your work if credit is included.


Bug Report?
Please give me these informations:
- What is it says in error window?
- When is it get error? (Right after run game, when you choose something, etc.)
- Do you have any other scripts running in your game that may crash with this script?
 
You keep comin' at us with some good stuff woratana, keep up the great work! When I get serious with VX, I'll probably be scooping all of your scripts up and loading them into my game :P

Full credit of course, because you've been working overtime lately!

Great job once again :thumb:
 
robot79796":12lqpp30 said:
If it is posible can it be made for rpg maker xp.
Me not liking vx.

"Me liking VX" :D

Anyway, nice script ^^, I do like all of your VX scripts..partially because they all seem to work with my custom ones lol, and mostly because they add so much more functionality.
 
Thanks for all the compliments. :D

@robot79796
Try this, let me know if this work or not:
Code:
#===============================================================
# â—
 
Me liking Woratana's scripts! :D
Okay, okay, enough bad grammar. You always seem to create the most essential scripts, very helpful!
 
how would one make it so a price changes based on lets say... steps???

like you would find lets say...
Coin Collection...
lets say every step adds to its value...

so when you first get it its worth 5gold... from when you first get it... only can get 1...
so ok its worth 5 gold... so even if you started at 7000 steps... got it it would only be worth 5gold...
so i guess you would put the starting steps in a variable...

now lets say it adds in 5 + 5*5(as in 5 steps)/10 I know its just f + 5*2.5 but I was thinking you could add in even more advanced things like the /10 would change based on how many times you ran from battle or something so if you run alot it would add alot slower....

so lets say you took 2100 steps but you ran 3 times...  so it would be 2100/13
so it would be 5 + 5*161.5 = 812 would be the new worth... (with only partial rounding to 1 decimal or 0 decimals if its easier lol)
how would one do something like that? <is it possible with events? or does it have to have a script to do it for ya>
 
Yay it works.

Wsensor:
you can make calculations with the varibles so you can make an common effent that calculates the prices.

if i have the time (if i can find it back) i could try to make an engien for you

edit 1:

i have made it in rmxp.
but if you make it like my events it would work on vx
http://www.megaupload.com/?d=LR5IBJ06
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top