Lunatic Mode & YEP ATB

Zerothedarklord

Veteran
Veteran
Joined
Jun 25, 2013
Messages
173
Reaction score
31
First Language
English
Primarily Uses
RMMV
Here is what I am trying to do:
In my game, I am attempting to create a Haste stat, a mechanic that would effectively increase spell casting speed (shortening the time required for a spell to go off after selecting it).
Here is the battle system I use: http://www.yanfly.moe/wiki/Battle_System_-_ATB_(YEP)

The way I made this new Haste stat is by using variables, placed in 4 different variables, each utilized for each of my game's characters. The problem I am running into is trying to differentiate who is attacking (or using a skill/item), I have successfully gotten it use a single variable, the problem is that when it does that, that 1 variable is applied globally, to both enemies as well as all actors. That isn't what I want, Haste is supposed to be a stat just like any other, where each character's Haste stat is unique.

So, here are the methods I attempted so far:
Within the Plugin Parameters, you will see a spot called Charge Gauge, and it says that "this is a formula processed as an eval". I can't figure out how to create an if statement for this, to check which battler is about to take action. If I simply try to write an if statement, it just fails, crashing with an error, something about if statements or something.
This is what I have so far that I have been testing: var a = BattleManager.actor.id; if(a === 2){1500 - ($gameVariables.value(84) * 9);} else {1500;}
My testing character, actor 2, uses a Haste stat stored at variable 84. For testing, I am multiplying the Haste stat by 9, which should result in a skill going off instantly. Furthermore, if the battler is not determined to be actor 2, it should default to the normal charge amount of 1500. However, what is happening instead, is everything is being ignored, simply using the 1500 charge amount for everyone.

The second thing I tried was trying to use the "Attack Speed" trait, hoping it might work during the Charge time, but unfortunately, it does not.

The third thing I tried was using the JS stuff provided on the page I linked earlier, but none of them do what I want. I did have an alternative idea of trying to make Haste instead cause your next turn to start quicker, but that doesn't work either.

I am fairly new to this stuff, but for the most part, I have figured out quite a bit on my own. Every idea I have had so far, I have figured out how to create it and make it work correctly. But this has had me stuck for over a week now, and I just can't figure it out. Anyone have any new ideas, or input that could help?
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
663
Reaction score
373
First Language
English
Primarily Uses
RMMV
Your if statement doesn't work because it is undefined. BattleManager.actor is a function. To get the actorId from the function you'd need to use BattleManager.actor().actorId().

I'm not sure that this would work either though, this function appears to only provide the actor that is currently acting, so I'm not sure how that works in the ATB plugin.

So, with that being said, and without testing this myself, why not use a check for a specific state on the actor instead? You're using a super complicated method to determine if an actor has a haste state on them, when you can check if the the actor has a haste state on them right from the formula, no variables required:
(BattleManager.actor() && BattleManager.actor().isStateAffected(x)) ? 0 : 1500
This should make the actor have zero charge time if they are affected by state X, or 1500 if not. I also added a check to make sure the BattleManager has an actor object, so it shouldn't crash.

edit:
I just tested this and it doesn't seem to work, after all. It always gives the second number. I suspect it has something to do with the fact that BattleManager.actor() is null unless someone is currently being given orders. I expect it becomes null after the orders are given as well.

It doesn't seem like the default note tags allow you to change the user's ATB values with a skill, only the target, so you'd need to use the lunatic eval codes to set the user's atbCharge value to maximum. I'm not sure how to go about doing this, but this is a good jumping off point for anyone else to try to assist you.
 
Last edited:

Zerothedarklord

Veteran
Veteran
Joined
Jun 25, 2013
Messages
173
Reaction score
31
First Language
English
Primarily Uses
RMMV
Your if statement doesn't work because it is undefined. BattleManager.actor is a function. To get the actorId from the function you'd need to use BattleManager.actor().actorId().

I'm not sure that this would work either though, this function appears to only provide the actor that is currently acting, so I'm not sure how that works in the ATB plugin.

So, with that being said, and without testing this myself, why not use a check for a specific state on the actor instead? You're using a super complicated method to determine if an actor has a haste state on them, when you can check if the the actor has a haste state on them right from the formula, no variables required:
(BattleManager.actor() && BattleManager.actor().isStateAffected(x)) ? 0 : 1500
This should make the actor have zero charge time if they are affected by state X, or 1500 if not. I also added a check to make sure the BattleManager has an actor object, so it shouldn't crash.

edit:
I just tested this and it doesn't seem to work, after all. It always gives the second number. I suspect it has something to do with the fact that BattleManager.actor() is null unless someone is currently being given orders. I expect it becomes null after the orders are given as well.

It doesn't seem like the default note tags allow you to change the user's ATB values with a skill, only the target, so you'd need to use the lunatic eval codes to set the user's atbCharge value to maximum. I'm not sure how to go about doing this, but this is a good jumping off point for anyone else to try to assist you.
Right. I already knew that because I already tried that. but thank you for offering your input. hopefully we can get more people thinking about this and get it figured out!
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Discovering math. functions for damage formulas was one of the greatest things for me.
It's very useful for balancing skills to work in a variety of possible circumstances.
For example if you have a skill that is supposed to work for both mages and warriors:
Code:
Math.max(a.atk * 2 - b.def, a.mat * 2 - b.mdf)
SpaceX: First-ever successful (manned) commercial spaceflight!! In these terrible and self-sabotaging times for the world, that's a ray of excitement and hope I needed badly.
GameDevJohn wrote on whtdragon's profile.
Hey I used you bunny and cat spritesheet for a game jam game. Thanks so much! You have really beautiful stuff here. I'll credit you at https://gamedevjohn.itch.io/bunny-boy
The video of a psycho chasing people on the streets with a sword before getting subdued is wild. Apparent screenshots of his Twitter feed (EDIT: confirmed by Dallas police) before it went private reveal a dangerous delusional mindset. I heard there was a bow person too. The crazies are really coming out of the woodworks.

Forum statistics

Threads
98,016
Messages
948,564
Members
129,275
Latest member
Descent89
Top