[XP] Skill Equipment System

Started by G_G, September 24, 2009, 11:20:10 pm

Previous topic - Next topic

G_G


Daclopeda

"What goes around, comes around."

Daclopeda

Hmm, I added it to the menu. But it only opens the first characters Skill Equip scene... I used:
   when 5 #Skillequip
           # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to Skill Equip
        $scene = Scene_SkillEquip.new


And it opens the character with the first ID's skillequip.

if I use this:

   when 5 #Skillequip
           # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to Skill Equip
        $scene = Scene_SkillEquip.new(@status_window.index)

I get an error.

I want to be able to choose the character as in Status, Equip and so on. Is that possible with this script?

Thank you^^
"What goes around, comes around."

G_G

Are you using the default menu?

Daclopeda

"What goes around, comes around."

G_G

See if this works.
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
#  This class performs menu screen processing.
#==============================================================================

class Scene_Menu
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     menu_index : command cursor's initial position
  #--------------------------------------------------------------------------
  def initialize(menu_index = 0)
    @menu_index = menu_index
  end
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # Make command window
    s1 = $data_system.words.item
    s2 = $data_system.words.skill
    s3 = $data_system.words.equip
    s4 = "Status"
    s5 = "Skill Equip"
    s6 = "Save"
    s7 = "End Game"
    @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7])
    @command_window.index = @menu_index
    # If number of party members is 0
    if $game_party.actors.size == 0
      # Disable items, skills, equipment, and status
      @command_window.disable_item(0)
      @command_window.disable_item(1)
      @command_window.disable_item(2)
      @command_window.disable_item(3)
    end
    # If save is forbidden
    if $game_system.save_disabled
      # Disable save
      @command_window.disable_item(4)
    end
    # Make play time window
    @playtime_window = Window_PlayTime.new
    @playtime_window.x = 0
    @playtime_window.y = 224
    # Make steps window
    @steps_window = Window_Steps.new
    @steps_window.x = 0
    @steps_window.y = 320
    # Make gold window
    @gold_window = Window_Gold.new
    @gold_window.x = 0
    @gold_window.y = 416
    # Make status window
    @status_window = Window_MenuStatus.new
    @status_window.x = 160
    @status_window.y = 0
    # Execute transition
    Graphics.transition
    # Main loop
    loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      # Frame update
      update
      # Abort loop if screen is changed
      if $scene != self
        break
      end
    end
    # Prepare for transition
    Graphics.freeze
    # Dispose of windows
    @command_window.dispose
    @playtime_window.dispose
    @steps_window.dispose
    @gold_window.dispose
    @status_window.dispose
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Update windows
    @command_window.update
    @playtime_window.update
    @steps_window.update
    @gold_window.update
    @status_window.update
    # If command window is active: call update_command
    if @command_window.active
      update_command
      return
    end
    # If status window is active: call update_status
    if @status_window.active
      update_status
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when command window is active)
  #--------------------------------------------------------------------------
  def update_command
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Switch to map screen
      $scene = Scene_Map.new
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # If command other than save or end game, and party members = 0
      if $game_party.actors.size == 0 and @command_window.index < 4
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # Branch by command window cursor position
      case @command_window.index
      when 0  # item
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to item screen
        $scene = Scene_Item.new
      when 1  # skill
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Make status window active
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 2  # equipment
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Make status window active
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 3, 4  # status
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Make status window active
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 5  # save
        # If saving is forbidden
        if $game_system.save_disabled
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to save screen
        $scene = Scene_Save.new
      when 6  # end game
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to end game screen
        $scene = Scene_End.new
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when status window is active)
  #--------------------------------------------------------------------------
  def update_status
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Make command window active
      @command_window.active = true
      @status_window.active = false
      @status_window.index = -1
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Branch by command window cursor position
      case @command_window.index
      when 1  # skill
        # If this actor's action limit is 2 or more
        if $game_party.actors[@status_window.index].restriction >= 2
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to skill screen
        $scene = Scene_Skill.new(@status_window.index)
      when 2  # equipment
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to equipment screen
        $scene = Scene_Equip.new(@status_window.index)
      when 3  # status
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to status screen
        $scene = Scene_Status.new(@status_window.index)
      when 3
        $game_system.se_play($data_system.decision_se)
        actor_id = $game_party.actors[@status_window.index].id
        $scene = Scene_SkillEquip.new(actor_id)
      end
      return
    end
  end
