This script allows you to limit the number of times a skill or item can
be used in a single battle. The use counts are reset at the end of each battle.
Script: download here
Place this script below Materials and above Main
Note-tag items or skills with
<battle use limit: x>
For some integer x. Once you’ve used a skill or item that many times in a
single battle you can’t use it again until the next battle.
Hey! I stumbled upon a fatal bug. It seems that the script doesn’t like the scope “All Allies” all too much, at least that’s when it throws me the following error:
Is there anyway you could help me out with this? I’d really rather not pass on this script, as it adds a whole level of depth to the skills of one of my main actors.
I have tested a potion with All Allies scope and it does not crash the game. Try it in a new project and verify that it is not a compatibility issue.
Indeed, my bad. I located the source of the error in a script from Moghunter, who basically overwrites a targeting method that skips the selection when the scope is set to “All Allies/Enemies”. Sadly, I need both scripts and am not experienced enough to adjust it on my own, so I’ll just have to avoid using items with an “All” scope.
Terribly sorry for wasting your time, keep up the good work!
Try moving this script above and below and see if that makes a difference. The default scripts do not prompt for selection when the scope targets all.
Sadly, this changed nothing. Still the same error here, no matter where I put it. 🙁
Hey there again. I really don’t want to waste your time, but could you just quickly check if this could be the source of the issue..? If I disable this particular script, the “All” scope works as it should.
(Full Script, Translated by me: http://pastebin.com/fskQnh6q)
Again, terribly sorry if I annoy you.
I just tested the two scripts and they work together.
Odd, seeing as it works fine if I disable it in my project. Well, thanks for going out of your way to check it anyway. I guess I’ll just have to delay the release a bit further back to find the issue! I really appreciate it! (:
To be absolutely sure, take those two scripts and move them into a new project of its own and see if the error occurs. It’s possible that there are multiple scripts working together to cause the problem, and disabling one of them just happens to solve it.
Interesting! I pasted the scripts together in a new project, and the exact same error popped up. I recorded a super awkward slow-downed gif to try and show you, it includes only using your script here, in addition to the battle cursor one. The Potion, as seen at the end, is set to target “All Allies”. ( http://puu.sh/hDZ2I/25c02e8bc5.gif )
Gosh, this is frustrating! I just want to get back to actual story progression, haha x(
Ok I think I see what’s going on. When I tested the scripts, I had two actors in the party, and it was the first actor that used the potion. The second actor simply guarded.
The bug occurs when the last actor uses something that does not require target selection, because once the last actor chooses the item/skill, the game will begin executing actions. Unfortunately, the cursor script will still try to check if the current item is enabled (for targeting purposes), and something goes wrong.
I’ve updated my script to prevent that check from causing issues.
Works like a charm! Thank you so much for your help Hime. I really owe you one, if you ever need anything, please, feel free to send me a message. Been doing translations, video and image editing for years, in case you’re interested in anything like that!
I’m currently working on a project that is planned for commercial release. This script does almost exactly what I need for my current design task! What’s the best way to talk with you about commercially licensing this script? Keep up the solid work!
Use the contact form from the “Contact me” link in the menu at the top.
I meant zero uses, not items. Also to the above, I guess I wanted to see if there was a way to
turn this script into a “consume x” one because right now, the default RMVXace has either use once or use forever. . For example, I want a want of cure wounds which
could be used 50 times before it turned into dust, which is something it cannot do, at least not with eventing for every item.
This script does not explicitly provide a “charge” count, though it is something that could easily be added as an add-on (even as a visual aid, so players know how many times they can use it). If you would like item charges you can consider something like Kread-EX’s Item Charges script: http://grimoirecastle.wordpress.com/rgss3-scripts/gameplay-scripts/item-charges/
How would you do it if you reached zero items, the item would disappear with some sort of message like “item x has ran out of magic.” I know the reset lines would have to be deleted but how would you call for the item to be deleted and would the charge be stored from battle?…i.e. I set the integer to 50 and the item was used five times in one battle? Would this code allow the game to “remember” that the item only has 45 charges left. Sorry for all of the questions but I am new to Ruby and RPGMaker VX ace.
Is there a way I can clear the battle use count another way instead of having it take effect every beginning and end of every battle? Say, with a line of script or something?
Probably, depending on when you want it to occur.
I don’t want it to be automated.
I want to be able to manually trigger it (For instance, when you rest at an Inn or such)
You’ll have to delete the lines that automatically refresh usage counts and then just use a script call.
Nice script bro!
There’s a bug when you have 0 items to use in battle and press OK at the blank item selection:
‘undefined method “id” for nil:Nilclass’
Any fix? 🙂
how about item description. by creating escape code (there’s global escape code scripts already)
Usage Left : lim(41)
example skill 41 limit is 3 per battle and already used once…
Usage Left : 2
after posting… have some thought… it would be better if:
Usage Left : 2 / 3
sorry for double post. cannot edit.
just a suggestion, how about showing how many times left? 🙂 thanks nice script
That is a visual thing and relies on specific menu systems. I don’t know where it would be placed.