Items with more than 1 use

Marioman13

Imaginationer
Veteran
Joined
Jan 3, 2015
Messages
41
Reaction score
6
First Language
English
Primarily Uses
I want to create an item that can be used several times. Is there a script that does this?
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,712
First Language
English
Primarily Uses
RMVXA
You probably don't need a script.  Depending on exactly what you want to do:

Set up your item so that all it does is call a common event.

In that common event, have a conditional with a variable switch set to e.g. 5 (if you want the item to be used 5 times).

When the common event is called, it checks what the variable is.  If it is greater than zero, it does whatever the action is that the item is meant to do and reduces the variable by one.

When the variable hits zero, you have some suitable message.
 

Marioman13

Imaginationer
Veteran
Joined
Jan 3, 2015
Messages
41
Reaction score
6
First Language
English
Primarily Uses
Darn. I forgot to mention without a script, since I have so many. Testing this script out on a new project worked well, though.

You probably don't need a script.  Depending on exactly what you want to do:

Set up your item so that all it does is call a common event.

In that common event, have a conditional with a variable switch set to e.g. 5 (if you want the item to be used 5 times).

When the common event is called, it checks what the variable is.  If it is greater than zero, it does whatever the action is that the item is meant to do and reduces the variable by one.

When the variable hits zero, you have some suitable message.
Ah, variables! I should of thought of that myself. Thanks!
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Can't you just set it to not consume?
 

Dymdez

Newbie-in-Chief
Veteran
Joined
Feb 4, 2014
Messages
752
Reaction score
154
First Language
English
Primarily Uses
Variables work best, because that will allow the player to also "recharge" their items, too!

Setting to not consume won't solve the problem, because he wants an eventual limit, I presume.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
lol - setting it to "not consume" means it won't be consumed, so can be used again and again. You COULD just increment a variable in the common event, and if it reaches a certain number, reset the variable to 0 and remove 1 of the item from your inventory (assuming you could have several of them, so it would start counting again with the next item).
 

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,867
Messages
1,017,062
Members
137,575
Latest member
akekaphol101
Top