Indie Dev

Hello Guest!. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, sell your games, upload content, as well as connect with other members through your own private inbox!

How to get an equip type Id?

Hello everyone! I'm not too skilled in javascript, so I wanna know if you guys can help me to know how to make a script call that returns the Id type of equip slot 2 (shields).

I'm using Yanfly's Skill Core so I want to check if the actor is equipped with a shield, if it's true the skill is avaliable.

Something like this:
If ("check condition here")
{
value = true;
} else {
value = false;
}
 

Xilefian

Adventurer
Xy$
0.00
JavaScript:
var actor = $gameActors.actor(1); // Get actor 1
var equipment = actor.equips()[1]; // Get equipment in slot 2 (arrays start at 0)
if ( equipment && equipment.etypeId == 2 ) {
    // There is something equipped and it is of type 2
    // type 2 == shield in Database -> Types -> Equipment Types
} else {
    // There is nothing equipped, or the thing that is equipped is not of type 2
}
For interest's sake, if you want to run this as an Event conditional branch it would be:
JavaScript:
var a = $gameActors.actor(1).equips()[1]; a ? a.etypeId == 2 : false
 
Top