Using an Item to Level Up

No matter what I do it levels up the whole party. But for context
1.png
2.png


Is there a specific script call that I can do to make it work on who it was selected on? Like any other growth like item. Thanks in advanced. It was in the MV version still for the entire party... but I want this remaster to only be for one character and used.
In a sense, it's like a Rare Candy from Pokemon. That's where I got the idea from.
What does the common event do?
What does the common event do?

Use item, common event, since level up is not something that can be targeted by an item otherwise. But it levels up the whole party instead. So, thought I'd ask around to see if it can be narrowed to select character.
Use item, common event, since level up is not something that can be targeted by an item otherwise. But it levels up the whole party instead. So, thought I'd ask around to see if it can be narrowed to select character.
I see it now, and I just reproduced that. It seems that having the variable set to 0 is the equivalent to "whole party" when you use the level up command.

You'll have to use the damage formula to get the target id. Put this there:
Code:
v[X]=b.id;0
Replace X by the variable ID.

Edit: also, I don't think you need to manually remove the item through the common event. If the item is set as consumable, it will get automatically removed once you use it. Having that additional removal through the common event will make so that, if the player has 2 eggs, he will lose both on a single use.
I think you're going to run into a problem with item use validation. If the actor you are trying to use it on is at max level, you will still end up using the item, but it won't do anything.

I think for the most optimal way to get this effect, you'll need to use a plugin.
I think you're going to run into a problem with item use validation. If the actor you are trying to use it on is at max level, you will still end up using the item, but it won't do anything.

I think for the most optimal way to get this effect, you'll need to use a plugin.
In that case it's possible to create a conditional branch that checks whether the target is at the max level or not (by using the ID variable to get the actor's level).

It's not optimal, but it works.
In that case it's possible to create a conditional branch that checks whether the target is at the max level or not (by using the ID variable to get the actor's level).

It's not optimal, but it works.
It terms of usability, I think it'd be a bit weird but it would work.

Back in the MV era (so a few years ago xD) Dekita made a Rare Candies plugin for MV, I had a copy of it in my old projects, threw that plugin into MZ, and it looks to work just fine!

The link to the original post is here:
https://forums.rpgmakerweb.com/index.php?threads/rare-candies.50343/

It looks like the original link is broken, but further down there is a wayback link that seems to work? Since I already had it downloaded from years ago I didn't check.
It terms of usability, I think it'd be a bit weird but it would work.

Back in the MV era (so a few years ago xD) Dekita made a Rare Candies plugin for MV, I had a copy of it in my old projects, threw that plugin into MZ, and it looks to work just fine!

The link to the original post is here:
https://forums.rpgmakerweb.com/index.php?threads/rare-candies.50343/

It looks like the original link is broken, but further down there is a wayback link that seems to work? Since I already had it downloaded from years ago I didn't check.

Well I found the plugin since I couldn't get the variables and common eventing to work to my liking. But I will remain adamant about finding out how to get this to work without the plugin, since the only downside is that it doesn't say [X] learned [skill]. But thank you nonetheless.

I see it now, and I just reproduced that. It seems that having the variable set to 0 is the equivalent to "whole party" when you use the level up command.

You'll have to use the damage formula to get the target id. Put this there:
Code:
v[X]=b.id;0
Replace X by the variable ID.

Edit: also, I don't think you need to manually remove the item through the common event. If the item is set as consumable, it will get automatically removed once you use it. Having that additional removal through the common event will make so that, if the player has 2 eggs, he will lose both on a single use.

Thank you for trying to help, but I couldn't get it to work... could be my lack of actual variable knowledge. Everything I tried and suggested, even the other picture you posted, couldn't exactly get it to work as it still leveled the entire party.
Well I found the plugin since I couldn't get the variables and common eventing to work to my liking. But I will remain adamant about finding out how to get this to work without the plugin, since the only downside is that it doesn't say [X] learned [skill]. But thank you nonetheless.

With the power of plugins, (almost) anything is possible!

If you want that level up message, you could dive into the plugin's code and change the line
Code:
this.changeLevel(this.level+1,false);
to
Code:
this.changeLevel(this.level+1,true);

If you do this, once you use the item and back out of the menu, the leveled up message will appear. It's not perfect, but I think that's what you want? (See if it works for your game. I'm using Visustella plugins so it's possible I have a bit of a different experience).
in MZ we can store Last Target Actor ID in a variable...
Change Variable -> Operand Game Data -> Last -> Last Target Actor ID
to store the target actor id in a variable...
let's say we store it to variable 7.

then we also need some check does the actor max level or not... can be using
Conditional Branch -> Script:
Code:
$gameActors.actor($gameVariables.value(7)).level < 99
don't forget to add else branch...
then put inside the true condition

Change Level -> Variable 7 -> add 1 lv
instead of Fixed actor ID.
remove the rare candy item -1

