I was trying to change the price of an item in my script Max Limit Breaker and for some reason the price still stays at the default price. I was wondering if I wrote this correctly.
module Warrior_Engine
module CORE
# This hash allows you to adjust the individual item price. This allows you
# to go past the original editor limit of 999,999 gold for a single item.
CUSTOM_PRICES ={
:item => {1 => 9999999999, 30 => 123456789999},
:weapon => {},
:armor => {},
}
end
end
module RPG
class Item
include Warrior_Engine::CORE
custom_prices = CUSTOM_PRICES[:item][@id]
@price = custom_prices.nil? ? 0 : custom_prices
end
class Weapon
include Warrior_Engine::CORE
custom_prices = CUSTOM_PRICES[:weapon][@id]
@price = custom_prices.nil? ? 0 : custom_prices
end
class Armor
include Warrior_Engine::CORE
custom_prices = CUSTOM_PRICES[:armor][@id]
@price = custom_prices.nil? ? 0 : custom_prices
end
end
That code will run as soon as your script is run. You want to alias the price method of those classes and return the custom price unless it's nil, else return the result of the aliased method.
Try this:
module Warrior_Engine
module CORE
# This hash allows you to adjust the individual item price. This allows you
# to go past the original editor limit of 999,999 gold for a single item.
CUSTOM_PRICES ={
:item => {1 => 9999999999, 30 => 123456789999},
:weapon => {},
:armor => {},
}
end
end
module RPG
class Item
include Warrior_Engine::CORE
alias ace_price price
def price
custom_prices = CUSTOM_PRICES[:item][@id]
return (custom_prices.nil? ? ace_price : custom_prices)
end
end
class Weapon
include Warrior_Engine::CORE
alias ace_price price
def price
custom_prices = CUSTOM_PRICES[:weapon][@id]
return (custom_prices.nil? ? ace_price : custom_prices)
end
end
class Armor
include Warrior_Engine::CORE
alias ace_price price
def price
custom_prices = CUSTOM_PRICES[:armor][@id]
return (custom_prices.nil? ? ace_price : custom_prices)
end
end
end
oh okay :haha: We learn something new everyday. Didn't even know The RPG module needs to be changed like that. Thank you.