Help With Fomar0153's Secondary Classes Script [VXACE]

WNxTyr4el

Veteran
Veteran
Joined
Aug 10, 2013
Messages
322
Reaction score
15
First Language
English
Primarily Uses
I'm new to the whole scripting thing.  I dabbled in C++ and VB when I was a wee teenager, but I've forgotten all of it.  I was looking at Fomar's Secondary Classes script because it interested me for a second game idea but I have no idea what have to do to get it to work.  Can anyone elaborate for me please? 

The instructions say to do this:

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>

But I don't understand what that means :( .  Help please!

=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
 
Last edited by a moderator:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,676
First Language
German
Primarily Uses
RMMV
I don't have the script available, so I can only answer generally - you might link the scripts if you want specific answers in the future.

In the database, most objects have a notefield for any form of data. This was originally intended for developer's own notes, but is mostly used as a way to get data into scripts without the need of programming knowledge. Whenever you read something about "Notetags", that means the script needs an entry into that box, formatted like the notetags description says.

In the example above, adding <secclass 5> into an actor's notefield would have that character start with a secondary class number 5.

If there is any form of command mentioned together with "script call", that means you have to use the "script"-command in an event to trigger that function.

I suggest you work with some of the tutorials and look how the unencrypted games handle those options. Follow the link in my signature to find some of the tutorials and samples.
 

WNxTyr4el

Veteran
Veteran
Joined
Aug 10, 2013
Messages
322
Reaction score
15
First Language
English
Primarily Uses
Sorry, I didn't realize I could post someone elses script.  Here it is though.  I also can't find the tutorials you were talking about.  I found the general ones but none that I thought would help me here.

=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
 
Last edited by a moderator:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,676
First Language
German
Primarily Uses
RMMV
Next, time, use not only the spoiler tags but also the code-tags as that will keep the formatting and make the script easier to read.

The two "variables" are the two lines beginning with "SECONDARY_CLASSES_", and you need to set those values to the way how you would add the second class to the actor.

The first variable defines whether the features from the second class should be added to the actor (true) or not (false)

The second variable defines the percentage how much of the parameters of the second class should be added to the actor, first class will always be added 100% - in this script's default 10% of the ATK, DEF, etc defined for the second class will be added.

What are your current remaining problems with the script? I already answered the most important parts in my answer #2 above.

We cannot tell you how to set those variables, because we don't know how you want the second class to behave in the game you're planning - the script is written in a way to allow for different game configurations, and you said nothing of your planning.
 

WNxTyr4el

Veteran
Veteran
Joined
Aug 10, 2013
Messages
322
Reaction score
15
First Language
English
Primarily Uses
Sorry I just wanted to know what I would have to fill in for the class or where it was even defined because I just can't read this type of stuff. I'm learning though.

By "how I would add the second class to the actor" do you mean by gaining a level, interacting with an item, or something like that?

And where do I actually fill in the class choices I could pick from? Or where to fill in even what class the actor changes to? Sorry I'm so newb at this I haven't found a good tutorial on scripting or learning the language of scripting so I have to ask for help

If I want them to gain a second class at a certain level. Or be able to pick a certain class at a certain level how would that look?
 
Last edited by a moderator:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,676
First Language
German
Primarily Uses
RMMV
Take a look at the database in the editor. Each object in each list is preceeded with a number - the default class list starts with "001:Soldier" and not with "Soldier".

The number is the so-called index, and while the editor usually can substitute the name in any list, as soon as you enter scripts that index has to be used.

That's why in the example above I posted the notetag <secclass 5> and not <secclass Samurai> - only the first variant with the number will work.

In the command description $game_actors[x].change_sec_class(class_id) there are two such indices - the X is the placeholder for the actor's ID (For example in default, the actor Natalie has the number 2) and the class_ID (which is the class number).

So using the script command to change the secondary class for 004:Ernest to 010:Sage, you'll need to execute the script command in an event with the following content:

$game_actors[4].change_sec_class(10);

As to when the class is to be changed, you have only to options: Either an actor has the class from the beginning (use the notetag) or he/she gets the class when an event executes the script command. There is no other option.

