zelanius

Mechanics Freak
Veteran
Joined
Apr 29, 2020
Messages
144
Reaction score
42
First Language
English
Primarily Uses
RMMV
@Trihan and all, I know this topic is a bit old, but I thought I would contribute something I found out recently. For some of us, we want to always show the targeting selection after selecting a skill. The problem with this is that any scope which is "The User" or "All x" or "Random xx" executes the skills after being selected. To work around this, YEP Target Core and Selection Control solves most of the problems by having notetags to control this. However, for "The User" scope, there is no simple notetag to resolve this. Nonetheless, this can be done with Lunatic Code by making the scope "1 Ally" and then inserting the below in the notetag (need Selection Control):
<Custom Select Condition>
if (target.name() === user.name()) {
condition = true;
} else {
condition = false;
}
</Custom Select Condition>
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,786
Reaction score
2,931
First Language
English
Primarily Uses
RMMZ
It's cool, I was coming here to revive it anyway. Thanks for the info!
 

ScorchedGround

Blizzards most disappointed fan (More than ever)
Veteran
Joined
Apr 12, 2020
Messages
647
Reaction score
899
First Language
German
Primarily Uses
RMMV
Heya @Trihan good to see you are back!

Actually, I could use your expertise here.

I was trying to create a basic "guardian angel" state using YEP_BuffsStatesCore.

Here's what I got so far:

State 177:

<Custom Respond Effect>
if (user.hpRate() < 0.05) {
user.startAnimation(210);
user.removeState(177);
user.addState(178);
}
</Custom Respond Effect>

State 178:

<Custom Turn End Effect>
var gain = Math.floor(user.mhp * 0.3);
user.startAnimation(210);
user.gainHp(gain);
user.removeState(178);
</Custom Turn End Effect>

(Note that both states also have the "State Resist: Knockout" trait)

So here's the premise of these states:

1. State 177 gets applied to a character via skill or item
2. The state lays "dormant", doing nothing until you get hit while being low on life
3. The State Resist: Knockout prevents the character from dying
4. State 177 gets switched out for State 178
5. The Character remains immune to death until of the round
6. The Character is healed for 30% HP at the end of the round
7. State 178 is removed from the character and is no longer invulnerable
8. This concludes the Guardian Angel state

However, as of right now, the character gets stuck at 0 HP on State 177 without anything happening.
That means that no commands from the notetags are actually executed.

Any help is welcome. I don't mind changing up these states and the notetags as long as the previously described premise of the state remains intact.

As always, thank you for your time and effort, Trihan.

Edit: Also, just in case this is relevant (I don't use BattleEngineCore or Action Sequences)
 
Last edited:

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,786
Reaction score
2,931
First Language
English
Primarily Uses
RMMZ
Ooh, that's a good one. I've got some coding I need to get done ASAP but once I'm done with that I'll take a look at this and see if I can't sort it out for ya.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,786
Reaction score
2,931
First Language
English
Primarily Uses
RMMZ
Okay, so your problem is the "user" in state 177 needs to be "target"; user in the custom respond effect is the *attacker*, not the battler being attacked, which is why your code wasn't triggering.

Note that you'll need to add a line that sets the target's HP to 1 before you remove 177, or they'll die instantly even if you have 178 set to resist knockout too. (since there's a wave of "death check" when one state is removed but before the other is applied). You could get around this by adding 178 first before removing 177.
 

ScorchedGround

Blizzards most disappointed fan (More than ever)
Veteran
Joined
Apr 12, 2020
Messages
647
Reaction score
899
First Language
German
Primarily Uses
RMMV
@Trihan Thank you for your quick response!

Your suggestions worked like a charm! Good to know Respond effects work differently than most other trigger types. I was not aware of that, I just assumed that "user" always referred to the bearer of the state.

As for circumventing the death checks, I just went with your idea of adding the state before removing the other one. There is no noticeable difference to see anyways.

Thanks again for your help!
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,786
Reaction score
2,931
First Language
English
Primarily Uses
RMMZ
I believe that for any state trigger effect that's based on a stage of an action executing, "user" refers to the battler who used the action, "target" refers to the battler which the skill is being used on (which will also be the bearer of the state), and "origin" refers to the battler which added the state to the target in the first place, which may or may not be the current user.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,786
Reaction score
2,931
First Language
English
Primarily Uses
RMMZ
Bumping this for visibility. I thought it was pinned.
 

zelanius

