Archlvt

Veteran
Veteran
Joined
Mar 8, 2019
Messages
68
Reaction score
5
First Language
English
Primarily Uses
RMMV
Hi Friends, long time no see.

I've got a question, mostly about syntax, regarding a custom effect I'm trying to get working. Basically, I would like the user to receive a damage buff based on how much MP they have. For example...

0-14% MP = Nothing
15-29% MP = +10% dmg
30-44% MP = +20% dmg
45-59% MP = +30% dmg
60-75% MP = +40% dmg

The way I figure it is I would make states without icons for each tier and have the appropriate state added when the user fell into the correct tier. I tried just to get a simple If users MP >50% then apply the state. Here is what I feel should have had the best chance of working.


<Custom Turn Start Effect>
if (user.mp > 50) {
a.addState(40);
} else {
a.removeState(40);
}
</Custom Turn Start Effect>

The actual effect is... non-existent. In fact the dozen different things I tried have had no effect at all. I have all of the necessary plugins by Yanfly and they are all working as intended insofar as I can tell. I think the problem is me and my noggin. If anyone could help me out with this one I'd be exceptionally grateful as it doesn't seem like a hard thing to pull off. But here I am.
**Edit**
Forgot to mention, all actors have a static 100 max MP indefinitely.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,041
Reaction score
2,297
First Language
English
Primarily Uses
RMMV
Custom Turn Start Effect on a state only applies if the battler already has the state when the turn starts, so if they don't *have* the one you've added this to, it won't do anything.

How do you have this set up currently?
 

Archlvt

Veteran
Veteran
Joined
Mar 8, 2019
Messages
68
Reaction score
5
First Language
English
Primarily Uses
RMMV
Custom Turn Start Effect on a state only applies if the battler already has the state when the turn starts, so if they don't *have* the one you've added this to, it won't do anything.

How do you have this set up currently?

Hey. I actually did try this already. I gave my mage an unnamed state that never goes away, and went back and forth above and below 50 MP and the other state was never added.

I've also tried others outside of custom turn start. The way I'd LIKE for it to turn out would be a notetag in the actor/class section, ideally, if that's even possible. Oh, and it doesn't have to happen at any specific point in time in the turn. The best case scenario would be the state being applied the second their MP rises or falls past the threshold rather than at the start or end of the turn.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,041
Reaction score
2,297
First Language
English
Primarily Uses
RMMV
Put this in your passive state:

Code:
<Custom Confirm Effect>
const mp = user.mp;
switch(true) {
  case (mp < 15): break;
  case (mp < 30): value *= 1.1; break;
  case (mp < 45): value *= 1.2; break;
  case (mp < 60): value *= 1.3; break;
  case (mp < 76): value *= 1.4; break;
  default: value *= 1.5; break;
}
value = Math.floor(value);
</Custom Confirm Effect>

I added a default to cover 76-100% to add a 50% boost because otherwise having more than 75% MP is detrimental, but that may be how you wanted it.

Also note that this will also boost healing, so if you only want it to boost damage you'll have to put in a check for value being > 0.
 

Archlvt

Veteran
Veteran
Joined
Mar 8, 2019
Messages
68
Reaction score
5
First Language
English
Primarily Uses
RMMV
Put this in your passive state:

Code:
<Custom Confirm Effect>
const mp = user.mp;
switch(true) {
  case (mp < 15): break;
  case (mp < 30): value *= 1.1; break;
  case (mp < 45): value *= 1.2; break;
  case (mp < 60): value *= 1.3; break;
  case (mp < 76): value *= 1.4; break;
  default: value *= 1.5; break;
}
value = Math.floor(value);
</Custom Confirm Effect>

I added a default to cover 76-100% to add a 50% boost because otherwise having more than 75% MP is detrimental, but that may be how you wanted it.

Also note that this will also boost healing, so if you only want it to boost damage you'll have to put in a check for value being > 0.

Hey thanks. It did work, although switching the solution to values instead of states presents a new issue, as I'd planned to add a specific state when the user reached 100MP. I've actually never used the code format you suggested so I don't know what the syntax would be. I tried...
case (mp = 100): a.addstate(41); break;

This, but obviously as this is a different format, it didn't work. I guess I should explain the mechanic to better give you an idea of how I want this to work. Basically, it's like blackjack, you want to get your MP as high as possible without capping, because when you cap you get arcane sickness. Arcane sickness will degen your health by 15% for 3-4 turns and you will be stuck at *1 value regardless of your MP. Once sickness wears off, you will resume being able to get your bonuses.

Your code is super useful and I will definitely find some uses for it outside of this scenario, so thank you for that. Is there any way to do it while staying within the constraints of States for the damage? That way, when Sickness is added, the user can be immune to their +damage states. And THEN, I will have a skill that adds a state that makes you immune to arcane sickness for 4-5 turns that can only be used occasionally, that will let the user reap the benefits of a full MP bar without repercussions.

/breath
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,041
Reaction score
2,297
First Language
English
Primarily Uses
RMMV
If you're comparing the value, you'd need a double equals.

