How to Check for Multiple of the Same Item

KholeG

Snek
Veteran
Joined
Apr 24, 2015
Messages
54
Reaction score
1
First Language
English
Primarily Uses
N/A
Hi guys!

I was wonder if there was a way I could check for multiple items at the same time in one script call.

Basically I want to make a basic crafting system without a huge fancy script, and I want to be able to check for multiple items with an ID value and make sure the player has enough of the items with said ID value, all in one script call.

Ex:

Player wants to craft item "Fork Lance"

Required Items:

2 Flotsam

3 Wood

2 Shells

Script then checks the player inventory for all 3 item IDs and then checks that there are enough of said item in the inventory.

Thanks for the help!
 

Chiakscare

Resident Tifaholic
Veteran
Joined
Jul 24, 2014
Messages
489
Reaction score
148
First Language
English
Primarily Uses
You could bind items to variables, then have Conditional Branches that check for a total number of that item's variable.

You'd only really need a script to make a crafting menu that shows the items and highlights them, etc; there's custom menu scripts available already; if you wanted the variable checking in the script itself, that's pretty easy to code; it's also easy to do in pure eventing.
 

KholeG

Snek
Veteran
Joined
Apr 24, 2015
Messages
54
Reaction score
1
First Language
English
Primarily Uses
N/A
In another game I'd been working on I did the crafting by checking for every subsequent item and it was tedious.

I have no idea how to script and I don't actually need a menu. Is there no way to call it in event as a script like;

check item id in player inventory - true/false (once for each id)

x number of item id = y (again once for each id)

if both = true, activate switch ID z

I can get around it with item variable binding, but that can also be tedious and I'm not quite sure how to do it properly.
 
Last edited by a moderator:

Kes

Global Moderators
Global Mod
Joined
Aug 3, 2012
Messages
21,381
Reaction score
10,824
First Language
English
Primarily Uses
RMVXA
Script then checks the player inventory for all 3 item IDs and then checks that there are enough of said item in the inventory.
I think you mean event in this part, not script.  In RM scripts and events are 2 very different things, and you need to be clear in your terminology, otherwise a lot of confusion can occur.

If you don't want to use a script, it can be done in a straightforward way in events, but it will be tedious (probably very tedious).  You will have to choose which option you find least bad.
 
Last edited by a moderator:

KholeG

Snek
Veteran
Joined
Apr 24, 2015
Messages
54
Reaction score
1
First Language
English
Primarily Uses
N/A
I think you mean event in this part, not script.  In RM scripts and events are 2 very different things, and you need to be clear in your terminology, otherwise a lot of confusion can occur.
No, actually I do mean script. By script, I mean the in event script. As in you use a script call in an event, and I'm referring to the script being called.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,641
Reaction score
2,971
First Language
Tagalog
Primarily Uses
If urbusing the script call conditional, you could always do

If a and b and c and so on
 
Last edited by a moderator:

KholeG

Snek
Veteran
Joined
Apr 24, 2015
Messages
54
Reaction score
1
First Language
English
Primarily Uses
N/A
What do you mean by that exactly? In my description?
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,641
Reaction score
2,971
First Language
Tagalog
Primarily Uses
Ibmean you can do

If $game_variables[1] == 2 and $game_variables[2] == 5 and so... on

As a condition so you only use 1 conditional to check for all required itens
 
Last edited by a moderator:

KholeG

Snek
Veteran
Joined
Apr 24, 2015
Messages
54
Reaction score
1
First Language
English
Primarily Uses
N/A
Alright, that makes a little more sense
 

Kes

Global Moderators
Global Mod
Joined
Aug 3, 2012
Messages
21,381
Reaction score
10,824
First Language
English
Primarily Uses
RMVXA
No, actually I do mean script. By script, I mean the in event script. As in you use a script call in an event, and I'm referring to the script being called.
That is not a script in RM  terminology.  It is, as you say, a script call (i.e. a call to a script).  Scripts are what you see in the script editor.  You do not have scripts in events.

You can, of course, use any form of words you like, but the chances are high that you will be misunderstood and potentially waste other peoples' time as they are quite likely to think you mean something else.
 

KholeG

Snek
Veteran
Joined
Apr 24, 2015
Messages
54
Reaction score
1
First Language
English
Primarily Uses
N/A
That is not a script in RM  terminology.  It is, as you say, a script call (i.e. a call to a script).  Scripts are what you see in the script editor.  You do not have scripts in events.

You can, of course, use any form of words you like, but the chances are high that you will be misunderstood and potentially waste other peoples' time as they are quite likely to think you mean something else.
My appologies, I'm still new to RM technology in the sense
 

Kes

Global Moderators
Global Mod
Joined
Aug 3, 2012
Messages
21,381
Reaction score
10,824
First Language
English
Primarily Uses
RMVXA
np.

Everything ends up with its own specialist terminology/jargon and I think in some other engines eventing is called scripting, so it can get very confusing.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
28,952
Reaction score
6,665
First Language
German
Primarily Uses
RMMV
It can be done by pure eventing, and a lot faster than that:

check item id in player inventory - true/false (once for each id)


x number of item id = y (again once for each id)


if both = true, activate switch ID z
Use the control variable command to get the number:


control variable:game data:item in inventory


then use conditional branch var >= number needed


If the item is not in inventory, the control variable will load zero - no need to check the existance of the item in extra lines.


The script line from Engr. Adiktuzmiko above still needs to fill the variables with the numbers, so it only combines several conditional branches into one line.


I suggest you follow the first link in my signature (starting point) and work through the tutorials linked there, especially the "Variables Guide" as that will help you understand how to use variables more effectively.
 

KholeG

Snek
Veteran
Joined
Apr 24, 2015
Messages
54
Reaction score
1
First Language
English
Primarily Uses
N/A
Thank you Andar, this really helped. I've got my issue all solved!
 

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

Latest Threads

Latest Posts

Latest Profile Posts

"Hey there! Hope you're having a nice day, you are awesome!"

(Of course the hand is awful :kaoswt: )
I need a new option on YouTube that goes "Dont recommend videos/channels in this language because I do not speak it"
I've reconsidered having a subclass system for my first two games since there will already be plenty of variation in playable actors and usable items in the games. The third game will need it because of the basis for the story but I want the actors in the first two to be more focused in their roles.
Behold! The Sea Doggo.
I am dead tired but at the same time I really wanna write a tutorial x_x

Forum statistics

Threads
93,372
Messages
911,774
Members
122,870
Latest member
BrokenBratva
Top