Checking to see if you have something in your inventory

pparke2

Villager
Member
Joined
Jun 4, 2014
Messages
6
Reaction score
1
First Language
English
Primarily Uses
Guys,


I'm trying to create a Throw skill similar to Final Fantasy games of old. I am using Yanfly's Skill Core and Skill Require Items plugins. Basically I don't want the skill to show up in the menu unless you have a spare Sword to throw. I see they have a lunatic call to hide the skill in the menu like this 


<Custom Show Eval>


if (user.level > 50) {


visible = true;


} else {


visible = false;


}


</Custom Show Eval>


It won't show up unless the actor that can use the skill is level 51 or higher.


How would I change that to reflect whether or not the party has whichever weapon or armor is required to throw it at the enemy. 


I tried $gameParty.weapon(x) > 0 but it doesn't work. I have no knowledge of JavaScript either so anything helps.


Thanks.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Look at Game_Interpreter to see what it does under Conditional Branch when checking to see if a weapon is in inventory.
 

pparke2

Villager
Member
Joined
Jun 4, 2014
Messages
6
Reaction score
1
First Language
English
Primarily Uses
Look at Game_Interpreter to see what it does under Conditional Branch when checking to see if a weapon is in inventory.


 Shaz, I'm not sure what that is or how you would go about checking that.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
In the rpg_objects.js script, search for Conditional Branch (the text you search for is the text on the button in the event editor).

Code:
    case 9:  // Weapon
        result = $gameParty.hasItem($dataWeapons[this._params[1]], this._params[2]);
        break;
parameter 1 is the weapon, parameter 2 is whether you want to also look for equipped stuff.


So your test should be something like

Code:
$gameParty.hasItem($dataWeapons[1], false)
replacing 1 with the appropriate weapon id (no leading zeros)
 
Last edited by a moderator:

pparke2

Villager
Member
Joined
Jun 4, 2014
Messages
6
Reaction score
1
First Language
English
Primarily Uses
I figured out what you were talking about. Thanks for helping out!
 

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

Latest Threads

Latest Profile Posts

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
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

Forum statistics

Threads
105,868
Messages
1,017,074
Members
137,578
Latest member
JamesLightning
Top