Chaos Project

RPG Maker => RPG Maker Scripts => Script Troubleshooting => Topic started by: Jackolas on October 28, 2009, 03:55:43 pm

Title: Increase Item cost (Solved)
Post by: Jackolas on October 28, 2009, 03:55:43 pm
working on a script atm.
but I wane know how I can add a number to the cost of an item
the reason for this is because the database is limited to max 99999G for an item.
I want to increase this by adding for example 100000G so the item would cost 199999G in a shop

how can I do this true a script?
Title: Re: Increase Item cost
Post by: G_G on October 28, 2009, 05:09:34 pm
$data_items[x].price += price

that would add but if you just want to set it do this
$data_items[x].price = price
Title: Re: Increase Item cost
Post by: Jackolas on October 28, 2009, 05:14:56 pm
nvm.. just found out that your Equipment Stat Breaker works like a dream for this :P
(is the code you just linked up)

EDIT: (new problem)

I know how I can add new prices etc.. but it would require the user of the script to add loads of lines somewhere middle in the script.
is it possible for example to link it to a configuration part of the script

for example.

somewhere in a script I have:

$data_items[x].price = y
x = my_script_config::x_price
y = my_script_config::y_price


and than in my configuration of my script:

config something[x,y]{
[1,100],
[2,200]
[etc,etc]}


it is possible... just can't figure out how to do it with my limited scripting knowledge.
Title: Re: Increase Item cost (new problem)
Post by: G_G on October 29, 2009, 07:33:00 am
use it like this or something
class RPG::Item
 def price
   case @id
   when 1 then return 100
   end
   return 10
 end
end
Title: Re: Increase Item cost (new problem)
Post by: Jackolas on October 29, 2009, 07:42:25 am
yeah.. that should work.

but how do I change the weapon price and the armor price than?
Title: Re: Increase Item cost (new problem)
Post by: G_G on October 29, 2009, 04:57:34 pm
Here you go
module RPG
  class Item
    def price
      case @id
      when 1 then return 100
      end
      return @price
    end
  end
  class Weapon
    def price
      case @id
      when 1 then return 100
      end
      return @price
    end
  end
  class Armor
    def price
      case @id
      when 1 then return 100
      end
      return @price
    end
  end
end
Title: Re: Increase Item cost (new problem)
Post by: Jackolas on November 02, 2009, 03:01:42 am
ty game_guy
You ROCK!!