AeonXI

Villager
Member
Joined
Dec 6, 2022
Messages
20
Reaction score
0
First Language
English
Primarily Uses
RMMV
A interesting mechanic that the Glory of Heracles series has is that when a character attacks, it shows a small flavour text of the character screaming or threatening the enemy. As you can already guess, I want that in my game! I also plan on giving player's the option of changing the default text themselves but for now, I just wanna focus on the random messages themselves.
Glory of Heracles 3 V1.1a-230409-200813.png
Essentially, I want the lines to be uttered randomly when a character attacks, dies, uses items and run away, and just to be clear, I want so that each character has their own set of lines (So that when I implement the option of players to change the dialogue they could do it for each individual character). But I have a very small knowledge of JavaScript and even less about how to put something like that in a RPG Maker MV. I vaguely know that you need to create events and put then on Switches or something like that, I'm sure I can do that using common events alone, but I have no idea how :/ .
 

TheAM-Dol

Randomly Generated Christmas Festivities
Regular
Joined
Feb 26, 2022
Messages
1,165
Reaction score
2,184
First Language
English
Primarily Uses
RMMV
Maybe someone will be able to offer you more direct help, but to help you work through part of the heavy lifting on this, you would want to build this system into a common event and then apply that common event to ever skill/item.
NOTE: There are a few problems with this method by itself, which is where you might need to do some googling (or maybe another user may be able to help you work around this.
  1. Most importantly is the way the game handles common events during battle when applied to skills. By default the common event is run after the skill is executed, which for adlib "Hiyah!" quotes would seem to have misplaced timing.
  2. Applying the common event to items and non-combat skills (field skills) will have the common event run regardless of whether the player is using it in the field or in combat. This might be okay depending on what the text says, but it could also be an unwanted behavior. So, in order to bypass that, you'd need to create a check within the common event to see if the player is in battle or not.
  3. It's also worth considering the gameplay value this adds. A lot of gamers nowadays find turn-based combat rather slow, and that mostly has to do with all the text, menuing, and waiting for animations to play. Adding additional unnecessary information that will slow the game down even further may be perceived as a nuisance by some gamers. At the very least, if you feel this should be part of your game, I would make sure to either reduce the frequency of these text events and/or providing an option in the menu to disable them entirely.
Create your common event
You can use the "Control Variables..." command to create random behavior. JS wizards might be able to clean this up a little, but for an event solution here is how you would do that:
Set a variable to "RanVar" (or any name that is easy for you to remember it's purpose. The name isn't particularly important other than for remembering and organizing). Put the operation to "Set" (which is the default operation when using variable control) and select the "Random" option from Operand the list below.
It's best to start the RanVar at 0 unless you have a 0 state. I'm going to assume you don't have a 0 state, so in this case, our RanVar will be indexed (meaning 0 is going to be the first entry and 5 will be our sixth entry).

Now at the start of the common event, the game will roll a random variable number between 0 and whatever the maximum you set.
Next create conditional branches for each possible roll. So "If RanVar = 0, do this." "If RanVar = 1, do this." etc...
Inside each conditional, you can set what ever text gets displayed.

For creating custom adlib shouts, you can save text input into a variable string. Then in the text box use the \v[varNumber] to show that string that has been saved to a variable.

One last part to this tutorial, which is on cleaning it up:
First, if you plan to create an option for players to disable this feature (which I highly recommend), at the very tippy-top of this common event you need to set up a conditional.
First, have a switch set up and name it first with exactly <Global Meta>, after the "global meta" tag, you can name the switch whatever you want. So it might look like "<Global Meta> BattleShouts"
You will need to download Olivia's meta controls in order to make this work (without it, the <Global Meta> tag won't work)
I have a tutorial on setting up options in your game that I will link here, but since that's outside the scope of this post, let's just get your common event set up for options later (You can always add the options to your game at a later point, let's just make sure we set the object up to be turned off/on properly)
Now At the top of the common event set the conditional "If <Global Meta> BattleShouts is turned on, ..."
Within this conditional you will build out the logic for the random battle shouts.

To reduce the frequency at which battle shouts happen in battle (so that it doesn't annoy players), you can have the RanVar roll higher than your available options. So let's say, for this example, you want 3 shouts. Let's roll the RanVar 0 - 5 (6 options)
"If RanVar = 0, shout"
"If RanVar = 1, shout"
"If RanVar = 2, shout"
And that's it. If RanVar rolls 3 or higher, there is no logic associated with those higher values effectively bypassing all of the shouts, therefore making shouts only happen 50% of the time.



You technically can create all of this within a single common event, but it's going to be much easier to manage if you build a common event for each type: physical attacks, magic attacks, and items.
You can then attach the common event in the skill/item properties.

So, basically, in order to execute this, you just need to find a plugin that moves when the common event activates when using skills. Surely that must exist already :LZSskeptic: Although, technically you don't need to that either. If you want to get creative, instead of it being a shout "as the actor executes the skill" it could instead be a cheeky one-line after the attack executes. So instead of "Hiyah!" slash! it is instead: slash! "You didn't see that coming, did you? heh, heh, heh."
(but then there's the problems of checking whether the player missed their hit or not...it's never that simple.)
To add random battle shouts to your RPG Maker game, you can create a common event and use the "Control Variables" command to set a random variable number. Then create conditional branches for each possible roll and set the text to be displayed within each conditional. You can also save text input into a variable string for custom adlib shouts. To prevent annoying players, you can reduce the frequency of battle shouts by having the variable roll higher than the number of available options. It's best to create a common event for each type of attack and attach it to the skill/item properties. However, you may need to do some research to work around some issues, such as the default timing of common events during battle and applying them to non-combat skills. Additionally, consider the gameplay value and provide an option to disable the feature.

edit:
Small edit, added link to my YEP Options tutorial (took me awhile to find it...)
 
Last edited:

Shaz

Keeper of the Nuts
Global Mod
Joined
Mar 2, 2012
Messages
46,153
Reaction score
16,971
First Language
English
Primarily Uses
RMMV

I've moved this thread to Plugin Requests. Thank you.



because you probably want something to happen while the attack is in progress, and not after it's all said and done.
 

ShadowDragon

Realist
Regular
Joined
Oct 8, 2018
Messages
8,229
Reaction score
3,499
First Language
Dutch
Primarily Uses
RMMV
I have the escape, premetive, surprise messages at random,
not when they attack or die though, but I could add them probably.

as you can set an entire list of random messages which seems to be fun.
check my spoiler for the battle messages plugin, as it is what you look for.

I will see when I got time to add the attack, and die at random on your choice.
 

Cythera

Regular
Regular
Joined
Jul 31, 2019
Messages
432
Reaction score
1,658
First Language
English
Primarily Uses
RMMV
So this may not be exactly what you're after, but I thought I'd mention it since I made a system with similar results.
It involves yep action sequence and yep gab window so the dialogue can open during the action without needing a text box and player input. Though if you don't want to/aren't able to use gab windows, a text box would work - but it slows down the flow of the battle.

I did this by calling a character-specific common event within the skill action sequence, and variables with their values set inside the skill to pull dialogue depending on conditions. So for fire-based skills for that character, I'd set the variable to 3, for example, and in the common event have a if var = 3 branch that contains all possible dialogue for that skill type. Also I run a % chance in the skill so dialogue isn't happening every single time - only if the % chance passes, then the event is called.

I'm currently testing 'reaction' dialogues, such as when characters take critical hits or fatal damage, but that uses two additional plugins - states core and passives. At least, that's the most efficient way I could think of to set it up >.> Better coders will no doubt have cleaner ways to do this than me.

Again, it may not be precisely what you're after, but I couldn't find a plugin that does what I wanted so I cobbled together my own system. If you want to give it a try, I can walk you through how to set it all up in more detail.
 

AeonXI

Villager
Member
Joined
Dec 6, 2022
Messages
20
Reaction score
0
First Language
English
Primarily Uses
RMMV
Sorry for responding late, got a bit busy...

@TheAM-Dol I just want to begin by saying again I'm still a beginner on JavaScript (and RPG Maker MV Events for that matter) so I may be forgetting something or writing the code like an absolute moron, my memory isn't the best either so... >>
I'm tried writing the Conditional Branch code in the Script command in all sorts of ways but all of them give me an error:
rpg maker mv error.png
This is how I wrote the code when I the error occured not sure how I'm supposed to "define" Shout, I thought it was just a command to make battle messages appear :/
(I'm sure I'm writing it all wrong...)
Just to make sure the solution wasn't on the tip of my nose I tried copying the code by how you "wrote" (without much of the syntax and all), but it also didn't go right.
other rpg maker mv error 2.png

Also, @ShadowDragon That's awesome! Also if you could add the attack and defense options can you also make it so that each actor has their own set of lines? I want it so that the player is able to make each character say something different when doing actions.

And I definitely wanna see more of your system @Cythera (Although I want to finish coding this Common Event first)! It could be useful for making my own system. Do these plugins make messages appear before the"Actor attacks!" message?
 

Cythera

Regular
Regular
Joined
Jul 31, 2019
Messages
432
Reaction score
1,658
First Language
English
Primarily Uses
RMMV
And I definitely wanna see more of your system @Cythera (Although I want to finish coding this Common Event first)! It could be useful for making my own system. Do these plugins make messages appear before the"Actor attacks!" message?
Sure thing!
So you can actually configure when the message appears based on when you call the common event in my system. Some actors have skills they have dialogue for before, some during, and some after the skill. Totally up to you when you want to have the dialogue have a chance to appear.
This is how my system looks (pardon the poorly cropped images haha)
Test battle with only one actor; just to show how the gab window works. It appears during her cast animation.
2.png
This is part of the common event I use for my character Mara and all her in-combat dialogue.
Currently, I have 2 possible lines for Mara whenever you uses a fire skill. So I use another variable called 'RNG' to pick one randomly. Right now, if-else branches work for it, but if I want more lines, I'll probably switch it over to pre-populated arrays, which would require me to use the 'Script' option and add in code, rather than using RM commands that you see below.
1.png
This is what I put in my skill action sequences to actually call the common event:

if ConfigManager.CGab
if Math.randomInt(10) === 1
change variable 167 = 1
common event: 56
end
end

The CGab is an option I put in my game so players can turn the in-battle dialogue on and off if they prefer.
Math.randomInt is the % chance check I mentioned. Only if the number generates to 1 will the common event 56 (Mara's dialogue common event) be called. The variable 167 is what I use to determine the condition. In this case, it's a fire skill. You can see in the common event, if the variable is 1, it runs the 'fire branch' I made and pulls dialogue that's for her fire skills.

Also, just for reference, in that second image you shared: whenever you use 'script' in RM, it's gotta be code in the block. What you put isn't exactly correct :3
When you reference a variable, it's "$gameVariables.value(x)" where x is the variable ID. The variable name is simply for devs; it has zero impact in-game (unless you're using a different plugin that makes it so)
Additionally, 'shout' isn't valid. You would "$gameMessage.add('Attack!');" to make a text box pop up with the word "Attack!" in it.
In the script block you have, everything there can be more easily done with RM's built in commands. Things like conditional branch, or show text. Scripts are really useful, don't get me wrong, but if you can do something using built-in features, it's usually better :3
 

AeonXI

Villager
Member
Joined
Dec 6, 2022
Messages
20
Reaction score
0
First Language
English
Primarily Uses
RMMV
@Cythera Okay, I got results!
Yaaaaaaaayyyy
Only problem is that it doesn't randomly switch to the other messages, why is that? Isn't the Control Variables function supposed to take care of that? >:/
For the record, this is how the code is now (It didn't change much but who knows, it may be helpful to know:
if (RanVar = 0){
$gameMessage.add('Die!');
} else if (RanVar = 1){
$gameMessage.add('Perish!');
} else if (RanVar = 2){
$gameMessage.add('Take THIS!');
}
 

Cythera

Regular
Regular
Joined
Jul 31, 2019
Messages
432
Reaction score
1,658
First Language
English
Primarily Uses
RMMV
Your variable reference is still incorrect.
$gameVariables.value(x) where x is the variable ID - from the screenshot above, it looks like you're using variable 1 for this.
And in JS - what MV uses - when you want to check values, it's == or ===. A single = is for assignment :)
So it should look like:
if($gameVariables.value(1) == 0) {
//message 1 here
} else if ($gameVariables.value(1) == 1) {
// message 2 here
}
and so on
 

AeonXI

Villager
Member
Joined
Dec 6, 2022
Messages
20
Reaction score
0
First Language
English
Primarily Uses
RMMV
Nice, it's working now, thanks! :-D
Do you also know how to make it only happen to the party? I know I could just create an "Attack 2" and put it into the Enemies skills but surely there's a more "sophisticated" way to do that no?
 

Cythera

Regular
Regular
Joined
Jul 31, 2019
Messages
432
Reaction score
1,658
First Language
English
Primarily Uses
RMMV
Yeah, there are ways, depending on how and when you're calling the common event
 

AeonXI

Villager
Member
Joined
Dec 6, 2022
Messages
20
Reaction score
0
First Language
English
Primarily Uses
RMMV
In my case, how would it be? This is how the code looks like (Yeah, I'm still using Script, too lazy to repeatedly keep going to the event commands menu >>)code.png
 

Cythera

Regular
Regular
Joined
Jul 31, 2019
Messages
432
Reaction score
1,658
First Language
English
Primarily Uses
RMMV
I need to know how you're calling the common event first before I can make suggestions.
When your characters use the skill, where is the common event? Something in the notetag? Or in the lil effects table on the right hand side of the skill page?
 

AeonXI

Villager
Member
Joined
Dec 6, 2022
Messages
20
Reaction score
0
First Language
English
Primarily Uses
RMMV
It's on effects table on the skill page :V
 

Cythera

Regular
Regular
Joined
Jul 31, 2019
Messages
432
Reaction score
1,658
First Language
English
Primarily Uses
RMMV
Erk. Okay. That's kinda worse-case, because the solution itself is bit repetitive.
So one way I can think to do this is to use a second variable in the damage formula itself:
a.isActor() ? v[x] = 1 : v[x] = 0 ; (put your dmg formula here)
Replace x with a different variable ID.
Then, in your common event, put everything you have INSIDE a conditional branch that checks if variable x is 1.

You're going to have to put that a.isActor() bit inside every skill that the actors and enemies share. What this is doing is changing a variable to have a value of 1 if the user is an actor. Then the common event checks if the variable has a value of 1 (thus is an actor) and will do the dialogue thing if that's the case.

It's a bit repetitive sadly, but the only other way I can think to do that is to mod the engine code itself to check if skill user is an actor every time a common event is called via a skill...but that's more complex, and can have side effects and implications later on in game development. Plus modding the engine itself should only be done if you really know what you're doing - a bit above me :yswt:
 

AeonXI

Villager
Member
Joined
Dec 6, 2022
Messages
20
Reaction score
0
First Language
English
Primarily Uses
RMMV
Won't be able to test it for now cuz I need to sleep, but thanks anyway!
 

TheAM-Dol

Randomly Generated Christmas Festivities
Regular
Joined
Feb 26, 2022
Messages
1,165
Reaction score
2,184
First Language
English
Primarily Uses
RMMV
I'm tried writing the Conditional Branch code in the Script command in all sorts of ways but all of them give me an error:
Hi Aeon,
Sorry, I should have made this more clear in my original response that I am talking about eventing this entire logic - meaning the entire thing would be built with event commands, and not script.
It would look something like this (except I built this in a standard event, you should build this in a common event)
eventcommands.png
Being familiar with script is really powerful (and I'm certain if you continue to write your events with script, you'll be running circles around me in no time) but I highly recommend getting familiar with all of the various event commands before wading through the wake of JS.

Anyways, it looks like you and @Cythera are working it out together, so I'll pass the torch off to her.
 

ShadowDragon

Realist
Regular
Joined
Oct 8, 2018
Messages
8,229
Reaction score
3,499
First Language
Dutch
Primarily Uses
RMMV
even if random messages on attack and guard for each actor based on
actorID, than the list can be extremely high, if its not using 1 ~ 4, but
also not entirely sure how to do that for each actor.

I might have an idea, but it takes time to add those, as its random
from the list, but if you really want to structure that instead of skills/states
like Cythera said (which is also a nice way to add for each actor if they
all use different skills set per actor, it would work if you are being comfortable
with the system.

if you want to set it up and grab automatically from the list of extend per
actor and per using the skill, it takes some time to impliment it though.

because skill, state, attack, defense is a big list per actor, though.
I need to think how I could impliment that nicely.
 

AeonXI

Villager
Member
Joined
Dec 6, 2022
Messages
20
Reaction score
0
First Language
English
Primarily Uses
RMMV
@ShadowDragon Well, if you want to, I wish you good look then...

Speaking of which, @Cythera can the code that you responded with in your last comment be edited to somehow make a individual actor random mesage event?
 

ShadowDragon

Realist
Regular
Joined
Oct 8, 2018
Messages
8,229
Reaction score
3,499
First Language
Dutch
Primarily Uses
RMMV
both ways can do that, I might have an idea, and end result can be the same,
after each role on the random variable, you check for the actor.

so if variable 1 = 2 and actor 3 cast it.

if variable = 0
if actorid = actor1
text: over here
end
if actorid = actor2
text: what you waiting for
end
end

and you basicly do that for each part, so the list can be long,
same with the pre-structur if I add it, but I can add the actorID in front
before the text message if they match.

I need to rewrite it tiny bit (which require my base by than), but the option
is also more wider, but you can add actorID easier, but I think I need to
double check more, but as the random message if for escaping, premitive
and surprise that counts for the entire part.

but if you want to play with it, it can take 1-2 weeks probably till its ready.
as I also might need some checks as default is "%1 attacks" which is given
in the skill description, that part need to be modified I think in order to say
different things when attacking with the same skill.
 

Latest Threads

Latest Profile Posts

Arrr me mateys, have ye seen the new Advent pirates? Wouldn't want to cross paths with those scallywags.
Is there a clinical term for the disorder wherein you always have way too many Internet browser tabs open?
Kokoro Reflections is my favorite tileset maker. I absolutely love their work. I have bought quite a bit from them. Best RPG Maker tileset creator ever imo.
Me working on a deadline, "don't make the baseline and chords too funky, don't over compose it... remember, you have to finish it." Touches MIDI controller...instant funk.
TGA are coming up, and I'm still mad Lies of P didn't get nominated.
Like, they chose a remake of a 20 year old game and a vanilla 2D Mario game over it?

Bah, humbug!
I'll be there for the trailers and whatever weird mistakes are made.

Forum statistics

Threads
136,784
Messages
1,269,958
Members
180,539
Latest member
z_juice
Top