My brother and I worked on this script and We can simply say it works flawlessly.
We developed this script because since pre-WOTLK didn't have race/faction change. (Tested on CMangos 2.4.3) No doubts that it should work on 1.12.1 or even WOTLK.
Thanks to Foereaper, Tommy, Jpp and Syphex for helpin' us out!
Update:
• Fixed Impossible Race Change "Undead Paladins"
• Added a GM check so it would remove the price if there is user is a GM (Requires .gm on)
We developed this script because since pre-WOTLK didn't have race/faction change. (Tested on CMangos 2.4.3) No doubts that it should work on 1.12.1 or even WOTLK.
Thanks to Foereaper, Tommy, Jpp and Syphex for helpin' us out!
Code:
--[[
Race Change Script
Developed for CMaNGOS 2.4.3
Developers: Grim, Render1982
What does it do:
For forty gold, it will change the player's race/faction.
If it's a faction change it will then teleport the player to their major city (SW and Org) and set their hearthstone binding to their teleport location.
How is it done:
It executes an SQL Query then Logs Out the player. all in only a second!
Known Bugs:
Items such as mounts and tabards won't change. (Implement Soon?) Temporary Fix was remove all the Race Restrictions
]]
local MoneyCount = 400000
local NPC_ENTRY = 60012
-- Do not touch these variables
local pGUID = 0
local coinage = 0
local isAlliance = false;
local isGM = false;
function ChangeRaceMenu(event, player, unit)
-- Check if the player is a GM; if so make it free
isGM = player:IsGM()
if isGM == true then
ReqCost = 0;
end
-- Check the player's class
if not (player:GetClass() == 3 or player:GetClass() == 7 or player:GetClass() == 11) then
player:GossipMenuAddItem(0, "Change Race to Human", 0, 1)
end
if not (player:GetClass() == 2 or player:GetClass() == 7 or player:GetClass() == 8 or player:GetClass() == 9) then
player:GossipMenuAddItem(0, "Change Race to Night Elf", 0, 2)
end
if not (player:GetClass() == 7 or player:GetClass() == 8 or player:GetClass() == 9 or player:GetClass() == 11) then
player:GossipMenuAddItem(0, "Change Race to Dwarf", 0, 3)
end
if not (player:GetClass() == 2 or player:GetClass() == 7 or player:GetClass() == 11 or player:GetClass() == 3) then
player:GossipMenuAddItem(0, "Change Race to Gnome", 0, 4)
end
if not (player:GetClass() == 2 or player:GetClass() == 8 or player:GetClass() == 11 or player:GetClass() == 5) then
player:GossipMenuAddItem(0, "Change Race to Orc", 0, 5)
end
if not (player:GetClass() == 2 or player:GetClass() == 8 or player:GetClass() == 9 or player:GetClass() == 4 or player:GetClass() == 5) then
player:GossipMenuAddItem(0, "Change Race to Tauren", 0, 6)
end
if not (player:GetClass() == 2 or player:GetClass() == 9 or player:GetClass() == 11) then
player:GossipMenuAddItem(0, "Change Race to Troll", 0, 7)
end
if not (player:GetClass() == 3 or player:GetClass() == 2 or player:GetClass() == 7 or player:GetClass() == 11) then
player:GossipMenuAddItem(0, "Change Race to Undead", 0, 8)
end
isAlliance = player:IsAlliance()
coinage = player:GetCoinage()
player:GossipMenuAddItem(0, "Nevermind..", 0, 9)
player:GossipSendMenu(1, unit)
end
-- Change the player's race, teleport them and set their hearthstone if needed, and deduct the forty gold.
function ChangeRaceSelect(event, player, unit, sender, intid, code)
if (intid == 1) then
if (coinage < MoneyCount) then
player:SendAreaTriggerMessage("Insufficent Funds!")
player:GossipComplete()
else
if (isAlliance == false) then
player:Teleport(0, -8944, 559, 94, 5.4)
player:SetBindPoint(-8944, 559, 94, 0, 1519)
end
player:ModifyMoney(-MoneyCount)
CreateLuaEvent(ToHuman, 1000, 2)
pGUID = player:GetGUIDLow()
player:LogoutPlayer(true)
end
elseif (intid == 2) then
if (coinage < MoneyCount) then
player:SendAreaTriggerMessage("Insufficent Funds!")
player:GossipComplete()
else
if (isAlliance == false) then
player:Teleport(0, -8944, 559, 94, 5.4)
player:SetBindPoint(-8944, 559, 94, 0, 1519)
end
player:ModifyMoney(-MoneyCount)
CreateLuaEvent(ToNelf, 1000, 2)
pGUID = player:GetGUIDLow()
player:LogoutPlayer(true)
end
elseif (intid == 3) then
if (coinage < MoneyCount) then
player:SendAreaTriggerMessage("Insufficent Funds!")
player:GossipComplete()
else
if (isAlliance == false) then
player:Teleport(0, -8944, 559, 94, 5.4)
player:SetBindPoint(-8944, 559, 94, 0, 1519)
end
player:ModifyMoney(-MoneyCount)
CreateLuaEvent(ToDwarf, 1000, 2)
pGUID = player:GetGUIDLow()
player:LogoutPlayer(true)
end
elseif (intid == 4) then
if (coinage < MoneyCount) then
player:SendAreaTriggerMessage("Insufficent Funds!")
player:GossipComplete()
else
if (isAlliance == false) then
player:Teleport(0, -8944, 559, 94, 5.4)
player:SetBindPoint(-8944, 559, 94, 0, 1519)
end
player:ModifyMoney(-MoneyCount)
CreateLuaEvent(ToGnome, 1000, 2)
pGUID = player:GetGUIDLow()
player:LogoutPlayer(true)
end
elseif (intid == 5) then
if (coinage < MoneyCount) then
player:SendAreaTriggerMessage("Insufficent Funds!")
player:GossipComplete()
else
if (isAlliance == true) then
player:Teleport(1, 1425.7, -4365.1, 25.24, 1.2)
player:SetBindPoint(1425.7, -4365.1, 25.24, 1, 1637)
end
player:ModifyMoney(-MoneyCount)
CreateLuaEvent(ToOrc, 1000, 2)
pGUID = player:GetGUIDLow()
player:LogoutPlayer(true)
end
elseif (intid == 6) then
if (coinage < MoneyCount) then
player:SendAreaTriggerMessage("Insufficent Funds!")
player:GossipComplete()
else
if (isAlliance == true) then
player:Teleport(1, 1425.7, -4365.1, 25.24, 1.2)
player:SetBindPoint(1425.7, -4365.1, 25.24, 1, 1637)
end
player:ModifyMoney(-MoneyCount)
CreateLuaEvent(ToTauren, 1000, 2)
pGUID = player:GetGUIDLow()
player:LogoutPlayer(true)
if (isAlliance == true) then
player:Teleport(1, 1425.7, -4365.1, 25.24, 1.2)
player:SetBindPoint(1425.7, -4365.1, 25.24, 1, 1637)
end
end
elseif (intid == 7) then
if (coinage < MoneyCount) then
player:SendAreaTriggerMessage("Insufficent Funds!")
player:GossipComplete()
else
if (isAlliance == true) then
player:Teleport(1, 1425.7, -4365.1, 25.24, 1.2)
player:SetBindPoint(1425.7, -4365.1, 25.24, 1, 1637)
end
player:ModifyMoney(-MoneyCount)
CreateLuaEvent(ToTroll, 1000, 2)
pGUID = player:GetGUIDLow()
player:LogoutPlayer(true)
end
elseif (intid == 8) then
if (coinage < MoneyCount) then
player:SendAreaTriggerMessage("Insufficent Funds!")
player:GossipComplete()
else
if (isAlliance == true) then
player:Teleport(1, 1425.7, -4365.1, 25.24, 1.2)
player:SetBindPoint(1425.7, -4365.1, 25.24, 1, 1637)
end
player:ModifyMoney(-MoneyCount)
CreateLuaEvent(ToUndead, 1000, 2)
pGUID = player:GetGUIDLow()
player:LogoutPlayer(true)
end
elseif (intid == 9) then
player:GossipComplete()
end
end
-- Execute the SQL Query and Change their Race
function ToHuman(event, delay, call)
CharDBExecute("UPDATE `characters`.`characters` SET `race`=1 WHERE `guid`="..pGUID..";")
end
function ToDwarf(event, delay, call)
CharDBExecute("UPDATE `characters`.`characters` SET `race`=3 WHERE `guid`="..pGUID..";")
end
function ToNelf(event, delay, call)
CharDBExecute("UPDATE `characters`.`characters` SET `race`=4 WHERE `guid`="..pGUID..";")
end
function ToUndead(event, delay, call)
CharDBExecute("UPDATE `characters`.`characters` SET `race`=5 WHERE `guid`="..pGUID..";")
end
function ToTauren(event, delay, call)
CharDBExecute("UPDATE `characters`.`characters` SET `race`=6 WHERE `guid`="..pGUID..";")
end
function ToGnome(event, delay, call)
CharDBExecute("UPDATE `characters`.`characters` SET `race`=7 WHERE `guid`="..pGUID..";")
end
function ToTroll(event, delay, call)
CharDBExecute("UPDATE `characters`.`characters` SET `race`=8 WHERE `guid`="..pGUID..";")
end
function ToOrc(event, delay, call)
CharDBExecute("UPDATE `characters`.`characters` SET `race`=2 WHERE `guid`="..pGUID..";")
end
RegisterCreatureGossipEvent(NPC_ENTRY, 1, ChangeRaceMenu)
RegisterCreatureGossipEvent(NPC_ENTRY, 2, ChangeRaceSelect)
Update:
• Fixed Impossible Race Change "Undead Paladins"
• Added a GM check so it would remove the price if there is user is a GM (Requires .gm on)
Last edited: