Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Skill Shop V4.2

Status
Not open for further replies.
you were missing addons :-/

here is Sprite_ActorCharGraphic

Code:
#============================================================================== 
# ** Sprite_ActorCharGraphic (V2.0)                                By Trickster
#-----------------------------------------------------------------------------
#  A Sprite Class that represents an actor character graphic. Also Handles a few
#  Graphical methods and animation. The Z coordinate is, by default,
#  in between the window and its contents for easy integration in a window.
#============================================================================== 

MACL::Loaded << 'Sprite_ActorCharGraphic'

class Sprite_ActorCharGraphic < Sprite
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :speed
  attr_accessor :animate
  attr_reader   :frame
  attr_reader   :pose
  #-------------------------------------------------------------------------
  # * Name      : Object Initialization
  #   Info      : Creates a New Instance of this Class
  #   Author    : Trickster
  #   Call Info : Three or Seven Arguments
  #               Game_Actor actor, Actor's Sprite to Display
  #               Integer X and Y, Position to Display
  #               Integer Speed, Speed of animation (Def 1)
  #               Integer Frame, Starting frame (Def. nil)
  #               String/Integer Pose, Pose Type/Pose Index (Def. nil)
  #               Viewport viewport, Viewport used (Def. nil)
  #-------------------------------------------------------------------------
  def initialize(actor, x, y, speed = 1, frame = 0, pose = 0, viewport = nil)
    # Call Sprite#initialize and Send Viewport
    super(viewport)
    # Setup Instance Variables
    @actor, @speed = actor, speed
    # Setup Position
    self.x = x
    self.y = y
    self.z = 101
    # Setup Bitmap
    self.bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
    # Setup Other Variables
    @name, @hue, @animate = @actor.character_name, @actor.character_hue, false
    # Setup Pose if string sent
    pose = MACL::Poses.index(pose) if pose.is_a?(String)
    # Setup Pose and Frame
    self.pose, self.frame = pose, frame
    # Setup Counter Instance Variable
    @count = 0
  end
  #-------------------------------------------------------------------------
  # * Name      : Set Graphic
  #   Info      : Sets Graphic to (Frame, Pose)
  #   Author    : Trickster
  #   Call Info : Two Arguments 
  #               Integer Frame, Frame
  #               String/Integer Pose, Pose Type/Pose Index 
  #-------------------------------------------------------------------------
  def set_graphic(pose, frame)
    # Set Pose and Frame
    self.pose, self.frame = pose, frame
  end
  #-------------------------------------------------------------------------
  # * Name      : Set Pose
  #   Info      : Sets The Pose
  #   Author    : Trickster
  #   Call Info : One Argument, String/Integer Pose Pose Type/Pose Index
  #-------------------------------------------------------------------------
  def pose=(pose)
    # Turn pose into an integer if string sent
    pose = MACL::Poses.index(pose) if pose.is_a?(String)
    # Return if pose is nil or same pose
    return if pose == nil or pose == @pose
    # Set Y Coordinate of Source Rectangle
    src_rect.y = bitmap.height / MACL::Poses.size * pose
    # Set Height of Source Rectangle
    src_rect.height = bitmap.height / MACL::Poses.size
    # Set Pose
    @pose = pose
  end
  #-------------------------------------------------------------------------
  # * Name      : Set Frame
  #   Info      : Sets the Frame
  #   Author    : Trickster
  #   Call Info : One Argument, Integer Frame, Frame to set
  #-------------------------------------------------------------------------
  def frame=(frame)
    # Return if frame is nil or same frame
    return if frame == nil or frame == @frame
    # Set X Coordinate of Source Rectangle
    src_rect.x = bitmap.width / MACL::Frames * frame
    # Set Height of Source Rectangle
    src_rect.width = bitmap.width / MACL::Frames
    # Set Frame
    @frame = frame
  end
  #-------------------------------------------------------------------------
  # * Name      : Frame Update
  #   Info      : Update Animation if enabled, Updates Graphic
  #   Author    : Trickster
  #   Call Info : No Arguments
  #-------------------------------------------------------------------------
  def update
    # Call Sprite Update
    super
    # Update Graphic
    update_graphic
    # Return if not animated
    return if not @animate or @speed == 0
    # Increase Counter
    @count += 1
    # Return if speed frames have not passed
    return if @count % @speed != 0
    # Set Frame Restrict to [0, frames)
    self.frame = (self.frame + 1) % MACL::Frames
  end
  #-------------------------------------------------------------------------
  # * Name      : Update Graphic (Private)
  #   Info      : Private Method, Updates Actor Graphic
  #   Author    : Trickster
  #   Call Info : No Arguements, can not be called outside this class
  #-------------------------------------------------------------------------
  private
  def update_graphic
    # Return if no changes made
    return if @name == @actor.character_name and @hue == @actor.character_hue
    # Update Name and Hue
    @name, @hue = @actor.character_name, @actor.character_hue
    # Set New Bitmap
    self.bitmap = RPG::Cache.character(@name, @hue)
  end
