MV Different Actor lines based on an action.

Greetings all! I come in need again. This may be a bit hard to explain, but I will do my best, so bear with me.

You know how in Overwatch, characters will react with different voice lines when they are healed, revived, debuffed, get a kill, etc like a character will say "Thanks for the heals, bro." when they recieve healing while on the brink of death, or "I don't feel so well" when hit with a debuff. I want to have that in my game.

So far, with Yanfly's Gab window and Base troop events, I was able to make low health quotes on each actor, with a number generator to vary up the quotes so it's not the same thing over and over again.

So to simplify, I want A gab window to appear when:

- Ally is Healed (Preferably when they are low on health)
- Ally is Debuffed
- Ally is Buffed
- Ally gets a kill

Thank you!
Bump.
Just to note it, we're not supposed to bump threads within 72 hours. Everyone here is a volunteer with a real life schedule, reading and posting in their free time.

It looks to me like you can do everything you're saying with notetags from Yanfly's Buffs & States Core. Give each actor a passive state from Auto Passive States with Custom Respond, Deselect, and Conclude notetags that checks what the action did and produces a gab window.
Give each actor a passive state from Auto Passive States with Custom Respond, Deselect, and Conclude notetags that checks what the action did and produces a gab window.
Can you tell me how to do this? I'm not familliar with javascript.
Can you tell me how to do this? I'm not familliar with javascript.
I don't think anything he said there requires javascript. It should be in the plugin settings.
I don't think anything he said there requires javascript. It should be in the plugin settings.
I know about the Actor Passive Parameters and all that, what I want to know is how to use in a conditional way. In other words, just give me a tutorial on how to do it, please.
Maybe @AquaEcho has something more streamlined in mind than I can think of - I'd love to make this less complex. But this is what I can think of.

Give each actor this passive state. In the notes put:

Code:
<Custom Deselect Effect>
$gameTroop._interpreter.setGabSpriteName(target._faceName);
$gameTroop._interpreter.setGabSpriteIndex(target._faceIndex);

// Ally is healed
if (!target.result().missed && this.isHpRecover())
{
    $gameTroop._interpreter.setGabText("Yay, I'm healed!");
    $gameTroop._interpreter.forceGab();
}

// Ally is debuffed
if (target.result().addedDebuffs.length>0)
{
    $gameTroop._interpreter.setGabText("Oh no!");
    $gameTroop._interpreter.forceGab();
}

// Ally is buffed
if (target.result().addedBuffs.length>0)
{
    $gameTroop._interpreter.setGabText("Woohoo!");
    $gameTroop._interpreter.forceGab();
}

</Custom Deselect Effect>

<Custom Establish Effect>
if (target.hp<=0 || target.isDead())
{
    $gameTroop._interpreter.setGabSpriteName(target._faceName);
    $gameTroop._interpreter.setGabSpriteIndex(target._faceIndex);
    $gameTroop._interpreter.setGabText("Take that!");
    $gameTroop._interpreter.forceGab();
}
</Custom Establish Effect>

I haven't messed with the gab plugin before, or tested this, so let me know if it...like, blows up your computer or anything.

If you get errors, hit F12 and take a screenshot of the Console tab.

And try to be patient and explain yourself well. "Just give me a tutorial" comes off unpleasantly needy 😉
"Just give me a tutorial" comes off unpleasantly needy 😉
I sincerely apologize for that.
No worries. Let me know if the above code works or has issues.
Maybe @AquaEcho has something more streamlined in mind than I can think of - I'd love to make this less complex. But this is what I can think of.
I don't know about more streamlined but there are notetags and plugin commands to use if you didn't want to jump straight to "lunatic mode"
I don't know about more streamlined but there are notetags and plugin commands to use if you didn't want to jump straight to "lunatic mode"
Such as? I honestly have no idea what notetags from which plugins can display a gab window under those conditions, so it would be helpful to me if you listed a few.

You could use plugin commands for the "killed an enemy" condition using troop events, but you'd have to use JavaScript to determine which actor should be saying it anyway, so you might as well just stick it in the passive state to have everything in one place.
I got an error, it seems to be trying to find the file " S t a z i e r.png" Instead of just "Stazier.png" (The Message bubble state is the one with your code.)
1683685477107.png










And here's the console as requested.
1683685749328.png
Well...that's the bottom of the stack, so we see a bunch of stuff you have mistyped in an action sequence 🤣

It's attackMotion(), not AttackMotion()

I also don't see how those spaces would get in there if that isn't what you have your image called in the first place.

But I do see an error I made - in the code I pasted, change the instances of setGabSpriteName and setGapSpriteIndex to setGabFaceName and setGabFaceIndex. That was a dumb mistake 😛
Dude, the fact that you can do this is amazing in itself.



My file has always been named "Stazier", I don't know what's going on.
1683687511555.png



1683687786511.png


Hopefully this is a better console screenshot? I ain't no coder, but I think those 20% between the name's letters should not be there.
I also don't see how those spaces would get in there if that isn't what you have your image called in the first place.

