Addon To Fomar's Secondary Classes Script

WNxTyr4el

Veteran
Veteran
Joined
Aug 10, 2013
Messages
322
Reaction score
15
First Language
English
Primarily Uses
Hey everyone. I'm looking for someone who can do a simple menu change once a secondary class has been selected. I just want the menu to display the actor's secondary class after a /. For example, Actor 1: Primary Class/Secondary Class. That's it really. I don't know how to do it myself and I didn't know about yanfly's script until today. Everything is already implemented in my game and I really don't want to change it lol.

Here's the script:

=begin

Secondary Classes

by Fomar0153

Version 1.0

----------------------

Notes

----------------------

This script allows you to give a character a second class they can learn

some or all of that classes skills and optionally inherit all of the

secondary classes traits and a percentage of it's paramaters.

----------------------

Instructions

----------------------

Setup the two variables in the module to your liking and any for any skill

that you wish to be primary only notetag the skill learning box (the one

with level, skill and notes) with <primary>

To change an actor's subclass call

$game_actors[x].change_sec_class(class_id)

To define a starting sub class notetag the actor like so:

<secclass x>

----------------------

Known bugs

----------------------

None

=end

module Fomar

# Have all the features/traits of the secondary class

SECONDARY_CLASSES_ADD_FEATURES = false

# Percentage of secondary class's params to be added

SECONDARY_CLASSES_PARAMS = 10

end

class Game_Actor < Game_Battler

attr_accessor :sec_class_id

alias sc_setup setup

def setup(actor_id)

@sec_class_id = 0

if $data_actors[actor_id].note =~ /<secclass (.*)>/i

@sec_class_id = $1.to_i

end

sc_setup(actor_id)

end

alias sc_init_skills init_skills

def init_skills

sc_init_skills

return if sec_class_id == 0

self.sec_class.learnings.each do |learning|

learn_skill(learning.skill_id) if learning.level <= @level and

not $data_skills[learning.skill_id].note.include?("<primary>")

end

end

def sec_class

$data_classes[@sec_class_id]

end

alias sc_feature_objects feature_objects

def feature_objects

return sc_feature_objects if @sec_class_id == 0

if Fomar::SECONDARY_CLASSES_ADD_FEATURES

return sc_feature_objects + [self.sec_class]

else

return sc_feature_objects

end

end

def change_sec_class(class_id)

@sec_class_id = class_id

refresh

end

alias sc_param_base param_base

def param_base(param_id)

if @sec_class_id == 0

return sc_param_base(param_id)

else

return sc_param_base(param_id) + ((Fomar::SECONDARY_CLASSES_PARAMS * self.sec_class.params[param_id, @level])/100)

end

end

end
 

Fomar0153

Arkz
Restaff
Joined
Mar 13, 2012
Messages
1,327
Reaction score
473
First Language
English
Primarily Uses
RMMZ
Assuming you force them to have a secondary class.

Code:
class Window_Base < Window  #--------------------------------------------------------------------------  # * Draw Class  #--------------------------------------------------------------------------  def draw_actor_class(actor, x, y, width = 112)    change_color(normal_color)    draw_text(x, y, width, line_height, actor.class.name + "/" + actor.sec_class.name)  endend
It'll probably be pretty squished though.
 

WNxTyr4el

Veteran
Veteran
Joined
Aug 10, 2013
Messages
322
Reaction score
15
First Language
English
Primarily Uses
Thanks Fomar!  Where in the script should it go though?  There are so many ends, I don't want to break anything.
 
Last edited by a moderator:

Fomar0153

Arkz
Restaff
Joined
Mar 13, 2012
Messages
1,327
Reaction score
473
First Language
English
Primarily Uses
RMMZ
In a new blank section.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,360
Reaction score
7,672
First Language
German
Primarily Uses
RMMV
Didn't work :(
Post a screenshot of your script editor where we can see where you put that script and which other scripts are added by you. Sometimes it's the order of scripts that determines compatibility.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,360
Reaction score
7,672
First Language
German
Primarily Uses
RMMV
Fomar said you should place the tiny script in a blank slot, instead you placed it inside the secondary classes slot.


Remove that from the secondary classes script, then right-click on the line "(insert here)", click insert, name that slot "secclass addon" and place the script lines there.
 

WNxTyr4el

Veteran
Veteran
Joined
Aug 10, 2013
Messages
322
Reaction score
15
First Language
English
Primarily Uses
Okay so here's the error I get when I haven't changed classes yet and I try to enter the menu

Script 'Draw Class' line 7:NoMethodError occurred.

undefined method 'name' for nil:NilClass

It does work if I can force a class change though
 
Last edited by a moderator:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,360
Reaction score
7,672
First Language
German
Primarily Uses
RMMV
Okay so here's the error I get when I haven't changed classes yet and I try to enter the menu


Script 'Draw Class' line 7:NoMethodError occurred.


undefined method 'name' for nil:NilClass


It does work if I can force a class change though
The small script accesses a value of the secondary class script, so it has to be below that other script.
That's why I told you to place the new slot at the bottom by inserting it on "insert here".


If you did that, then post your screenshots again (this time please with spoiler tags, so that they don use up so much screenspace if you don't need to see them again)
 

kerbonklin

Hiatus King
Veteran
Joined
Jan 6, 2013
Messages
1,726
Reaction score
275
First Language
English
Primarily Uses
RMMV
Sorry for quoting the big image but I noticed there is no end after the def change_sec_class function and before game Window_Base < Window.  Instead you have it after the def draw_actor_class function.  Move that end to where it should be.

That might be causing the error
 
Last edited by a moderator:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,360
Reaction score
7,672
First Language
German
Primarily Uses
RMMV
Sorry for quoting the big image but I noticed there is no end after the def change_sec_class function and before game Window_Base < Window.  Instead you have it after the def draw_actor_class function.  Move that end to where it should be.


That might be causing the error
Doing that would break the class definition for the next function as well - the entire structure (line 77 to 85) is supposed to go into its own slot and not into that script (and that was already corrected a few posts ago), the correct end for the previous class definition is i line 95, because the next function (param_base) is also supposed to be in the same class as the change_sec_class function. Following your advice would just create different errors.
 

WNxTyr4el

Veteran
Veteran
Joined
Aug 10, 2013
Messages
322
Reaction score
15
First Language
English
Primarily Uses
Okay, so I put it directly beneath the Secondary Classes script in the script editor and I still can't open the menu below level 15.  I'm getting the same error that I posted above.

And I also tried it as the last script in the script editor - meaning I put it under the More Choices script too.
 
Last edited by a moderator:

Fomar0153

Arkz
Restaff
Joined
Mar 13, 2012
Messages
1,327
Reaction score
473
First Language
English
Primarily Uses
RMMZ
Do you only gain a secondary class after level 15?

If so sorry, I assumed you would always have a secondary class.

Code:
class Window_Base < Window  #--------------------------------------------------------------------------  # * Draw Class  #--------------------------------------------------------------------------  def draw_actor_class(actor, x, y, width = 112)    change_color(normal_color)    if actor.sec_class_id > 0      draw_text(x, y, width, line_height, actor.class.name + "/" + actor.sec_class.name)    else      draw_text(x, y, width, line_height, actor.class.name)    end  endend
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,857
Messages
1,017,019
Members
137,564
Latest member
McFinnaPants
Top