[RESOLVED] Checking items in inventory

Started by ShadowBlaze, April 07, 2009, 08:17:59 pm

Previous topic - Next topic

ShadowBlaze

April 07, 2009, 08:17:59 pm Last Edit: April 07, 2009, 10:31:48 pm by ShadowBabe
Hi, I am making a craft system out of events and I would like to know how to check a players inventory for how many items of a certain type he has, for example:

Some Dude: How many bombs would you like to make? It reqiures 1 Coconut to make 1 Bomb.

*Input Number: 10* *Then store in variable 1*

KAY, so here how do you check if he has 10 Coconuts in his inventory? Not just 1 Coconut but checking for more than 1.

The condition branch option where you check if Coconuts is in the inventory but it only checks if its in the inventory not how many is in the inventory.

So can anybody help me out? I think it needs a script for this to work. Just make the script store the number of items in a variable and then condition branch it, if you know what i mean. >_>
Results for being 100% left handed:

Things I know about you
1. Your reading my comment
2. Now your saying/thinking thats a stupid fact.
4. You didnt notice that i skipped 3.
5. Your checking it now.
6. Your smiling.
7. Your still reading my comment.
8. You know all you have read is true.
10. You didnt notice that i skipped 9.
11. Your checking it now.
12. You didnt notice there are only 10 facts

legacyblade

To check if the party has a certain number of an item (say coconuts ), use the following syntax in the "script" section of a conditional branch.

$game_party.item_number(item_id) == number


That would check to see if the item you're checking (who's ID you put between the parenthesizes) is equal to a certain number. Repalce the "==" with any other comparison sign (<<, >>, !=, <=, >=). If you want to assign the number of a particular item to a variable, do the following.

$game_party.item_number(item_id) = $game_switches[switch_number]


I don't have my computer, so I can't test these script calls out, but I'm pretty sure that's the correct syntax.

Landith

Quote from: legacyblade on April 07, 2009, 10:22:36 pm
$game_party.item_number(item_id) = $game_switches[switch_number]


I don't have my computer, so I can't test these script calls out, but I'm pretty sure that's the correct syntax.


If he want's to assign it to a variable, shouldn't h-she use

$game_party.item_number(item_id) = $game_variables[variableID]


not switches..?

legacyblade

oops, I'm tired. I meant variables. Thanks for catching that lani. Yes use the code snippet the poster above me provided, for it produces the desired effect.

ShadowBlaze

Thanks Legacy, and Lani for correcting it
Results for being 100% left handed:

Things I know about you
1. Your reading my comment
2. Now your saying/thinking thats a stupid fact.
4. You didnt notice that i skipped 3.
5. Your checking it now.
6. Your smiling.
7. Your still reading my comment.
8. You know all you have read is true.
10. You didnt notice that i skipped 9.
11. Your checking it now.
12. You didnt notice there are only 10 facts

Aqua

Um... you're supposed to use

$game_variables[variableID]= $game_party.item_number(item_id) 


If you're using the other one, then you'd be changing the number of item_id to what was in variableID.

ShadowBlaze

Yea, Aqua is right! He just got you both LOL!
Thanks Aqua for CORRECTING their mistakes.
Results for being 100% left handed:

Things I know about you
1. Your reading my comment
2. Now your saying/thinking thats a stupid fact.
4. You didnt notice that i skipped 3.
5. Your checking it now.
6. Your smiling.
7. Your still reading my comment.
8. You know all you have read is true.
10. You didnt notice that i skipped 9.
11. Your checking it now.
12. You didnt notice there are only 10 facts