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.

Set actor level to that of another actor or the entire party

Set actor level to that of actor or the entire party
By Daxisheart


WTF is this:
A tutorial on how to change an actor's level to that of a party member or the entire party. It's an very simple idea for me, and despite the directions it's only a couple of clicks, so I'd thought I'd put this up for any noob.
Of course, the tutorial is just how I'd do it, not anyone else. If you have different ways, good for you, maybe post them up for the community to use. This tutorial is just my way.
Also to be noted, I'm doing this on RMXP since I'm XP biased. Quite easy to adapt to any other RM, and you should get an idea of what just happened and be able to adapt by the end of it.

Prerequisites:
You need to know the basics of controlling variables. The basics are really all that's needed; just know to set variables, basic addition, etc. A competent user, which I will assume you are, can glance at the event screen and can pretty figure out what it's supposed to do (I mean, Control variable controls the variables obviously, setting a variable SETS it to a certain number of your choosing, etc.). When I state a word, like an operand, at least check your control variable screen for the blue word "operand" before asking what it is, etc.


Here's a picture of the "Control Variables" Event screen. Throughout the tutorial, I'll refer to the things and numbers that I'd marked out and highlighted a couple times throughout the tutorial.

35558291.png
You have a level 32 CHAR1. You want to introduce CHAR2 into your party, and CHAR2's level is 1. You want to change CHAR2 to the same level as CHAR1. Here's how we do it:

Action 1: Go to the first page of events. Go to "Control Variables." Set out a variable. Let's call it ACTOR_VAR. Done at (1), and set using operation at (2)

Action 2: Set your ACTOR_VAR to operand actor, which is (4). For the actor, (5), change it to the actor you want to the other to change to.
(So, if we want CHAR2 to be like CHAR1, set it to the actor CHAR1)
Right next to (5) is (6), and set it, (6), to level, which it should already be at actually.

Action 3: Same controlled Variables screen, In Operations, (2), subtract ACTOR_VAR by exactly 1. You'll find out why, and I'm quite sure there are ways around this, but it's the easiest thing I've got in mind at the moment.

Action 4: Go to the 3rd event page, and go to "Change Level." Set actor to the actor's level you want to change to (CHAR2). Set the operation to decrease, and just set it to constant 99.

Action 5: Now, got to the same "Change Level" event again, and then set it to the same actor (CHAR2). Then, instead of the operand constant, we set it to variable ACTOR_VAR. Increase CHAR2's level by ACTOR_VAR.

Congrats! Now, you have a level 32 CHAR2, the same level as Level 32 CHAR1!


Wait a minute, WTF happened? Let's recap now so you can understand what just happened.

For Actions 1-2, we made it so that a variable is the same number as CHAR1's level.
For Actions 3-4, because RMXP's change level event operation has to increase or decrease, we decrease ACTOR_VAR BY 1, and change CHAR2's level TO 1 so we can add a number that would then be the same as CHAR2. Don't worry about the huge 99; decreasing CHAR2's level by 99 would simply bring it to 1.
For Action 5, we then add ACTOR_VAR to CHAR2's current level, resulting in the same level as CHAR1.

Here's a little mathematical example:

1 + (X-1) = X
X is CHAR1's level, courtesy of action 2
1 is CHAR2's initialized level, courtesy of Action 4.
The (X-1) is the ACTOR_VAR minus 1, courtesy of Action 3.
1 + (X-1) is basically courtesy of Action 5, which finishes the whole thing.

For this, you basically had to know the operations of the event screen and basic control variables. Simple enough, and if you actually count the number of clicks, it's barely anything at all.
The title says it all. You want to introduce CHAR 5 to the party, which consists of CHAR1, CHAR2, CHAR3, and CHAR4. You want CHAR5 to be the AVERAGE of the entire party. Basically, once you've learned how to do Tutorial A, B is just repetition crap.

Action 1: Go to the 1st page of events. Go to "Control Variables". Create 5 variables, ACTOR_VAR1, ACTOR_VAR2, ACTOR_VAR3, ACTOR_VAR4, and Party Average

Action 2: Set your ACTOR_VAR1 to operand actor. For the actor, change it to the first party member in your party, found at (6), remember? Set it to level, of course, found at (7).

Action 3: Repeat Action 2 to each of the party members in your party, but using the corresponding ACTOR_VAR#, aka, use ACTOR_VAR1 for CHAR1, ACTOR VAR2 for CHAR2, etc.

Action 4: Go to the "Control Variables" screen once more, and set the variable you want to change to PARTY_AVERAGE. Next, for operations (2), change the operations to add. Next, for Operands (3), set it to Variable, and choose ACTOR_VAR1.

Action 5: Repeat Action 4 to each of the four ACTOR_VAR#. By the end, PARTY_AVERAGE should have the amount of ACTOR_VAR1-4 added up.