at the else branch... add some notification that the actor level is maxed...

this is the screenshot example:
item rare candy: (make it NOT consumeable since we will remove it manually at common event)
1606371108789.png


common event rare candy:
1606371145127.png

i use variable 7 to store the target actor id.
the level up message is also using escape code
\n[\v[7]] Level UP !!

hope this help

edit: this also did not show X learn Y skill message though...
it's possible to show learn skill using combination of event + script call... but not recommended for beginner... better use plugin instead...
With the power of plugins, (almost) anything is possible!

If you want that level up message, you could dive into the plugin's code and change the line
Code:
this.changeLevel(this.level+1,false);
to
Code:
this.changeLevel(this.level+1,true);
If you do this, once you use the item and back out of the menu, the leveled up message will appear. It's not perfect, but I think that's what you want? (See if it works for your game. I'm using Visustella plugins so it's possible I have a bit of a different experience
I too am using their plugins. Worked, but I see what you mean now. Just need to add in and EndScene script.
in MZ we can store Last Target Actor ID in a variable...
Change Variable -> Operand Game Data -> Last -> Last Target Actor ID
to store the target actor id in a variable...
Oh, I didn't remember that. That's quite convenient. @Riku_Masamune should do this way instead, then.

@estriole offered a nice alternative that you should probably use, but I'll still explain what I did just to give you an insight. It's good to know different methods of doing the same thing because you acquire familiarity with the engine.

Well I found the plugin since I couldn't get the variables and common eventing to work to my liking. But I will remain adamant about finding out how to get this to work without the plugin, since the only downside is that it doesn't say [X] learned [skill]. But thank you nonetheless.



Thank you for trying to help, but I couldn't get it to work... could be my lack of actual variable knowledge. Everything I tried and suggested, even the other picture you posted, couldn't exactly get it to work as it still leveled the entire party.
Okay, so I'm doing this in VXA because it's the only RM I have installed right now, but it should work the same in MV (at least the damage formula seemed to be the same when I tested the trial).

The first step is to make the item deal damage, only it's a "fake damage" (the 0 in the formula I sent above), because what you actually wanna do is get the actor ID ("b.id") of the hero which the item is being used on.

What the formula I sent means is basically:
Define variable X as the target; then deal 0 damage.

Now you can check the print I attached to see how to set the item in the database. Notice that I used X as "1" because, on the above screenshot, I'm using variable 0001 to define "Character".
With the power of plugins, (almost) anything is possible!

If you want that level up message, you could dive into the plugin's code and change the line
Code:
this.changeLevel(this.level+1,false);
to
Code:
this.changeLevel(this.level+1,true);

If you do this, once you use the item and back out of the menu, the leveled up message will appear. It's not perfect, but I think that's what you want? (See if it works for your game. I'm using Visustella plugins so it's possible I have a bit of a different experience).
in MZ we can store Last Target Actor ID in a variable...
Change Variable -> Operand Game Data -> Last -> Last Target Actor ID
to store the target actor id in a variable...
let's say we store it to variable 7.

then we also need some check does the actor max level or not... can be using
Conditional Branch -> Script:
Code:
$gameActors.actor($gameVariables.value(7)).level < 99
don't forget to add else branch...
then put inside the true condition

Change Level -> Variable 7 -> add 1 lv
instead of Fixed actor ID.
remove the rare candy item -1

at the else branch... add some notification that the actor level is maxed...

this is the screenshot example:
item rare candy: (make it NOT consumeable since we will remove it manually at common event)
View attachment 169073

common event rare candy:
View attachment 169074
i use variable 7 to store the target actor id.
the level up message is also using escape code
\n[\v[7]] Level UP !!

hope this help

edit: this also did not show X learn Y skill message though...
it's possible to show learn skill using combination of event + script call... but not recommended for beginner... better use plugin instead...

This did the trick! Thank you, and I did the show level up option for conveniences sake on the player to let them know they learned something.
Thank you all again! I appreciate it very much!
in case someone still want to use eventing + script call to show the learned skills... here's the improved version of the common event:
1606373213715.png


since it's quite long here's the bottom part:
1606373336551.png


in that common event example i use:
variable 7 -> to store Last Target Actor ID
variable 8 -> to store ALL SKILLS LIST learned at that level
variable 9 -> to grab one skill from variable 8 to show in the text
variable 10 -> i use this to store the level raised to what number so we can show it as
Reid level up to level x

if you're confused... alternatively you can grab my plugin demo here...
i put the common event there and you can copy it. (and change the variable according to your project)
Thank you again. It is good to know I was on somewhat the right track when I made this item in MV. But really wanted it to work on just one (without editing the core files to add in LV in the other default growth). But I didn't know about the change in variable targets in MZ, so thank you again very much; to everyone who helped and assisted too!

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/using-an-item-to-level-up.130317/