Random Panda

Veteran
Veteran
Joined
May 3, 2016
Messages
120
Reaction score
31
First Language
English
Primarily Uses
RMMV
Hi All,

I have been doing my best to make a unique piece of equipment that would allow the equipped actor to use two different items in one turn. Similar to W-item in FF7. I have made a little bit of progress, but I definitely need some help. So far my biggest lead seems to be utilizing this Script call:

Code:
SceneManager._scene.commandItem();

Which can bring up the item menu whenever I call it, but if I try to use any item I get a "TypeError: Cannot read property 'setItem' of null". I guessing that this is because I'm calling the item menu and the game doesn't know which actor is calling it. But like I said, I'm guessing...

Regardless, I was wondering if anyone here knew of a way to properly call the battle version of the item menu through scripts. Or even a completely different way of getting this two item effect to work. Any help is greatly appreciated as always.
 

Aphotic

Veteran
Veteran
Joined
Feb 19, 2019
Messages
54
Reaction score
32
First Language
English
Primarily Uses
RMMV
Hi All,

I have been doing my best to make a unique piece of equipment that would allow the equipped actor to use two different items in one turn. Similar to W-item in FF7. I have made a little bit of progress, but I definitely need some help. So far my biggest lead seems to be utilizing this Script call:

Code:
SceneManager._scene.commandItem();

Which can bring up the item menu whenever I call it, but if I try to use any item I get a "TypeError: Cannot read property 'setItem' of null". I guessing that this is because I'm calling the item menu and the game doesn't know which actor is calling it. But like I said, I'm guessing...

Regardless, I was wondering if anyone here knew of a way to properly call the battle version of the item menu through scripts. Or even a completely different way of getting this two item effect to work. Any help is greatly appreciated as always.
I don't know if this is the most efficient way, but you could accomplish something like this by using a handful of Yanfly plugins: Instant Cast, Skill Core, and Auto Passive States. Skill Core and Auto Passive States are free, but Instant Cast is not.

This is a long explanation, so bear with me.

You would start by making two states, let's call them "Additional Item" and "Item Used." For the purposes of this explanation, "Additional Item" will be Id 1 and "Item Used" will be Id 2.

"Additional Item" would be invisible and would have the effect of making items instant cast. You would just put <Instant Cast Item: x to y> in the state notes, where 'x' and 'y' are the range of items you want to be instant cast. If all items, then just '1' to the highest item ID.

You would then want to check that an item hasn't already been used by using this script in "Additional Item" state.

Code:
<Custom Passive Condition>
\\if the user has "Item Used", they
\\will not get "Additional Item"
if (user.isStateAffected(2)) {
condition = false;
\\otherwise they will
} else {
condition = true;
}
</Custom Passive Condition>

"Item Used" would be a check that an item has been used. It would be applied whenever we use an item and it would need to accomplish two things: make it so items AREN'T instant, and that 'Item' is the only action you can take.

Your would first make "Item Used" Remove at Action End, and then in its notes you would want to disable every relevant command. To do this, you could use Victor Engine's Command Replace plugin and put a tag into the "Item Used" state for each relevant command,
<command replace: 'Attack', ''>,
<command replace: 'Skill', ''>, etc, which will effectively remove each command except for Item.
You would then include a tag in the notes of EVERY item that should be affected that adds the "Item Used" state IF "Additional Item" is active.

Code:
//This will add our "Item Used" state if
//the user has the "Additional Item" (passive) state
//adjust 1 and 2 to the correct Ids in your own setup
<Before Eval>
if (user.isStateAffected(1)) {
user.addState(2);
}
</Before Eval>

Note: there may be a way to call this script whenever ANY item is used without putting it in the notes of EVERY item, but I'm not sure how to accomplish this.

Finally we just need to attach the "Additional Item" passive state to the equipment itself.

I haven't had a chance to personally test this, but the flow would essentially be this:

-User wearing the equipment has the "Additional Item" state. They can use any normal action that isn't an Item, ending their turn, or use an Item, which will be Instant Cast.
-If they use an Item, apply the "Item Used" state, which will restrict their standard action to another item, also disabling the "Additional Item" state so that this Item is NOT Instant Cast.
-Their turn ends and removes the "Item Used" state, which in effect reapplies the "Additional Item" state for their next turn.

Hope this helps!
 

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
3,009
Reaction score
2,305
First Language
Portuguese - Br
Primarily Uses
RMMZ
Hi there!
Let me see if I understand you:
  1. Do you want an actor to be able to use two specific items when he is equipping a specific armor?
  2. Or do you want an actor to USE two specific items when he equips a specific armor?
 