Action 6: Divide PARTY_AVERAGE by 4, or the amount of party members you have. THAT'S IT!!! THAT'S THE AVERAGE LEVEL! GUESS WHAT THE H*** WE DO NEXT?!?!?!

Action 7: Subtract PARTY_AVERAGE by exactly 1.

Action 8: Go to the 3rd event page, and go to "Change Level." Set actor to the actor's level you want to change to (CHAR5). Set the operation to decrease, and just set it to constant 99.

Action 9: Now, got to the same "Change Level" event again, and then set it to the same actor (CHAR5). Then, instead of the operand constant, we set it to variable PARTY_AVERAGE. Increase CHAR5's level by PARTY_AVERAGE.


AND.... YOU'RE DONE. Okay, the usual WTF, and now for the explanation:

For Action 1, we created the variables we're about to use. Simple enough.
For Actions 2-3, we set all the ACTOR_VAR# to the respective party members that you currently have.
For Actions 4-5, we added up all of the ACTOR_VAR# into PARTY_AVERAGE. That gives you the amount of ACTOR_VAR# added up, which is used...
For Action 6, where we got the average of the 4 party members added together.
For Actions 7-9, we did the usual familiar thing that we did in Tutorial A. With that, CHAR5 has the average of your party, or at least CHAR1-4.

Now, there's something that pops up when doing all this. What would happen if, at step 6, PARTY_AVERAGE was an odd number, or one not perfectly divisible by 4?
Well, RMXP's program rounds DOWN if the number if it's not an integer. If it's 2.5, the variable would become 2. If it's 2.9999999999999, it rounds down to 2. For any programmer out there, you know exactly what I'm talking about.
So, let's give an example with basic numbers to show why rounding down is the proper choice for this with an example:
1 + 1 + 2 + 1 = 5. 5/4 = 1.25, which rounds down to 1. When we finish up Actions 7-9, it becomes 0, which added to the initialized level of 1, the character would then be level 1. Now, if it had rounded up, the character would be level 2, which, as you clearly see, is not the average. 1.25 is closer to 1 than to 2.
The level that is given from Tutorial B is the average, or as close as it can get considering that "levels" deals purely in integer numbers.

As you can clearly see, Tutorial B is simply Tutorial A extended a little bit. The extra variables were purely made to accommodate the number of CHARs that we are working with. Tutorial B can work with only 2 CHARs and adding CHAR3, resulting in only 3 variables, or 22 CHARs, resulting in 23 variables.

Oh yeah, I should mention at this moment if you really didn't know...
You don't HAVE to introduce a new actor into your party. You can just fiddle around with the actors in your database for whatever your needs are. I'm using the variables names PARTY_AVERAGE and things like that to only easily accommodate you with the ideas of using the variables in this way. I'm pretty sure you already know this, so whatever.


So, anyways, those are the two tutorials right there for something simply done. A lot is written, if you notice, but it's actually very, very simple once you understand where the direction's going, which is nothing hard at all.
Of course, this is the way I'd do things. If I had to, I would do it this way. If anyone has a problem with the ideas I've written down, there's a technical problem because of some careless error/instruction of mine, or someone thinks that they have a more efficient way to do things, just inform me.

I also have a tutorial C in plan, which deals with creating a common event for this thing. How? Well, it's in the works; if you've been rmming or programming long enough, you probably know how to already.
 
So question.Why would I use this? If you were to give an example on how you would apply this, it would be great. I have thought of a reaosn why this would be used, but hope to see what you have in mind.

You put alot of work in this and I like that. I have a found an other way to do this with out really any math. But it shows you understand Variables/ teaches about Variables, which is great. Good Job. I hope to find a way to use this Tutorial.
 

Jason

Awesome Bro

Well Kid, it could be used for the pacing of a game, for example, at one part of a game, Bob joins the party, however, if you're level 10 and talk to Bob, he'll be level 10, if you're level 99 and talk to him, he'll be level 99, so it's keeping the levelling pace of the rest of the party so you don't have to spend all your time levelling him up.

I must say, I quite like the idea of an average level based on the party members, I've never actually done it like that before, I've always used the first method, lol.

Great work!
 
WOW! Just wow. I really must of been tired :blank: . I didn't think about that. This is a pretty awesome. I agree with that the average thing is insanely nice looking. :cheers:
 
Oh, gee, thanks, I guess I should check up on threads I make more. :smile:
And actually, it only took an hour or so to type it all up, and 25% of that was only because I messed myself up adding extra, meaningless stuff that made myself go "wtf why did I add all that crap".

Well, yeah, what Jbrist said, along with the fact that sometimes, the party characters split up and the paths give different levels. Bring them together again, and maybe one's 40, the other's 50, and if you want to bring in a new character and you're unsure what level he/she should be at this point in the game(too lazy to test play it :tongue:), just use the average party thing.
 

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