Jump to content

Help with VE Passive State Syntax?

Recommended Posts

Using VE Passive States script ( https://victorenginescripts.wordpress.com/rpg-maker-vx-ace/passive-states/ ), I am able to accomplish a few things I want to do when characters equip certain pieces of gear. What I am now looking to do is also look into how to check which TYPE of gear is equipped in the script tags as well.


<passive state: 3>
!@equips[1].is_nil? && @equips[2].is_nil?;
</passive state>

The above code works fine as it is checking whether or not the actor is a) equipped with something in slot 1 and b) NOT equipped with anything in slot 2. This is great for states that increase ATK or some other stat when wearing, let's say, a body armor but also no shield.


However, if I wanted to check if the actor was 1) equipped with something in slot 1 and 2) that the item equipped in slot 1 is a shield (from armor types in the system tab), that is where I run into issues with the syntax. I cannot seem to get it to work unless I use something like this:


<passive state: 3>
!@equips[1].is_nil? && self.armors.any?{ |eq| eq.atype_id == 2 };
</passive state>

This will tell the script "There must be an item equipped in slot 1 (etype_id) and ANY item the character has equipped in ANY slot has to be id 52 (atype_id). As you can guess, this creates a lot of lag in menus when the game has to check every single piece of gear the character has equipped in order to return true or false. It gets even worse if a character has multiple passive states for different types of gear. I would like it to only check that specific slot (etype_id 1) for that type of armor (atype_id 2). I expect that the lag will be reduced significantly if I can get this written out correctly. Thanks in advance for any assistance!


EDIT: It appears this works, figured out by searching through some other calls dealing with equips.

<passive state: 3>
!@equips[1].is_nil? && self.equips[2].atype_id == 2;
</passive state>

So, no need for the help, but I hope this can help anyone else using this script who may have been wondering about how to check for specific gear slots/types.

Edited by WCouillard

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.