I am currently working on a script i started working on a very long time ago. It is a script were the player can spend points to make the characters in the game learn different skills and increase their attributes. So basically what i'm trying to do is to create a small window that displays the cost of the skill, and the text in this window will change whenever you move the cursor to another skill. Here is the window:
I've created a module in my script, and here is the important part of it:
If switch 8 is turned on, then the "Fire" skill will be displayed and choosable in a window, i've gotten that far. But what i can't quite figure out is how i could display the different costs(this is in the "Window_Info_Cost" window) of the skills based on if a switch is on. I only want to display the cost if the skill is available. So let's say switch 8 is turned on, the fire skill is then available, but how do i make it display the number in Skills::Victory_Points[0] ?
And in my Scene in the update i have this line:
(@skill_skills is the window displaying all the skills)
This will make the window draw the number in the Victory_Points array based on the cursor index in the @skill_skills window.
And everything works, except that it draws every cost. even if you go to a skill that is not available/not seen in the window. So basically what i want is to only draw the numbers in the Victory_Points array if the corresponding switch in Skills::Switches is turned on(When a switch is turned on, a skill becomes available to learn).
I hope i wasn't too confusing. and if you want me to give more information or maybe post a picture of the window(s) and show you what i mean, i'll gladly do it. Anyway, thanks for reading!
Over and out - Gando
Code:
#==============================================================================
# ** Window_Info_Cost
#------------------------------------------------------------------------------
# This window is used to show information about the command window.
#==============================================================================
class Window_Info_Cost < Window_Base
def initialize
super(0, 430, 110, 50)
self.contents = Bitmap.new(width - 32, height - 32)
end
#--------------------------------------------------------------------------
# * Set Text
# text : text you want to see in the window.
# align : alignment of the text you want to see in the window.
#--------------------------------------------------------------------------
def set_text(text, align = 0)
# If at least one part of text and alignment differ from last time
if text != @text or align != @align
# Redraw text
self.contents.clear
self.contents.font.color = normal_color
text_rect = self.contents.text_size(text.to_s)
self.contents.draw_text(0, -15, self.width, height, 'Cost:', align)
self.contents.draw_text(50, -14, text_rect.width, height, text.to_s, align)
@text = text
@align = align
end
end
end
I've created a module in my script, and here is the important part of it:
Code:
module Skills
# This is the cost of the skills
Victory_Points = [0, 2, 5]
#These are the switches.
Switches = [8, 9, 7]
# These are the names of the skills available to learn.
Database_Skills = ["Fire", "Heal", "Mass Heal"]
end
If switch 8 is turned on, then the "Fire" skill will be displayed and choosable in a window, i've gotten that far. But what i can't quite figure out is how i could display the different costs(this is in the "Window_Info_Cost" window) of the skills based on if a switch is on. I only want to display the cost if the skill is available. So let's say switch 8 is turned on, the fire skill is then available, but how do i make it display the number in Skills::Victory_Points[0] ?
And in my Scene in the update i have this line:
Code:
@window_info_cost.set_text(Skills::Victory_Points[@skill_skills.index])
This will make the window draw the number in the Victory_Points array based on the cursor index in the @skill_skills window.
And everything works, except that it draws every cost. even if you go to a skill that is not available/not seen in the window. So basically what i want is to only draw the numbers in the Victory_Points array if the corresponding switch in Skills::Switches is turned on(When a switch is turned on, a skill becomes available to learn).
I hope i wasn't too confusing. and if you want me to give more information or maybe post a picture of the window(s) and show you what i mean, i'll gladly do it. Anyway, thanks for reading!
Over and out - Gando