Add State Based on Armor and Weapon Type Equipped?

fallenlorelei

Veteran
Veteran
Joined
Jul 8, 2013
Messages
298
Reaction score
344
First Language
English
Primarily Uses
So I just asked a question yesterday (and it was answered and I am still so happy about it!), but I am terrible at JS. I'm hoping someone could help me with this one too.


Basically I am attempting to activate a Passive State when the actor has a certain armor and weapon type equipped. Essentially a set bonus. I haven't been able to find a plugin to do this for me (most are not compatible with Yanfly's Equip Core, which I am using for random pre/suffixes). So what I am trying to accomplish is:

  • If actor has weapon type 1 equipped, and armor type 1 equipped, add state 15
  • If actor has weapon type 2 equipped, and armor type 2 equipped, add state 15
  • If actor has weapon type 3 equipped, and armor type 3 equipped, add state 15
  • If actor has weapon type 4 equipped, and armor type 4 equipped, add state 15



I tried doing this with a common event, but it didn't work. So now I am trying to do it with Yanfly's Auto Passive States but I can't get the custom conditional to work.


Right now, this is the notetag for the "BONUS" state:


<Custom Passive Condition>
if ($gameActors.actor(1).isWtypeEquipped(1))
{
condition = true;
} else {
condition = false;
}
</Custom Passive Condition>


1. This doesn't work


2. If we can get it to work, how would I add "and armor type (1) equipped"?


Thanks for any help you might have :)
 
Last edited by a moderator:

Astfgl66

Veteran
Veteran
Joined
Jan 5, 2016
Messages
722
Reaction score
578
First Language
French
Primarily Uses
So using the plugin parameters I put state 4 as a global actor passive.


Then in state 4 notetag if I try your notetag I get an error: maximum call stack size exceeded.


But by using this I get a working result:


<Custom Passive Condition>
if (user.isWtypeEquipped(2)) {
condition = true;
} else {
condition = false;
}
</Custom Passive Condition>




There's no default function to check for armor types equipped that I could find, so I just adapted one from the weapon function; paste this in a .js file.


Game_Actor.prototype.isAtypeEquipped = function (atypeId) {
return this.armors().some(function(armor) {
return armor.atypeId === atypeId;
});
}




My final notetag is:


<Custom Passive Condition>
if (user.isWtypeEquipped(2) && user.isAtypeEquipped(1)) {
condition = true;
} else {
condition = false;
}
</Custom Passive Condition>


And it's working perfectly.


I tested it with item core and dreamX's plugins too.
 

fallenlorelei

Veteran
Veteran
Joined
Jul 8, 2013
Messages
298
Reaction score
344
First Language
English
Primarily Uses
@Astfgl66 I should just start messaging you directly with all of my questions, haha.


This is amazing. Thank you so much!  :guffaw: :guffaw:
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts



I've been experimenting with improved memory management again, which allowed me to include items to increase player path length. These are both 44 grid spaces long, and stable. :LZSexcite:
I FINALLY DID IT! 5 years making my very first game and I just officially released it on STEAM..... OMG..... I can say I finished a game! The feelings!!!!!
Stream will be live shortly! I am going to be playing some Among Us! Feel free to drop by!
Ami
tv program always get the ratings (it's the reason why drama series has 1000+ episode),also full and nonsense of censorship (weird blur, a scene getting cut because the unconvenient viewer,but it unconvenient to me either. you never see what the original is)

i know the reason is to take cover the viewer from the negative thing,but i just laughing and mocking of them that they're always suck :guffaw:
Star Chart Idea - Just something I am working on.

Forum statistics

Threads
104,460
Messages
1,006,440
Members
135,966
Latest member
Kleik
Top