Now, event's can be executed at different times - and you can use that to set the class change at any point where you can execute an event. That may require a lot of eventing (for example, it isn't easy to check for a level-up by events, that requires a lot of variable handling).

If you want the player to choose between different classes, then you have to use a "show choice"-command in the event that will change the secondary class and use the script command with different numbers depending on the choice.

If you have problems with eventing (making complex event structures), then I suggest going back to tutorials and sample games to learn how to event something. The link in my signature can guide you to the most important tutorials, samples and tips.
 
Last edited by a moderator:

WNxTyr4el

Veteran
Veteran
Joined
Aug 10, 2013
Messages
322
Reaction score
15
First Language
English
Primarily Uses
I'm not really having any trouble with eventing.  I've gotten that down.  I'd really like it to be a level-up event but that may be more complicated than I can do.  I was thinking maybe a common event would work, but I'm not sure?  Thanks for the help though, that explains it a lot.

If anyone knows or has ideas on how I'd do this by a level-up event that'd be really helpful.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,676
First Language
German
Primarily Uses
RMMV
yes, a common event set on parallel (with several waitframes to prevent lag) can check if the actor's level has been changed - you just need to reserve one variable for each actor you have to store the previous level.

It's easier and doesn't require a parallel process common event if the class change is done only at trainers - simply have those training events check the actor level when triggered.

And there are probably half a dozen other ways to hide the triggering event at other places (checking when transferring to a specific map, checking after certain quests and so on)
 

WNxTyr4el

Veteran
Veteran
Joined
Aug 10, 2013
Messages
322
Reaction score
15
First Language
English
Primarily Uses
yes, a common event set on parallel (with several waitframes to prevent lag) can check if the actor's level has been changed - you just need to reserve one variable for each actor you have to store the previous level.

It's easier and doesn't require a parallel process common event if the class change is done only at trainers - simply have those training events check the actor level when triggered.

And there are probably half a dozen other ways to hide the triggering event at other places (checking when transferring to a specific map, checking after certain quests and so on)
Okay so I'd set up a common event for each actor that I am currently using and define a variable for their level and have the game check it each time?  And once that variable reaches a certain level, prompt the script right?

Oh, and where would I put the common event?
 
Last edited by a moderator:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,676
First Language
German
Primarily Uses
RMMV
Okay so I'd set up a common event for each actor that I am currently using and define a variable for their level and have the game check it each time?  And once that variable reaches a certain level, prompt the script right?

Oh, and where would I put the common event?
A single common event handling every actor is enough - you need one variable per actor, but not an event for each actor.

But I don't understand your last question, common events are always in the database, never on map (that's why they're called common)
 

WNxTyr4el

Veteran
Veteran
Joined
Aug 10, 2013
Messages
322
Reaction score
15
First Language
English
Primarily Uses
Oh so they're like "Global" events? Always running? That's pretty cool! Thanks! I think I can figure it out then. I'll reply back if I need help.

Would the script be put into the common event and since its a common event, it's always running?  So each time my character levels up, the common event will be running and check each actor's level and if it's the specified level it will prompt to add the class?
 
Last edited by a moderator:

WNxTyr4el

Veteran
Veteran
Joined
Aug 10, 2013
Messages
322
Reaction score
15
First Language
English
Primarily Uses
I'm having trouble figuring out how to make the common event.  I have one common event with 3 conditional branches (one for each actor) using the Variable switch "ActorLevel" = 15.  But where do I define "ActorLevel" as...that actor's level.  Basically how do I set up the level-check?
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,676
First Language
German
Primarily Uses
RMMV
WNxTyr4el, please avoid double posting, as it is against the forum rules. You can review our forum rules here. Thank you.


You need two commands


1) control variable : game data : actor : actor ID : Level


2) conditional branch : variable = 15


You can use a temporary variable for everything or you can assign a variable to hold that current level for each actor if you want to check the levels in other scripts as well.
 

WNxTyr4el

Veteran
Veteran
Joined
Aug 10, 2013
Messages
322
Reaction score
15
First Language
English
Primarily Uses
WNxTyr4el, please avoid double posting, as it is against the forum rules. You can review our forum rules here. Thank you.

