Recoil Damage Possible?

This is something I wanted to implement into my first game, but I didn't know how. I still don't know how, so I was wondering if someone could help me with this...


I need help making two sets of "recoil damage" properties. One for a weapon and one for armor.


For the weapon, once the user attacks with said weapon (or magic), they lose x amount of HP.


For the armor, the enemy needs to lose x amount of HP once they attack the user that wears it.


Any ideas?


Also, apologies if this was not posted in the right spot. I'm not entirely sure where to put it...
*I'll try to make this as easy as possible and so that anyone new to RMVX can follow along as well.*


This will require at least:


2* states (one for the enemy that will be applied when the player attacks and one for the player that will be on whenever he is wearing the armor you want to have this on)


2 skills   (one that will be "added" onto the players attack and one that will be "added" on when someone attacks the player)


at least 1 common event  (which will be called whenever the attack or skill is used that you want to activate this)


*(This can be cut down to no states if the recoil only happens to the player when using a certain weapon or to a enemy when the character is using a specific armor.  However, if you want to link the recoil to spells I don't know any other way.)


Ok, now what you want to do is get the states ready first.  You can name them whatever you want, but I would suggest something easy to remember like Weapon_Recoil and


Armor_Recoil.  Set up the Weapon_Recoil to either the character or weapon or spell that you want it on and set it so that it will be applied 100% of the time, but MAKE SURE that the state wears off (since this state puts damage on the player you will have to figure out how you want the state to wear off since you won't be able to set it up to remove with damage).  Do the same for Armor_Recoil but have the state either linked permanently to the character or so that it is automatically applied to the character when wearing said armor.  Just make sure that you don't make any of the enemies resistant to the state and you should be good.


Next, make the Skills.  Again, name them whatever you want, but make sure you know which one you want to link to which state so that you don't end up doing a ton of damage to your player and barely any to the enemies.  Make the both of the skills so that they attack the user only... unless you want your entire party to take damage...


Now for the common event.  (Note: I use this in my own game for random spell fires when using weapons, I've never set it up so that it happens 100% of the time, so I don't know if it will work with the first attack or not.)


You can have both of these in the same common event, or you can make 2 separate events if it's easier for you to keep track of that way.


For the Weapon_Recoil:


If the recoil is set to a weapon then you will have to set up a starting conditional branch to check if the character that is attacking has that weapon equipped.


Set a conditional branch to see if the enemy has the state inflicted. (This can be skipped if the recoil is only linked to the weapon)  Since you can have up to 8 enemies in VX Ace, you will have to copy everything in this part while checking every enemy, which is one reason why you NEED to make sure that the state wears off of the enemy so you don't take multiple recoil damage from one attack.


If everything is true, then have your character "use" the Recoil skill so that they damage themselves.   You shouldn't need to fill out the Else part...


Once that is done, just copy it for however many characters can use that weapon and/or for however many weapons you have with recoil.


For the Armor_Recoil:


Very similar, but you just need to set up a conditional branch to see if the target has the Armor equipped or the state on them that will cause the recoil.


If true then have the enemy use the Armor_Recoil skill on themselves.


*Edit* You will have to figure out how to set it up so that the enemy that attacked is the one that uses the skill on itself, which can get a little tricky and may even require some scripting.  I haven't tried to do this yet, so I'm not sure how it would work in any situation other than one player and one enemy. *Edit*


I know this was a little wordy, but I hope it helps.  Like I said, if you are using the "attacking the enemy adds the state to them" method, it may not work on the first attack, but if you play around with it for a while you should be able to get it working.

Original thread: https://forums.rpgmakerweb.com/threads/recoil-damage-possible.60426/