Need Help Making A Specific Item

Okay, so I tried fixing it turning Common Event, and Troops like this:


porkbun_2.png



But when I test it, it doesn't work. And when I try to get an NPC to tell me the value of Variable 1 (Battle Count), the NPC always states that it is zero. Even when I check the variables (by pressing F9), after a couple of battles, it still counts as zero.



Am I still missing something?
Yes


1) a control variable contains the number when the control command is used. you always need to repeat it to load the current number (in this case, before checking it in the troop event.


2) the troop event is set to "don't run" - which is computer terminology for "never execute", it has absolutely nothing to do with the escape option (as some people continue to state wrongly).


You need to condition that troop event to run on turn 0.
Yes


1) a control variable contains the number when the control command is used. you always need to repeat it to load the current number (in this case, before checking it in the troop event.


2) the troop event is set to "don't run" - which is computer terminology for "never execute", it has absolutely nothing to do with the escape option (as some people continue to state wrongly).


You need to condition that troop event to run on turn 0.

So, I would need to set the variables (both of them) on each troop as well and not just on the Common Event?
No - you don't want to update the end count, that needs to stay updated only on the common event or it would never end the effect.


but yes, you need to set the counter variable on each troop - I suggest you check the script list, there is a script that executes the troop events of the first troop on all troops.


That way you only need to place the event on the first troop and it will automatically be processed by all troops.
No - you don't want to update the end count, that needs to stay updated only on the common event or it would never end the effect.


but yes, you need to set the counter variable on each troop - I suggest you check the script list, there is a script that executes the troop events of the first troop on all troops.


That way you only need to place the event on the first troop and it will automatically be processed by all troops.

I got it to work...sort of.


The battle count is now working, but the item's effect ends prematurely with this setup on the Troops:

Code:
Conditions: Turn 0
Span: Battle

Control Variables: 0001 Battle Count = Battle Count
Control Variables: 0002 Pork Bun Effect = Battle Count
If: Battle Count = Pork Bun Effect
 > Change State: Entire Party, - 5% Defensive Buff
End
You didn't understand what I wrote.


I said the troop event MUST NOT contain a control variable for the pork effect end count.


Remove that line and it will work.


But only remove that line, not the other control variable - that one is needed.


I suggest you search the forums for "variables guide" - that is a tutorial game for how to use variables. It is also linked in my starting point tutorial, which you can see in my signature
You didn't understand what I wrote.


I said the troop event MUST NOT contain a control variable for the pork effect end count.


Remove that line and it will work.


But only remove that line, not the other control variable - that one is needed.


I suggest you search the forums for "variables guide" - that is a tutorial game for how to use variables. It is also linked in my starting point tutorial, which you can see in my signature

Well, it works now (sort of, again)...the buff stays but it doesn't disappear after 5 battles.


Another question, for all the other food items I have in my project, it would follow this syntax as well, correct? Just keep appending the troops with the conditions for each item?


Also, downloading the tutorial you spoke of. Though I notice it's for VX Ace and I don't have that maker.
how variables are handled hasn't changed that much since RM2K - it's basic mathematics what this is about.


If it doesn't disappear after five rounds, you're still doing something wrong - please post a screenshot of your troop event and of the item common event as they are now (have you changed the troop event condition like mentioned a few posts above? That is one of the many details why we ask for screenshot, you didn't include that info in your post where you only retyped the commands.
how variables are handled hasn't changed that much since RM2K - it's basic mathematics what this is about.


If it doesn't disappear after five rounds, you're still doing something wrong - please post a screenshot of your troop event and of the item common event as they are now (have you changed the troop event condition like mentioned a few posts above? That is one of the many details why we ask for screenshot, you didn't include that info in your post where you only retyped the commands.



I didn't post any screenshot because the Common Events page is still the same as the one from my previous screenshot (and didn't think that I would have to, apologies for that). The only changes are from the ones you have told me to change in the Troops part which is this one:


porkbun_3.png



I am guessing that my mistake is in the conditional branch?
no, unless you somehow mixed up the engine or have similiarly named variables that you misselected, that conditional branch should work.


Please test by adding a show text after the control variables command but before the if branch, and have that show text show the numbers of both variables with the \V textcode.
no, unless you somehow mixed up the engine or have similiarly named variables that you misselected, that conditional branch should work.


Please test by adding a show text after the control variables command but before the if branch, and have that show text show the numbers of both variables with the \V textcode.



The Battle Count increments but the value for Variable 2 (Pork Bun Effect) remains 0 even after several battles according to the message.
then the item isn't calling the common event correctly - please show a screenshot of the item and how it calls the common event.
Here it is:


porkbun_4.png
Please add a show text to the common event to see if it is called when using that item - everything looks OK.


I can only think of two possible causes remaining: either you have variables with the same name but different IDs and choosen the wrong one in one of the events, or a plugin is interfering with your events.


One question however: you did start a new game for every test, yes? Because loading a saved game also loads old database settings for some cases, and the playtest might still work on older (buggy) data.
Please add a show text to the common event to see if it is called when using that item - everything looks OK.


I can only think of two possible causes remaining: either you have variables with the same name but different IDs and choosen the wrong one in one of the events, or a plugin is interfering with your events.


One question however: you did start a new game for every test, yes? Because loading a saved game also loads old database settings for some cases, and the playtest might still work on older (buggy) data.



I don't have any plugins in it and the only variables I have are Variables 1 and 2. I also start a new game every time I'm testing it. Triple checked everything as well.


I'm going to make a new project and test it again just to be sure.


EDIT:


So the basic item (and effect) is working on the new project I made. Which is strange since I did the exact same thing as in the previous project.


Now, I only need to figure out how to keep the player from ingesting another food item immediately after eating (like they would have to wait a battle before they could).


Also, I have one last question (posted a couple of posts back) about other similar items to this (but with a different effect). Making them follows the same process as with this Pork Bun item, correct? But I need to add conditional branches per item on the troops? Is that right?

Original thread: https://forums.rpgmakerweb.com/threads/need-help-making-a-specific-item.63490/