There's a way I can do this through multiple common events, but I am trying to decrease my amount of common events and put the event into just one due to the amount of this particular type of item. Efficiency and all that. That's why I'm posting this under Javascript/Plugin Support, as I'm thinking I'll either need a plugin, or some Yanfly notetag for this to do as I want.
I have an item called "Basket of Fruit." Scope is set to "None." On use of the item, the party receives +5 apples. This is done by calling a common event, and then adding +5 apples to inventory. Simple enough.
The problem I have is that I have a lot of these "Baskets." Basket of Fruit, Basket of Vegetables, Basket of... Whatever, etc. etc. etc.
So I'd like to just use 1 common event with multiple conditional branches that checks for a state (or variable) before doing adding the items. The item would do this on activation:
Setting the scope to "None" does what I want, but it doesn't add the state to anyone, so while the common event technically runs, it's not doing anything because no one has a state. Alternatively, with a scope of "None," I tried setting a variable using a damage formula "v[38] = 1" and making the conditional, "If variable 38 = 1, then +5 apples" but that didn't work either.
Any ideas?
Sorry for the wall of text. I feel like this is a simple matter and I overexplained myself, lol.
I have an item called "Basket of Fruit." Scope is set to "None." On use of the item, the party receives +5 apples. This is done by calling a common event, and then adding +5 apples to inventory. Simple enough.
The problem I have is that I have a lot of these "Baskets." Basket of Fruit, Basket of Vegetables, Basket of... Whatever, etc. etc. etc.
So I'd like to just use 1 common event with multiple conditional branches that checks for a state (or variable) before doing adding the items. The item would do this on activation:
- Add an invisible state ("Fruit," "Vegetable," etc.) (or alternatively, set a variable, which would help cut down on the # of states I have)
- Call on the common event "Gain Items"
- Common event contains multiple conditional branches. "If actor has state Fruit, then +5 apples." "If actor has state Vegetables, then +5 broccoli."
- Common event then removes the state from the actor.
- User is free to now open up their basket of Vegetables and repeat the process.
Setting the scope to "None" does what I want, but it doesn't add the state to anyone, so while the common event technically runs, it's not doing anything because no one has a state. Alternatively, with a scope of "None," I tried setting a variable using a damage formula "v[38] = 1" and making the conditional, "If variable 38 = 1, then +5 apples" but that didn't work either.
Any ideas?
Sorry for the wall of text. I feel like this is a simple matter and I overexplained myself, lol.