end

Daclopeda

 :D Ah, it worked!
Thank you very much;)
"What goes around, comes around."

kmart002

Hey, I have no technical problems with the script, but for some reason, when I equip the skill I want in the menu, it doesn't stay equipped. Like right after I equip it and go to the skills menu, it's visible, but the second I move, and I look back into my skills menu, it's gone. Any ideas? Or am I just a noob haha

zottel89

September 14, 2012, 10:48:47 am #68 Last Edit: September 14, 2012, 11:10:17 am by zottel89
Hey guys :)

This script is REALLY awesome and a great idea, it's all working fine for me (I'm using it as an additional choice
in the custom menu) except for one little thing:



The SP (or 'AP', I changed the name) on the right side are not being shown properly !!
The text needs to be a little more on the left ... I'm sorry but I'm a total noob regarding RubyScript :(

What line are the right 'coordinates' for this in ?  I can't find it.


Another thing is:

I did configure the skill 'Querschnitt' to need 5 FP to be used, but it still shows '100' behind it (which is the mana cost).
Why is that ?

KK20

QuoteThe SP (or 'AP', I changed the name) on the right side are not being shown properly !!
Locate this:
self.contents.draw_text(0, 0, 640, 32, "#{ap} #{@actor.skillap} / " +
                                           "#{@actor.skillmaxap}", 2)
Change the '640' to a smaller value.

QuoteI did configure the skill 'Querschnitt' to need 5 FP to be used, but it still shows '100' behind it (which is the mana cost).
This is intended--that is what the script does. You can even see in the screen shot example that the SP/MP cost is shown, not the AP cost. If you want it to show the AP cost instead, locate this:
self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
and replace it all with this:
self.contents.draw_text(x + 232, y, 48, 32, GameGuy.skill_ap(skill.id).to_s, 2)

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!

zottel89

Thank you so much, it both worked great :)

zottel89

September 17, 2012, 12:22:42 pm #71 Last Edit: September 17, 2012, 12:26:21 pm by zottel89
Sorry for the double-post, but there is a very strange bug that keeps appearing...

Whenever my character leans a new spell due to a level-up, the spell is listed twice (!) in the
'Skill equipment" window...

but (!) if a spell is learned through an event command, it's not listed twice...

What the hell is going on? :D



