PDA

View Full Version : cMaNGOS TBC Duel reset



Zalvia
09-24-2016, 09:20 AM
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
09-24-2016, 03:18 PM
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



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..

slp13at420
09-24-2016, 03:32 PM
you may also want to experiment with unit:GetPowerType(); (http://eluna.emudevs.com/Unit/GetPowerType.html)

Zalvia
09-24-2016, 08:04 PM
Thanks i will test tomorrow

Zalvia
09-25-2016, 06:57 AM
Mana reset doesnt work. I tried to set to 127 and it again doesnt reset

Vitrex
09-25-2016, 04:49 PM
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.


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 :




if ( pWinner->getPowerType() == 0 )


pWinner->SetMaxPower((0, pWinner->GetMaxPower(0));





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