MV A bundle of problems

So, I've been trying to figure these out myself to no avail...

Spoiler: my life problems
Problem 1: How can I set a variable for a player where if a party member equips a weapon, a variable changes according to what weapon is equipped to that actor. For example, we equip a fire sword, variable Actor0Element would equal "Fire". But then that same actor switches to an ice weapon, variable Actor0Element would now be equal to "Ice". This way I can properly show animations for skills all actors share, but they'd have a special effect depending on an actors variable.

Problem 2: How can I create a function where if variable "Stylish Evasion = 1", each time an actor evades, an animation plays on that actor and their attack increases by +1, but once they're hit, that additional attack resets.

Problem 3: How can I create a function where if variable "Lone Wolf = 1", a state given to the last actor alive where that actor gains special buffs, however, once a party member is revived, this buff is removed from all actors.

Please, pleaaaase give me some solutions. I've been haven't a hard time figuring these out and they're definitely core features that I need, and the best part is that Problems 2 and 3 can be modified and reused for different types of things.


If it turns out to be something too difficult to where it must be commissioned, let me know...
I'll just say, it's best to not pm solutions. No one else can learn from this thread if it is discussed in a pm. Please post solutions here.
I'll just say, it's best to not pm solutions. No one else can learn from this thread if it is discussed in a pm. Please post solutions here.
It's not against the rules though, so what's wrong with simply PM'ing me? Plus it's my thread. If anyone has a question they can just post their own.

*Edit*
Please PM solutions.
This may work for #1


conditional Branch.png
I had this in mind, but with over 100 weapons, it seems a little difficult to keep up. I'll keep this as a last resort. Thank you.
That's an awful lot of weapons for one character but, it seems you will need some kind of variable for each. Good luck with your project. I'm interested to see what you find out; curious.
what's wrong with simply PM'ing me?

What's wrong with just PMing you is that you don't know if the person knows what they are talking about. If they post something that just won't work in the forum, others will be able to say it won't work and explain why. If they PM you, nobody else will know what you've been told, so if it's wrong, you will waste your time trying to get it to work, then going back and forth with someone who doesn't really know what they're doing, and you'll achieve nothing and be right back where you started, minus the time you spent on it. And probably more than slightly frustrated as well.

Why is it so important to get PM responses? You can just flag the topic to watch it and you'll still get notifications/emails of responses.

However, if you wish to receive replies via PM, please say so and we'll close the thread so nobody can reply here.
Plus, a huge amount of the knowledge I have about RPG Maker comes from Googling and finding threads where people were discussing a similar thing. I can't think of any way using PMs is specifically beneficial to you, so it seems vaguely rude to the community to not show in public what other people have done to help you.

In that vein, I am pretty sure I've seen your question 3 come up before and someone posted a way to do it using Yanfly's Buffs or States. I'll do a little search and let you know if I find it.

Edit: I haven't found the old thread, but off the top of my head, you'd use Yanfly's Buffs and States Core. Give Knockout a Custom Apply Effect, and have the script within loop through the party members; if there's only 1 that's alive, and your Lone Wolf variable is on, give him the state with the buffs. Similarly, give Knockout a Custom Remove Effect that removes the lone wolf buff state from all party members.
Plus, a huge amount of the knowledge I have about RPG Maker comes from Googling and finding threads where people were discussing a similar thing. I can't think of any way using PMs is specifically beneficial to you, so it seems vaguely rude to the community to not show in public what other people have done to help you.

In that vein, I am pretty sure I've seen your question 3 come up before and someone posted a way to do it using Yanfly's Buffs or States. I'll do a little search and let you know if I find it.

