- 0
-=[TFS]=- 0.4 8.60 - Recovery Exp ele só recupera quem é level 1 até 100 não recupera quem é level 717217 eu quero que ele recupera level dês do level 1 até 717217 ele recupera level quando morre
-
Recently Browsing 0 members
- No registered users viewing this page.
Question
Muvuka 1
NPC Scrutinon
tem que ter item e a quantidade para recupera a exp local itemid,count = 9020,300 -- edite o id e count do item aqui
Explicação:
Você compra no npc a exp que você perdeu na sua última morte.
Lib > functions.lua adc death_tabble = {before_exp = 135215,after_exp = 135216, check = 251201}
CREATURESCRIPTS/SCRIPTS
function onLogin(cid) registerCreatureEvent(cid, "Exp_P") if getPlayerStorageValue(cid, death_tabble.check) >= 1 then setPlayerStorageValue(cid, death_tabble.after_exp, getPlayerExperience(cid)) setPlayerStorageValue(cid, death_tabble.check, -1) end return true end function onPrepareDeath(cid, lastHitKiller, mostDamageKiller) setPlayerStorageValue(cid, death_tabble.before_exp, getPlayerExperience(cid)) setPlayerStorageValue(cid, death_tabble.check, 1) return TRUE end
CREATURESCRIPTS.XML
<event type="preparedeath" name="Exp_P" event="script" value="exp_buy.lua"/> <event type="login" name="Exp_L" event="script" value="exp_buy.lua"/>
NPC
<?xml version="1.0" encoding="UTF-8"?> <npc name="Scrutinon" script="data/npc/scripts/expbuy.lua" walkinterval="0" floorchange="0"> <health now="100" max="100"/> <look typeex="7825" head="7825" body="0" legs="0" feet="0" addons="0"/> <parameters> <parameter key="message_greet" value="Grande |PLAYERNAME|! Eu posso {recuperar} a exp perdida em sua morte." /> <parameter key="message_decline" value="Adios." /> </parameters> </npc>
NPC/SCRIPTS
local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() 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 msg = string.lower(msg) local itemid,count = 9020,300 -- edite o id e count do item aqui if isInArray({"recover","recuperar","exp","experience"}, msg) then npcHandler:say("voce deseja recuperar a exp perdida apos a sua morte por "..count.." "..getItemNameById(itemid).."? {yes}", cid) talkState[talkUser] = 1 elseif (msgcontains(msg, 'yes') and talkState[talkUser] == 1) then if getPlayerStorageValue(cid, death_tabble.before_exp) ~= -1 and getPlayerExperience(cid) < getPlayerStorageValue(cid, death_tabble.before_exp) then if doPlayerRemoveItem(cid, itemid, count) == TRUE then local count = (getPlayerStorageValue(cid, death_tabble.before_exp) - getPlayerStorageValue(cid, death_tabble.after_exp)) doPlayerAddExp(cid, count) npcHandler:say("Obrigado! aqui esta sua experiencia.", cid) else npcHandler:say("Desculpe, voce nao tem "..getItemNameById(itemid).." suficientes!", cid) talkState[talkUser] = 0 end else npcHandler:say("Desculpe, voce nao morreu ou ja recuperou sua exp perdida!", cid) talkState[talkUser] = 0 end elseif msg == "no" then selfSay("Then not", cid) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
Link to comment
Share on other sites
1 answer to this question
Recommended Posts