Mechanics Freak
Veteran
Joined
Apr 29, 2020
Messages
144
Reaction score
42
First Language
English
Primarily Uses
RMMV
I tried searching through the forum, but can't find it, and so decided to post here. How do I make an item effect through script call? The reason I am doing this, is specifically because of YEP Stat Allocation, which can only grant bonus AP through script calls, but not through notetags. However, while adding AP through learning skills is straight forward using the <Learn Cost Eval> notetag, there does not seem to be an equivalent for items. Appreciate any help, please, and a big thanks in advance!
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
2,287
Reaction score
1,237
First Language
English
Primarily Uses
RMMV
I tried searching through the forum, but can't find it, and so decided to post here. How do I make an item effect through script call?
I found your question a bit confusing...items have specific properties called effects, which you can see on the right-hand side of the database screen. So it sounded like you're trying to add one of those effects to an item during the course of the game, which might be possible with Yanfly's independent items, but not usually.
The reason I am doing this, is specifically because of YEP Stat Allocation, which can only grant bonus AP through script calls, but not through notetags.
Then I got to this part and I think your question is how to make an item that, when used in the menu, will give allocation points to an actor.

You'll need to also have Yanfly's Skill Core installed. On the item, add the effects Add State (x) and Remove State (x), where x is an empty state - this should allow you to use it on a party member without requiring healing or anything.

Then, in the notetags, put:
Code:
<After Eval>
target.gainBonusAp(x, 0);
</After Eval>
where x is the amount of AP you want to give them. You may also replace the 0 with a specific class, if that's a part of your system.
 

zelanius

Mechanics Freak
Veteran
Joined
Apr 29, 2020
Messages
144
Reaction score
42
First Language
English
Primarily Uses
RMMV
I found your question a bit confusing...items have specific properties called effects, which you can see on the right-hand side of the database screen. So it sounded like you're trying to add one of those effects to an item during the course of the game, which might be possible with Yanfly's independent items, but not usually.

Yes, but with the effects, I am not able to do a script call on the target.


Then, in the notetags, put:
Code:
<After Eval>
target.gainBonusAp(x, 0);
</After Eval>
where x is the amount of AP you want to give them. You may also replace the 0 with a specific class, if that's a part of your system.

This works! Thank you.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
2,287
Reaction score
1,237
First Language
English
Primarily Uses
RMMV
Yes, but with the effects, I am not able to do a script call on the target.
I know, that's why your question didn't make sense.

I'm glad you got it working.
 

ScorchedGround

Blizzards most disappointed fan (More than ever)
Veteran
Joined
Apr 12, 2020
Messages
647
Reaction score
899
First Language
German
Primarily Uses
RMMV
Hey @Trihan ,
this is a quick one regarding BuffStatesCore

I want to make a passive state with this premise:
"Every time the character takes direct damage, all other allies are healed for 5% of damage dealt."

I got this so far:

JavaScript:
<Custom React Effect>
if (value > 0) {
let targets = $gameParty.aliveMembers();
let heal = value * 0.05;
targets.forEach(function(target) {
  target.gainHp(heal);
  target.startAnimation(337);
  target.startDamagePopup();
});
}
</Custom React Effect>

And this works fine, but obviously the main target that gets hit also profits off the healing, which I don't want.

So how can I change the targets to all aliveMembers, excluding the character being attacked?
Basically "let targets = $gameParty.aliveMembers() - target;"
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
2,287
Reaction score
1,237
First Language
English
Primarily Uses
RMMV
I want to make a passive state with this premise:
"Every time the character takes direct damage, all other allies are healed for 5% of damage dealt."
JavaScript:
<Custom React Effect>
if (value > 0) {
    let heal = value * 0.05;

    for (var i=0; i<$gameParty.aliveMembers().length; i++)
    {
        if ($gameParty.aliveMembers()[i]==target)
            continue;

        $gameParty.aliveMembers()[i].gainHp(heal);
        $gameParty.aliveMembers()[i].startAnimation(337);
        $gameParty.aliveMembers()[i].startDamagePopup();
    }
}
</Custom React Effect>
 
Last edited:

ScorchedGround

Blizzards most disappointed fan (More than ever)
Veteran
Joined
Apr 12, 2020
Messages
647
Reaction score
899
First Language
German
Primarily Uses
RMMV
JavaScript:
<Custom React Effect>
if (value > 0) {
    let heal = value * 0.05;

    for (var i=0; i<$gameParty.aliveMembers().length; i++)
    {
        if ($gameParty.aliveMembers()[i]==target)
            continue;

        $gameParty.aliveMembers()[i].gainHp(heal);
        $gameParty.aliveMembers()[i].startAnimation(337);
        $gameParty.aliveMembers()[i].startDamagePopup();
    }
}
</Custom React Effect>