Random Panda

Veteran
Veteran
Joined
May 3, 2016
Messages
120
Reaction score
31
First Language
English
Primarily Uses
RMMV
I don't know if this is the most efficient way, but you could accomplish something like this by using a handful of Yanfly plugins: Instant Cast, Skill Core, and Auto Passive States. Skill Core and Auto Passive States are free, but Instant Cast is not.

This is a long explanation, so bear with me.

You would start by making two states, let's call them "Additional Item" and "Item Used." For the purposes of this explanation, "Additional Item" will be Id 1 and "Item Used" will be Id 2.

"Additional Item" would be invisible and would have the effect of making items instant cast. You would just put <Instant Cast Item: x to y> in the state notes, where 'x' and 'y' are the range of items you want to be instant cast. If all items, then just '1' to the highest item ID.

You would then want to check that an item hasn't already been used by using this script in "Additional Item" state.

Code:
<Custom Passive Condition>
\\if the user has "Item Used", they
\\will not get "Additional Item"
if (user.isStateAffected(2)) {
condition = false;
\\otherwise they will
} else {
condition = true;
}
</Custom Passive Condition>

"Item Used" would be a check that an item has been used. It would be applied whenever we use an item and it would need to accomplish two things: make it so items AREN'T instant, and that 'Item' is the only action you can take.

Your would first make "Item Used" Remove at Action End, and then in its notes you would want to disable every relevant command. To do this, you could use Victor Engine's Command Replace plugin and put a tag into the "Item Used" state for each relevant command,
<command replace: 'Attack', ''>,
<command replace: 'Skill', ''>, etc, which will effectively remove each command except for Item.
You would then include a tag in the notes of EVERY item that should be affected that adds the "Item Used" state IF "Additional Item" is active.

Code:
//This will add our "Item Used" state if
//the user has the "Additional Item" (passive) state
//adjust 1 and 2 to the correct Ids in your own setup
<Before Eval>
if (user.isStateAffected(1)) {
user.addState(2);
}
</Before Eval>

Note: there may be a way to call this script whenever ANY item is used without putting it in the notes of EVERY item, but I'm not sure how to accomplish this.

Finally we just need to attach the "Additional Item" passive state to the equipment itself.

I haven't had a chance to personally test this, but the flow would essentially be this:

-User wearing the equipment has the "Additional Item" state. They can use any normal action that isn't an Item, ending their turn, or use an Item, which will be Instant Cast.
-If they use an Item, apply the "Item Used" state, which will restrict their standard action to another item, also disabling the "Additional Item" state so that this Item is NOT Instant Cast.
-Their turn ends and removes the "Item Used" state, which in effect reapplies the "Additional Item" state for their next turn.

Hope this helps!
I'm attempting to try this out now. Thank you for the whole write up.

Hi there!
Let me see if I understand you:
  1. Do you want an actor to be able to use two specific items when he is equipping a specific armor?
  2. Or do you want an actor to USE two specific items when he equips a specific armor?
Closer to option 2: I want to be able to use any two items while equipped with a specific armor during battle.
 

Random Panda

Veteran
Veteran
Joined
May 3, 2016
Messages
120
Reaction score
31
First Language
English
Primarily Uses
RMMV
@Aphotic Thank you so much. That got me like 99% of the way there. Now I'm just dealing with setting up the command restrictions the way that I want them. Which I mostly have, I just need to figure out what to call to outright cancel a players turn. But I'll make a separate post if I can't figure that out. Since it is technically a different matter. But again thanks!
 

Aphotic

Veteran
Veteran
Joined
Feb 19, 2019
Messages
54
Reaction score
32
First Language
English
Primarily Uses
RMMV
I had considered that, the only thing I can think of is either allowing the character to Guard, or change the Guard action to a Wait/Cancel action entirely. I believe there are other plugins available to that allow to manually add action types. Good luck!
 

Latest Threads

Latest Posts

Latest Profile Posts

New sprites & animations for Mint and Beri are coming along!
Guh-Colorbound.gif
ScreenShot_10_5_2022_4_44_8.png
Mad O' Malley... a stick figure that's afraid of it's existence being erased. so they always start battle in an anxious state.
Before, I was drawing all the sprite work, super big and shrinking it down. Which was really time consuming if thing's changed. So instead I'm drawing the characters sketch, and then remaking it with pixel art instead.
Why are job interviews so terrifying. :kaodes:

Forum statistics

Threads
125,801
Messages
1,173,664
Members
164,964
Latest member
oliveleaf
Top