Adjusting Levels via script calls, for party members instead of individual actors...

Reapergurl

Drummer Extraordinaire! xD
Veteran
Joined
Dec 15, 2016
Messages
534
Reaction score
552
First Language
British English
Primarily Uses
Other
Okay, there is a great list of script calls by @Archeia , in which I found the Adjusting Levels, but for individual actors, not by party member roster.

Like, if Actor 1 isn't in my party, why would I want to adjust that actor's level to suit a level cap?

I was able to get the Party Member's Level for Variable Insertion, but I'm pretty sure the same

Code:
$game_party.members[0].level
isn't going to work. I'd try to flesh this out myself but...I've really forgotten how this works.

Also, I'm not trying to change the level of every party member all at once, especially if it's not necessary.

Thanks in advance for a quick reply!

~Amelia ♥
 

Jonforum

Veteran
Veteran
Joined
Mar 28, 2016
Messages
1,623
Reaction score
1,439
First Language
French
Primarily Uses
RMMV
$gameActors.actor(1)._level = 4
$gameActors.actor(1)._level = 12
$gameActors.actor(1)._level = 1

you can see all possibility by insert
$gameActors.actor(1);
in the console log (F8)
 

Reapergurl

Drummer Extraordinaire! xD
Veteran
Joined
Dec 15, 2016
Messages
534
Reaction score
552
First Language
British English
Primarily Uses
Other
@Jonforum Thanks for the fast reply.

So, gameActors would correspond to individual party members?

Like...

$gameActors.actor(1) would be Party Leader,
$gameActors.actor(2) would be Party Member 2,

and so on?

Edit:

The following is what I had thought.

Code:
$game_party.members[0].change_level(10, false)

$game_party.members[1].change_level(10, false)

$game_party.members[2].change_level(10, false)

#...and so on...
 
Last edited:

Jonforum

Veteran
Veteran
Joined
Mar 28, 2016
Messages
1,623
Reaction score
1,439
First Language
French
Primarily Uses
RMMV
yes but sorry i just see your are not in the Rmmv engine but you are RGSS.
is my mistake but is maybe very similar ..
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
Well, party members are actors, but if for some reason you need to do it for party members and cannot know which actors they are directly, you can always use $game_party.members[position] to get the actor in that position, then use any actor related command on that.. coz in the end, they are still actors.

For adjusting level, you can actually do this I think:

$game_party.members[position].level += value

or just use this, repeat depending on how many level ups you need

$game_party.members[position].level_up

I would actually suggest using the level_up command because in case you have scripts that run on level up, then using that one will trigger them too. It also processes skill learning which will not trigger if you modified the .level directly
 

Reapergurl

Drummer Extraordinaire! xD
Veteran
Joined
Dec 15, 2016
Messages
534
Reaction score
552
First Language
British English
Primarily Uses
Other
@Engr. Adiktuzmiko Actually...

The idea is to not increase the level. But I'm glad I have the $game_party.members[0] part correct.

Yes, a level cap means adjusting the level down, not up.

But to a set value, such as 10, 23, 55, 84, the set values I have for my level caps, and that is if the Party Level is !=Level Cap Number.

It's like this.

I have states set up that will set EXR to 0%, as well as force the level cap to that level, thanks to @Tsukihime . However, any party members already above the cap will need to have their levels adjusted.

The adjusting will not affect those under the level cap.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
$game_party.members[0] is the same as $game_party.leader - the leader is party member 0.
$game_party.members[1] is the first follower.

Why are you trying to do it in a script call? The Change Level - Entire Party will change the level of all your current party members - if Actor 1 is not in the party, their level will not change.

edit: never mind - you posted while I was posting, and explained it :)
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
then use .level_down

If you don't know exactly how much to level down, do this

actor = $game_party.members[position]
amount = actor.level - YOUR_LEVEL_CAP
(a..amount).each {|x| actor.level_down} unless amount < 1

I have states set up that will set EXR to 0%, as well as force the level cap to that level, thanks to @Tsukihime . However, any party members already above the cap will need to have their levels adjusted.
Just curious, but why would any of the party members be higher than the level cap at any point in time? You have full control over the level at which the player encounters those members, so why not just set their starting level to the cap at that point in time? Surely you know when exactly they will meet so you should also know what is the cap at that point, unless you don't have a definite time and location where they will meet.
 