Thank you very much @ATT_Turan .

This seems to work for me. Atleast the healing part.
I had to adjust the code to round up the heal first though to avoid janky numbers. I kinda forgot that initially.

Strangely though, if the character with the state is defeated, they don't play their collapse animation and instead just keep standing there, frozen.

On another note, is it possible to activate this effect only when the target is still alive after taking damage?

I imagine you'd need a respond effect instead, right? I appreciate any help.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,786
Reaction score
2,931
First Language
English
Primarily Uses
RMMZ
Thank you very much @ATT_Turan .

This seems to work for me. Atleast the healing part.
I had to adjust the code to round up the heal first though to avoid janky numbers. I kinda forgot that initially.

Strangely though, if the character with the state is defeated, they don't play their collapse animation and instead just keep standing there, frozen.

On another note, is it possible to activate this effect only when the target is still alive after taking damage?

I imagine you'd need a respond effect instead, right? I appreciate any help.
Shouldn't be hard to do, I'll whip something up for you in a bit.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
2,287
Reaction score
1,237
First Language
English
Primarily Uses
RMMV
Strangely though, if the character with the state is defeated, they don't play their collapse animation and instead just keep standing there, frozen.
I'm not sure why that would occur, maybe playing other animations during the damage resolution interrupts it somehow.
On another note, is it possible to activate this effect only when the target is still alive after taking damage?

I imagine you'd need a respond effect instead, right? I appreciate any help.
Yes, just change the whole thing to Respond instead of React. That might also fix your not-dying problem. You'll want to do if (value>0 && target.hp>0)
 
Last edited:

ScorchedGround

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

Yeah, I did some experimenting already since our last exchange.
I tried numerous things, and this is what I got last before your and @Trihan 's response:

JavaScript:
<Custom Respond Effect>
if (value > 0 && target.hp > 0) {
    let heal = Math.ceil(value * 0.05);

    for (var i=0; i<$gameParty.aliveMembers().length; i++)
    {
        if ($gameParty.aliveMembers()[i]==target)
            continue;

        $gameParty.aliveMembers()[i].gainHp(heal);
        $gameParty.aliveMembers()[i].startAnimation(337);
        $gameParty.aliveMembers()[i].startDamagePopup();
    }
} else if (target.hp <= 0) {
target.performCollapse();
}
</Custom Respond Effect>

This, however, also did not fix any of the previous issues.

But thank you very much for your help so far, @ATT_Turan :smile:

@Trihan
Thank you very much, I am eager to see what you come up with! :biggrin:
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
2,287
Reaction score
1,237
First Language
English
Primarily Uses
RMMV
Are you sure you don't have anything set in the state itself? It's not state 1?
 

ScorchedGround

Blizzards most disappointed fan (More than ever)
Veteran
Joined
Apr 12, 2020
Messages
647
Reaction score
899
First Language
German
Primarily Uses
RMMV
Aww, come on man, I may be a fool, but I am not a complete rookie.
Doing anything to state #1 is too foolish, even for me. :kaophew:

Anyways, the state in question is ID 184 and its basically empty apart from the notetag:

Unbenannt.png

The only thing notable about this whole setup is that this state is actually a Passive State
(YEP_AutoPassiveStates) bound to a skill.

The skill (ID 733) in question is, however, mostly empty aswell.

Unbenannt2.png

So, considering that the heal effect is working properly, the notetag seems to be in effect aswell.
 

Latest Threads

Latest Posts

Latest Profile Posts

Can't wait for next update! :)
I really want to get a cat... but our puppy is still... well... a puppy and would eat and bark at a cat if we got one... *sighs* I guess I'll wait a couple of years~
unintentionally made a track that sounds straight out of Yume Nikki
Revisiting one of my older projects in a long time to work some more on the mechanics. I've been working on- and off-again for about a year now on recreating the Force and Mystic systems from Wild ARMs. And I think I've finally made some good breakthroughs on that!

Still, it is not perfect and I may post my thoughts at a later time to see if there are any other suggestions or alternatives I've missed.
actor name string, why you gotta be case sensitive like that?

Forum statistics

Threads
116,110
Messages
1,095,877
Members
151,516
Latest member
HevaCat
Top