I am in need of some help.
I have some skills that use Yanfly's skill cost script, and it needs X amount of Y item to work- I have that part taken care of.
However, in the skill description, I have
"Uses Item X. STOCK: \v[#]."
The Variable is not coming up.
I have used "Control Variables [0012]:Item 1 - [item 1] in Inventory"
The Variable remains at 0 despite that the items are in my inventory.
I've moved this thread to RGSSx Script Support. Please be sure to post your threads in the correct forum next time. Thank you.
1. Please give a link to the script.
2. Is the script DESIGNED to use variables? If the notes are only read on starting a new game or loading the database, your variable at that time will be 0.
3. WHERE have you used "Control Variables [0012]:Item 1 - [item 1] in Inventory"? When is this called? Do you actually use - (minus) or = (equals)? If minus, won't it keep getting smaller and smaller each time it's run?
Please show us the event where you're setting this up (screenshot of entire event window), and a screenshot of the skill.
Well, in that event, you don't add any Earth Shard to inventory, so by the end of that event, that variable is going to be 0. I also don't see where the reference to a variable is in the skill notes. Is Earth Shard item #19? Just because you're using variable 19, doesn't mean it's going to look at item 19, unless you've set them up to match. So your notes are telling it to look at the Item with id 19, not the item with the id of whatever number is in variable 19. And I don't actually see why you're setting variables, unless something OTHER than this script is using them?
It may well be an event issue, but because it's a particular script that you're trying to get working, and the script requires things to be set up a certain way, it goes into script support (ie - you wouldn't be having this problem if you weren't using the script).
edit: Oh, wait a minute - you've only shown part of the event. Can you show the missing bits too, please?
After the Intro event runs, can you verify that you DO have that item in inventory? At the time the skill is used, can you verify that you have the item in inventory? Are you using any scripts that modify the behaviour of party inventory that might be affecting this?
I think item 19 is actually the item in variable 12 because he is using variable 12 and item 19...
can you show a screenie of what it looks in-game?
and just to be clear, your problem is the description box right? if yes, then it's not a problem with the script since the script doesn't do anything to the description box... the custom costs on the notetag are reflected in the skill selection (in the same place where you show mp cost normally) and not in the description, so the tags and the script has nothing to do with it...
The skill still refers to item 19 though. I don't see any link between variable 12 and item 19. Of course, the Change Items and Control Variables don't actually show the item id, just the description.
The thing is I don't think his problems is with the notetags and the script, because that script does not do anything to the skill description, and as his posts says, he has a problem with the skill description...
which is why I want him to clarify it and post a screenie of what it looks in-game... coz if it's really the skill description, then it could simply mean that his variables aren't being set or something...
@OP - make sure you're not running it via Battle test too...
Ugh! Solomon, I'm sorry. I really should read things more thoroughly.
Can you give us a screenshot of your Skill window when that skill is highlighted? And after taking the screenshot, hit F9 (from the map) to go into debug, find variable 12, and confirm that there IS something in it other than 0?
wow, never knew of that debug thing...
anyway, we really need the screenshot and the situation when does his tests... I do hope it's not battle test...
Item 19 is Riot Codes. I give the player 5 Riot Codes to start. When battle is engaged, the Skill Description says Stock: 5. However, when I use the skill, it causes 1 of those Riot Codes to be taken out of my inventory. The variable is not updated to reflect that. Thus, when I end the battle, I have 3 Riot Codes yet the Variable stays at 5.
Ahhh... then it's with the script probably...
It won't update the variable unless you explicitly tell the script to do so in the <custom cost perform> block
so your custom cost perform block should look like this
<custom cost perform>
$game_variables[12] -= 1
</custom cost perform>
BTW, that means your first post is misleading, because on your first post you said it was staying at 0...
What about when you get more of the item?
At every moment when you can change the quantity you have in stock (buy screens, sell screens, any time you can use it, etc), you need to make it recalculate that variable.
I think the problem might be a misunderstanding of the control variable command...
"Control Variable [#] = [item] in inventory" will fill that variable with the number of the items in inventory AT THAT TIME!
If you change the numbers of the item in inventory, the variable WILL NOT BE UPDATED unless you process another "Control variable" command.
Updating that variable is usually not part of the script, as you did place the original value with the autorun event.
That autorun is only partially visible, but I assume that you switch it off at the end, because otherwise the player would never be able to move.
But if you do not repeat the control variable commands, then those variables will never update, always keeping the number you set at the beginning.
And I think that you just assumed the variable would automatically change to the value of the items in inventury after "assigning" them, but the control variable command does not assign, it's a one-time-only data transfer.
I was playing someone else's project, and the variables changed each time the attack was used. How am I able to auto-update my variables in battle?
that game obviously uses scripts and replaces the default battlesystem.
But that alone doesn't even tell if the message was done by variables or if the entire message system was replaced.
And since the game doesn't contain the project file, no one can check how it was done there.
As I told before, there are several options how to do that - you have to test which one would be best for you from the methods I mentioned above.
But you as the developer are the one who is responsible for updating the Game-Variables, they will not update automatically in a default project.
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.