You need two commands

1) control variable : game data : actor : actor ID : Level

2) conditional branch : variable = 15

You can use a temporary variable for everything or you can assign a variable to hold that current level for each actor if you want to check the levels in other scripts as well.
Sorry about that.  I thought after a certain amount of time, a bump was acceptable.  I understand #2, that's what I have.  But I don't understand #1.  Could you explain more?
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,676
First Language
German
Primarily Uses
RMMV
Sorry about that.  I thought after a certain amount of time, a bump was acceptable.  I understand #2, that's what I have.  But I don't understand #1.  Could you explain more?
It is how I write a sequence of clicks to get to a special function.

Or in other words:

click in the event area, select control variable command. in that command, select game data. at the left end of the line with game data, the dots will open the next selection window. there you select actor - and so on.

Bumping is considered allowed after 72 hours - this community is very active, but everyone usually works on his/her own game or ideas, and the problems might be more complex and require some thinking.
 

WNxTyr4el

Veteran
Veteran
Joined
Aug 10, 2013
Messages
322
Reaction score
15
First Language
English
Primarily Uses
So like this?  I just haven't put in the script yet.

 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,676
First Language
German
Primarily Uses
RMMV
So like this?  I just haven't put in the script yet.
no, you need to set the variable to the level before you can check it's value.

As I numbered it above: 1) the control variable, then 2) conditional branche depending on the result of the variable

If you set it to parallel process, then include a wait(60) at the end - without wait, it would test sixty times per second what those values are and create a lot of lag...
 

WNxTyr4el

Veteran
Veteran
Joined
Aug 10, 2013
Messages
322
Reaction score
15
First Language
English
Primarily Uses
Thanks a lot!  I think I got it!

I'm just trying to figure out how the script itself works.  Does it give you access to all the second classes skills?  And how should I approach the trait inheritances if I want to do that?  I don't have any parameters for any of my classes because I'm afraid they'll throw the game out of balance.  A classes parameter is basically just an added % onto their existing stats, right?

Also, what does it mean by

"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>"
 
Last edited by a moderator:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,676
First Language
German
Primarily Uses
RMMV
A classes parameter is basically just an added % onto their existing stats, right?
Wrong.

Go to the database to the actor tab - that is what an actor basically has - which means that he has no stats.

It's the class that creates the stats, and if you set the parameters on the classes to zero (as indicated by "I don't have any parameters for any of my classes"), then the actor will have zero parameters.

It might be just the wording - features are what can give the parameters a % bonus, and the classes are one of many places where an actor can gain features. But the base parameters themselves are defined ONLY in the class, nowhere else.

Basically adding a second classe can add base parameters, features and skills to the actor. The variables and notetags allow you to define what exactly will be added and what will not be added.

That is for you to decide and to configure, and that is what the skill description is for.

With the default value of 10, that means that 10% of the secondary class parameter curves will be added to the parameter curves of the primary class - you can set that to 0 if you don't want parameters added to your primary class.

The second option is wether features of the second class should be added to the first class or not - should the actor be able to use the equipment, skills, bonus of the second class or not?

And the last option is to be used for skills in a different way.

Take the following example:

You have a healer class, and that class has the skill "revive" - but you want that skill only be available if the primary class is healer. An actor that learned healer as a secondary class only should not be able to revive others. To make that happen, you place the tag <primary> into the notefield of the revive skill - it will not be learned by an actor that has healer as secondary class, only by those who have healer as primary class.
 

WNxTyr4el

Veteran
Veteran
Joined
Aug 10, 2013
Messages
322
Reaction score
15
First Language
English
Primarily Uses
Wow that helps a lot. So basically if I don't add any <primary> tags in any note boxes, all skills of the secondary class will be learned?

And if the option is set to false, no skills of the secondary class will be learned? Is that what I get from what you said? Or will skills be learned no matter what?
 
Last edited by a moderator:

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

Latest Threads

Latest Profile Posts

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
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

Forum statistics

Threads
105,868
Messages
1,017,072
Members
137,578
Latest member
JamesLightning
Top