Chance to Refund Item in Battle

Vis_Mage

Novice Magician
Veteran
Joined
Jul 28, 2013
Messages
574
Reaction score
196
First Language
English
Primarily Uses
RMMV
Hey! :kaohi:

I was wondering if anyone could help me with a (hopefully simple) script request.

Pretty much, I'm hoping for a script that a % chance (possibly stored in a variable to allow for mid-game % changing) to have an item used within battle to be refunded (not used up), ideally with a message in the battle log saying "Got a Freebie!" or something of the nature.

A couple other cool features might be allowing to have items with different refund % (as notetags or listed in the script itself), or having equipment that could raise the odds, but I wouldn't worry about it if it proves to be difficult.

Thank you!:kaopride:
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,592
Reaction score
6,522
First Language
Indonesian
Primarily Uses
RMVXA
To put it simple
> You use a heal pot in battle
> There's 50% chance that the item is refunded after battle
> You got the chance
> After battle, you get the item back?

Not sure why anyone would want that and what kind of concept that need it. But it should be doable.
 

Vis_Mage

Novice Magician
Veteran
Joined
Jul 28, 2013
Messages
574
Reaction score
196
First Language
English
Primarily Uses
RMMV
To put it simple
> You use a heal pot in battle
> There's 50% chance that the item is refunded after battle
> You got the chance
> After battle, you get the item back?

Not sure why anyone would want that and what kind of concept that need it. But it should be doable.
Just about, only difference being that the refund (and text) would happen directly after using the item in battle, before the next action.

Mostly wanting to use it for a Scavenger-esque class, and to give a little extra incentive to the often overlooked consumable items. It's kinda like a critical hit, but with items! :kaopride:
 

Harosata

Dramatic Lightning's BFF
Veteran
Joined
Aug 20, 2015
Messages
246
Reaction score
70
First Language
English
Primarily Uses
RMVXA
At one level, it would be easy because the Game_Party's consume_item is simply a lose_item, so it is possible to put in the similarly structured gain_item with a rand < 0.5 (example chance) and in_battle (switch for checking battle mode). Just as it is easy (for some of us) to make the notetag to make our own chances.

However, I'd had to work out the message part, so perhaps put that part around the call to the battle log or activate a switch.
 

A-Moonless-Night

WINTER IS COMING
Veteran
Joined
Mar 17, 2012
Messages
681
Reaction score
446
First Language
English
Primarily Uses
RMVXA
Here you go. Let me know if there's anything missing.
 

Vis_Mage

Novice Magician
Veteran
Joined
Jul 28, 2013
Messages
574
Reaction score
196
First Language
English
Primarily Uses
RMMV
Here you go. Let me know if there's anything missing.
Thank you, it works great! :kaothx:

Only ran into one thing that might be worth looking into. If you have the message style set to :log, the "Player recovered the Potion" text overwrites the item's effect ( such as"Player recovered 20 HP").
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,865
Messages
1,017,059
Members
137,575
Latest member
akekaphol101
Top