Plugin Request: Equipment & Inventory Variables.

Berin90

Villager
Member
Joined
Jan 1, 2017
Messages
10
Reaction score
0
First Language
Italiano
Primarily Uses
Hi everyone!
I would need a plugin to assign the variable when the weapons is in inventory and also in the equipment.
Because i need to give the variables at all weapons in game.
Could you make this script for me?

I have seen the script by LadyBaskerville, That it called "Equipment Variables".

Thanks :cutesmile:
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,956
Reaction score
14,802
First Language
English
Primarily Uses
RMVXA

I've moved this thread to Plug-In Requests. Thank you.

 

LadyBaskerville

Hell-poodle
Veteran
Joined
Sep 12, 2016
Messages
667
Reaction score
564
First Language
German
Primarily Uses
RMMV
Now I feel bad for not thinking of this when you asked me in the other thread, but I only just realized: is there a reason why you can't use the Control Variable event command? It has an option to set a variable to the number of items in the inventory (with/without equipment). You could make a Common Event for setting the variable to the right value (with all the maths you need) and call it every time right before you use that variable.

Unless you need the variable in a context where you can't call a common event/do the calculations with Event Commands - in that case it would be great if you could give some more details on what exactly you want to do.
 

Berin90

Villager
Member
Joined
Jan 1, 2017
Messages
10
Reaction score
0
First Language
Italiano
Primarily Uses
Now I feel bad for not thinking of this when you asked me in the other thread, but I only just realized: is there a reason why you can't use the Control Variable event command? It has an option to set a variable to the number of items in the inventory (with/without equipment). You could make a Common Event for setting the variable to the right value (with all the maths you need) and call it every time right before you use that variable.

Unless you need the variable in a context where you can't call a common event/do the calculations with Event Commands - in that case it would be great if you could give some more details on what exactly you want to do.

Hi Lady, Thanks for your reply.
Then.. I being not expert, I don't know all the possible solutions, but..
I would like the game every time knew how many weapon my PG has with him. Both for the equipment and for inventory.
This is for make it work much events in this my game.
I hope i was clear to explaining what i would like. Because I do not speak English well eheh
 

LadyBaskerville

Hell-poodle
Veteran
Joined
Sep 12, 2016
Messages
667
Reaction score
564
First Language
German
Primarily Uses
RMMV
Ah, I think I understand now. So doing it with events would work in theory, but it would be very impractical to check for each weapon in the game how many the player has and add them all? Because if that is the case, I think a script call would work best. Basically, you could tell the program in any event "Count how many weapons (equipped and not equipped) the player has in total and set a variable to that number." Would that work for you? If yes, I can put the script call together for you later today.
 

Berin90

Villager
Member
Joined
Jan 1, 2017
Messages
10
Reaction score
0
First Language
Italiano
Primarily Uses
Ah, I think I understand now. So doing it with events would work in theory, but it would be very impractical to check for each weapon in the game how many the player has and add them all? Because if that is the case, I think a script call would work best. Basically, you could tell the program in any event "Count how many weapons (equipped and not equipped) the player has in total and set a variable to that number." Would that work for you? If yes, I can put the script call together for you later today.

Oh yes! Would work so.
When i want check the weapons of the Characters in the group (Both only for my principal character then for all character in the group) Just i call the script and it would works?
 

LadyBaskerville

Hell-poodle
Veteran
Joined
Sep 12, 2016
Messages
667
Reaction score
564
First Language
German
Primarily Uses
RMMV
Exactly. Here's the code; simply copy it into a Script Call event command:
Code:
var weaponCount = 0;
// add weapons in inventory
for (var i = 1; i <= $dataWeapons.length; i++) {
  weaponCount += $gameParty.numItems($dataWeapons[i]);
}
// add weapons in equipment
$gameParty.members().forEach(function(actor) {
  if (actor.equips()[0]) weaponCount++;
  });
