Non riesco a far si che quando compro una abilità, mi scenda la variabile scelta del prezzo dell'abilità.
(Non uso i soldi normali, in quanto voglio differenziare i due valori).
Ecco lo script
#================================================================
==============
# Skill Shop for RMXP
#==============================================================================
# By Nechigawara Sanzenin
# WARNING!! : This script can use on RPG Maker XP Only!! (VX Not Support)
#==============================================================================
# ระบบซื้อสกิลของ RMXP
#==============================================================================
=begin
วิธีใช้:
ใส่ "$skill_shop =[หมายเลขสกิล]" ในคำสั่งใช้สคริปต์ เพื่อกำหนดสกิลที่จะขาย
ใส่ "$scene = Scene_Skill_Shop.new" ในคำสั่งใช้สคริปต์ เพื่อเรียกหน้าต่างซื้อสกิล
ตัวอย่าง :
$skill_shop =[1,2,3,6,7]
$scene = Scene_Skill_Shop.new
ตั้งค่าข้อความในหน้าต่างที่ใต้ "# Learn Text".
ตั้งค่าราคาที่ใต้ "# Price Data".
ตั้งค่าฮีโร่คนใด้ซื้อสกิลใดได้บ้างที่ใต้ "# Hero Data"..
=end
#==============================================================================
#module SKILL_SHOP
#==============================================================================
module SKILL_SHOP
# Learn Text
How_Learn = "Qual'è eroe vuole impararla?"
Can_Learn = "Può inpararla"
Cant_Learn = "Non può impararla"
Learnt = "Imparata"
Teach = "Impara"
Cancel = "Esci"
# Price Data
PRICE = {
# for No Set Price
0 => 100,
# Add Price Here
28 => 5,
29 => 15,
30 => 25,
# End
}
# Hero Data
SKILL_BUY = {
# Add what skill can hero buy Here
1 => [28,29,30],
2 => [28,29,30],
# End
}
# Add Price
def self.skill_price(id)
if PRICE.include?(id)
return PRICE[id]
else
return PRICE[0]
end
end
# Add Hero id
def self.skill_buy(id)
if SKILL_BUY.include?(id)
return SKILL_BUY[id]
else
return []
end
end
end
#==============================================================================
#class Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
def learn?(skill)
learn = skill_learn?(skill.id)
if learn
return false
else
return true
end
end
end
#==============================================================================
#class Window_Skill_ShopCommand
#==============================================================================
class Window_Skill_ShopCommand < Window_Selectable
#--------------------------------------------------------------------------
def initialize
super(0, 64, 480, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
@item_max = 2
@column_max = 2
s1 = SKILL_SHOP::Teach
s2 = SKILL_SHOP::Cancel
@commands = [s1, s2]
refresh
self.index = 0
end
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
def draw_item(index)
x = 4 + index * 240
self.contents.draw_text(x, 0, 128, 32, @commands[index])
end
end
#==============================================================================
#class Window_Skill_ShopBuy
#==============================================================================
class Window_Skill_ShopBuy < Window_Selectable
#--------------------------------------------------------------------------
def initialize(shop_goods)
super(0, 128, 368, 352)
@skill_shop_goods = $skill_shop
refresh
self.index = 0
end
#--------------------------------------------------------------------------
def skill
return @data[self.index]
end
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in 0...@skill_shop_goods.size
skill = $data_skills[@skill_shop_goods[i]]
if skill != nil
@data.push(skill)
end
end
# If the number of items is not 0, it draws up bit map, drawing all item
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
def draw_item(index)
skill = @data[index]
# Acquiring the frequency of possession of the item
price = SKILL_SHOP.skill_price(skill.id)
enabled = (price <= $game_variables[50])
# If price is not below the money in hand, at the same time the frequency of possession 99, usually in letter color
# So if is not, it sets to invalid letter color
if enabled
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4
y = index * 32
rect = Rect.new(x, y, self.width - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(skill.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 212, 32, skill.name, 0)
self.contents.draw_text(x + 240, y, 88, 32, price.to_s, 2)
end
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(skill == nil ? "" : skill.description)
end
end
#==============================================================================
#class Window_Skill_ShopStatus
#==============================================================================
class Window_Skill_ShopStatus < Window_Selectable
#--------------------------------------------------------------------------
def initialize
super(368, 128, 272, 352)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
@item = nil
refresh
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@item_max = $game_party.actors.size
if @item == nil
return
end
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 200, 32, SKILL_SHOP::How_Learn)
self.contents.font.color = normal_color
# Equipment supplementary information
for i in 0...$game_party.actors.size
# Acquiring the actor
actor = $game_party.actors[i]
can_learn = SKILL_SHOP.skill_buy(actor.id)
id = @item.id
enabled = (can_learn.include?(id) and actor.learn?(@item))
# If equipment possibility if usually in letter color, the impossibility, it sets to invalid letter color
if enabled
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
# Drawing the name of the actor
self.contents.draw_text(4, 64 + 64 * i, 120, 32, actor.name)
# Check Skill
if can_learn.include?(id) == false
text = SKILL_SHOP::Cant_Learn
elsif actor.learn?(@item) == false
text = SKILL_SHOP::Learnt
else
text = SKILL_SHOP::Can_Learn
end
# Drawing the item
self.contents.draw_text(124, 64 + 64 * i, 112, 32, text, 2)
end
end
#--------------------------------------------------------------------------
def item=(item)
if @item != item
@item = item
refresh
end
end
#--------------------------------------------------------------------------
def update_cursor_rect
# Cursor position as for -1 all selection, -2 below independence selection (user himself)
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(0, 64 + @index * 64, self.width - 32, 32)
end
end
end
#==============================================================================
#class Scene_Skill_Shop
#==============================================================================
class Scene_Skill_Shop
#--------------------------------------------------------------------------
def main
# Drawing up the help window
@help_window = Window_Help.new
# Drawing up the command window
@command_window = Window_Skill_ShopCommand.new
# Drawing up the Goldwyn dough
@gold_window = Window_Gold3.new
@gold_window.x = 480
@gold_window.y = 64
# Drawing up the dummy window
@dummy_window = Window_Base.new(0, 128, 640, 352)
# Drawing up the purchase window
@buy_window = Window_Skill_ShopBuy.new($game_temp.shop_goods)
@buy_window.active = false
@buy_window.visible = false
@buy_window.help_window = @help_window
# Drawing up the status window
@status_window = Window_Skill_ShopStatus.new
@status_window.visible = false
@status_window.active
# Transition execution
Graphics.transition
# Main loop
loop do
# Renewing the game picture
Graphics.update
# Updating the information of input
Input.update
# Frame renewal
update
# When the picture changes, discontinuing the loop
if $scene != self
break
end
end
# Transition preparation
Graphics.freeze
# Releasing the window
@help_window.dispose
@command_window.dispose
@gold_window.dispose
@dummy_window.dispose
@buy_window.dispose
@status_window.dispose
end
#--------------------------------------------------------------------------
def update
# Renewing the window
@help_window.update
@command_window.update
@gold_window.update
@dummy_window.update
@buy_window.update
@status_window.update
# When the command window is active,: Update_command is called
if @command_window.active
update_command
return
end
# When the purchase window is active,: Update_buy is called
if @buy_window.active
update_buy
return
end
# When the target window is active,: Update_target is called
if @status_window.active
update_target
return
end
end
#--------------------------------------------------------------------------
def update_command
# The B when button is pushed
if Input.trigger?(Input::B)
# Performing cancellation SE
$game_system.se_play($data_system.cancel_se)
# Change to map picture
$scene = Scene_Map.new
return
end
# When C button is pushed
if Input.trigger?(Input::C)
# Eliminating the help text
@help_window.set_text("")
# It diverges at cursor position of the command window
case @command_window.index
when 0 # It purchases
# Performing decision SE
$game_system.se_play($data_system.decision_se)
# State of window to purchase mode
@command_window.active = false
@dummy_window.visible = false
@buy_window.active = true
@buy_window.visible = true
@buy_window.refresh
@status_window.visible = true
when 1 # It stops
# Performing decision SE
$game_system.se_play($data_system.decision_se)
# Change to map picture
$scene = Scene_Map.new
end
return
end
end
#--------------------------------------------------------------------------
def update_buy
# Setting the item of the status window
@status_window.item = @buy_window.skill
# The B when button is pushed
if Input.trigger?(Input::B)
# Performing cancellation SE
$game_system.se_play($data_system.cancel_se)
# State of window to early mode
@command_window.active = true
@dummy_window.visible = true
@buy_window.active = false
@buy_window.visible = false
@status_window.visible = false
@status_window.item = nil
# Eliminating the help text
@help_window.set_text("")
return
end
# When C button is pushed
if Input.trigger?(Input::C)
# Acquiring the item
@item = @buy_window.skill
@price = SKILL_SHOP.skill_price(@item.id)
enabled = (@price <= $game_variables[50])
# When the item is invalid, or when price it is on from the money in hand
unless enabled
# Performing buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Performing decision SE
$game_system.se_play($data_system.decision_se)
@buy_window.active = false
@status_window.active = true
@status_window.index = 0
end
end
#--------------------------------------------------------------------------
def update_target
# The B when button is pushed
if Input.trigger?(Input::B)
# Performing cancellation SE
$game_system.se_play($data_system.cancel_se)
# Eliminating the target window
@buy_window.active = true
@status_window.index =- 1
@status_window.active = false
return
end
# When C button is pushed
if Input.trigger?(Input::C)
@actor = $game_party.actors[@status_window.index]
can_learn = SKILL_SHOP.skill_buy(@actor.id)
id = @item.id
enabled = (can_learn.include?(id) and @actor.learn?(@item))
$game_variables[50]-@price
# When with SP and so on is cut off and it becomes not be able to use
unless enabled
# Performing buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Performing shop SE
$game_system.se_play($data_system.shop_se)
@actor.learn_skill(@item.id)
@buy_window.refresh
@gold_window.refresh
@status_window.refresh
@buy_window.active = true
@status_window.index =- 1
@status_window.active = false
end
end
end
Question
Valentino
Non riesco a far si che quando compro una abilità, mi scenda la variabile scelta del prezzo dell'abilità.
(Non uso i soldi normali, in quanto voglio differenziare i due valori).
Ecco lo script
#================================================================ ============== # Skill Shop for RMXP #============================================================================== # By Nechigawara Sanzenin # WARNING!! : This script can use on RPG Maker XP Only!! (VX Not Support) #============================================================================== # ระบบซื้อสกิลของ RMXP #============================================================================== =begin วิธีใช้: ใส่ "$skill_shop =[หมายเลขสกิล]" ในคำสั่งใช้สคริปต์ เพื่อกำหนดสกิลที่จะขาย ใส่ "$scene = Scene_Skill_Shop.new" ในคำสั่งใช้สคริปต์ เพื่อเรียกหน้าต่างซื้อสกิล ตัวอย่าง : $skill_shop =[1,2,3,6,7] $scene = Scene_Skill_Shop.new ตั้งค่าข้อความในหน้าต่างที่ใต้ "# Learn Text". ตั้งค่าราคาที่ใต้ "# Price Data". ตั้งค่าฮีโร่คนใด้ซื้อสกิลใดได้บ้างที่ใต้ "# Hero Data".. =end #============================================================================== #module SKILL_SHOP #============================================================================== module SKILL_SHOP # Learn Text How_Learn = "Qual'è eroe vuole impararla?" Can_Learn = "Può inpararla" Cant_Learn = "Non può impararla" Learnt = "Imparata" Teach = "Impara" Cancel = "Esci" # Price Data PRICE = { # for No Set Price 0 => 100, # Add Price Here 28 => 5, 29 => 15, 30 => 25, # End } # Hero Data SKILL_BUY = { # Add what skill can hero buy Here 1 => [28,29,30], 2 => [28,29,30], # End } # Add Price def self.skill_price(id) if PRICE.include?(id) return PRICE[id] else return PRICE[0] end end # Add Hero id def self.skill_buy(id) if SKILL_BUY.include?(id) return SKILL_BUY[id] else return [] end end end #============================================================================== #class Game_Actor #============================================================================== class Game_Actor < Game_Battler def learn?(skill) learn = skill_learn?(skill.id) if learn return false else return true end end end #============================================================================== #class Window_Skill_ShopCommand #============================================================================== class Window_Skill_ShopCommand < Window_Selectable #-------------------------------------------------------------------------- def initialize super(0, 64, 480, 64) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = $fontface self.contents.font.size = $fontsize @item_max = 2 @column_max = 2 s1 = SKILL_SHOP::Teach s2 = SKILL_SHOP::Cancel @commands = [s1, s2] refresh self.index = 0 end #-------------------------------------------------------------------------- def refresh self.contents.clear for i in 0...@item_max draw_item(i) end end #-------------------------------------------------------------------------- def draw_item(index) x = 4 + index * 240 self.contents.draw_text(x, 0, 128, 32, @commands[index]) end end #============================================================================== #class Window_Skill_ShopBuy #============================================================================== class Window_Skill_ShopBuy < Window_Selectable #-------------------------------------------------------------------------- def initialize(shop_goods) super(0, 128, 368, 352) @skill_shop_goods = $skill_shop refresh self.index = 0 end #-------------------------------------------------------------------------- def skill return @data[self.index] end #-------------------------------------------------------------------------- def refresh if self.contents != nil self.contents.dispose self.contents = nil end @data = [] for i in 0...@skill_shop_goods.size skill = $data_skills[@skill_shop_goods[i]] if skill != nil @data.push(skill) end end # If the number of items is not 0, it draws up bit map, drawing all item @item_max = @data.size if @item_max > 0 self.contents = Bitmap.new(width - 32, row_max * 32) self.contents.font.name = $fontface self.contents.font.size = $fontsize for i in 0...@item_max draw_item(i) end end end #-------------------------------------------------------------------------- def draw_item(index) skill = @data[index] # Acquiring the frequency of possession of the item price = SKILL_SHOP.skill_price(skill.id) enabled = (price <= $game_variables[50]) # If price is not below the money in hand, at the same time the frequency of possession 99, usually in letter color # So if is not, it sets to invalid letter color if enabled self.contents.font.color = normal_color else self.contents.font.color = disabled_color end x = 4 y = index * 32 rect = Rect.new(x, y, self.width - 32, 32) self.contents.fill_rect(rect, Color.new(0, 0, 0, 0)) bitmap = RPG::Cache.icon(skill.icon_name) opacity = self.contents.font.color == normal_color ? 255 : 128 self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity) self.contents.draw_text(x + 28, y, 212, 32, skill.name, 0) self.contents.draw_text(x + 240, y, 88, 32, price.to_s, 2) end #-------------------------------------------------------------------------- def update_help @help_window.set_text(skill == nil ? "" : skill.description) end end #============================================================================== #class Window_Skill_ShopStatus #============================================================================== class Window_Skill_ShopStatus < Window_Selectable #-------------------------------------------------------------------------- def initialize super(368, 128, 272, 352) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = $fontface self.contents.font.size = $fontsize @item = nil refresh self.active = false self.index = -1 end #-------------------------------------------------------------------------- def refresh self.contents.clear @item_max = $game_party.actors.size if @item == nil return end self.contents.font.color = system_color self.contents.draw_text(4, 0, 200, 32, SKILL_SHOP::How_Learn) self.contents.font.color = normal_color # Equipment supplementary information for i in 0...$game_party.actors.size # Acquiring the actor actor = $game_party.actors[i] can_learn = SKILL_SHOP.skill_buy(actor.id) id = @item.id enabled = (can_learn.include?(id) and actor.learn?(@item)) # If equipment possibility if usually in letter color, the impossibility, it sets to invalid letter color if enabled self.contents.font.color = normal_color else self.contents.font.color = disabled_color end # Drawing the name of the actor self.contents.draw_text(4, 64 + 64 * i, 120, 32, actor.name) # Check Skill if can_learn.include?(id) == false text = SKILL_SHOP::Cant_Learn elsif actor.learn?(@item) == false text = SKILL_SHOP::Learnt else text = SKILL_SHOP::Can_Learn end # Drawing the item self.contents.draw_text(124, 64 + 64 * i, 112, 32, text, 2) end end #-------------------------------------------------------------------------- def item=(item) if @item != item @item = item refresh end end #-------------------------------------------------------------------------- def update_cursor_rect # Cursor position as for -1 all selection, -2 below independence selection (user himself) if @index < 0 self.cursor_rect.empty else self.cursor_rect.set(0, 64 + @index * 64, self.width - 32, 32) end end end #============================================================================== #class Scene_Skill_Shop #============================================================================== class Scene_Skill_Shop #-------------------------------------------------------------------------- def main # Drawing up the help window @help_window = Window_Help.new # Drawing up the command window @command_window = Window_Skill_ShopCommand.new # Drawing up the Goldwyn dough @gold_window = Window_Gold3.new @gold_window.x = 480 @gold_window.y = 64 # Drawing up the dummy window @dummy_window = Window_Base.new(0, 128, 640, 352) # Drawing up the purchase window @buy_window = Window_Skill_ShopBuy.new($game_temp.shop_goods) @buy_window.active = false @buy_window.visible = false @buy_window.help_window = @help_window # Drawing up the status window @status_window = Window_Skill_ShopStatus.new @status_window.visible = false @status_window.active # Transition execution Graphics.transition # Main loop loop do # Renewing the game picture Graphics.update # Updating the information of input Input.update # Frame renewal update # When the picture changes, discontinuing the loop if $scene != self break end end # Transition preparation Graphics.freeze # Releasing the window @help_window.dispose @command_window.dispose @gold_window.dispose @dummy_window.dispose @buy_window.dispose @status_window.dispose end #-------------------------------------------------------------------------- def update # Renewing the window @help_window.update @command_window.update @gold_window.update @dummy_window.update @buy_window.update @status_window.update # When the command window is active,: Update_command is called if @command_window.active update_command return end # When the purchase window is active,: Update_buy is called if @buy_window.active update_buy return end # When the target window is active,: Update_target is called if @status_window.active update_target return end end #-------------------------------------------------------------------------- def update_command # The B when button is pushed if Input.trigger?(Input::B) # Performing cancellation SE $game_system.se_play($data_system.cancel_se) # Change to map picture $scene = Scene_Map.new return end # When C button is pushed if Input.trigger?(Input::C) # Eliminating the help text @help_window.set_text("") # It diverges at cursor position of the command window case @command_window.index when 0 # It purchases # Performing decision SE $game_system.se_play($data_system.decision_se) # State of window to purchase mode @command_window.active = false @dummy_window.visible = false @buy_window.active = true @buy_window.visible = true @buy_window.refresh @status_window.visible = true when 1 # It stops # Performing decision SE $game_system.se_play($data_system.decision_se) # Change to map picture $scene = Scene_Map.new end return end end #-------------------------------------------------------------------------- def update_buy # Setting the item of the status window @status_window.item = @buy_window.skill # The B when button is pushed if Input.trigger?(Input::B) # Performing cancellation SE $game_system.se_play($data_system.cancel_se) # State of window to early mode @command_window.active = true @dummy_window.visible = true @buy_window.active = false @buy_window.visible = false @status_window.visible = false @status_window.item = nil # Eliminating the help text @help_window.set_text("") return end # When C button is pushed if Input.trigger?(Input::C) # Acquiring the item @item = @buy_window.skill @price = SKILL_SHOP.skill_price(@item.id) enabled = (@price <= $game_variables[50]) # When the item is invalid, or when price it is on from the money in hand unless enabled # Performing buzzer SE $game_system.se_play($data_system.buzzer_se) return end # Performing decision SE $game_system.se_play($data_system.decision_se) @buy_window.active = false @status_window.active = true @status_window.index = 0 end end #-------------------------------------------------------------------------- def update_target # The B when button is pushed if Input.trigger?(Input::B) # Performing cancellation SE $game_system.se_play($data_system.cancel_se) # Eliminating the target window @buy_window.active = true @status_window.index =- 1 @status_window.active = false return end # When C button is pushed if Input.trigger?(Input::C) @actor = $game_party.actors[@status_window.index] can_learn = SKILL_SHOP.skill_buy(@actor.id) id = @item.id enabled = (can_learn.include?(id) and @actor.learn?(@item)) $game_variables[50]-@price # When with SP and so on is cut off and it becomes not be able to use unless enabled # Performing buzzer SE $game_system.se_play($data_system.buzzer_se) return end # Performing shop SE $game_system.se_play($data_system.shop_se) @actor.learn_skill(@item.id) @buy_window.refresh @gold_window.refresh @status_window.refresh @buy_window.active = true @status_window.index =- 1 @status_window.active = false end end endGrazie in anticipo!
Targhette Rpg2s:
http://img14.imageshack.us/img14/5421/contestsecondo.png
Partecipante al Rpg2s.net Game Contest #3
http://www.rpg2s.net/images/gc3/gc3_firma.png
Gioco in Sviluppo: DREAMS
http://img16.imageshack.us/img16/2121/dreamstitle2.png
SKY's CRY!
http://www.rpg2s.net...showtopic=12557
Lista di script creati da me:
Support System FF9
Multiscope System
Advanced Armor System
Protection System
Trance System
FF2 Development System
Scene Vittoria Animato
Aperion System
Elemosina System
Valentino's Scene Shop
Item Plus System
Panorama Acceleration System
Conversione da VX a XP, Vehicle System
Sentinel System
Scene Zoolab
Valentino's Random System
Oggetti Riutilizzabili
Break Pictures Limit
Gameover Animato
Valentino's Gun Mode
Valentino's Ally System
Link to comment
Share on other sites
2 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now