But I do see an error I made - in the code I pasted, change the instances of setGabSpriteName and setGapSpriteIndex to setGabFaceName and setGabFaceIndex. That was a dumb mistake 😛
out of curiosity, i took some of the lines you wrote to try out myself. I had the same spacing issue, but the console indicates that its the only issue after the corrections

JavaScript:
<Before Eval>
$gameTroop._interpreter.setGabFaceName(user._faceName);
$gameTroop._interpreter.setGabFaceIndex(user._faceIndex);

$gameTroop._interpreter.setGabText("Oh no!");
$gameTroop._interpreter.forceGab();
</Before Eval>
1683687827745.png

1683687849668.png

EDIT: thing to maybe note if anyone in the future who also uses the classchange plugin and has faces set by class. I had to change ._faceName and ._faceIndex to .faceName() and .faceIndex(). the prior set of properties returns the actor images set in the database, but i have combat face images change based on class and had to use the methods. It still spaces out the filepath though
I'd strongly suggest you open that HIME_TargetAnyScope with a text editor and find all places where it says "console.log" and put a // at the beginning of the line to get rid of them. Then Refresh the plugin in your plugin manager.

@Robro33 Thanks for the help. I can see where it's being done by the Yanfly Gab plugin on lines 345 and 330, I just can't fathom the reason for it.

I don't see how that wouldn't break the basic functionality of the plugin command itself.

It's easy enough to change, but I want to experiment with the plugin first to see why it does that.

Edit: Aha! Because plugin command arguments aren't passed to the function as a straight text string, they're passed as an array of strings divided up by word. SO! Try the revamped code, just delete everything in the state note field and paste the new one in:
Code:
<Custom Deselect Effect>
$gameTroop._interpreter.setGabFaceName([target._faceName]);
$gameTroop._interpreter.setGabFaceIndex([target._faceIndex]);

// Ally is healed
if (!target.result().missed && this.isHpRecover())
{
    $gameTroop._interpreter.setGabText(["Yay, I'm healed!"]);
    $gameTroop._interpreter.forceGab();
}

// Ally is debuffed
if (target.result().addedDebuffs.length>0)
{
    $gameTroop._interpreter.setGabText(["Oh no!"]);
    $gameTroop._interpreter.forceGab();
}

// Ally is buffed
if (target.result().addedBuffs.length>0)
{
    $gameTroop._interpreter.setGabText(["Woohoo!"]);
    $gameTroop._interpreter.forceGab();
}

</Custom Deselect Effect>

<Custom Establish Effect>
if (target.hp<=0 || target.isDead())
{
    $gameTroop._interpreter.setGabFaceName([target._faceName]);
    $gameTroop._interpreter.setGabFaceIndex([target._faceIndex]);
    $gameTroop._interpreter.setGabText(["Take that!"]);
    $gameTroop._interpreter.forceGab();
}
</Custom Establish Effect>
I'd strongly suggest you open that HIME_TargetAnyScope with a text editor and find all places where it says "console.log" and put a // at the beginning of the line to get rid of them. Then Refresh the plugin in your plugin manager.


Changed to //console.log, or should it be // console.log? The plugin still works as intended.


Also the little js addon makes it kinda work. It makes the player say "Y a y I ' m h e a l e d", with spaces in between the letters, similar to the error above. Interesting.
Changed to //console.log, or should it be // console.log? The plugin still works as intended.
Doesn't matter.

Also the little js addon makes it kinda work.
See my edit above.
Edit: Aha! Because plugin command arguments aren't passed to the function as a straight text string, they're passed as an array of strings divided up by word. SO! Try the revamped code, just delete everything in the state note field and paste the new one in:
Code:
<Custom Deselect Effect>
$gameTroop._interpreter.setGabFaceName([target._faceName]);
$gameTroop._interpreter.setGabFaceIndex([target._faceIndex]);

// Ally is healed
if (!target.result().missed && this.isHpRecover())
{
    $gameTroop._interpreter.setGabText(["Yay, I'm healed!"]);
    $gameTroop._interpreter.forceGab();
}

// Ally is debuffed
if (target.result().addedDebuffs.length>0)
{
    $gameTroop._interpreter.setGabText(["Oh no!"]);
    $gameTroop._interpreter.forceGab();
}

// Ally is buffed
if (target.result().addedBuffs.length>0)
{
    $gameTroop._interpreter.setGabText(["Woohoo!"]);
    $gameTroop._interpreter.forceGab();
}

</Custom Deselect Effect>

<Custom Establish Effect>
if (target.hp<=0 || target.isDead())
{
    $gameTroop._interpreter.setGabFaceName([target._faceName]);
    $gameTroop._interpreter.setGabFaceIndex([target._faceIndex]);
    $gameTroop._interpreter.setGabText(["Take that!"]);
    $gameTroop._interpreter.forceGab();
}
</Custom Establish Effect>
Can confirm that works. Atleast for me. That seems like an oddly specific issue, but itll be something I keep in mind later
Now it works perfectly! Now I gotta add a variable so it doesn't get spammed every time the actor gets healed, and write custom voicelines for each actor, which I think I can do on my own.

Thank you all for the help!

Original thread: https://forums.rpgmakerweb.com/threads/different-actor-lines-based-on-an-action.157326/