// set a game variable to the total number of weapons
$gameVariables.setValue(6, weaponCount); // change the 6 in this line if you need to
This counts the total number of weapons in the party's inventory and in the equipment of all actors in the party. Then it sets a variable to that value - currently it uses variable #6, but you can just change that number in the last line of the script call.

If you don't want to include the equipment of every actor, but only of actor #1 (or a different one, you can change that again), use the following:
Code:
var weaponCount = 0;
// add weapons in inventory
for (var i = 1; i <= $dataWeapons.length; i++) {
  weaponCount += $gameParty.numItems($dataWeapons[i]);
}
// add weapons in equipment
if ($gameActors.actor(1).equips()[0]) weaponCount++; //change here for a different actor id
// set a game variable to the total number of weapons
$gameVariables.setValue(6, weaponCount);// change the 6 in this line if you need to

Let me know if it works; if there are any errors, I'll be back to fix them in a few hours (have to go to work for now).
 

Berin90

Villager
Member
Joined
Jan 1, 2017
Messages
10
Reaction score
0
First Language
Italiano
Primarily Uses
Exactly. Here's the code; simply copy it into a Script Call event command:
Code:
var weaponCount = 0;
// add weapons in inventory
for (var i = 1; i <= $dataWeapons.length; i++) {
  weaponCount += $gameParty.numItems($dataWeapons[i]);
}
// add weapons in equipment
$gameParty.members().forEach(function(actor) {
  if (actor.equips()[0]) weaponCount++;
  });
// set a game variable to the total number of weapons
$gameVariables.setValue(6, weaponCount); // change the 6 in this line if you need to
This counts the total number of weapons in the party's inventory and in the equipment of all actors in the party. Then it sets a variable to that value - currently it uses variable #6, but you can just change that number in the last line of the script call.

If you don't want to include the equipment of every actor, but only of actor #1 (or a different one, you can change that again), use the following:
Code:
var weaponCount = 0;
// add weapons in inventory
for (var i = 1; i <= $dataWeapons.length; i++) {
  weaponCount += $gameParty.numItems($dataWeapons[i]);
}
// add weapons in equipment
if ($gameActors.actor(1).equips()[0]) weaponCount++; //change here for a different actor id
// set a game variable to the total number of weapons
$gameVariables.setValue(6, weaponCount);// change the 6 in this line if you need to

Let me know if it works; if there are any errors, I'll be back to fix them in a few hours (have to go to work for now).

Omg, i love you!:kaoluv:
Ok.. hahaha I'm sorry for this my sudden reaction.

Yes, it's work perfectly!

Thank You very much for the help.
At the end of game i insert you on the special thanks in the end credits.
Thank you very much again. :thumbsup-left::cutesmile::cutesmile::cutesmile::thumbsup-right:
 

LadyBaskerville

Hell-poodle
Veteran
Joined
Sep 12, 2016
Messages
667
Reaction score
564
First Language
German
Primarily Uses
RMMV
Haha, no problem! Glad I could help :)
 

Latest Threads

Latest Profile Posts

Revisiting one of my older projects in a long time to work some more on the mechanics. I've been working on- and off-again for about a year now on recreating the Force and Mystic systems from Wild ARMs. And I think I've finally made some good breakthroughs on that!

Still, it is not perfect and I may post my thoughts at a later time to see if there are any other suggestions or alternatives I've missed.
actor name string, why you gotta be case sensitive like that?
Doing RPG Maker News for 26th October 2021

My entire world, full of monsters and treasures, will likely be done by the end of the year. After that it's all NPCs and side quests... then done. I'm never making an open world game again xD
The more I read Calvin and Hobbes as an adult, the more I deeply respect Bill Watterson. Plenty of stuff flew over my head, but now that I'm old enough to appreciate the viewpoints he shared with the fun and imagination? I am grateful that C&H was basically my early childhood.

Forum statistics

Threads
116,102
Messages
1,095,790
Members
151,491
Latest member
vubao200618
Top