ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
1,762
Reaction score
902
First Language
English
Primarily Uses
RMMV
Just for testing purposes, if you remove the respond effect and just have the empty passive state on the character, do they die properly? (such a weird-sounding question...)
 

ScorchedGround

Blizzards most disappointed fan (More than ever)
Veteran
Joined
Apr 12, 2020
Messages
620
Reaction score
832
First Language
German
Primarily Uses
RMMV
@ATT_Turan

Well, the question may be weird but you might have actually been onto something.
As it turns out, they still don't die properly, even with a completely empty notebox.

So, as the obvious next step, I took a look at other states to look for differences that could cause this issue, since this is the first time this has ever happened to me in game-testing.

Here is what I found:

For some odd reason, the cause seems to be that the state "Priority" is set to 50.
I usually only set state priorities from 0 to 6, but since this state was a prototype, I didn't change anything yet, hence the priority was at 50.

I changed the priority to 0 and the characters die properly again, with and without the notetag.
This is really bizarre though. It still works when I change the priority to 3 or 4 or 5.

But at 50 it stops working for some reason.

Nevertheless, the "collapse animation" issue seems to be resolved now.
Thank you very much!
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
1,762
Reaction score
902
First Language
English
Primarily Uses
RMMV
That seems very weird, as the only thing the priority is described to affect is displaying any icons. And I've never changed any of mine from the default. But if that made it work for you, good!
 

ScorchedGround

Blizzards most disappointed fan (More than ever)
Veteran
Joined
Apr 12, 2020
Messages
620
Reaction score
832
First Language
German
Primarily Uses
RMMV
Hello, I am back for more. As always, thank you for helping.

This time, I am looking for a notetag for a skill in YEP_SkillCore.

As usual, here is the basic premise of the skill:

#1 Skill has a basic damage formula (let's say 100 flat damage for demonstration purposes)
#2 The damage is reduced by 20% for each "active enemy" (excluding the target itself)
-> active enemy means all enemies that are not defeated
-> Conversely, all enemies that ARE defeated and (if possible) enemies that
did not appear yet (appear halfway function) should be excluded
-> the damage reduction should be multiplicative for each consecutive enemy

Some examples:
Using the skill on a single enemy: 100 damage

Using the skill on an enemy with 2 enemies total: 80 damage
-> 100 * 0.8

Using the skill on an enemy with 3 enemies total: 64 damage
-> 100 * 0.8 * 0.8

Using the skill on an enemy with 4 enemies total and 2 enemies that did not appear yet: 51 damage
-> 100 * 0.8 * 0.8 * 0.8
 
Last edited:

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
1,762
Reaction score
902
First Language
English
Primarily Uses
RMMV
You don't strictly need the Skill Core for this. $gameTroop.aliveMembers().length will give you how many living enemies there are. So if you multiply ($gameTroop.aliveMembers().length-1)*(damage*0.2), you get 20% of your damage per living enemy.

You can incorporate that directly into the skill's damage formula (or use it in a Skill Core notetag for some other purpose). You probably want to put it inside a Math function so that if there are more than 5 other enemies you don't start getting into negative percentages and increasing your damage.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,749
Reaction score
2,847
First Language
English
Primarily Uses
RMMZ
That wouldn't actually work, Turan:

With 1 enemy, that'd end up being 0 * 100 * 0.2, which would end up being 0.

With 2 enemies, it'd be 1 * (100 * 0.2), which would correctly give you 80.

With 3 enemies, it'd be 2 * (100 * 0.2), which would end up being 40.

The formula you want is:

var value = 100; for (var i = 0; i < $gameTroop.aliveMembers().length - 1; i++) { value *= 0.8; }; Math.floor(value)
 

ScorchedGround

Blizzards most disappointed fan (More than ever)
Veteran
Joined
Apr 12, 2020
Messages
620
Reaction score
832
First Language
German
Primarily Uses
RMMV
Edit: ninja'd by Trihan

Thank you for your answers.
Your solution works very well, thank you @Trihan .

