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.

Skills that add to attributes

A few of the skills in my game aren't going to be useable, instead the act of learning them will increase the character's attributes (such as strength) permanently.

I've tried to accomplish this effect via common events, but have been unsuccessful. So I assume this is something that will have to be scripted.

How would I go about doing this?
 
This might not be the best way, but make a skill, I'll call it StrUp. Set a common event that ups the param by whatever (Pg 3, change parameters). Now the problem is that the player can use this how ever many times they want. To fix this either add a common event that removes the skill (Pg 3, Change skills). I don't know how you are doing skill learning, but you can force the player to use the skill when he gets it then remove the skill right away.
 
Thing is, I don't want the skill to be useable at all, but I do want it to appear in the skill menu (so that the player can see what it does and that they know it all ready). And as far as I know, the force action event command only works in battle.

Thanks for trying though.
 
If you set it to Never, I don't think the skill ever fires the commont event attached to it...

I made a solution script for it, but to add more skills you have to script more manually, so I'll think better way so you won't have to script (just edit something).

So far, here is my idea:
- Check the skill ID when it's learned. If it's what you want, increase the specific stats.

Here it is. Let's say we want skill #1 (on the database, default is Heal) to increase actor's Strength by 5.

1. On Game Database, just set skill #1 Occassion to Never. Leave anything as it is and press OK.
2. Go to Script Editor. On Game_Actor class, learn_skill() method, modify to:
Code:
  def learn_skill(skill_id)
    if skill_id > 0 and not skill_learn?(skill_id)
      @skills.push(skill_id)
      @skills.sort!
      case skill_id
      when 1
        @str_plus = 5
      end
    end
  end

I think your request is a good idea, so I might continue scripting on this (so I can use it too in my game).
 
OK, made it, although might not the best script. You won't need to script by your own (as opposed to my script before, you must add when and @something_plus += some_value for each skills). You just need to define which skills are passive (don't forget to set the Occassion to Never) and what attributes will be raised up (or even raised down!).

This is how to install:
1. Just make a new page above Main (press Insert when you highlight Main, you will have a blank new page). Name it something, like EDIT Game_Actor.
2. Copy this code and paste it to your new page:
Code:
#include all passive skills ID here
#separate each input by a comma
PASSIVE_SKILL = [1, 4, 7]
#set which attribute would increase
#separate each input by comma (and new line for easy reading)
#follow the format:
#skill_id => [HP+, SP+, STR+, DEX+, AGI+, INT+]
#as the example:
ATTRIBUTE = 
{
1 => [5, 0, 0, 0, 0, 0] ,
4 => [0, 5, 0, 0, 0, 0] ,
7 => [0, 0, 5, 5, 5, 5]
}

class Game_Actor < Game_Battler
  alias my_learn_skill learn_skill
  def learn_skill(skill_id)
    my_learn_skill(skill_id)
    if PASSIVE_SKILL.include?(skill_id)
      #p ATTRIBUTE[skill_id]
      @maxhp_plus += ATTRIBUTE[skill_id][0]
      @maxsp_plus += ATTRIBUTE[skill_id][1]
      @str_plus += ATTRIBUTE[skill_id][2]
      @dex_plus += ATTRIBUTE[skill_id][3]
      @agi_plus += ATTRIBUTE[skill_id][4]
      @int_plus += ATTRIBUTE[skill_id][5]
    end
  end
end
Instruction given within the script in case you are not online and check this page.

Now, how to set up "passive skill" (I'd refer to skills that are unusable and raises attributes as "passive skill" from now on)...

1. Look up part of the script which reads
Code:
PASSIVE_SKILLS = [1, 4, 7]
It should be at the third line. For an example, I've added 3 passive skills (which are really silly to be passive, but this is just only an example) which IDs are 1, 4, 7. You can always know the skill ID from the database: just look at the skill number and you get skill ID(WITHOUT leading zeroes). To add new passive skill, just add its ID within PASSIVE_SKILLS array. Remember to separate each entry by a comma.

2. To set up which attributes the passive skill will increase, find the 9th line which reads:
Code:
ATTRIBUTE = 
{
1 => [5, 0, 0, 0, 0, 0] ,
4 => [0, 5, 0, 0, 0, 0] ,
7 => [0, 0, 5, 5, 5, 5]
}
The format I used is:
Code:
Skill_ID => [HP+, SP+, STR+, DEX+, AGI+, INT+]
so follow that format. I think the format is self explanatory.
For example, if you want skill #2 gives you additional 5 STR, set it like this:
Code:
ATTRIBUTE = 
{
2 => [0, 0, 5, 0, 0, 0]
}
As before, remember to separate each entry with a comma.
Don't forget that you can use negative values for any attributes you want to decrease. For example, a
Code:
5 => [0, 0, 5, 0, 0, -10]
would simply mean that skill #5 will increade 5 STR and decrease 10 INT.

That's it! From now on, all passive skills learnt by any actors will have attribute effects like you want.

I hope you find it useful. Should there be any questions, errors, or improvements, let me know.
 

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