[RESOLVED][RGSS] two issues I'm having...

Started by bigace, January 20, 2013, 03:03:29 pm

Previous topic - Next topic

bigace

January 20, 2013, 03:03:29 pm Last Edit: January 21, 2013, 01:03:56 am by bigace
Okay in my scene_skill script I've create (about 80%) done, I've ran into two issues that I can't really see where to fix it at. So I need another pair of eyes for help.
Issue I:
Spoiler: ShowHide

I thought an image would make more sense then me explaining it.
Issue II:
When you start the skill scene you'll notice in the help window that for some reason one of the selected skills description will show up for a second before returning to command description, even though the skill window isn't even active. It may be hard to understand that part, you'll have to plug-in and see what I mean.

Scene_Skill Download Link Dead


Use Dropbox to upload your files. Much simpler than other upload sites, you can simply place a folder on your desktop that will sync with your DropBox account.

KK20

1.
Spoiler: ShowHide
Problem is this under Window_SkillStatus

def update; super; update_item(@item_window.skill); end   #<- posted this to show what is exactly going on here
def update_item(skill)
  return if @skill == skill
  @skill = skill
  refresh
end

@item_window.skill actually equals some skill. The index of that window is -1. In case you don't know a negative index value in an array starts from the end. Thus, @item_window.skill is returning the last skill the actor knows.

You need to make it so that @skill = nil when @item_window is no longer active (or has an index of -1). I did this

def update_item(skill)
  return if ((@skill == skill and @item_window.active) or (!@item_window.active and @skill.nil?))
  @skill = (@item_window.active ? skill : nil) # added
  refresh
end


2.
Spoiler: ShowHide
 Well, we know that the problem has something to do with the method update_help in Window_Skill. Using Find brought me nowhere; nothing was out of place. I had to then refer to the parent class Window_Selectable. Finding every instance of update_help brought me to three methods: index=, help_window=, and update (we can rule out update). Now to determine what is the cause, we find where the help window is assigned to skill window.

def create_item_window
  dy = @category_window.y + @category_window.height
  dh = 480 - dy
  @skill_window = Window_Skill.new(0, dy, 640, dh, @actor)
  @skill_window.help_window = @help_window                 #<- Ah, here it is
  @skill_window.deactivate.unselect
  @target_window = Window_Target.new
  hide_target_window
end

Which, if we look at the method help_window=

  def help_window=(help_window)
    @help_window = help_window
    # Update help text (update_help is defined by the subclasses)
    if self.active and @help_window != nil                # Skill_Window is indeed active and we just set @help_window, so it's not nil
      update_help
    end
  end

It is calling update_help, which will then write the skill located at -1 (why -1? Because when you create a new Window_Selectable, initialize sets the @index to -1) in the array of the actor's skills.

You can prevent this from happening if you set the Skill Window to be inactive before calling help_window=, which, according to your current code, is a matter of swapping two lines.

def create_item_window
  dy = @category_window.y + @category_window.height
  dh = 480 - dy
  @skill_window = Window_Skill.new(0, dy, 640, dh, @actor)
  @skill_window.deactivate.unselect                  # Swap this
  @skill_window.help_window = @help_window           # with that
  @target_window = Window_Target.new
  hide_target_window
end



I noticed a couple other things as well that could be bugs. Can't recall where I saw them.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

bigace

Quote from: KK20 on January 20, 2013, 11:09:21 pm
1.
Spoiler: ShowHide
Problem is this under Window_SkillStatus

def update; super; update_item(@item_window.skill); end   #<- posted this to show what is exactly going on here
def update_item(skill)
  return if @skill == skill
  @skill = skill
  refresh
end

@item_window.skill actually equals some skill. The index of that window is -1. In case you don't know a negative index value in an array starts from the end. Thus, @item_window.skill is returning the last skill the actor knows.

You need to make it so that @skill = nil when @item_window is no longer active (or has an index of -1). I did this

def update_item(skill)
  return if ((@skill == skill and @item_window.active) or (!@item_window.active and @skill.nil?))
  @skill = (@item_window.active ? skill : nil) # added
  refresh
end


2.
Spoiler: ShowHide
 Well, we know that the problem has something to do with the method update_help in Window_Skill. Using Find brought me nowhere; nothing was out of place. I had to then refer to the parent class Window_Selectable. Finding every instance of update_help brought me to three methods: index=, help_window=, and update (we can rule out update). Now to determine what is the cause, we find where the help window is assigned to skill window.

def create_item_window
  dy = @category_window.y + @category_window.height
  dh = 480 - dy
  @skill_window = Window_Skill.new(0, dy, 640, dh, @actor)
  @skill_window.help_window = @help_window                 #<- Ah, here it is
  @skill_window.deactivate.unselect
  @target_window = Window_Target.new
  hide_target_window
end

Which, if we look at the method help_window=

  def help_window=(help_window)
    @help_window = help_window
    # Update help text (update_help is defined by the subclasses)
    if self.active and @help_window != nil                # Skill_Window is indeed active and we just set @help_window, so it's not nil
      update_help
    end
  end

It is calling update_help, which will then write the skill located at -1 (why -1? Because when you create a new Window_Selectable, initialize sets the @index to -1) in the array of the actor's skills.

You can prevent this from happening if you set the Skill Window to be inactive before calling help_window=, which, according to your current code, is a matter of swapping two lines.

def create_item_window
  dy = @category_window.y + @category_window.height
  dh = 480 - dy
  @skill_window = Window_Skill.new(0, dy, 640, dh, @actor)
  @skill_window.deactivate.unselect                  # Swap this
  @skill_window.help_window = @help_window           # with that
  @target_window = Window_Target.new
  hide_target_window
end



I noticed a couple other things as well that could be bugs. Can't recall where I saw them.

:facepalm: Why does everything look so simple after someone does it. Thank you. I knew it was the Window_SkillStatus, but I didn't what I was doing, just doing unnecessary  stuff. Well if you remember any more errors tell me before I submit the script on tuesday.


Use Dropbox to upload your files. Much simpler than other upload sites, you can simply place a folder on your desktop that will sync with your DropBox account.

KK20

The "Press [Shift] to show..." text has a questionable opacity thing going on. I'm not sure what's suppose to happen though.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

bigace

are you talking about when there's no skill active, the button quote doesn't appear? Now that you've help fixed that issue, this has become noticable. This will be an easy fix.


Use Dropbox to upload your files. Much simpler than other upload sites, you can simply place a folder on your desktop that will sync with your DropBox account.

KK20

Eh, I kinda meant in general.

1. Select View Skills
2. Text is fully white. Opacity looks 255.
3. Press Shift to view skills stats. Opacity still 255.
4. Move to another skill. Opacity suddenly halved.
5. Press Shift. Still halved.
6. Shift again. Returns to 255.

Basically mess around with pressing shift a bit and moving around.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

bigace

Well the color changing was very simple like I said before :) . Okay thanks for your help again, if you see anymore error before tomorrow that would be great.


Use Dropbox to upload your files. Much simpler than other upload sites, you can simply place a folder on your desktop that will sync with your DropBox account.