I have a npc reset script here, but I wanted help from you to make some changes, since I could not do it on my own ....
First, it is a request, which at each reset, is a certain percentage of hp / mana for example:
1Reset- 10%
2Reset- 15%
3Reset- 20%
and so it goes...
second, I changed some things for the player to receive skill, however, it is not obeying the config table! It does not add the amount of the table, it only adds 2-3 skillsl!
First, it is a request, which at each reset, is a certain percentage of hp / mana for example:
1Reset- 10%
2Reset- 15%
3Reset- 20%
and so it goes...
second, I changed some things for the player to receive skill, however, it is not obeying the config table! It does not add the amount of the table, it only adds 2-3 skillsl!
--[[Script made 100% by Nogard and Night Wolf.
You can feel free to edit anything you want, but don't remove the credits]]
local config = {
minlevel = 510, --- level inical para resetar
price = 10000, --- preço inicial para resetar
newlevel = 20, --- level após reset
priceByReset = 10000, --- preço acrescentado por reset
mlnew = 20,
skillnew = 25
}
--- end config
function addReset(cid)
resets = getResets(cid)
setPlayerStorageValue(cid, 378378, resets+1)
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
------------------------------------ MUDE AQUI A % DE VIDA QUE GANHA AO RESETAR ---------------------
local hp = getCreatureMaxHealth(cid)
local resethp = hp*0.15
setCreatureMaxHealth(cid, resethp)
local differencehp = (hp - resethp)
doCreatureAddHealth(cid, -differencehp)
local mana = getCreatureMaxMana(cid)
local resetmana = mana*0.15
setCreatureMaxMana(cid, resetmana)
local differencemana = (mana - resetmana)
doCreatureAddMana(cid, -differencemana)
------------------------------------ FIM ----------------------------
------------------------------ EDIÇÃO DAS SKILLS --------------------
if isInArray({1,5,2,6}, getPlayerVocation(cid)) then
local magic = getPlayerSkillLevel(cid, SKILL__MAGLEVEL)
doPlayerAddSkillTry(cid,SKILL__MAGLEVEL, config.mlnew)
end
if isInArray({4,8,12,16}, getPlayerVocation(cid)) then
local fist = getPlayerSkillLevel(cid, SKILL_FIST)
local club = getPlayerSkillLevel(cid, SKILL_CLUB)
local sword = getPlayerSkillLevel(cid, SKILL_SWORD)
local axe = getPlayerSkillLevel(cid, SKILL_AXE)
local shield = getPlayerSkillLevel(cid, SKILL_SHIELD)
doPlayerAddSkillTry(cid,SKILL_FIST, config.skillnew)
doPlayerAddSkillTry(cid,SKILL_SHIELD, config.skillnew)
doPlayerAddSkillTry(cid,SKILL_AXE, config.skillnew)
doPlayerAddSkillTry(cid,SKILL_SWORD, config.skillnew)
doPlayerAddSkillTry(cid,SKILL_CLUB, config.skillnew)
end
if isInArray({3,7}, getPlayerVocation(cid)) then
local distance = getPlayerSkillLevel(cid, SKILL_DISTANCE)
local shield = getPlayerSkillLevel(cid, SKILL_SHIELD)
doPlayerAddSkillTry(cid,SKILL_SHIELD, config.skillnew)
doPlayerAddSkillTry(cid,SKILL_DISTANCE, config.skillnew)
end
------------------------FIM ----------------------------------
doRemoveCreature(cid)
db.query("UPDATE `players` SET `description` = ' [Reset: "..resets.."]' WHERE `players`.`id`= ".. playerid .."")
db.query("UPDATE `players` SET `level`="..config.newlevel..",`experience`= 0 WHERE `players`.`id`= ".. playerid .."")
return TRUE
end
function getResets(cid)
resets = getPlayerStorageValue(cid, 378378)
if resets < 0 then
resets = 0
end
return resets
end
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandlernCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandlernCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandlernCreatureSay(cid, type, msg) end
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid
local newPrice = config.price + (getResets(cid) * config.priceByReset)
if msgcontains(msg, 'reset') then
if getResets(cid) == resets then
selfSay('You want to reset your character? It will cost '..newPrice..' gp\'s!', cid)
talkState[talkUser] = 1
else
selfSay('I couldnt acess your bank of acess!', cid)
end
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if getPlayerMoney(cid) < newPrice then
selfSay('Its necessary to have at least '..newPrice..' gp\'s for reseting!', cid)
elseif getPlayerLevel(cid) < config.minlevel then
selfSay('The minimum level for reseting is '..config.minlevel..'!', cid)
else
doPlayerRemoveMoney(cid,newPrice)
playerid = getPlayerGUID(cid)
addEvent(addReset, (5*1000), cid)
local msg ="---[Reset: "..getResets(cid).."]-- You have reseted! You'll be disconnected in 5 seconds."
if doPlayerPopupFYI(cid, msg) then
end
end
talkState[talkUser] = 0
elseif(msgcontains(msg, 'no')) and isInArray({1}, talkState[talkUser]) == TRUE then
talkState[talkUser] = 0
selfSay('Ok.', cid)
elseif msgcontains(msg, 'quantity') then
selfSay('You have a total of '..getResets(cid)..' reset(s).', cid)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
You can feel free to edit anything you want, but don't remove the credits]]
local config = {
minlevel = 510, --- level inical para resetar
price = 10000, --- preço inicial para resetar
newlevel = 20, --- level após reset
priceByReset = 10000, --- preço acrescentado por reset
mlnew = 20,
skillnew = 25
}
--- end config
function addReset(cid)
resets = getResets(cid)
setPlayerStorageValue(cid, 378378, resets+1)
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
------------------------------------ MUDE AQUI A % DE VIDA QUE GANHA AO RESETAR ---------------------
local hp = getCreatureMaxHealth(cid)
local resethp = hp*0.15
setCreatureMaxHealth(cid, resethp)
local differencehp = (hp - resethp)
doCreatureAddHealth(cid, -differencehp)
local mana = getCreatureMaxMana(cid)
local resetmana = mana*0.15
setCreatureMaxMana(cid, resetmana)
local differencemana = (mana - resetmana)
doCreatureAddMana(cid, -differencemana)
------------------------------------ FIM ----------------------------
------------------------------ EDIÇÃO DAS SKILLS --------------------
if isInArray({1,5,2,6}, getPlayerVocation(cid)) then
local magic = getPlayerSkillLevel(cid, SKILL__MAGLEVEL)
doPlayerAddSkillTry(cid,SKILL__MAGLEVEL, config.mlnew)
end
if isInArray({4,8,12,16}, getPlayerVocation(cid)) then
local fist = getPlayerSkillLevel(cid, SKILL_FIST)
local club = getPlayerSkillLevel(cid, SKILL_CLUB)
local sword = getPlayerSkillLevel(cid, SKILL_SWORD)
local axe = getPlayerSkillLevel(cid, SKILL_AXE)
local shield = getPlayerSkillLevel(cid, SKILL_SHIELD)
doPlayerAddSkillTry(cid,SKILL_FIST, config.skillnew)
doPlayerAddSkillTry(cid,SKILL_SHIELD, config.skillnew)
doPlayerAddSkillTry(cid,SKILL_AXE, config.skillnew)
doPlayerAddSkillTry(cid,SKILL_SWORD, config.skillnew)
doPlayerAddSkillTry(cid,SKILL_CLUB, config.skillnew)
end
if isInArray({3,7}, getPlayerVocation(cid)) then
local distance = getPlayerSkillLevel(cid, SKILL_DISTANCE)
local shield = getPlayerSkillLevel(cid, SKILL_SHIELD)
doPlayerAddSkillTry(cid,SKILL_SHIELD, config.skillnew)
doPlayerAddSkillTry(cid,SKILL_DISTANCE, config.skillnew)
end
------------------------FIM ----------------------------------
doRemoveCreature(cid)
db.query("UPDATE `players` SET `description` = ' [Reset: "..resets.."]' WHERE `players`.`id`= ".. playerid .."")
db.query("UPDATE `players` SET `level`="..config.newlevel..",`experience`= 0 WHERE `players`.`id`= ".. playerid .."")
return TRUE
end
function getResets(cid)
resets = getPlayerStorageValue(cid, 378378)
if resets < 0 then
resets = 0
end
return resets
end
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandlernCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandlernCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandlernCreatureSay(cid, type, msg) end
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid
local newPrice = config.price + (getResets(cid) * config.priceByReset)
if msgcontains(msg, 'reset') then
if getResets(cid) == resets then
selfSay('You want to reset your character? It will cost '..newPrice..' gp\'s!', cid)
talkState[talkUser] = 1
else
selfSay('I couldnt acess your bank of acess!', cid)
end
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if getPlayerMoney(cid) < newPrice then
selfSay('Its necessary to have at least '..newPrice..' gp\'s for reseting!', cid)
elseif getPlayerLevel(cid) < config.minlevel then
selfSay('The minimum level for reseting is '..config.minlevel..'!', cid)
else
doPlayerRemoveMoney(cid,newPrice)
playerid = getPlayerGUID(cid)
addEvent(addReset, (5*1000), cid)
local msg ="---[Reset: "..getResets(cid).."]-- You have reseted! You'll be disconnected in 5 seconds."
if doPlayerPopupFYI(cid, msg) then
end
end
talkState[talkUser] = 0
elseif(msgcontains(msg, 'no')) and isInArray({1}, talkState[talkUser]) == TRUE then
talkState[talkUser] = 0
selfSay('Ok.', cid)
elseif msgcontains(msg, 'quantity') then
selfSay('You have a total of '..getResets(cid)..' reset(s).', cid)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())