Tente assim, vá em data/npc, crie um arquivo chamado PromoNew.xml e adicione isso dentro:
<npc name="Varkhal" script="data/npc/scripts/promonew.lua" floorchange="0" walkinterval="25" access="5" level="1" maglevel="1">
<health now="150" max="150"/>
<look type="152" head="114" body="114" legs="0" feet="0" addons="3"/>
<parameters>
<parameter key="message_greet" value="Hello |PLAYERNAME|. For promote for first time, say "first promote", to second promotion say, "second promote"
and to third promote say "third promote"" />
</parameters>
</npc>
Agora em data/npc/scripts, crie um arquivo chamado promonew.lua e adicione isso dentro:
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 promote = {
["first vocation"] = {level = 50, price = 20000, promotion = 1, premium = true},
["second vocation"] = {level = 100, price = 50000, promotion = 2, premium = true},
["third vocation"] = {level = 150, price = 80000, promotion = 3, premium = true},
}
if promote[msg] then
if promote[msg].premium == true and not isPremium(cid) then
npcHandler:say('You need a premium account in order to get promoted', cid)
return 0
end
if not isPremium(cid) then
if getPlayerPromotionLevel(cid) < promote[msg].promotion then
if getPlayerLevel(cid) >= promote[msg].level then
if doPlayerRemoveMoney(cid, promote[msg].price) then
setPlayerPromotionLevel(cid, promote[msg].promotion)
npcHandler:say('Congratulations! You are now promoted!', cid)
npcHandler:say('You need a premium account in order to get promoted', cid)
return 1
end
else
npcHandler:say('You need the necessary gps to buy this promotion.', cid)
end
else
npcHandler:say('I am sorry, but I can only promote you once you have reached the necessary level', cid)
end
else
npcHandler:say('You are already promoted!', cid)
end
end
return 1
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Aqui está! o npc se chama Promo New, para fazê-lo aparecer, logue o GOD e diga: "/n Promo New" sem as aspas! Para se promover pela primeira vez, diga first promote, e assim sucessivamente: second promote e third promote! Coloquei 3 apenas. Para configurar, aonde está vermelho no script, pode configurar preço (price) se tem que ser premium ou não, oque fala para promover e level necessário.
Boa sorte, poste resultados





info
Grupo: Campones
Registrado: 13/01/13
Posts: 78
Reputação: 0
é possivel criar um npc que a cada 50 level o player vai la e se promove ?
se for por favor alguem me encina a fazer ?