case (mp == 100)
 

Archlvt

Veteran
Veteran
Joined
Mar 8, 2019
Messages
68
Reaction score
5
First Language
English
Primarily Uses
RMMV
case (mp == 100): a.addState(41); break;

Did not work either, I'm guessing the a.addstate part is the problem. In any case, even if it had worked, I would still have the issue of arcane sickness not working the way it was intended.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,041
Reaction score
2,297
First Language
English
Primarily Uses
RMMV
Okay, so you have two passive states. One for the buff, and one for Arcane Sickness. The buff state looks almost the same as the one I gave you already:

Code:
<Custom Confirm Effect>
const mp = user.mp;
switch(true) {
  case (mp < 15): break;
  case (mp < 30): value *= 1.1; break;
  case (mp < 45): value *= 1.2; break;
  case (mp < 60): value *= 1.3; break;
  case (mp < 76): value *= 1.4; break;
  default: break;
}
value = Math.floor(value);
</Custom Confirm Effect>

Only difference is the default case now does nothing, so that 100% MP deals 1x damage just like less than 15% does.

Then your Arcane Sickness state has the -15% max HP or whatever you want to do with it, and the notetag:

Code:
<Custom Passive Condition>
if (user.mp == 100) {
  condition = true;
} else {
  condition = false;
}
</Custom Passive Condition>

The two together will basically mean that at 100% MP, the user has Arcane Sickness and deals normal damage, but at anything less than that will have the appropriate boost.
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
6,007
Reaction score
5,646
First Language
English
Primarily Uses
RMVXA
<Custom Turn Start Effect>
if (user.mp > 50) {
a.addState(40);
} else {
a.removeState(40);
}</Custom Turn Start Effect>
I think one of the issues here is that you're using "a" to represent the battler, a shortcut for 'user' which should only be available when performing a battle action. However, I'm not even sure "user" is valid here, since there's no skill being used in the scope of this tag. I forget what the correct syntax would be here - it might just be addState(40) or it might be self.addState(40) or battler.addState(40)

You also might be able to utilize his Auto Passive States plugin to get the job done. I've never used this plugin myself, but my understanding of it is that it would handle this kind of "always on" passive behavior for you and plus it comes with handy conditions like <Passive Condition: MP Above x%> and <Passive Condition: MP Below x%>

Alternatively, it doesn't seem like it would be that hard to just Event this behavior using Troop Events (and you can use a Base Troop Events script - Yanfly has one but a few other non-paywalled authors also offer one - to make things much easier). At the beginning of each turn (Turn 0 + 1X, with Scope "Turn"), remove all "MP Damage Bonus" states from an actor. Then, check their MP using Conditional Branches - if it's >= 15 and < 30, add "MP Damage Bonus 10%"; if it's >= 30 and < 45, add "MP Damage Bonus 20%", and so on - and finally, if it's >= 100, add "Arcane Sickness".
 

Archlvt

Veteran
Veteran
Joined
Mar 8, 2019
Messages
68
Reaction score
5
First Language
English
Primarily Uses
RMMV
I added the custom passive condition into the Arcane Sickness state, but it still doesn't want to seem to apply itself. I even tried going below 100 MP and then raising it back up. Nothing.
 

Archlvt

Veteran
Veteran
Joined
Mar 8, 2019
Messages
68
Reaction score
5
First Language
English
Primarily Uses
RMMV
I think one of the issues here is that you're using "a" to represent the battler, a shortcut for 'user' which should only be available when performing a battle action. However, I'm not even sure "user" is valid here, since there's no skill being used in the scope of this tag. I forget what the correct syntax would be here - it might just be addState(40) or it might be self.addState(40) or battler.addState(40)

You also might be able to utilize his Auto Passive States plugin to get the job done. I've never used this plugin myself, but my understanding of it is that it would handle this kind of "always on" passive behavior for you and plus it comes with handy conditions like <Passive Condition: MP Above x%> and <Passive Condition: MP Below x%>

Alternatively, it doesn't seem like it would be that hard to just Event this behavior using Troop Events (and you can use a Base Troop Events script - Yanfly has one but a few other non-paywalled authors also offer one - to make things much easier). At the beginning of each turn (Turn 0 + 1X, with Scope "Turn"), remove all "MP Damage Bonus" states from an actor. Then, check their MP using Conditional Branches - if it's >= 15 and < 30, add "MP Damage Bonus 10%"; if it's >= 30 and < 45, add "MP Damage Bonus 20%", and so on - and finally, if it's >= 100, add "Arcane Sickness".

I actually do have the AutoPassiveStates plugin. I'll keep playing around with it to get the desired result.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,041
Reaction score
2,297
First Language
English
Primarily Uses
RMMV
Show me how you have Arcane Sickness set up. It works flawlessly on my end.
 

Archlvt

Veteran
Veteran
Joined
Mar 8, 2019
Messages
68
Reaction score
5
First Language
English
Primarily Uses
RMMV
Here is my page for Arcane Sickness. It will have a custom add effect that removes the other +damage states, but since I haven't created those states yet there was no sense in making that effect yet.
 