Edit: I haven't found the old thread, but off the top of my head, you'd use Yanfly's Buffs and States Core. Give Knockout a Custom Apply Effect, and have the script within loop through the party members; if there's only 1 that's alive, and your Lone Wolf variable is on, give him the state with the buffs. Similarly, give Knockout a Custom Remove Effect that removes the lone wolf buff state from all party members.
Sweet, that makes sense, how do I check each party member using a loop?
if($gameParty.aliveMembers().length == 1){ $gameParty.aliveMembers()[0].addState(X); //or just turn ON Lone Wolf switch }

maybe?
Hmm, do I just add another <Custom Apply Effect> ?
I already have a Custom Apply Effect in the KO notetag... not sure if having another custom apply will not work

*Edit*
Awesome, problem 3 solved. :^)
How does that remove the state from the actor once another party member is revived?
How does that remove the state from the actor once another party member is revived?
I tried fiddling a bit thinking this would work but it doesn't.

Code:
<Custom Remove Effect>
if($gameParty.aliveMembers().length >= 2 && $gameVariables.value(301) === 1)
{
if(($gameActors.members().filter( function (actor) { return actor.isStateAffected(62); } ).length > 0) === 1)
{    
     actor.removeState(62);
     actor.startAnimation(54);
}
}
</Custom Remove Effect>

So basically I tried checking if there was 2 or more actors alive and if Lone Wolf Skill was active. If those are true, then it's supposed to check if an actor has state 62, once it returns true, then remove the state and play an animation on that actor.
if(($gameParty.members().filter( function (actor) { return actor.isStateAffected(62); } ).length > 0) === 1)

Pretty sure you have to remove the text in red..


if($gameParty.aliveMembers().length >= 2 && $gameVariables.value(301) === 1){ $gameParty.members().forEach( function (actor) { if(actor.isStateAffected(62)){ actor.removeState(62); actor.startAnimation(54); } } ); }
maybe?
if(($gameActors.members().filter( function (actor) { return actor.isStateAffected(62); } ).length > 0) === 1)

Pretty sure you have to remove the text in red..
Now I tried this and it still doesn't work:

Code:
<Custom Remove Effect>
if($gameParty.aliveMembers().length > 1 && $gameVariables.value(301) === 1){
if(($gameActors.members().filter( function (actor) { return actor.isStateAffected(62); } ).length > 0)
{
     actor.removeState(62);
     actor.startAnimation(54);
}}
</Custom Remove Effect>
it should be $gameParty , not $gameActors. Missed that typo. But actor is still not defined. Try code I posted above.

Edit: I also don't understand why that code should be inside <Custom Remove Effect>. It should be in a common event that you call when you use a revival spell or at the end of each turn for safe measure.
How can I set a variable for a player where if a party member equips a weapon,
please check here:
one of the plugins listed does what you want, running code or common event on equip. I haven't used it myself however, and it appears to be one of those plugins that react to wrong order and other requirements, so you'll have to experiment a bit.
so what's wrong with simply PM'ing me?
that means that you'll be the only one who can read the solution.
everyone helping here does so in their free time, and while I have no problems spending my time helping others, I don't want the results to vanish with a single person.
So I absolutely refuse to give answers by PM, I only answer by forum post.
Edit: I also don't understand why that code should be inside <Custom Remove Effect>. It should be in a common event that you call when you use a revival spell or at the end of each turn for safe measure.
Is there some way to revive a party member in battle that doesn't involve removing the Knockout state? That's what a revival spell does, for sure.

The only trick I can think of is how he wants this to interact with battle ending and starting with only one living party member. There should probably be a script/event stuck at the beginning and end of every troop to check for it.
Okay, problem 3 is solved and I don't wish to resolve problem 1 anymore, bumping.
Eh, this may be ugly but try adding this as a plugin:

(function() { var variableId = 0; // change var id var stateId = 0; // change state id var animationId = 0; //change animation id var AG_EvasionState_Game_Actor_performEvasion = Game_Actor.prototype.performEvasion; Game_Actor.prototype.performEvasion = function() { AG_EvasionState_Game_Actor_performEvasion.call(this); if($gameVariables.value(variableId) === 1){ this.addState(stateId); this.startAnimation(animationId); } }; })();

I haven't tested this code ingame but you do for me x)
Make the State in database have 100% chance to be removed upon taking damage and you can use some other plugin that allows stackable states? I don't know, I'm too lazy to do with Buffs, sorry. Good luck lol.

Original thread: https://forums.rpgmakerweb.com/threads/a-bundle-of-problems.133801/