Custom resource(instead of using MP or TP)

Hello

So what I want to do is for a certain class to use a custom resource for 4 skills.

I did it in a way but its not working as I want it when it comes to items. I want to make a potion to raise my custom resource, but when I am doing that it raises a variable, and that means that anyone can drink the potion and the variable will still raise for my other character to use.

I sort of fixed the issue with yanfly's item requerment plug in, but it has fixed 50% of the issue.
Now if I have 2 of the same class, they both can use this item and raise the custom's resource variable, and when one of them casts a spell it will be depleted for both actors..

so is there a proper way to make a custom resource that only one class can use?
Could you just assign the the potion to only affect the actor that uses it? Since you got it to work with only the classes can you get it to do the same thing but with actors instead? That way it can only affect one character.
The
Could you just assign the the potion to only affect the actor that uses it? Since you got it to work with only the classes can you get it to do the same thing but with actors instead? That way it can only affect one character.
The problem is that when they use the potion it affects the variable , and this variable is used for eveyone.. Its like i drink a potion of mana and the mana it fills the mp of all the party and when I am using skills it depletes the mana of all members of the party
@leontas2007

So what you want is a resource that all characters use but they don't share the same variable? If this is true would setting a resource variable for each actor solve the problem?
@leontas2007

So what you want is a resource that all characters use but they don't share the same variable? If this is true would setting a resource variable for each actor solve the problem?
Sadly...no.. Because if I do that, I have to create duplicates of all items ,equipments, again for each actor..
Sadly...no.. Because if I do that, I have to create duplicates of all items ,equipments, again for each actor..

You can set an item to do a common event under 'Other' in the Effects section of the item. There may be an easier way to do it, and I'll keep thinking on it but for now you could make the potion trigger a common event which checks for what actor is using it and restore the amount of resource that you'd like.

For example you could have a potion give the user a blank state then have the potion trigger a common event that checks for what actor has the state applied to them. Once it find the actor with the state applied can restore the resource and remove the blank state.
If this is hard to understand I can set it up and show you a picture of what I mean.
I haven't a pc in front of me to test it yet. I have a break at work now and i have a couple of hours to go home.

So today or tommorow I will test what you said and post the results.

Thank you very much for your time

(For both posts that I made)
I haven't a pc in front of me to test it yet. I have a break at work now and i have a couple of hours to go home.

So today or tommorow I will test what you said and post the results.

Thank you very much for your time

(For both posts that I made)

Glad I could help, If I think of a better way to do things I'll let you know. ^^
You can set an item to do a common event under 'Other' in the Effects section of the item. There may be an easier way to do it, and I'll keep thinking on it but for now you could make the potion trigger a common event which checks for what actor is using it and restore the amount of resource that you'd like.

For example you could have a potion give the user a blank state then have the potion trigger a common event that checks for what actor has the state applied to them. Once it find the actor with the state applied can restore the resource and remove the blank state.
If this is hard to understand I can set it up and show you a picture of what I mean.

It works. I did exactly what I did with my other problem with the burn states and it works. The only problem now is that I use a lot of variables and common events. At least I don't have to create duplicates of the items
It works. I did exactly what I did with my other problem with the burn states and it works. The only problem now is that I use a lot of variables and common events. At least I don't have to create duplicates of the items

Yeahh.. sorry Its a difficult thing to do without plugins that was the easiest and shortest way I could think of.
Why can't/don't you use this plugin:
Yanfly Skill Cost Items.(It requires Skill Core by Yanfly)
Why can't/don't you use this plugin:
Yanfly Skill Cost Items.(It requires Skill Core by Yanfly)
I am using this plugin, the problem isn't the skill cost but where the custom resource is stored and how actors can access to it. I want only one class to have access and be affected to my custom resource, but its really hard to actualy do it.
With lunatic mode this can be done really easily.
But I need some questions answered first.

1.what is this variable used for? ie is it used in another skill or to increase the power of the skill?

2.Is this skill usable by other classes, ie the chemist class uses healing potions for this skill cost , while the white mage uses mp?

3.Does the variable need to be triggered whenever a person who has this skill uses the item? When they use the skill? Or just when they are the class and use this item?
The difference between them, is the first one will only increase the variable when they have the skill and use the item(either in or out of combat). The second will increase the variable when the skill is used. The third will increase the variable when they are the class that can use the skill, and when they use the item(in or out of battle) regardless if they have the skill or not.

4. If you want the variable tied to item usage do you want it, to increase even when it is not used as a skill cost. Ie the chemist uses a heal potion to cure themselves, it increase the variable. They use heal which increase potion, as the skill cost are potions.

5.And let me make sure I understand your post correctly.
You want a skill to use a item. The item alone can be used by anyone, but when actors of a specfic class, lets say chemist, uses the item it increases a variable, that affects something, and relates to the skill cost of the skill that uses the item. This skill may or maynot be used by other classes but when it's used by the chemist class, the skill cost is the item.
With lunatic mode this can be done really easily.
But I need some questions answered first.

1.what is this variable used for? ie is it used in another skill or to increase the power of the skill?

2.Is this skill usable by other classes, ie the chemist class uses healing potions for this skill cost , while the white mage uses mp?

3.Does the variable need to be triggered whenever a person who has this skill uses the item? When they use the skill? Or just when they are the class and use this item?
The difference between them, is the first one will only increase the variable when they have the skill and use the item(either in or out of combat). The second will increase the variable when the skill is used. The third will increase the variable when they are the class that can use the skill, and when they use the item(in or out of battle) regardless if they have the skill or not.

