I'm having trouble setting a variable in the damage formular of a certain skill, because nothing I do seems to work and I have done at least 1 hour of research and nothing i found worked so i wanted to ask if its possible to change the value of let's say variable 34 to 1 and if it is then how would i do it?
Skill Set Variable
RPG Maker MV SupportTry using "$gameVariables.value(x)" in your formula, where x is your variable ID.
I actually thought he wanted to use a variable in the skill damage formula. My bad. XD
i have already tried that and i just couldnt get it to work even one of my friends tried and it didnt work for them either so we must be doing something wrong or there is a bug in rpg maker
If you mean to "use a variable" in your damage formula as I assumed, I tried it myself and it works.
You have to "set" the specific variable before a value will be added to your damage formula.
For example, in Scene A, something happens where you want the Attack power variable (let's say variable 3) to be set to 10, (which might be added to other calculations in your Attack damage formula), you have to set an event command "Control Variable 3 = 10" (or using the script call that waynee95 showed). Only then will your variable 3 have a value of 10 in it to used in your damage formula.
If you don't set a value to your variable before using it, it will be just zero. Hope that helps.
If you're still having trouble, please show a screenshot of when you set the variable, and your damage formula, or you can PM me an empty project of how you made your variables event and damage formula (please remove all the audio and graphic files if you do).
You have to "set" the specific variable before a value will be added to your damage formula.
For example, in Scene A, something happens where you want the Attack power variable (let's say variable 3) to be set to 10, (which might be added to other calculations in your Attack damage formula), you have to set an event command "Control Variable 3 = 10" (or using the script call that waynee95 showed). Only then will your variable 3 have a value of 10 in it to used in your damage formula.
If you don't set a value to your variable before using it, it will be just zero. Hope that helps.
If you're still having trouble, please show a screenshot of when you set the variable, and your damage formula, or you can PM me an empty project of how you made your variables event and damage formula (please remove all the audio and graphic files if you do).
No im not trying to show it i am trying to do what waynee95 did but it doesnt work and the reason i need it is because i use a skill which should set the variable to 1 using the damage formular and then it plays a common event where it checks if the variable is 1 and i have several of these skills that use the same common event but the variable should be set to something else like 2 or 3
I don't think you were supposed to be able to set a variable that way in the damage formula box. The damage formula is supposed to be for just that : damage formulation. Unless someone else has proven otherwise (or if there are plug-ins for this effect), you could set separate common events for separate skills instead.
The problem is that i cant use 1 common event for each skill because i will be using it for a crafting system so that would mean that i would quite possibly have over 100 common events just for that one mechanic in my game and i would much rather use just 1 common event but if there is a plugin that adds a way to set variables using the damage formular then i would like a link for it 🙂
Can you post your current damage formula?
$gameVariables.setValue(34, 1); is the damage formular i am using and it is set to hp recovery if thats needed info
Did you set a scope for the skill?
EDIT: It seems that the damage formula will only be executed, when the skill has a scope set.
@laugexd
EDIT2: You want to check that variable inside a Common Event right?
Instead of checking a variable that is set inside a damage formula, you can just check which skill or item was used in battle. Add a Common Event to the skill or item, inside that event you can use some conditional branches with some scriptcalls to check the used skill.

EDIT: It seems that the damage formula will only be executed, when the skill has a scope set.
@laugexd
EDIT2: You want to check that variable inside a Common Event right?
Instead of checking a variable that is set inside a damage formula, you can just check which skill or item was used in battle. Add a Common Event to the skill or item, inside that event you can use some conditional branches with some scriptcalls to check the used skill.

i tried using the conditional branch you used at the top of the image (i didnt use the script under it) and it just gave me an error about "isSkill undefined" or something along those lines
Can you post that common event?
You have a typo: BattleMananger.
i get the same error as before... could you send exactly what you wrote in as in text so i can copy and paste it?
Okay, then try
PHP:
BattleManager._action && BattleManager._action.isSkill() && BattleManager._action.item().id === 48
i dont get an error but the conditional branch still says it doesnt work also i downloaded your storage system which i will be using in my game and i have credited you. i just thought it looked good so 😛
Are you sure you have the right id at the end?
And thanks. 🙂
And thanks. 🙂
Original thread: https://forums.rpgmakerweb.com/threads/skill-set-variable.83051/