Jump to content
  • 0

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


Agency

Question

Recommended Posts

The below should work, however I have not had the chance to test it. Save it as a .lua file within your lua_script folder and either reload the Lua engine (.reload eluna) or restart the server. Let me know how it turns out for you :)

function OnDuelReset(event, winner, loser)    
   -- Reset winner cooldowns, health and power
   winner:ResetAllCooldowns()
   winner:SetHealth(winner:GetMaxHealth())
   winner:SetPower(winner:GetPowerType(), winner:GetMaxPower())

   -- Reset loser cooldowns, health and power
   loser:ResetAllCooldowns()
   loser:SetHealth(loser:GetMaxHealth())
   loser:SetPower(loser:GetPowerType(), loser:GetMaxPower())
end


RegisterPlayerEvent(11, OnDuelReset)

Link to comment
Share on other sites

@Foereaper

I thought deeper into this and came to the conlusion, that you were able to reset your cool downs and trinkets, after you wiped in a raid (just going outside and do a duel).

Is there a possibility to exclude all other regions but Durotar, Dun Morogh and Elwynn Forest and the tauren start zone (I forgot the name :D) (since there would be the most duels happening)?

Link to comment
Share on other sites

Here you go, zones can be edited and added in the top most Lua table :) Have a whirl and let me know how it works. It requires both loser and winner to be within the same allowed zone to work, to prevent any form of teleport abuse etc. This can be changed if you wish.

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
		winner:ResetAllCooldowns()
		winner:SetHealth(winner:GetMaxHealth())
		winner:SetPower(winner:GetPowerType(), winner:GetMaxPower())

		loser:ResetAllCooldowns()
		loser:SetHealth(loser:GetMaxHealth())
		loser:SetPower(loser:GetPowerType(), loser:GetMaxPower())
	end
end
end


RegisterPlayerEvent(11, OnDuelReset)

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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