Parry script - Small fun PvP mechanic

jose_95

Member
Nov 10, 2019
13
0
0
Script: https://one.denizenscript.com/haste/62930

This script adds a PvP mechanic to your server, ready to use for all types of PvP.
It consists of parrying:

- When someone swings with a weapon that does at least 3 damage (To count it as a good weapon) and a cooldown percent higher than 45%, they are in a parry state for half a second (It looks like a lot of time but trust me, it's just right). If instead of a swing it's a hit, it will be for 0.3 seconds instead.
- When a parrying player is attacked, there are some checks to see if the parry works or not.

- First, it checks if the parrying player is looking directly at the entity. This way you can't parry something behind you.

- It checks if the difference between the damage of the parrying player's weapon and the weapon it's parrying is high (It's well calculated, don't worry about changing it. It works for all server styles) If it's false, the weapon damages are similar and it results in a parry. If it's true, it checks if the parrying player's weapon damage is the higher one. If that's true, the parry works.


So basically, if I swing at the same time an enemy player swings their weapon at me and we both have an iron sword (6 damage), it will result in a parry and the damage will be denied for both of us. If the damage difference is not too high, the same can happen between a wooden sword and an iron sword, This means that if I have a diamond sword (7) and someone with a wooden sword (4) tries to parry me, I have a way higher damage and so I will deny the parry.

This difference check is dynamic and is not a straight 3: A 70 damage weapon beats a 40 damage weapon. The same goes for arrows and projectiles, except it doesn't check the weapon damage, rather the projectile damage. This way, if someone shoots a power 10 arrow at me and I try to parry with a wooden sword, it will deny the parry.

Feedback is appreciated :)
 

mcmonkey

Administrator
Staff member
Helper
+++ I encountered 3 potential problems with that script.
+++ (1) WARNING: Line 63: Uneven number of <tag-marks>, are you missing a < or > ?
+++ (2) WARNING: Line 66: Uneven number of <tag-marks>, are you missing a < or > ?
+++ (3) WARNING: Line 71: Uneven number of <tag-marks>, are you missing a < or > ?
Can't even pass a monkeybot check.