I just thought of an interesting mechanic I'd like to implement. I'm using UNCO's Ammunition System to give my Bows a limited number of arrows to use. Arrows will also be found throughout the game so the ammo will replenish. But I had an idea on how to regain some arrows.
I have arrow items to use for ammunition, so I only need to change the number of arrows in inventory. That is, I don't need this to be specifically compatible with the ammo plugin since it won't be of consequence.
What I'd like is to have the game track how many times enemies are hit with arrows in battle. I'm going to have a separate skill for firing arrows instead of using the standard attack skill. So, let's say Skill ID 10, "Arrow Fire" for the sake of discussion. That skill will be used to fire arrows and only to fire arrows.
So I'm thinking that I would need something to track how many times Skill ID 10 is used in battle. Then, when the battle is over, the party should get rewarded with a percentage of that number of arrows. Let's say the arrow is Item ID 5 "Arrow".
Here's an example with the reward percentage set at 80%:
In battle, John uses Arrow Fire 10 times. When the battle is over, 8 arrows are included in rewards.
The result of the percentage would have to be rounded up or down, of course. I would prefer down. So if 5 arrows were used the percentage is 50, the party would get 2 arrows back, not 2.5.
How do I do this?
Are they random battles, or evented?
If evented, set a variable to 0 prior to the start of battle. Have the skill increment the variable so you can track how many times the skill has been used (how many arrows have been fired). After the battle (back in the event), use a conditional branch to see if any arrows were fired and how many should be given back.
If they're random battles you can use my Battle Result plugin to turn on a switch at the end of every battle (regardless of outcome), and have a common event conditioned by the switch to do the check to see if arrows were used and give them back. At the end of the common event, set the variable back to 0.
These would both give the arrows back as rewards when you're back on the map, not as part of battle. If you want it to be done with the battle loot, you will need a plugin.
Alright, so I got everything working except your plugin. I have a switch and common event set up to use with your plugin and in evented battles. The switch works fine in evented battles and when turning it on through the debug menu. But after a random encounter, the switch doesn't turn on. At first I just had it assigned to Battle Won and when that didn't work I assigned it all conditions. It still didn't work.
Thank you, by the way!
Can you show a screenshot of the plugin manager, a screenshot of the plugin parameters, and a screenshot of your common event? Also, after a battle where the common event doesn't run, can you open the console (F8) and check if there are any error messages? If there are, grab a screenshot of that too.
Can you try JUST that plugin in a brand new project with no others, and see if it does the same thing? I wonder if it's a compatibility issue. Do you have any plugins that alter battle start/end behaviour, specifically with random battles?
Perfect! Are you using the latest version of MV? Is this a new project started in the latest version, or did you start it in an earlier version (and did you upgrade all the scripts correctly)?
The above proves it's JUST an issue with my plugin, and no compatibility problem, which means it shouldn't take too long to track down.
Brand new project started in the latest version. Ah, wait. I have 1.3.1...
Okay, I updated to 1.3.3. Do you want me to try a new project in that?
Also, is my game project updated just by updating the program?
It should still work. I wrote it in one of the earlier versions.
I've just tried it in a brand new 1.3.3 project and it works, both for evented battles, and for random battles.
Just gone back to 1.3.1 and tried it, and it still works for random and evented battles.
I don't recall making any changes to this plugin - did you only just download it, or did you get it from the DLC that came with the engine?
I got it from the link in your signature.
Your game is not updated just by updating MV. The update thread has specific steps you need to follow, in the first post. It involves copying away your plugins.js file, replacing all the default .js files and index.html with the versions from the new MV's newdata folder, and then copying your plugins.js file back again. After that, you need to go through ALL the plugins and make sure they're all up to date.
As for this plugin, I don't really know what to do next. The one in my signature is the same as the one I tested in both 1.3.1 and 1.3.3 and they both work for random and evented battles.
I would ask if you have another plugin that's using the same switch, as that would be an issue. But you put it into a new project without any other plugins, so it shouldn't be caused by that. Instead of turning followers off, can you just make it show some text? Remember to turn the switch off at the end of the event so it doesn't repeat.
I'm uploading it right now. Quick question while I'm waiting. Do I need to change the filename from mv_battle_result_switches.js?
No - I just edited my post. I've figured out the problem. You didn't give the plugin the correct name when you saved it. Just check my post again above yours.
It had that name when I downloaded it. I'll change it.
EDIT: Success!
In that case, what should your dynamic traits plugin be named?
It's not called mv_battle_result_switches on Pastebin. The paste name is MV Battle Result Switches - with spaces. That is not the name of the file. That is just what I call it on pastebin (and I add the MV to distinguish my plugins from my Ace scripts).
It doesn't matter what you call the Dynamic Traits and Effects plugin, because there are no parameters.
Okay, thanks.
I'm very happy with the switches plugin. Thanks again for that!