Last edited:

Reapergurl

Drummer Extraordinaire! xD
Veteran
Joined
Dec 15, 2016
Messages
534
Reaction score
552
First Language
British English
Primarily Uses
Other
@Shaz @Engr. Adiktuzmiko This may be of some help.
I think I may see the problem. Should it be
Code:
actor = $game_party.members[0].change_level(10, false)
?

Edit:
Why do I have it set up in this fashion?

Yes, there is a good chance that characters may come into play with their levels already higher than the cap. Also, it is possible that not every character will become playable.

One other thing. The Level Cap does not apply to members that leave the party, it is removed. Part of the reason for this is because they may not return, for an indefinite period of time, or ever.

I also implement this for the anti-mega grind. Yes, go right ahead, get stronger, but you're not going to take down a Lv. 15 hard boss with level 50 characters to make it a cake walk.
 

Attachments

Last edited:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
I think problem is that some of your one lines, doesn't fit in one line of the script call box... I don't think the game processes it correctly when it happens

You could just put this in a script slot, make sure it's a script slot in the script editor and not the script box of an event or common event.

Code:
module REAPER
  def self.adjust_level(level_cap)
    $game_party.members.each do |actor|
      actor.change_level(level_cap,false) if actor.level > level_cap
    end
  end
end
then on your event, just use

REAPER.adjust_level(put_your_current_level_cap_here)

this will iterate thru all party members and check if their level is above the cap or not, and adjust accordingly.
 
Last edited:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
I think I may see the problem. Should it be
Code:
actor = $game_party.members[0].change_level(10, false)
?

no



You have and !already_dead on its own line in the script. Put it on the line above. The and needs to go at the end of the line if you're going to add a manual line break, so it knows there's more to come.

Does adding state 52 change the actor from not being dead to being dead? If it doesn't, you're not achieving anything with those few lines.

What exactly is "the problem"? What's not happening that you expect to be happening?

Why do you have a condition that does one thing if the party level is > 10, and then another block that does exactly the same thing if the party level is < 10? What if the party level IS 10, but the actor levels are not? I think, if you're having problems with things not working, your conditional branches would be a good place to start looking. Add a Show Text command prior to each script call to make it clear what's being run. That will help you find where the problem is.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
Then ur also trying to do actor = actor_object.change_level which will not result to actor being an actor since change_level doesn't return an actor...

And doing this on a parallel common event is a bit overkill, no need for it. Just do the check when a party member is added since that is when you want to limit it anyway.

That way you can also save on switches because instead of having a switch per cap, you just need one variable where you set the level cap.

Have you tried the method I posted and see if that worked or not?
 
Last edited:

Reapergurl

Drummer Extraordinaire! xD
Veteran
Joined
Dec 15, 2016
Messages
534
Reaction score
552
First Language
British English
Primarily Uses
Other
@Shaz I'm trying to add the Level Cap State directly to the party member in that position.

I'm reading @Archeia 's archived Script calls and trying to figure that mess out.

Apparently, copying word for word into the script box isn't helping me any, lol

If the Party Level is 10, that is because the added levels of all party members, divided by the number of party members equals 10.

I have a constantly running Parallel Process (Common Event) that collects all relevant game data and stores it in variables; I have it gather the levels for all five Party Members, adding them together, and then dividing the variable by the number of Party Members, which is also already stored. So, if the Party Level is 10, then all Party Members are at Level 10. If it is not, then it checks to see if any Party Members are above 10, and if so, adjusts their level to the Level Cap, without showing the level change in a textbox on screen.

@Engr. Adiktuzmiko Will it adjust the level to the Level Cap, or by the Level Cap?

Either way, I guess one thing I can do is go back to variables and lots more conditional branches to check per Actor ID.

But that will eliminate the fifth member for checking.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
If you use the script snippet I posted a few posts back (the one with the module REAPER thingy), you don't even need to use conditional branches as the snippet even does the check for you.. All you will need to do is put it on the script editor and use the call in the event where you need to adjust levels (which normally is just the events where you add a party member), no need for extra checks etc. I updated it btw, it's way shorter now, in case you missed it.

Except it doesn't do the collapse effect etc that you had, but you could ofc easily add it there into the snippet if you need it. Though why do you need the collapse effect anyway + the check if dead? Can you explain the purpose of that part?
 
Last edited:

Reapergurl

Drummer Extraordinaire! xD
Veteran
Joined
Dec 15, 2016
Messages
534
Reaction score
552
First Language
British English
Primarily Uses
Other
@Engr. Adiktuzmiko So, it will just adjust to the Level Cap?

Well, that's one half solved. Now to the other.

Of course, I may end up checking the Actor ID's for that part, I dunno.

Edit:
Will adding \n in the script box make a line break? I heard that somewhere before.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
Yes, it sets the exp to the exp needed for that level.

What problem needs Actor IDs? I've never seen you use actor IDs in any of your posted images, so why do you think you need them?

the dead checks? you could do that inside the snippet I posted utilizing the actor variable so you won't ever need to know the ID of the actor in that slot.

oh just wanna say that this is totally contradicting

already_dead = actor.dead?
add state
perform collapse if actor.dead? and !already_dead

already_dead is basically the same as actor.dead? in those 3 lines of code and in that last line ur checking if he is dead but not already_dead, which will almost never be true, unless the state you add in between is the death state. ! is the shortcut for not

Here is an updated snippet that even does the death check for you... but you now need to also supply the state Id for the current cap

Code:
module REAPER
  def self.adjust_level(level_cap,state_id)
    $game_party.members.each do |actor|
      if actor.level > level_cap
        actor.change_level(level_cap,false)
        actor.add_state(state_id)
        actor.perform_collapse_effect if actor.dead?
        actor.result.clear
      end
    end
  end
end
so for the level 10 cap as example, just call REAPER.adjust_level(10,52)

On a last note, collapse effect is only done if ur in battle, so unless this runs in battle, there's no point in doing it.
 
Last edited:

Reapergurl

Drummer Extraordinaire! xD
Veteran
Joined
Dec 15, 2016
Messages
534
Reaction score
552
First Language
British English
Primarily Uses
Other
Not the dead checks (I was dumb for copying and pasting that part). No, it's to add the Level Cap State.
Edit:
Will adding \n in the script box make a line break? I heard that somewhere before.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
Then just add this script

Code:
module REAPER
  def self.adjust_level(level_cap,state_id)
    $game_party.members.each do |actor|
      if actor.level > level_cap
        actor.change_level(level_cap,false)
        actor.add_state(state_id)
        actor.result.clear
      end
    end
  end
end
Then call it when you need to check for the level caps (so when you add new party members)

REAPER.adjust_level(level_cap,state_id)

so for example, for the level 10 cap

REAPER.adjust_level(10,52)
 

Reapergurl

Drummer Extraordinaire! xD
Veteran
Joined
Dec 15, 2016
Messages
534
Reaction score
552
First Language
British English
Primarily Uses
Other
Well, this seems all super...and then this. :ysad:

(Script 'Game Interpreter' Line 543: NoMethodError occurred.

undefined method 'level' for nil:NilClass)

Makes me wonder if some of the variable collecting I'm doing is wrong.

How to get the party size array?
Code:
$game_party.members.size
?

Is this in any way, incorrect?

Code:
>Control Variables: [0034: Party Level] = $game_party.members[0].level

>Control Variables: [0034: Party Level] += $game_party.members[1].level

>Control Variables: [0034: Party Level] += $game_party.members[2].level

>Control Variables: [0034: Party Level] += $game_party.members[3].level

>Control Variables: [0034: Party Level] += $game_party.members[4].level

>Control Variables: [0035: Party Count] = $game_party.members.size

>Control Variables: [0034: Party Level] /= [0035: Party Count]
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
It means one or more of those party members are not yet present, resulting to a nil value instead of an actor... Right now you method assumes a full party of 5 (since you manually used .members[0] up to members[4]), so if it's not, one of those Party Level += will return an error. If you want to continue doing it this way, it should be

Party Level += $game_party.members[position].level unless $game_party.members[position].nil?

So that it will only try to add the level if that position has an actor in it.

If you use the snippet I gave you, you wouldn't even need to do this check by yourself coz it is completely self sufficient, you just need to do the single script call and poof, everyone above the cap will be lowered to the cap and have the cap state.

TBH, I feel like you're just ignoring the snippets that I so thoughtfully wrote to achieve what you want to do in the fastest possible way that I know.
 
Last edited:

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

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,849
Messages
1,016,975
Members
137,563
Latest member
cexojow
Top