- 0
Simple "Learned Skill" window, scripting trouble
Asked by
TriangleGM
-
Recently Browsing 0 members
No registered users viewing this page.
Asked by
TriangleGM
No registered users viewing this page.
I'm trying to create a window that will simply display
"CHARACTER learned SKILL"
as needed when characters gain levels in battle.
EDIT: Okay, I figured out why nothing was happening. I left out the "window.visible" line. D'oh.
However, my new problem is, the window never goes away. So how do I make this window disappear after it shows up?
(Oringinal post text)
At this point, everything runs smoothly, but nothing happens.
There's no error, but there's no New Skill window displayed either.
I like learning about the scripting side of things, but I always seem to get to this same problem.
I did successfully create an element type for bard weapons that causes them to attack all enemies at once.
So, I have done SOME of this stuff before, but I am NOT fluent in RMXP's scripting.
Any suggestions at all would be much appreciated.
This is my new window class (placed before main):
#============================================================================== # ** Window_LearnSkill #------------------------------------------------------------------------------ # This window displays new skills learned at the end of a battle. #============================================================================== class Window_LearnSkill < Window_Base #-------------------------------------------------------------------------- # * Object Initialization # name : actor name # dskill : new skill name #-------------------------------------------------------------------------- def initialize(name, newskill) @name = name @dskill = $data_skills[newskill] super(160, 0, 320, 64) self.contents = Bitmap.new(width - 32, height - 32) self.y = 160 - height / 2 self.back_opacity = 160 self.visible = false refresh end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh self.contents.clear x = 4 self.contents.font.color = normal_color cx = contents.text_size(@name).width self.contents.draw_text(x, 0, cx, 32, @name) x += cx + 4 self.contents.font.color = normal_color cx = contents.text_size("learned").width self.contents.draw_text(x, 0, 64, 32, "learned") x += cx + 16 self.contents.font.color = normal_color cx = contents.text_size(@dskill.name).width self.contents.draw_text(x, 0, cx, 32, @dskill.name) y = 32 end endI have then placed a line to call the window directly into the Game_Actor class at line 468, during the # Learn Skill loop, as shown here.
#-------------------------------------------------------------------------- # * Change EXP # exp : new EXP #-------------------------------------------------------------------------- def exp=(exp) @exp = [[exp, 9999999].min, 0].max # Level up while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0 @level += 1 # Learn skill for j in $data_classes[@class_id].learnings if j.level == @level learn_skill(j.skill_id) @newskill_window = Window_LearnSkill.new(@name, j.skill_id) end end end # Level down while @exp < @exp_list[@level] @level -= 1 end # Correction if exceeding current max HP and max SP @hp = [@hp, self.maxhp].min @sp = [@sp, self.maxsp].min endTo clarify, I JUST want an awareness of skills learned, nothing else. I've seen a few examples of custom battle result windows here and there on "the googles," but they're all WAY more involved than what I want. Everyone wants to display a full list of character attribute changes with each level-up. I just want there to be SOME way of the player knowing they have a new skill, because sometimes it's important to the game's puzzle mechanics (i.e. use "Feat Of Strength" skill to roll boulder on map).
P.S.: By the way, I used to hang around on the RPG Revolution forums a couple years back.
Edited by TriangleGMShare this post
Link to post
Share on other sites