Jump to content
WCouillard

VE Passive States - Check if actor has X armor type equipped?

Recommended Posts

Trying to use VE Passive States to apply states based on if an actor's equipment currently has X armor type (light armor, hat, etc.). I feel like I'm close to getting it to work (no longer getting game crashes), but the effect isn't doing anything. Would anyone be able to tell me the proper syntax to check using this script?

 

VE - Passive States

 

<passive state: 77>
actor.equips.include?($data_armors[304...324]) ? true : false;
</passive state>

Currently, this isn't causing a crash, but it isn't working (and this one is meant to directly check an actor's equipment, rather than it's type, which would be better). Anyone know where I'm going wrong here?

Share this post


Link to post
Share on other sites

The notetag is on the armor, to apply a state on the actor. But, I have some things like "Boost HP regeneration by 10% when wearing a hat" and such. So I'd like the passive state to only be "true" when the actor equipped with the armor in question to have a certain armor type included in their equipments (in this example, a hat).

Share this post


Link to post
Share on other sites

I don't quite follow.

You have an armor type (hat)

You have a baseball cap (armor type Hat)

You equip baseball cap

 

You have in baseball cap note tag

<passive state: 77>
true;
</passive state>

So the state is applied when the baseball cap is equipped.

You have a second armor.

Sombrero (armor type hat (or whatever))

you equip Sombrero

You have in sombrero the note tag

<passive state: 77>
true;
</passive state>

state is applied with Sombrero equipped.

 

Is this not correct?

Share this post


Link to post
Share on other sites

No, I have an accessory, which has the effect of increasing a stat when also equipped with a hat. See what I mean? The state applies the stat buff, the passive state tag on the accessory would have to see if the actor is also equipped with a hat.

Share this post


Link to post
Share on other sites

a=actor.equips; b=$data_armors[304..324]; a.include?(b)

 

Try that, see if it works.

 

Also:

 

a=actor.equips; b=actor.equips.atype_id[*]; a.include?(b)

[*] : Change this to the proper Armor type ID. Keep the brackets!

Share this post


Link to post
Share on other sites

Unfortunately, neither of those are working.

 

The first one applies the passive state with and without the right armors equipped (always returns true), and the second has no effect (always returns false).

Share this post


Link to post
Share on other sites

Huh, I had no idea you could index arrays by range like that. Neat! Though, your problem is that what you are doing there is actually checking if 'actor.equips' includes the array '$data_armors[304...324]' as a member. After all, arrays can have arrays inside them.

 

Also '? true : false' is completely unnecessary. Think about it... It's basically saying if something is true it's true and if it's false it's false. :P Okay okay, maybe if you really need the result to be the exact values 'true' and 'false', but I don't think you do and there are easier ways to do that (like using !! before something).

 

Anyway, what you actually want to do is something more like:

actor.armors.any?{ |eq| (304...324).include?(eq.id) }

Also if you want to actually use the armor's type, try this and replace the 5 with the right armor type index:

actor.armors.any?{ |eq| eq.atype_id == 5}
 
Edited by Kayzee

Share this post


Link to post
Share on other sites

Unfortunately, that has the same effect in both examples. It always returns as false. Before, it was always returning as true because I forgot to add the required ; at the end of the line, but even with it, it then always returns false.

 

So we either get always true (no bueno) or always false (also no bueno). *sigh* REALLLLLLY wanna get this working. What else can we try? I appreciate you guys helping!

 

EDIT: GOT IT!

self.armors.any?{ |eq| eq.atype_id == 5 }

This worked. Thank you guys for helping me out!

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.

×