Attachments

  • asick.png
    asick.png
    171.1 KB · Views: 5

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,041
Reaction score
2,297
First Language
English
Primarily Uses
RMMV
That's how I have it set up as well. So the icon never comes up for it at all when you're at 100% MP?
 

Archlvt

Veteran
Veteran
Joined
Mar 8, 2019
Messages
68
Reaction score
5
First Language
English
Primarily Uses
RMMV
That's how I have it set up as well. So the icon never comes up for it at all when you're at 100% MP?
Never. Even if I drop my MP below 100% and then raise it back up in hopes of a trigger.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,041
Reaction score
2,297
First Language
English
Primarily Uses
RMMV
The only thing I can think of is that you have another plugin interfering with this then, because I have the effect you're after working fine using Buffs & States Core + Auto Passive States.

Can I see the notetag for your actor/class?
 

Archlvt

Veteran
Veteran
Joined
Mar 8, 2019
Messages
68
Reaction score
5
First Language
English
Primarily Uses
RMMV
The only thing I can think of is that you have another plugin interfering with this then, because I have the effect you're after working fine using Buffs & States Core + Auto Passive States.

Can I see the notetag for your actor/class?
It's completely blank for both.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,041
Reaction score
2,297
First Language
English
Primarily Uses
RMMV
...passive states don't apply unless you give the actor that's supposed to have them a <passive state: id> tag.

Okay, so I've noticed a small flaw with my initial solution (it removes Arcane Sickness as soon as you're below 100% MP) so here is Trihan's complete recipe for Archivt's Patented Arcane Buff/Sickness mechanic!

1. Create two states: Arcane Manager and Arcane Sickness. Arcane Sickness just has the -15% HP regen trait set to expire in 3-4 turns. Arcane Manager has the following notetag:

Code:
<Custom Confirm Effect>
const mp = user.mp;
switch(true) {
  case (mp < 15): break;
  case (mp < 30): value *= 1.1; break;
  case (mp < 45): value *= 1.2; break;
  case (mp < 60): value *= 1.3; break;
  case (mp < 76): value *= 1.4; break;
  default: break;
}
value = Math.floor(value);
</Custom Confirm Effect>
<Custom Action End Effect>
if (user.mp == 100) {
  user.addState(13);
}
</Custom Action End Effect>

Where 13 is the ID of Arcane Sickness.

2. Add the following to your actor/class notetag:

Code:
<Passive State: 1>

Where 1 is the ID of the Arcane Manager state.
 
Last edited:

Archlvt

Veteran
Veteran
Joined
Mar 8, 2019
Messages
68
Reaction score
5
First Language
English
Primarily Uses
RMMV
...passive states don't apply unless you give the actor that's supposed to have them a <passive state: id> tag.

Okay, so I've noticed a small flaw with my initial solution (it removes Arcane Sickness as soon as you're below 100% HP) so here is Trihan's complete recipe for Archivt's Patented Arcane Buff/Sickness mechanic!

1. Create two states: Arcane Manager and Arcane Sickness. Arcane Sickness just has the -15% HP regen trait set to expire in 3-4 turns. Arcane Manager has the following notetag:

Code:
<Custom Confirm Effect>
const mp = user.mp;
switch(true) {
  case (mp < 15): break;
  case (mp < 30): value *= 1.1; break;
  case (mp < 45): value *= 1.2; break;
  case (mp < 60): value *= 1.3; break;
  case (mp < 76): value *= 1.4; break;
  default: break;
}
value = Math.floor(value);
</Custom Confirm Effect>
<Custom Action End Effect>
if (user.mp == 100) {
  user.addState(13);
}
</Custom Action End Effect>

2. Add the following to your actor/class notetag:

Code:
<Passive State: 1>

Where 1 is the ID of the Arcane Manager state.

Right sorry, I wasn't using passive states in the beginning so I didn't think to add that when it was suggested. This works, but not in the way I intended, as the state needs to linger for 3-4 turns. In a passive states scenario, it goes away the second my MP drops.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,041
Reaction score
2,297
First Language
English
Primarily Uses
RMMV
Look at the edit.
 

Latest Threads

Latest Profile Posts

1620833447825.png
This is one of the most beautiful art styles I've seen... it's also the style I draw in... er.... what's this style called...?
Ami
This is the End of the Endurance,everyone are celebrating the end of their Endurance

I just wondering what Menu for Tomorrow
Two years into developing my game and I just scrolled through the BaseResource Pack that comes with MV for the first time xD I never knew how much awesome stuff was in there. Also so many names I know from the forum, like Shaz & Archeia ... and that's not the only resource pack I found in the depth of my hard drive :0 Right now I'm both confused and hyped about all the stuff I own.
Decided to start watching Naruto; and not only is it a genuinely good series, but it's also very inspiring.
I just wish Funimation got its act together and fix the missing dubbed episodes.

Forum statistics

Threads
111,289
Messages
1,059,974
Members
144,602
Latest member
sdzezzzs
Top