The RPG Maker Resource Kit

RMRK RPG Maker Creation => RPG Maker General => General Scripting => Topic started by: GEXROX on July 04, 2008, 09:53:43 AM

Title: Is there a 'code' for how many of a certain item/armor/weapon the player has?
Post by: GEXROX on July 04, 2008, 09:53:43 AM
Could someone tell me if there is a bit of code to call to say how many of a particular item/armor/weapon is in the player's inventory? thnx in advance and for all those who are thinking it, yes i am new to this whole Ruby thing. (personally im more fond of GML, but thats not even a programming language  :D) .
Title: Re: Is there a 'code' for how many of a certain item/armor/weapon the player has?
Post by: modern algebra on July 04, 2008, 01:46:15 PM
Just use Control Variable: Item [] in possession for items

For weapons and armor there is no evented way I know of, so the code is this:


$game_variables[variable_id] = $game_party.weapon_number (weapon_id)
$game_variables[variable_id] = $game_party.armor_number (armor_id)


That will only give the ones in your inventory though, and will not include armors or weapons that are equipped.
Title: Re: Is there a 'code' for how many of a certain item/armor/weapon the player has?
Post by: GEXROX on July 05, 2008, 01:19:34 AM
Thanks, it works perfectly! but also, if you replace the word 'armor' or 'weapon' with 'item', it works for the items, too! thanks for your help!
Title: Re: Is there a 'code' for how many of a certain item/armor/weapon the player has?
Post by: Sophist on July 05, 2008, 01:49:38 AM
Topic Resolved?

Please edit your first post and place [Resolved] in the topic title and select to lock this topic until it is necessary to open it again.

Thank you!

               -The Management
Title: Re: Is there a 'code' for how many of a certain item/armor/weapon the player has?
Post by: modern algebra on July 05, 2008, 02:00:28 AM
Yeah, but why use a script when you can use a built-in event command?  :police:
Title: Re: Is there a 'code' for how many of a certain item/armor/weapon the player has?
Post by: GEXROX on July 05, 2008, 01:03:49 PM
I don't know... i guess to save mucking around with variables for ages. Off topic for a minute, know of any good ff-style side-view cbs?
Title: Re: Is there a 'code' for how many of a certain item/armor/weapon the player has?
Post by: GEXROX on July 06, 2008, 07:22:38 AM
just joking. i know ur not allowed.