Need Help With A Skill + Related Common Events

Gray96

Veteran
Veteran
Joined
Jan 4, 2018
Messages
33
Reaction score
5
First Language
English
Primarily Uses
RMMV
First, some background: I have a character in my game that is essentially a demonic gourmand. As such, I wanted to create a skill tied to his eating habits. This made me think of the move "Belch" from pokemon, which has a very high base power but can only be used if the Pokémon has first consumed a berry. Using this as inspiration, I set out to make the skill "Beelzebelch" (Beelzebub Belch, ha). This skill will be similar to the aforementioned Pokémon version with a few differences: First off, instead of berries, the skill will work with any consumable item. Second, I'd like for the skill to be usable once per consumable item used (I.e if one potion is used by the character, he can use Beelzebelch once, and if two potions are used by the character he can use the skill twice). Taking these factors into account, I made the following common event that will be tied to every consumable item in my game:

upload_2018-7-5_15-30-30.png

...One example would be this potion here:

upload_2018-7-5_15-31-14.png

Next step, the skill itself:

upload_2018-7-5_15-32-25.png

Which, if you look in the "Effect" box, runs the common event "Beelzebelch". Here's what I've come up with so far for that event:

upload_2018-7-5_15-33-37.png

Where in this case, the forced action is the part of the skill that actually damages enemies. That skill is as follows for those interested:

upload_2018-7-5_15-38-39.png

(please ignore the formula, I haven't started balancing damage much in my game yet)

So, looking at this, you may have already noticed my problem... The "Consumable Variable" rises by +1 when a consumable item is used by ANY character, and I need to find a way to make the common event only occur when the character in question, Malphas, uses the item. We can't have him burping up other people's food after all... Looking through conditional branches, I didn't find a way to do this at a glance. There was a branch for if Malphas is in the party, but what I really need is more like "if x character uses x item", and that does not seem to be an option. Does anybody know of a creative way to fix this problem, or perhaps a way to do it with plugins? I've downloaded a good number of Yanfly's plugins, so I'm thinking my issue could probably be solved with some javascript notetags. I can move this post to another thread if that is the case.

Any help is appreciated, thanks in advance!
 

Attachments

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
30,401
Reaction score
7,222
First Language
German
Primarily Uses
RMMV
create an invisible target state that has no effect, no icon, low priority and is nothing but a name to check.
add that state as a 100% effect to every consumable item.

in the common event, check if the actor has that state - if yes he used the item and increase the variable. if not someone else used that item.
additionally, have the common event remove the state from the entire party at the end (so that it isn't triggered multiple times
 

Gray96

Veteran
Veteran
Joined
Jan 4, 2018
Messages
33
Reaction score
5
First Language
English
Primarily Uses
RMMV
create an invisible target state that has no effect, no icon, low priority and is nothing but a name to check.
add that state as a 100% effect to every consumable item.

in the common event, check if the actor has that state - if yes he used the item and increase the variable. if not someone else used that item.
additionally, have the common event remove the state from the entire party at the end (so that it isn't triggered multiple times

I figured there would be a simple solution! Thanks!
 

Traveling Bard

The Bard
Veteran
Joined
Jul 4, 2012
Messages
564
Reaction score
482
First Language
English
Primarily Uses
Try this:
1. Remove the common events.
2. Use yanfly's skill core plugin + the following notetag on your items:
<After Eval>
// Check if the actor ID is 1.
if (user.actorId() === 1) {
var foodStorage = $gameVariables.value(5);
$gameVariables.setValue( 5, foodStorage + 1 );
}
</After Eval>
3. Remove the Burp skill and have the Beezelburb skill contain all your damaging & animation logic.
4. Add the following notetags to the Beezelburb skill:
<Custom Requirement>
//Skill will only be able to be used if variable 5's value is greater than 0
if ($gameVariables.value(5) > 0) {
value = true;
} else {
value = false;
}
</Custom Requirement>
<Custom Execution>
var currentItemCount = $gameVariables.value(5);
$gameVariables.setValue(5, currentItemCount - 1);
</Custom Execution>

This is just off the top of my head. Only issues would be if you intend for multiple users (other actors or enemies) to utilize this kind of skill. If it's unique to this character, then the above should be fine; otherwise, we might need to add some more checks & tie these variables to the user as a property or something. Hope this helps!

Edit: Took too long to answer haha Andar's version works too :)
 

Gray96

Veteran
Veteran
Joined
Jan 4, 2018
Messages
33
Reaction score
5
First Language
English
Primarily Uses
RMMV
Try this:
1. Remove the common events.
2. Use yanfly's skill core plugin + the following notetag on your items:
<After Eval>
// Check if the actor ID is 1.
if (user.actorId() === 1) {
var foodStorage = $gameVariables.value(5);
$gameVariables.setValue( 5, foodStorage + 1 );
}
</After Eval>
3. Remove the Burp skill and have the Beezelburb skill contain all your damaging & animation logic.
4. Add the following notetags to the Beezelburb skill:
<Custom Requirement>
//Skill will only be able to be used if variable 5's value is greater than 0
if ($gameVariables.value(5) > 0) {
value = true;
} else {
value = false;
}
</Custom Requirement>
<Custom Execution>
var currentItemCount = $gameVariables.value(5);
$gameVariables.setValue(5, currentItemCount - 1);
</Custom Execution>

This is just off the top of my head. Only issues would be if you intend for multiple users (other actors or enemies) to utilize this kind of skill. If it's unique to this character, then the above should be fine; otherwise, we might need to add some more checks & tie these variables to the user as a property or something. Hope this helps!

Edit: Took too long to answer haha Andar's version works too :)
Thanks for the input! I like this method since it will gray out the skill when it is unusable. With that said, I did have a small issue. The first half of the skill works, in that items with the notetag you suggested will successfully enable the skill. However, upon using the skill once after 1 item use, it remained enabled even though the variable should have decreased. At first, I adjusted the <Custom Execution> portion in the skill to read:

<Custom Execution>
var foodStorage = $gameVariables.value(5);
$gameVariables.setValue(5, foodStorage - 1);
</Custom Execution>

You'll notice that all I changed was the "currentItemCount" over to "foodStorage" in order to match the name in the item notetags. Thought this would do the trick, but no dice. I ended up working around the issue by just adding a new common event in the Beelzebelch skill as follows:

So here's the skill...
upload_2018-7-6_12-43-15.png

...And the common event is simply a conditional branch that reduces the foodStorage variable by 1 if it is > 0.


With this setup, the skill seems to be working as intended. Still, I was wondering if you knew what part of the code might need to be altered to successfully reduce the variable without the use of this common event? I'm fairly confident that the issue lies in the <Custom Execution> part. Thanks again for all your help, and I hope it's not too much of a bother!
 

Attachments

Last edited:

Zarsla

Veteran
Veteran
Joined
Jan 23, 2015
Messages
708
Reaction score
227
First Language
English
Primarily Uses
Try this:
<Custom Execution>
var currentItemCount = $gameVariables.value(5);
currentItemCount -=1;
$gameVariables.setValue(5, currentItemCount);
</Custom Execution>
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Husband has roped me into playing one of his PSO2 characters. Productivity is now negative.
Tileset A is lava! Don't burn D:
as MZ come out what you guys think about.....Some particles engine :3c?
Who wants to sing this song with me?~

Decided to submit my games to the Monday Night Stream. Figured it might be a fun way to get some traction.

Forum statistics

Threads
100,706
Messages
978,559
Members
132,320
Latest member
LavaWave
Top