end
 
Hi, I'm having a minor problem with this script.

Everything works normal except one thing. I select a skill from the shop menu then it goes to the screen where you select the character to get the skill. If I cancel and go back to the screen where you select the skill, you can still see the character screen under it. Here's a screenshot.


This only happens once you go to the character select screen, then go back to the skill select screen. It doesnt happen when you first open the scene.

It has to be a slight conflict with another script of mine but I have no idea which it could be. I'm running the following scripts.

- SDK 2.2
- the latest MACL, plus I still have MACL 1.5 because the latest doesnt seem to be compatible with Minkoff's Animated Battlers.
- Minkoff's Animated Battlers
- Chrono Trigger CMS
- Dubeleaux's AMS

 
hey man i got a problem with ur script how do u subtract and add skills to the menu ive already learned to edit what u need to learn it figured it would be somewhere on that script

nm i figured it out simple i feel like a retard haha
 
right... I have one or two things...

  1. Forgetting old moves...
    I got an idea partially set up with the RTP skillz where the skills of the same element type can be 'improved' if you will. Instead of learning ## skills, you forget the weaker version of the spell. it will make for a more organized skill menu.

    Is there any way (eventing is an option, but it will be very long and annoying to write) I can do this? Do any scripts exist that can work in conjunction with the Skill_Shop?

  2. Skill pre-requisite...
    I know that there is that function in the script already, but I can't seem to get it to work...

    I know that it has somthing to do with lines 80 ~ 88 in setup
    Code:
    #--------------------------------------------------------------------------
      # * Skill Learn Requirement
      #   - Syntax {skill_id => [skill_ids]}
      #--------------------------------------------------------------------------
      Skill = {}
      #--------------------------------------------------------------------------
      # * Default Skill Learn
      #--------------------------------------------------------------------------
      Skill.default = []

    and something with this area in Window_
    Code:
     # Next If Cost or Requiremnt is zero or No Skills Required
          next if (((0..2) === index and var == 0) or (index == 3 and var == 1) or 
                    (index == 5 and var == [0]))
          # Increase Y
          rect.y += 32
          # Set to Normal Color
          self.contents.font.color = normal_color
          # Branch with index
          case index
          when 0..3
            # Branch with index
            case index
            when 0
              # Replace [gold] with gold
              text = line.sub(/\[gold\]/, var.to_s)
            when 1..2
              # Replace [exp] with exp
              text = line.sub(/\[exp\]/, var.to_s)
            when 3
              # Replace [level] with level
              text = line.sub(/\[level\]/, var.to_s)
            end
            # Draw Display Line
            self.contents.draw_text(rect, text)
            cx = contents.text_size(text).width
            # Update Txt Rect
            txt_rect.x, txt_rect.y = rect.x + cx + 4, rect.y
            # Branch with index again
            case index
            when 0
              # Draw Word for gold
              self.contents.font.color = system_color
              gold = $data_system.words.gold
              self.contents.draw_text(txt_rect, gold)
            when 1..2
              # Draw Exp
              self.contents.font.color = system_color
              self.contents.draw_text(txt_rect, Skill_Shop::Exp)
            end
          when 4
            # If Any class can learn draw that
            if var.includes?('all')
              # Draw Any Class Text
              self.contents.draw_text(rect, Skill_Shop::Any_Class_Text)
            else
              # Run Through Each Class id
              var.each do |class_id|
                # Get Class Name
                name = $data_classes[class_id].name
                # Subsititute [class] with class name
                self.contents.draw_text(rect, line.sub(/\[class\]/, name))
                # Increase Y
                rect.y += 32
              end
            end
          when 5
            # Run Through Each Skill id
            var.each do |skill_id|
              # Get Skill name
              name = $data_skills[skill_id].name
              # Subsititute [skill] with class name
              self.contents.draw_text(rect, line.sub(/\[skill\]/, name))
              # Increase Y
              rect.y += 32
            end
          end
        end
      end

    I tried to put stuff in there (its gone now) and it either didn't show up on the menu, or the menu pinged an error...
    I understand the syntax of the Setup part, but i think my problem is in the 'Default Skill Learn' area.... and the bottom and top most portions of the Winow_ block i posted...

    am i forgetting somthing else? This is my first time working with a script so if its dogone obvious i apologise... (I can also do some extensive eventing here but nobody wants that)

thanks for your time....
 

Irgna

Member

The demo link is dead. I would greatly appreciate it if the demo was reuploaded as this is one of the few scripts I still need for the game I am working on.
 
Status
Not open for further replies.

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top