And another little thing (which isn't that important) is:

If the Skill Equipment script is active, newly learned spells are not shown at the end of a fight (if you lvlup)
anymore (for example:   Alex learned Ice !).

I'm using the standard combat system btw (if this helps) !

KK20

I can't seem to reproduce your first error. My actor learned the skill once. Go back and check to make sure you didn't configure something incorrectly.

As for the second, that feature is not even in the default RMXP. Go ahead and make a new game and do a test battle--it won't say "Actor X learned Y" upon level up. You must have used another script.

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!

zottel89

September 17, 2012, 04:32:53 pm #73 Last Edit: September 17, 2012, 04:51:59 pm by zottel89
Oh yeah, stupid me...
I did actually use the EasyLvLUpNotifier by Blizzard !!

Just have to figure out how I can still make it show the newly learned spells now...^^



Well, did you really try it out by fighting enemies and lvling up after the fight ?!

Because this error happens to me everytime :(

If you just [add EXP] to your character until he lvls up, then it does not add the spell twice.

I also tried to add the spell to the configuration (i.e. giving it an individual SP cost) but it still
adds the spell twice ...

Could it be because there is NO new spell being learned at LvL 2 ?!
You just get a new spell at LvL 3, so maybe it adds it twice because there 'should' have been a new spell at lvl 2 also ?!
I donno :D

KK20

September 17, 2012, 10:45:32 pm #74 Last Edit: September 17, 2012, 10:52:19 pm by KK20
Yep. I'll tell you everything I did.

New Project. Change EXP growth rate for Aluxes to the lowest values (requires 10exp for level 2). Fighter class learns Feint Attack at level 2. Ghosts give 5exp each. Make new event that starts a battle with 2 Ghosts. Also make new event that allows me to view the Scene_SkillEquip. Test run game.
Level 2 after killing. Check the SkillEquip scene. Only Cross Cut and Feint Attack are in the list.

Make a new game and use only this script. If you are getting errors still, then I haven't the slightest clue.

EDIT: Upon further playing around, I found that you can actually make a class learn the same skill twice. Check your actor's class and make sure you didn't put two of the same skill listed. When I did this, I got two listings of the skill in my scene.

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!

zottel89

September 18, 2012, 05:58:36 am #75 Last Edit: September 18, 2012, 06:35:52 am by zottel89
Quote from: KK20 on September 17, 2012, 10:45:32 pm
EDIT: Upon further playing around, I found that you can actually make a class learn the same skill twice. Check your actor's class and make sure you didn't put two of the same skill listed. When I did this, I got two listings of the skill in my scene.


I thought that you might ask that, but nope...  the class learns the skill only once
due to the class window.

Quote from: KK20 on September 17, 2012, 10:45:32 pm
Yep. I'll tell you everything I did.

New Project. Change EXP growth rate for Aluxes to the lowest values (requires 10exp for level 2). Fighter class learns Feint Attack at level 2. Ghosts give 5exp each. Make new event that starts a battle with 2 Ghosts. Also make new event that allows me to view the Scene_SkillEquip. Test run game.
Level 2 after killing. Check the SkillEquip scene. Only Cross Cut and Feint Attack are in the list.

Make a new game and use only this script. If you are getting errors still, then I haven't the slightest clue.


Hmm, I'll try and edit this later on.

But try having no skill being learned at LvL 2, but one at LvL 3.

Edit:

Ok now I'm getting really frustrated :(
If I copy the EXACT 2 scripts (Scene_Menu and SkillEquipping) from my main game to a new test-project
....  it all works fine  :<_<:

Now I'll have to figure out what causes this bug in my main game.... *sigh*
This is gonna be hard I guess.

KK20

It sounds like the methods def learn_skill and/or def exp= are being overwritten by another script located below this script in your game. My suggestion is to SHIFT + CTRL + F for those two methods and see if they appear anywhere else in your scripts. The only ones we want to care about, though, come after this script.

After doing that, try placing this script as far down the list as you can go, but still being above Main.

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!

zottel89

The SkillEquipment script has already been the one right above main (by coincidence, I guess).

So these are the results of the search you recommended:


FOR DEF LEARN_SKILL ->


1. In the script "Game_Actor" :

 #--------------------------------------------------------------------------
  # * Learn Skill
  #     skill_id : skill ID
  #--------------------------------------------------------------------------
  def learn_skill(skill_id)
    if skill_id > 0 and not skill_learn?(skill_id)
      @skills.push(skill_id)
      @skills.sort!
    end
  end



2. In the script "SkillEquipping" :

  def learn_skill(skill_id)
    if skill_id > 0 and not skill_learn?(skill_id)
      @eskills.push(skill_id)
      @eskills.sort!
    end
  end




FOR DEF EXP=    ->

1. In the script "Game_Actor" :

#--------------------------------------------------------------------------
  # * 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)
        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



2. In the script "SkillEquipping" :

  def exp=(exp)
    @exp = [[exp, 9999999].min, 0].max
    while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
      @level += 1
      @skillap += GameGuy.ap_gain(@id)
      @skillmaxap += GameGuy.ap_gain(@id)
      for j in $data_classes[@class_id].learnings
        if j.level == @level
          learn_skill(j.skill_id)
        end
      end
    end
    while @exp < @exp_list[@level]
      @level -= 1
    end
    @hp = [@hp, self.maxhp].min
    @sp = [@sp, self.maxsp].min
  end
  def clear_skills
    @skills = []
    @eeskills = []
    @ap = @maxap
  end
end






I don't know, seems all pretty normal to me...
I'm really confused about what is causing this  :facepalm:

KK20

Well, two things you can do at this point:
1.) If you have any other custom scripts in your game, try removing all of them. Test play your game and see if the error still persists. If it does, then something in your database is out of place. If the error goes away, which I don't think is possible since you claim there are no other scripts that use those two methods, one of your scripts is making a compatibility problem.
2.) Make a new project.

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!

zottel89

Well number 2 is definitely not an option since I've been working on this game for almost a year now
(and I've been working with RM2000 and 2003 since ... I think '03)  :haha:

But yeah, oh well...   I guess I'm gonna try out experimenting with removing several scripts and stuff like that,
thanks :)

If it comes down to nothing, I'm just gonna make a game without a skill equipment system ^^