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.

Calling certain variables for skills (Like Runescape skills)

Hi everyone.

Thanks for the consideration of even reading this request.  If there is already a script that does this, a link would be well appreciated.

What I'm looking for is a skill system based on variables... such as:  When your character uses a fire or ice spell, they get 1 skill point toward their destruction skill which is at the moment being held as a variable, which is perfectly fine.  I'd also like to eventually use variables for things such as blacksmithing, alchemy, melee, ranged, searching, and sneak skills.  However; I'd love a menu screen that can be activated from either the main esc menu, or by a button press, whichever is easier, that shows a list of my selected variables and their value. 

If that doesn't make any sense, please reply or PM me and I'll give more info.  Or if you have any other and/or better ideas, please PM me. I'm 100% open for input!  Thanks again.
 
Code:
class Scene_Skills2
  def main
    @window = Window_Skills2.new
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      break if $scene != self
    end
    Graphics.freeze
    @window.dispose
  end
  def update
    @window.update
    if Input.trigger?(Input::B)
      $scene = Scene_Menu.new
      $game_system.se_play($data_system.buzzer_se)
    end
  end
end
class Window_Skills2 < Window_Base
  def initialize
    super(0,0,640,480)
    self.contents = Bitmap.new(width-32,height-32)
    refresh
  end
  def refresh
    lvl = $game_variables[0]
    self.contents.draw_text(0, 0, 200, 32, "Fishing: Level #{lvl}"
    lvl = $game_variables[1]
    self.contents.draw_text(0, 32, 200, 32, "Mining: Level #{lvl}"
  end
end

Then you'll want to call this from the menu. To do that you'll wanna edit the menu script like so:

Code:
    s1 = $data_system.words.item
    s2 = $data_system.words.skill
    s3 = $data_system.words.equip
    s4 = "Status"
    s5 = "Skills"
    s6 = "Save"
    s7 = "End Game"
    @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7])

Change "when 4" to "when 5"
Change "when 5" to "when 6"

Add this code in:

Code:
    when 4
      $game_system.se_play($data_system.decision_se)
      $scene = Scene_Skills2.new





Instructions:

These are your skills:

Code:
    lvl = $game_variables[0]
    self.contents.draw_text(0, 0, 200, 32, "Fishing: Level #{lvl}"
    lvl = $game_variables[1]
    self.contents.draw_text(0, 32, 200, 32, "Mining: Level #{lvl}"

To change the variables, change the 0 and 1 in $game_variables[ x ].

To change the text just er... change the text, but leave in the #{lvl} (This shows your level variable).

To add a new skill:

Code:
lvl = $game_variables[y]
    self.contents.draw_text(0, 0, 200, 32, "SKILLNAME: Level #{lvl}"

y = the number of the game variable you are using
SKILLNAME = the name of the skill
You'll wanna add 32 to the second number as well. So like 0, 32, 64, 96, 128, 160, 192, 224, 256, etc.



I typed this up from memory in the quickchat box, so sorry if this doesn't work. Oh and sorry if this isn't what you meant either. No credit needed or anything.
 
Alright. Progress.

Looks like this would work perfect but I keep getting a syntax error.  Line 31.  I thought it had something to do with using an empty variable, but they're all set to zero... I think.  I'm not sure how to let the program know it's 0 without using a parallel event.  But I'd assume that every variable is 0 until it's given another value.

Code:
 lvl = $game_variables[2]
    self.contents.draw_text(0, 0, 200, 32, "Climbing skill: #{lvl}"
    lvl = $game_variables[3]
    self.contents.draw_text(0, 32, 200, 32, "Interrogation skill: #{lvl}"
  end

There's the code. Line 31 is:

Code:
lvl = $game_variables[3]

If anyone knows why I'm getting the error, I'd be glad to know. This code would really help my game along. : )  Thanks again, Wyatt.
 

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