Shoorkill
Member
- Joined
- Dec 17, 2018
- Messages
- 126
- Reaction score
- 21
hello, I need this script to do a "reset" on the character, when he conquers the new vocation he returns to level 8 with life and initial mana in the case of life=185, mana=40... can someone help me?
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 onThink() npcHandlernThink() 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
if(msgcontains(msg, 'deus')) then
selfSay('Ora,ora vejo que tem se empenhado!', cid)
selfSay('Posso te evoluir a Deus?', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
-------CONFIGS-------
local level = 500
local cost = 5000000
------/CONFIGS-------
-----LOCALS-----
local id = getPlayerGUID(cid)
local name = getCreatureName(cid)
local vocation = getPlayerVocation(cid)
local storage = getPlayerStorageValue(cid, 85989)
local skillPoints = getPlayerStorageValue(cid, 23001)
local maxRebirth = 1 --Change this for the number of rebirths
local new = (getPlayerVocation(cid)+4)
----/LOCALS-----
if(getPlayerLevel(cid) >= level) then
if getPlayerStorageValue(cid, 85989) < maxRebirth then
if(doPlayerRemoveMoney(cid, cost) == TRUE) then
if(isInArray({9, 10, 11, 12}, vocation)) then
local player = Player(cid)
doPlayerSetVocation(cid, new)
doSendMagicEffect(getCreaturePos(cid), 49)
player:setStorageValue(85989, storage == -1 and 1 or storage + 1)
player:setStorageValue(23001, skillPoints == -1 and 1 or skillPoints + 1)
addReset(cid)
Game.broadcastMessage("Player: " .. name .. " se tornou um Deus!", MESSAGE_STATUS_WARNING)
doRemoveCreature(cid)
else
selfSay('Voce precisa evoulir a valan primeiro.', cid)
talkState[talkUser] = 0
end
else
selfSay('Voce nao tem dinheiro.Voce precisa pagar 5kk pela sua evolucao.', cid)
talkState[talkUser] = 0
end
else
selfSay('Voce ja e um Deus player.', cid)
talkState[talkUser] = 0
end
else
selfSay('Somente personagens level 500+ pode se tornar Deus.', cid)
talkState[talkUser] = 0
end
elseif(msgcontains(msg, 'no') and talkState[talkUser] == 1) then
selfSay('Tudo bem,volte mais tarde.', cid)
talkState[talkUser] = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
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 onThink() npcHandlernThink() 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
if(msgcontains(msg, 'deus')) then
selfSay('Ora,ora vejo que tem se empenhado!', cid)
selfSay('Posso te evoluir a Deus?', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
-------CONFIGS-------
local level = 500
local cost = 5000000
------/CONFIGS-------
-----LOCALS-----
local id = getPlayerGUID(cid)
local name = getCreatureName(cid)
local vocation = getPlayerVocation(cid)
local storage = getPlayerStorageValue(cid, 85989)
local skillPoints = getPlayerStorageValue(cid, 23001)
local maxRebirth = 1 --Change this for the number of rebirths
local new = (getPlayerVocation(cid)+4)
----/LOCALS-----
if(getPlayerLevel(cid) >= level) then
if getPlayerStorageValue(cid, 85989) < maxRebirth then
if(doPlayerRemoveMoney(cid, cost) == TRUE) then
if(isInArray({9, 10, 11, 12}, vocation)) then
local player = Player(cid)
doPlayerSetVocation(cid, new)
doSendMagicEffect(getCreaturePos(cid), 49)
player:setStorageValue(85989, storage == -1 and 1 or storage + 1)
player:setStorageValue(23001, skillPoints == -1 and 1 or skillPoints + 1)
addReset(cid)
Game.broadcastMessage("Player: " .. name .. " se tornou um Deus!", MESSAGE_STATUS_WARNING)
doRemoveCreature(cid)
else
selfSay('Voce precisa evoulir a valan primeiro.', cid)
talkState[talkUser] = 0
end
else
selfSay('Voce nao tem dinheiro.Voce precisa pagar 5kk pela sua evolucao.', cid)
talkState[talkUser] = 0
end
else
selfSay('Voce ja e um Deus player.', cid)
talkState[talkUser] = 0
end
else
selfSay('Somente personagens level 500+ pode se tornar Deus.', cid)
talkState[talkUser] = 0
end
elseif(msgcontains(msg, 'no') and talkState[talkUser] == 1) then
selfSay('Tudo bem,volte mais tarde.', cid)
talkState[talkUser] = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())