4. If you want the variable tied to item usage do you want it, to increase even when it is not used as a skill cost. Ie the chemist uses a heal potion to cure themselves, it increase the variable. They use heal which increase potion, as the skill cost are potions.

5.And let me make sure I understand your post correctly.
You want a skill to use a item. The item alone can be used by anyone, but when actors of a specfic class, lets say chemist, uses the item it increases a variable, that affects something, and relates to the skill cost of the skill that uses the item. This skill may or maynot be used by other classes but when it's used by the chemist class, the skill cost is the item.

Ok, I have a custom resource, exactly like TP, its the exact same thing, but instead of TP the name is rage and its only used for one class.
I just like TP, I have made some skills to give you rage when you hit the enemy.
Rage is stored in a variable.

Now what I want to so with this, is to make a potion for example that restores our rage, just like an HP, MP, TP potion.

The problem with this, is that when I use the potion what it does is just to add a number to a variable with the name rage with a common event, so if a random person drinks the potion the number will still be added to the variable.

Example.

Borg is a "berserker" and uses "rage" to do some of his skills.

Gabriel is a "rogue" and takes the rage pill that refills the rage, but rogues don't use rage, but no matter the class, the rage pill is still used on Gabriel and Borg's rage is filled, which makes zero sense because Borg never used a rage pill to fill his rage.
I'm assuming your using Yanfly Skill Core.

Place this notetag in the item that would be the rage pil. x is the id of the variable that's connect to the rage, y is the id of the class that uses rage, and w is the amount you want to add. No need for mess common event.
<After Eval>
if(user.currentClass().id === "y"){
var values = ($gameVariables.value(x) + w);
$gameVariables.setValue(x, values);
} else{}
</After Eval>

If you have seprate variables for rage per actor that uses this class then:
l, m, n represent the id of the specfic actor. So in the if statement, checks the class id of the user and the id of the user.
x, z and a represent the variable id.
So if user is actor 1 and is the berserk class then a spefic variable will increase. and then if it's actor 2 and so on and so on.
<After Eval>
if(user.currentClass().id === "y" && user.actorId() === "l"){
var values = ($gameVariables.value(x) + w);
$gameVariables.setValue(x, values);
} else if(user.currentClass().id === "y" && user.actorId() === "m"){
var values = ($gameVariables.value(z) + w);
$gameVariables.setValue(z, values);
} else if(user.currentClass().id === "y" && user.actorId() === "n"){
var values = ($gameVariables.value(a) + w);
$gameVariables.setValue(a, values);
} else{}
</After Eval>
I'm assuming your using Yanfly Skill Core.

Place this notetag in the item that would be the rage pil. x is the id of the variable that's connect to the rage, y is the id of the class that uses rage, and w is the amount you want to add. No need for mess common event.
<After Eval>
if(user.currentClass().id === "y"){
var values = ($gameVariables.value(x) + w);
$gameVariables.setValue(x, values);
} else{}
</After Eval>

If you have seprate variables for rage per actor that uses this class then:
l, m, n represent the id of the specfic actor. So in the if statement, checks the class id of the user and the id of the user.
x, z and a represent the variable id.
So if user is actor 1 and is the berserk class then a spefic variable will increase. and then if it's actor 2 and so on and so on.
<After Eval>
if(user.currentClass().id === "y" && user.actorId() === "l"){
var values = ($gameVariables.value(x) + w);
$gameVariables.setValue(x, values);
} else if(user.currentClass().id === "y" && user.actorId() === "m"){
var values = ($gameVariables.value(z) + w);
$gameVariables.setValue(z, values);
} else if(user.currentClass().id === "y" && user.actorId() === "n"){
var values = ($gameVariables.value(a) + w);
$gameVariables.setValue(a, values);
} else{}
</After Eval>
I am learning javascript trying to learn exactly the things that you wrote! You know so much, when you can write any code you want the possibilites are endless.

Thank you very much.

As for the rage per actor, I was trying to make it per class, but since its stored in one variable, this is not possible. This creates a problem when you want to make class change ingame. If the player can change to a berseker ingame, then this can be a challenge to make it work.
im kinda in a similar situation right now. in my case i want
buying/selling crafting materials = variable x currency type (yanflys more currencys)
Alchemist class have, variable x as a skill cost for most skill.
is there some way i can do that? or am i goin to have to make that 1 currency type as an item with an insane stack quantity (yanflys skill cost item)
@Tiamat-86 commenting a question on someone elses help thread, can get you in trouble with the mods.
However to answer your question, I'm assuming you have the same variable for everything ie variable 5 is the cost for the crafting items and that anyone who is the alchemist class would be using vairiable 5, well in that case, place this code in the skill notetag box, this is assuming that these skills are only used by alchemist class. And you need Yanfly Skill Core:

<Custom Requirement>
if ($gameVariables.value(x) >= y) {
value = true;
} else {
value = false;
}
</Custom Requirement>
<Custom Execution>
$gameVariables.setValue(x, -y);
</Custom Execution>
<Custom Cost Display>
\c[4]y\c[0] VariableName
</Custom Cost Display>

X is the variable id
Y is the cost if the skill
VariableName is the name of the Variable

Original thread: https://forums.rpgmakerweb.com/threads/custom-resource-instead-of-using-mp-or-tp.86768/