An issue im having with babs and skilling up...

Started by Mixxth, May 27, 2015, 09:40:00 pm

Previous topic - Next topic

Mixxth

When my characters level, they get the skills allocated to them in the classes page, the problem is the player doesnt get informed they learnt any skills, they just appear in the skill menu, how do you fix this, so that when you level a message appears of some sort saying something like "X has learned Heal!"
Donald Knuth: "I can't go to a restaurant and order food because I keep looking at the fonts on the menu. Five minutes later I realize that it's also talking about food."

KK20

The lower this is placed on the script list, the better the chance it will work with other scripts.
Spoiler: ShowHide

class Game_Actor < Game_Battler
  alias notify_new_skill learn_skill
  def learn_skill(skill_id)
    if skill_id > 0 and not skill_learn?(skill_id)
      skill = $data_skills[skill_id].name
      $game_temp.skill_learn(@actor_id, skill)
    end
    notify_new_skill(skill_id)
  end
end

class Window_Skill_Notify < Window_Base
  def initialize
    super(180, -96, 280, 96)
    self.contents = Bitmap.new(width - 32, height - 32)
    @phase = 0
    @frame_counter = 0
    self.opacity = 180
  end
 
  def draw_skill_learn(id, skill)
    self.contents.clear
    return if id.nil? || skill.nil?
    actor = $game_actors[id]
    return if actor.nil?
    draw_actor_graphic(actor, 32, 64)
    self.contents.draw_text(50, 16, width - 32 - 50, 32, "Learned " + skill,1)
    @phase = 1
    @frame_counter = 200
  end
 
  def update
    case @phase
    when 0 # Startup phase
      if !$game_temp.learn_list.empty?
        draw_skill_learn(*$game_temp.learn_list.shift)
      end
    when 1 # Appearing
      self.y += 8 if self.y < 0
      @phase = 2 if self.y >= 0
    when 2 # Displaying window for 5 seconds
      @frame_counter -= 1
      @phase = 3 if @frame_counter == 0
    when 3 # Disappearing
      if !$game_temp.learn_list.empty?
        @phase = 0
        return
      end
      self.y -= 8 if self.y > -96
      @phase = 0 if self.y <= -96
    end
  end
end


class Game_Temp
  attr_accessor :learn_list
 
  alias init_for_skilllearn initialize
  def initialize
    init_for_skilllearn
    @learn_list = []
  end
 
  def skill_learn(actorid, skill)
    @learn_list.push([actorid, skill]) unless @learn_list.include?([actorid, skill])
  end
end


class Scene_Map
  alias init_skilllearn_win_main main
  def main
    @skilllearn_window = Window_Skill_Notify.new
    init_skilllearn_win_main
    @skilllearn_window.dispose
  end
 
  alias update_for_skilllearn update
  def update
    @skilllearn_window.update
    update_for_skilllearn
  end
end

I borrowed the code from another script request I had fulfilled.

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!

Sylphe

Just saying, perhaps it would work better if you put this in the Scene_Map main method override 

Spoiler: ShowHide
@skilllearn_window = Window_Skill_Notify.new
   # Maybe you will not often see a square on the map with that shi
    @skilllearn_window.visible=false
    init_skilllearn_win_main
    @skilllearn_window.dispose


Just added a line

:-* :-*
blindly follow his heart can lead to the loss

Sylphe, descendant of Zoldik Family.
Quote from: TedBearTRY KEEP UP

KK20

You'd have to add another line where the window becomes visible again.
I forgot the reason behind negative coordinates in VXA. Tested the script in XP and it's fine. XPA spits out a blank window if there's nothing to be shown.

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!

Sylphe

Yes in the Window notify  update method =3
Ok I saw "babs" in the subject so I thought you gave a rmxp script

Hum KK20 just stop posting pleaz
The reason why: ShowHide

2222 POSTS !!!!!

blindly follow his heart can lead to the loss

Sylphe, descendant of Zoldik Family.
Quote from: TedBearTRY KEEP UP