Would it be possible to have a passive state that reduces the cost of shops?

So I had an idea for a state/skill. Let's call it Haggle. By having learned the skill Haggle, it would grant a passive state that gives the player a 10% discount at all shops. This could be stacked by having more active party members that also know Haggle, so that if each of your 4 party members knows it, you get a 40% discount on all purchases.

But uh... I have no idea how I could go about doing this. Is something like this even possible? Like, how can I make a passive state that is always active as long as a skill is learned, and how can I make a state affect shop prices? Could it be done through Common Events maybe? Somehow I think it can't be done... but I thought I'd ask anyway. So if it IS possible... how can I do it?

Edit: Also, could this maybe be achieved by an actor wearing a specific piece of equipment?
Just to confirm - your profile says you use VX Ace, but you posted in MZ support. This question is for MZ?

Are you using VisuStella States for passive states?

The answer is...pretty easily. Presuming you're on MZ using VisuStella Skills and States Core to have passive states, they included in the documentation a script call to check for a passive state.

So in your event talking to a shopkeeper, you do:
Conditional Branch -> Tab 4 Script -> $gameParty.members()[0].states().includes($dataStates[X])
--Shop Processing, and you can on that screen specify whatever prices you want for the items.
-Else
--Shop Processing with the default prices

You'd replace X in the script with the ID of your Haggle state, and that's checking for the party leader to have it. If you want to do something different, like see if any party member has it, let me know.
Just to confirm - your profile says you use VX Ace, but you posted in MZ support. This question is for MZ?

Are you using VisuStella States for passive states?

The answer is...pretty easily. Presuming you're on MZ using VisuStella Skills and States Core to have passive states, they included in the documentation a script call to check for a passive state.

So in your event talking to a shopkeeper, you do:
Conditional Branch -> Tab 4 Script -> $gameParty.members()[0].states().includes($dataStates[X])
--Shop Processing, and you can on that screen specify whatever prices you want for the items.
-Else
--Shop Processing with the default prices

You'd replace X in the script with the ID of your Haggle state, and that's checking for the party leader to have it. If you want to do something different, like see if any party member has it, let me know.

Oops, yeah, I've used VX Ace before, but am currently using MZ. I guess I should update that lol.

I haven't used that plugin yet, but I'll check it out!

And yeah, I want it to check for each actor in the party. So if all 4 actors in your party have the Haggle state, then it'd give you a total of a 40% discount. Also, will that script call also apply to reducing the cost of inns?
Also, will that script call also apply to reducing the cost of inns?
It sounds like you might want to mess around in the event editor some more, maybe do a few tutorials on eventing. Shops and inns have nothing to do with scripting, the example I gave you is a very basic use of the Conditional Branch event command: if this is true, do this, else do a different thing.

You can put any event commands you want inside of conditional branches; shop processing, inns, battles, show text, whatever.
And yeah, I want it to check for each actor in the party. So if all 4 actors in your party have the Haggle state, then it'd give you a total of a 40% discount.
Okay, that'll make your event a bit longer, but not really more complex. You'll use a script call on the very first line to set a variable equal to how many party members know Haggle.
Script -> $gameVariables.setValue(VarID, $gameParty.members().filter(member => member.states().includes($dataStates[StateID])).length)

Conditional Branch -> VarID==4
--Shop Processing with your prices set to 40% discount
-else
--Conditional Branch -> VarID==3
---Shop Processing with 30% discount
--else
---Conditional Branch -> VarID==2
----Shop Processing with 20% discount
---else
----Conditional Branch -> VarID==1
-----Shop Processing with 10% discount
----else
-----Shop Processing at normal prices

In the script replace StateID with the ID of your Haggle state. In the script and every conditional, you'd replace VarID with the ID of an unused variable in your game.
It sounds like you might want to mess around in the event editor some more, maybe do a few tutorials on eventing. Shops and inns have nothing to do with scripting, the example I gave you is a very basic use of the Conditional Branch event command: if this is true, do this, else do a different thing.

You can put any event commands you want inside of conditional branches; shop processing, inns, battles, show text, whatever.

Okay, that'll make your event a bit longer, but not really more complex. You'll use a script call on the very first line to set a variable equal to how many party members know Haggle.
Script -> $gameVariables.setValue(VarID, $gameParty.members().filter(member => member.states().includes($dataStates[StateID])).length)

Conditional Branch -> VarID==4
--Shop Processing with your prices set to 40% discount
-else
--Conditional Branch -> VarID==3
---Shop Processing with 30% discount
--else
---Conditional Branch -> VarID==2
----Shop Processing with 20% discount
---else
----Conditional Branch -> VarID==1
-----Shop Processing with 10% discount
----else
-----Shop Processing at normal prices

In the script replace StateID with the ID of your Haggle state. In the script and every conditional, you'd replace VarID with the ID of an unused variable in your game.

Just finally had the chance to try it out. Seems to work fine! Thanks! 😀

Original thread: https://forums.rpgmakerweb.com/threads/would-it-be-possible-to-have-a-passive-state-that-reduces-the-cost-of-shops.149592/