Jump to content

[Zero] Reset CD's mana and hp after dueling.


Agency

Recommended Posts

Posted

From memory, Rage power type is 1, so whenever the player has rage as power it should now be set to 0 instead of max :)

local AllowedZones = {12, 1, 14, 215};

local function OnDuelReset(event, winner, loser)
local winnerZone, loserZone = winner:GetZoneId(), loser:GetZoneId()

-- Loop through allowed zones specified above
for _, zone in pairs(AllowedZones) do
	-- Reset winner and loser cooldowns, health and power if winner and loser is within allowed Zone
	if(winnerZone == zone) and (loserZone == zone) then
		local winnerPType, loserPType = winner:GetPowerType(), loser:GetPowerType()

		winner:ResetAllCooldowns()
		winner:SetHealth(winner:GetMaxHealth())

		-- Set power to 0 if type is 1 (Rage), else set to max power
		if(winnerPType == 1) then
			winner:SetPower(winnerPType, 0)
		else
			winner:SetPower(winnerPType, winner:GetMaxPower())
		end

		loser:ResetAllCooldowns()
		loser:SetHealth(loser:GetMaxHealth())

		-- Set power to 0 if type is 1 (Rage), else set to max power
		if(loserPType == 1) then
			loser:SetPower(loserPType, 0)
		else
			loser:SetPower(loserPType, loser:GetMaxPower())
		end
	end
end
end


RegisterPlayerEvent(11, OnDuelReset)

Posted

Okay, we found another "problem". This script also resets arcanite/mooncloth/saltshaker CDs. Is it possible to exclude these from being reseted?

Transmute Arcanite Spell ID: 17187

Mooncloth Spell ID: 18560

Saltshaker Spell ID: 19567

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use