Roll for Attack, roll for damage

I have been playing around with RPG Maker VXace for about a month now. I can design the basics, but I'm fairly comfortable with the sheer volumes of opportunities this shallow insight allows for in terms of story telling.


In terms of Combat Mechanics, I'm significantly less confident.


I've played D&D variations for nearly 2 decades, and I'm much more comfortable working with dice systems then the multi-thousand hit point 'World of Warcraft' boss articulations, or standard Final Fantasy norms that have been established for longer then I've been playing role playing games. I don't really understand what is too much or not enough, and all sorts of little intricacies that go into normal RPGs.


When I learned that I could call common events from Skills that players use, I got excited about taking the harshest flaw of D&D out of the situation. I could automate the dice rolling and other mechanical bits. No longer would I have to worry about someone using a fireball on a boss that is immune to fire and me just simply forgetting about it, or care if a die in particular has all the 20's rolled out of it! I can just establish the Dice Mechanics, let the game worry about that, and focus more on the story telling methodology and clever uses of switches, and other goodies that the program provides!


Now... In application of that... I may have bit off more then I could chew.


So, in bare bones, this is the idea for a roll for attack common event. Basically, the game will roll 3 6-sided dice and check if any of the three match each other for a critical hit. I want it sprawled out like this, so that I can add animations, sound effect and so forth of the dice rolled and add flare for critical rolls. With additional tweaking, I can add things like extra dice, rolling extras and dropping the lowest and so forth. I'm not sure if all the situations should be independent common events or if they should be accounted for via switches in one massive common event. For right now, I'm just trying to get the basic attack working, and we can move on from there.


- Common event [Basic Attack Roll]
     - Set Variable [Attack Skill] to ["The attacking character's melee attack skill"]
     - Set Variable [Die 1] to 1-6 randomly
     - Set Variable [Die 2] to 1-6 randomly
     - Set Variable [Die 3] to 1-6 randomly
     - Check for Critical Hit
        - Compare if Variable [Die 1] is equal to Variable [Die 2]
             - Turn Switch [Critical] On
             - Else;
        - Compare if Variable [Die 1] is equal to Variable [Die 3]
             - Turn Switch [Critical] On
             - Else;
        - Compare if Variable [Die 2] is equal to Variable [Die 3]
             - Turn Switch [Critical] On
             - Else;
     - Set Variable [Attack Value] to Variable [Die 1], [Die 2], [Die 3] and [Attack Skill] added together
     - Compare if Variable [Attack Value] is Equal to or greater then ["The target's Defense"];
        - If Critical is on
             - Call common event [Critical damage]
             - Else;
        - Call common event [Damage]
     - Else;
        - Set Switch [Hit] to Off
     - End Event


I know it's not written in proper terms, but this is just so I know what I'm doing within the program itself. I apologize, I'm still learning them thoroughly. I understand that reading things in


incorrect vernacular can be literally painful for people. I put the names of the Variables, Common Events and Switches in brackets and things with ["This"] should be read as reading the game data.


So, as though I was a four year old; How do I make the combat match what I'm trying to do? will the game run the common event before calculating damage? use the common events to set the Skills attack and damage rolls? Or is this just a pipe dream without learning the intricacies of Ruby coding?


Thank you for reading!
It depends on what battle system you are using, though since you are a newbie to RPG Maker, I assume you're using the default. You can make your common event, then in the Troops tab, call that common event on the first page (Don't worry, by the way. I understand what your terms mean, and I don't find it in the least bit painful). 


Here's what your Common Event would look like:


Control Variables: [Attack Skill] = [Actor]'s ATK


Control Variables: [Die 1] = Rand. (1...6)


Control Variables: [Die 2] = Rand. (1...6)


Control Variables: [Die 3] = Rand. (1...6)


Conditional Branch: Variable [Die 1] = Variable [Die 2]


Control Variables: [Critical] = Variable [Attack Skill]


Control Variables: [Critical] *= x (x is any number)


Decrease Enemy HP: [Critical]  


Branch End


Conditional Branch: Variable [Die 1] = Variable [Die 3] 


Control Variables: [Critical] = Variable [Attack Skill]


Control Variables: [Critical] *= x (x is any number)


Decrease Enemy HP: [Critical]


Branch End 


(Repeat Above lines for all die combinations)


Control Variables: [Hit Chance] = Rand. 1...3 (Can be any number)


Conditional Branch: Variable [Hit Chance] >= 1 


Conditional Branch: Variable [Die 1] != Variable [Die 2] (Use all possible die combinations)


Control Variables: [Attack Value] += Script: $game_variables[x],[y],[z]


Decrease Enemy HP: [Attack Value]


Branch End


Conditional Branch: Variable [Attack Value] >= Game Data: Enemy 1's DEF


Decease Enemy HP: [Critical]


Else


Control Variables: Damage = Variable [Attack Skill] 


Control Variables: Damage /= x (You can either add or divide here)


Decrease Enemy HP: [Damage] 


Branch End


Branch End


Let me know if you have any questions. I tried to color-code it as best I could so it would be clearer for you.  🙂
I've been scoping out spiffy things that can be done via the damage formula box (Admittedly, I have yet to successfully test out a move as of yet), and learned that you can force skills and actions and their ilk via eventing. For some reason, when I do the battle test function on the troop page; either the custom skills don't show up at all, or it just crashes. I'm beginning to think that the tester doesn't load common events?


But this task has become significantly more complicated since when I first started.


