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,950
Reaction score
14,788
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
658
Reaction score
554
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
658
Reaction score
554
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
658
Reaction score
554
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
658
Reaction score
554
First Language
German
Primarily Uses
RMMV
Haha, no problem! Glad I could help :)
 

Latest Threads

Latest Posts

Latest Profile Posts

Firefox pointed me to a little inspiration: https://www.atlasobscura.com/articles/writers-maps

So, I shared. :D
To be released 2021/10/21
Now that I made this "What the MZ RTP is missing" spreadsheet it's itching me to fill some the gaps D:
Aaaaand I completely forgot about the RMMV Chicken Rave my brother decided to implement in a parody of my VERY FIRST UNFINISHED project. We could not escape the chicken rave... The chickens would block the ladder...
I love how I can look up a problem I'm having with my game, find a post from like six years ago that addresses the issue, and the solution provided still works in RPG Maker.
It's times like those that my life feels really easy XD

Forum statistics

Threads
115,949
Messages
1,094,294
Members
151,207
Latest member
majinludde
Top