Get variable of actor equip page.

hoboayoyo

Villager
Member
Joined
Oct 29, 2016
Messages
17
Reaction score
2
Primarily Uses
I have an event that runs on the equip screen , this changes what skills the current actor has depending on what is equiped.
To save a bunch of time, what is a script command I can store as a variable that tells me what actor equip page i am on.?
I know
$gameParty._menuActorId = x;
SceneManager.push(Scene_Equip);
Will load the actor page but I want the variable of the actors page im already on to store.

Thanks,
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,226
Reaction score
1,634
First Language
EN
Primarily Uses
RMMZ
Have you tried $gameParty._menuActorId? :kaoswt:
 

hoboayoyo

Villager
Member
Joined
Oct 29, 2016
Messages
17
Reaction score
2
Primarily Uses
Thanks that was exactly it!
Is there a good recourse for all of the script variables I can call?
I know there is a script resource for event commands here but I havent found one for the interior stuff like the one you mentioned.

Updated:
I think i found it here
 

hoboayoyo

Villager
Member
Joined
Oct 29, 2016
Messages
17
Reaction score
2
Primarily Uses
Have you tried $gameParty._menuActorId? :kaoswt:
do you know how i can grab the equipment in the Nth slot while on the page?
I tried the following with no success.

this._actor.equips()[1](edited)
$gameParty.members()[1].equips()[1]
And if your able to can you explain how you figured out how to piece that together?
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,226
Reaction score
1,634
First Language
EN
Primarily Uses
RMMZ
Personally I just browse the project code files, in the project's js subfolder...I also have several years of experience doing that. In this case, most of the relevant code (party, actor, equipment) can be found in rpg_objects.js.

do you know how i can grab the equipment in the Nth slot while on the page?
First, we need an actor reference. In this case, we have the actor ID, so we can get a reference from $gameActors. However, there's a shortcut available (search for _menuActorId in rpg_objects.js and you'll see it pretty quickly):
JavaScript:
$gameParty.menuActor()
You can reference their equipment with the Game_Actor.prototype.equips method, as you tried:
JavaScript:
$gameParty.menuActor().equips()
This is an array of objects ($dataWeapons and $dataArmors references) that can be indexed like any other array. Remember that index 0 is the first element of the array, so to get the second equipped item you can use this:
JavaScript:
$gameParty.menuActor().equips()[1]
From there you can access any property you like, e.g. the name of the item in the current actor's second equip slot:
JavaScript:
$gameParty.menuActor().equips()[1].name
If you want to discover all the properties available to reference from the database objects, you have a few different options:
  • Press F8 during playtest to show the console and try typing in something like this to view the internal structure of a particular database object:
    console.log($dataArmors[1])

  • Check the database files in the project's data subfolder, e.g. Armors.json. This is directly read/written to by the editor, so I don't recommend making any manual edits. Also avoid opening the files while the project is open in the editor, just in case.

  • Infer relevant values by looking through the code, e.g. you know that the game draws item names in the equip window, so you can check out rpg_windows.js, search for equip or something, and see if you can find where it draws the item names.

Note that this is a JavaScript keyword; its value depends on where it is used. For example, a Script command is evaluated in a Game_Interpreter context, i.e. this will point to an instance of Game_Interpreter.prototype. More details:

Lastly...
I tried the following with no success.

this._actor.equips()[1](edited)
$gameParty.members()[1].equips()[1]
I'm guessing you saw an error when you tried to run this code? Something like "Cannot read property 'equips' of undefined"? If so, please note that the error messages are not just for show: they are deliberately programmed to (try to) point out what is going wrong. In other words, don't just say "no success" when confronted with a detailed error. :kaoslp:
 

hoboayoyo

Villager
Member
Joined
Oct 29, 2016
Messages
17
Reaction score
2
Primarily Uses
Thanks so much for the info.
Ill check out rpg_objects.js for easier references.
The results I got from the above were just '0'
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,226
Reaction score
1,634
First Language
EN
Primarily Uses
RMMZ
You're welcome! :kaojoy:

The results I got from the above were just '0'
:kaoswt: Oh. If you try that in a Script command with no plugins enabled, it will throw exactly the error I described, so I assume you tried it in a different context that either has its own error-handling routine or a well-defined value for this._actor...

[Edit: after re-reading your opening post, I'm guessing you're using this in an item/skill's damage formula? By default the engine returns 0 if the formula evaluates to an error or non-numerical value. Note that you can experiment using the console, accessible by pressing F8 during playtest. :kaohi:]

Sorry if I sounded snappy about that, by the way. Just wanted to highlight the fact that error messages can be helpful~ :kaothx:
 

Latest Threads

Latest Posts

Latest Profile Posts

Making Houses and Outside on the same map with RPG Maker MV!
Do people actually use buff/debuff function?
Ami


Imagine you (as Miner) Sleep in the Cave,the other side is a Bunch of Golds,how d'you feel?
finally got footage of my main character running around his corrupted street...
I finally got the ships and water to flow like I wanted to~ the canals are a success. Now to loop the animation for the kites. So many kites.

Forum statistics

Threads
107,702
Messages
1,031,532
Members
139,836
Latest member
dangkykubetim
Top