Basically; I had to start by assigning 18 variables: 8 for attack dice (The most that could be rolled for any one single attack), 8 for damage dice (Again, the most one would need to roll for a basic attack), 1 for attack roll 'value' in total, 1 for the Damage roll value in total.


Each skill has a common event that just simply sets up the parameters of what I want the attack to do, (Drop dice, add dice, and so forth) and act as a directory of skills and events to be used and the order to do them in.


So, Fire Blitz (3d6 attack and damage, can be boosted. On a critical hit, adds an extra d6 to damage.) would look a little something like this;


Player Skill - Fire Blitz


#Description - A Fire Attack that does Brutal Damage on a critical hit.


#Scope - 1 enemy


#Damage formula is empty, Starts by applying the [Target] State, (which I'm trying to use as a way of keeping it from attacking random enemies that the player didn't choose) and #calls Common Event: Fire Blitz Directory


Common Event: [Fire Blitz Directory]


Control Switch: [Check Critical] On


Control Switch: [Allow Boosted to hit] On


Control Switch: [Allow Boosted to Damage] On


Call Common Event: [Roll all the dice]


Call Common Event: [Confirm Critical]


Control Variable [Attack Value]: += \V1 (And V2, and V3)


Conditional Branch: If Switch [Boosted Attack] is ON


Control Variable [Attack Value]: +=\V4


Else; End


Conditional Branch; If \V5 is <=6


Control Variable [Attack Value]: +=\V5


Else; End


Conditional Branch; If \V6 is <=6


Control Variable [Attack Value]: +=\V6


Else; End


Control Variable [Damage Value]: += \V9 (And V10, and V11)


Conditional Branch: If [Boosted Damage] is ON


Control Variable [Damage Value]: +=\V12


Else; End


Conditional Branch; If \V5 is <=6


Control Variable [Damage Value]: +=\V13


Else; End


Conditional Branch; If \V6 is <=6


Control Variable [Damage Value]: +=\V14


Else; End


Conditional Branch; If \V7 is <=6


Control Variable [Damage Value]: +=\V15


Else; End


Force Skill [Fire Attack]


Control Variable V1...V3, V9...V11 ==0


Control Variable V4...V8, V11...V18 ==0


Control Switches OFF (as necessary)


Force Skill [Wipe]


End; End.


The Fire Attack Skill (And it's adjacent skills, Ice attack, electric attack, etc.) has a Scope set to ALL, with a special damage formula that I'm not sure if I can set up correctly, as I can't have a basic swing work right yet. It will basically see if the b. has the Target state, and if it does, it will do damage as such; IF a.att+a.str+\V17>=10+b.agi+b.def ; v/18- b.mdf - b.luk : Else End (Since I'm completely redoing the damage and evasion system, I will be renaming all of the states appropriately). The "Wipe" skill will just simply remove all the 'Target' States from the board, So I don't have to do anything weird or fancy with setting up the state parameters to make it efficient.


The roll dice event just simply rolls the dice as needed. It checks if the additional dice need to be rolled, and will roll them when they need to be. I decided to just simply make the confirming of a critical a separate event, so that the game doesn't check if it doesn't need to (it's surprisingly difficult to tell Ruby to check if any of up to 8 variables are identical, and I don't want the game slugging along if it is too much for it to handle.) and will skip to letting the directory handling what is up. I choose to set the 'off' dice to 7, as making this an in game event I can interact with is easier in testing then trying to work it out in combat. I can just tell the game to show text "\V1...\V8,\V17  (Break) \V9....\V18, \V18" And I will know if it is rolling dice it doesn't need to, or coming up with crazy values.


It's weird coming up with the minimum viable game; I've set the skill to self, gave good ol' Eric Max health and itty bitty stats to see it run in real time. It's odd to see an adventurer talk to a teddy bear so he can punch himself right in the face, check where ask it for numbers, only to get frustrated and do it again.


Once I have this figured out in a working manner, I get to work on States that will call common events and more importantly skills. I need skills to do damage based on a small number rather then percentages. A boss with 100 HP would probably break this game, but poison that does 10 damage would break it in the opposite direction. And I want 'burn' to be like poison but could do 0-2 damage, which gives me a headache trying to rationalize. I also have an idea for an "Over-charged" state that will electrocute random battlers and possibly spread onto others.


There is a lot of tactics and versatility of this battle structure I'm designing, and the turn economy is really tight, but RPG Maker is definitely confused with what ever it is that I'm doing at almost every turn. If I do get it up and running efficiently, I'll publish it for free with the necessary cogs inside for other people to use. I'd hate for all this work to go unused by others in the community, especially after all the tutorials and explanations available for me to get to this point.
That's actually pretty impressive. Just, a couple of suggestions? If testing it in the database doesn't work, I'd suggest doing what I do and setting up a random event that triggers a battle. After you've tested and made sure it works, just delete the event. Another suggestion I have is, don't use Else statements in your conditional branches unless you absolutely have to. I find it to be an extreme waste of space and takes significantly longer to scroll through your event page. But other than that, I don't see why it wouldn't work. You might need to find a way to clean it up slightly so that you don't have so many variables (believe me, I need to clean up my variable section because it gets confusing to work with all of those). As well, if you have too many common events and a battle scene to process, your game will either lag or crash. 


But yes, when you do get it to work, let me know and as soon as you finish your game, publish it and make a thread about it. Can't wait to see it!  🙂

Original thread: https://forums.rpgmakerweb.com/threads/roll-for-attack-roll-for-damage.62589/