Also I am relieved to see that non-appeared enemies seem to be excluded from the aliveMembers array by default already.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,749
Reaction score
2,847
First Language
English
Primarily Uses
RMMZ
Edit: ninja'd by Trihan

Thank you for your answers.
Your solution works very well, thank you @Trihan .

Also I am relieved to see that non-appeared enemies seem to be excluded from the aliveMembers array by default already.
Yep! Reason being that technically they aren't actually in the battle at all until they appear.
 

bluebomber25

Veteran
Veteran
Joined
May 24, 2020
Messages
48
Reaction score
5
First Language
English
Primarily Uses
RMMV
Regarding Yanfly's Skill Core , I believe I have 2 lunatic-mode problems.
The first one is I am attempting to have skills have a base value and scale with the user's stats.
skill power will also scale with stats. The second is I am attempting to use Lunatic Mode strats without ANY JS knowledge.

EX: I would like MP cost of Heal to be 25 + (the user's level *5). It's strength is 250 +(a.mhp*.1)
The skill strength works perfectly. Formula box behaving well today.

Changing x inside the base notetag <MP Cost: x> to (25+(a.level*5)) ends up with 0 cost.
Got rid of the base tag and tried Lunatic Mode method.
It states that "cost is a variable already predefined with the MP Cost".

<Custom MP Cost>
cost += $gameVariables.value(1);
</Custom MP Cost>

However, changing "cost" to 25+(a.level*5) results in a cost of 0.
I assume that the right side of the equation is the MP value to display, since 1 is the parameter ID for MP. So I am not touching that. But how can I get my calculation to go through? or should I give up and just use a regular MP number and be done?
 

ScorchedGround

Blizzards most disappointed fan (More than ever)
Veteran
Joined
Apr 12, 2020
Messages
620
Reaction score
832
First Language
German
Primarily Uses
RMMV
@bluebomber25

That's probably because you used "a" to reference the user.
Yanfly Notetags do not deal with "a" as far as I know.

Try using "user" instead, like this:

<Custom MP Cost>
cost = 25 + (user.level*5);
</Custom MP Cost>

Just Copy-Paste this into the skills notebox
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,749
Reaction score
2,847
First Language
English
Primarily Uses
RMMZ

bluebomber25

Veteran
Veteran
Joined
May 24, 2020
Messages
48
Reaction score
5
First Language
English
Primarily Uses
RMMV
@ScorchedGround @Trihan
Welp, that worked perfectly! I had the right idea, wrong side of the equation.

This might be a dumb question, but can either of you explain why
cost = 25+(user.level*5) works and 25+(user.level*5)= $gameVariables.value(1) does not?
 

ScorchedGround

Blizzards most disappointed fan (More than ever)
Veteran
Joined
Apr 12, 2020
Messages
620
Reaction score
832
First Language
German
Primarily Uses
RMMV
@bluebomber25
I am not sure if I can explain the technical stuff, I think @Trihan sure could though.

But as I understand it, "cost" is the value that will ultimately return the mp-cost of the skill.
Which means that it always needs to be part of the equation so that you can manipulate it.

If there is no "cost" then the notetag returns 0.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,749
Reaction score
2,847
First Language
English
Primarily Uses
RMMZ
ScorchedGround is correct; the notetag will always use the variable "cost" to return the final value, so if that isn't part of your calculation you'll never have a cost.

But aside from that...

25+(user.level*5)= $gameVariables.value(1)

This is trying to assign the value that's in game variable 1 to the numeric value 25 + (user.level * 5). You can't assign a value to a number. You COULD do $gameVariables.setValue(1, 25 + user.level * 5) and then game variable 1 will contain that value, but it still won't affect the cost unless you then assign that value to the cost variable.
 

bluebomber25

Veteran
Veteran
Joined
May 24, 2020
Messages
48
Reaction score
5
First Language
English
Primarily Uses
RMMV
ScorchedGround is correct; the notetag will always use the variable "cost" to return the final value
Cost is the variable? I thought the part that actually says Gamevariable was the variable. Maybe I should read lunatic mode from right to left!

Seriously though, thank you for your speedy responses!
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,749
Reaction score
2,847
First Language
English
Primarily Uses
RMMZ
Cost is the variable? I thought the part that actually says Gamevariable was the variable. Maybe I should read lunatic mode from right to left!

Seriously though, thank you for your speedy responses!
It might help you, yeah.

Okay, so basically the way the plugin is coded, it looks for the text in between <Custom MP Cost> and </Custom MP Cost>, evaluates any code within it, and returns a variable called "cost". It doesn't have to be cost in general, but that's the variable name Yanfly chose to be returned by the function which handles this so that's the name you have to use for it in the notetag.

$gameVariables is a global object which contains the data for your in-game variables; it's actually held internally as an array called _data, but it provides a function called "value" you can call to get the value held in a given index of the array. So $gameVariables.value(1) will actually give you $gameVariables._data[1].
 

bluebomber25

Veteran
Veteran
Joined
May 24, 2020
Messages
48
Reaction score
5
First Language
English
Primarily Uses
RMMV
That entire last paragraph is way over my head. I'm just an old man making an RPG without any code knowledge. I appreciate your efforts, @Trihan, and one day I will click on that coffeepot in your sig.
 

ScorchedGround

Blizzards most disappointed fan (More than ever)
Veteran
Joined
Apr 12, 2020
Messages
620
Reaction score
832
First Language
German
Primarily Uses
RMMV
Okay so this is more of a general question about notetags:

Is it possible to incorporate variables like counters to the notetag?
And if so:
#1 What is the most intelligent way to set them up and manipulate them?
#2 Do they persist across multiple notetags? And if not, what is the workaround?

One example for what kinds of effects I'd like to make:

<Custom Apply Effect>
counter = 5;
</Custom Apply Effect>

<Custom React Effect>
if (value > 0 && counter > 0) {
counter -= 1;
value = Math.round(value * 0.5);
} else if (counter === 0) {
target.removeState(x);
}
</Custom React Effect>
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,749
Reaction score
2,847
First Language
English
Primarily Uses
RMMZ
Okay so this is more of a general question about notetags:

Is it possible to incorporate variables like counters to the notetag?
And if so:
#1 What is the most intelligent way to set them up and manipulate them?
#2 Do they persist across multiple notetags? And if not, what is the workaround?

One example for what kinds of effects I'd like to make:

<Custom Apply Effect>
counter = 5;
</Custom Apply Effect>

<Custom React Effect>
if (value > 0 && counter > 0) {
counter -= 1;
value = Math.round(value * 0.5);
} else if (counter === 0) {
target.removeState(x);
}
</Custom React Effect>
The best way for a persisting variable is to add it as a property to the target, since you can add new properties to any object any time you wish and they'll remain there until you close the game or delete them. So rather than counter = 5 you'd do target._counter = 5; (the underscore isn't necessary, but it's a naming convention to denote internal properties with an underscore at the beginning of their identifier)
 

ScorchedGround

Blizzards most disappointed fan (More than ever)
Veteran
Joined
Apr 12, 2020
Messages
620
Reaction score
832
First Language
German
Primarily Uses
RMMV
@Trihan
I see, that is very helpful, thank you for the info!

So I have this setup now, which does not seem to work:

<Custom Apply Effect>
user._counter = 2; // Does this need to be user or target?
</Custom Apply Effect>

<Custom React Effect>
if (value > 0 && target._counter > 0) { // And what about these?
target._counter -= 1;
value = Math.round(value * 0.5);
} else if (target._counter <= 0) {
target.removeState(139);
}
</Custom React Effect>

Side-question, I imagine that I should give each counter unique names right?
Calling every counter "counter" is surely prone to causing conflicts.
 

Latest Threads

Latest Profile Posts

I THINK I have a slightly better grasp on drawing my maps now... sorta. I still need to figure out how to draw a city of sorts. I've only got the abstract going so far.
One day, I'll not have this lingering cough and we'll have another make a game stream.
A music I create while practicing E Major scale. :D
Too bad the Boss Battle Build Bout isn't also for VXAce.

Forum statistics

Threads
115,181
Messages
1,087,910
Members
149,751
Latest member
dxdiagnostical
Top