• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

cMaNGOS TBC Duel reset

Zalvia

Member
Code:
function DuelDone(event, pWinner, pLoser)
pWinner:ResetAllCooldowns()
pLoser:ResetAllCooldowns()
pWinner:SetHealth(pWinner:GetMaxHealth())
pLoser:SetHealth(pLoser:GetMaxHealth())
end

RegisterPlayerEvent(11, DuelDone)

That's the script I use it works but I want to add on duel start reset too and reset for mana
 

slp13at420

Mad Scientist
Code:
[COLOR="#808080"]
function DuelDone(event, pWinner, pLoser)
-- reset cd's
	pWinner:ResetAllCooldowns();
	pLoser:ResetAllCooldowns();

-- reset hp
	pWinner:SetHealth(pWinner:GetMaxHealth());
	pLoser:SetHealth(pLoser:GetMaxHealth());

-- reset mana . power_id 0
	pWinner:SetMaxPower(0, pWinner:GetMaxPower(0));
	pLoser:SetMaxPower(0, pLoser:GetMaxPower(0));

end

RegisterPlayerEvent(10, DuelDone) -- duel starts
RegisterPlayerEvent(11, DuelDone) -- duel ends
[/COLOR]

http://eluna.emudevs.com/Unit/SetMaxPower.html

you might be able to replace Power_ID:0 with Power_ID:127 and just reset ALL powers for player class including hp..
 
Last edited:

Vitrex

Moderator
Mana reset doesnt work. I tried to set to 127 and it again doesnt reset

Try to use 0 instead of 127 and other values defined including HP.
Code:
enum Powers{
    POWER_MANA        = 0,
    POWER_RAGE        = 1,
    POWER_FOCUS       = 2,
    POWER_ENERGY      = 3,
    POWER_HAPPINESS   = 4,
    POWER_RUNE        = 5,
    POWER_RUNIC_POWER = 6,
    MAX_POWERS        = 7,
    POWER_ALL         = 127,         // default for class?
    POWER_HEALTH      = 0xFFFFFFFE   // (-2 as signed value)
};

Something like :
Code:
[TABLE]
[TR]
[TD]if ( pWinner->getPowerType() == 0 )[/TD]
[/TR]
[TR]
[TD]pWinner->SetMaxPower((0, pWinner->GetMaxPower(0));[/TD]
[TD][/TD]
[/TR]
[/TABLE]

read more about this :
Get max power - http://eluna.emudevs.com/Unit/GetMaxPower.html
Get power Type - http://eluna.emudevs.com/Unit/GetPowerType.html
Set Max Power - http://eluna.emudevs.com/Unit/SetMaxPower.html
 
Top