Code: require "/scripts/util.lua" require "/scripts/status.lua" require "/items/active/weapons/weapon.lua" Parry = WeaponAbility:new() function Parry:init() species = world.entitySpecies(activeItem.ownerEntityId()) self.cooldownTimer = 0 end function Parry:update(dt, fireMode, shiftHeld) WeaponAbility.update(self, dt, fireMode, shiftHeld) self.cooldownTimer = math.max(0, self.cooldownTimer - dt) if self.weapon.currentAbility == nil and fireMode == "alt" and self.cooldownTimer == 0 and status.overConsumeResource("energy", self.energyUsage) then self:setState(self.parry) end end function Parry:parry() self.weapon:setStance(self.stances.parry) self.weapon:updateAim() status.setPersistentEffects("broadswordParry", {{stat = "shieldHealth", amount = self.shieldHealth}}) local blockPoly = animator.partPoly("parryShield", "shieldPoly") activeItem.setItemShieldPolys({blockPoly}) animator.setAnimationState("parryShield", "active") animator.playSound("guard") if self.knockback > 0 then local knockbackDamageSource = { poly = blockPoly, damage = 0, damageType = "Knockback", sourceEntity = activeItem.ownerEntityId(), team = activeItem.ownerTeam(), knockback = self.knockback, rayCheck = true, damageRepeatTimeout = 0.25 } activeItem.setItemDamageSources({ knockbackDamageSource }) end local damageListener = damageListener("damageTaken", function(notifications) for _,notification in pairs(notifications) do if notification.hitType == "ShieldHit" then if status.resourcePositive("perfectBlock") then if species == "hylotl" then animator.burstParticleEmitter("bonusBlock") animator.playSound("bonusEffect") self.blockCountShield = 0.008 status.modifyResourcePercentage("health", 0.005 + self.blockCountShield ) --hylotl get a heal when they perfectly block else animator.playSound("perfectBlock") animator.burstParticleEmitter("perfectBlock") end break else animator.playSound("parry") animator.setAnimationState("parryShield", "block") end return end end end) self:refreshPerfectBlock() local counter util.wait(self.parryTime, function(dt) --Interrupt when running out of shield stamina if not status.resourcePositive("shieldStamina") then return true end damageListener:update() if status.resourcePositive("perfectBlock") then animator.setGlobalTag("directives", self.perfectBlockDirectives) counter=true self.parryTime = 0 else animator.setGlobalTag("directives", "") end end) if counter then self.counterAttack() end self.cooldownTimer = self.cooldownTime self:reset() end function Parry:reset() animator.setGlobalTag("directives", "") animator.setAnimationState("parryShield", "inactive") status.clearPersistentEffects("broadswordParry") activeItem.setItemShieldPolys({}) activeItem.setItemDamageSources({}) end function Parry:uninit() self:reset() end function Parry:refreshPerfectBlock() local perfectBlockTimeAdded = math.max(0, math.min(status.resource("perfectBlockLimit"), self.perfectBlockTime - status.resource("perfectBlock"))) status.overConsumeResource("perfectBlockLimit", perfectBlockTimeAdded) status.modifyResource("perfectBlock", perfectBlockTimeAdded) end function Parry:counterAttack() Parry:reset() status.setPersistentEffects("counterAttack", { {stat = "damageBoost", amount = 1}, {stat = "invulnerable", amount = 1} }) local stateThread = coroutine.create(self.stateThread) for _,ability in pairs(self.weapon.abilities) do ability:update(dt, "primary", shiftHeld) end while coroutine.status(stateThread) ~= "dead" do coroutine.resume(stateThread) end status.clearPersistentEffects("counterAttack") end --weapons are state machines and use a single coroutine called stateThread. When the stateThread dies this one does as well. function Parry:stateThread() if coroutine.status(self.weapon.stateThread) then return false elseif self.weapon.currentState == "winddown1" then return false else return true end end So here's what i'm trying to do. I wish to have it so when you score a perfect block on a parry you get damageBoost and the first combostep from the weapons meleeCombo fires. I'm getting a lot of various errors and nothing seems to be working. Am I missing something. Error Log https://pastebin.com/byiFEZ2D