Jump to content

(Resolvido)(NPC) MULTIFUSOES - AOL/BLESS/PREMIUM


Go to solution Solved by Jobs,

Recommended Posts

Bom gostaria que esse npc heala-se 100% a vida do player que falar com ele (LIFE FULL), desse bless custando 2crystal porem a cada 30 leveis que player upar aumenta-se 2 crystal (bless so a partir do lvl 40),  aol custa-se apenas 2 crystal e vendesse 1 dia de premium account por 3 crystal coins

OldTaboos24hpor48h.com Inauguração DOMONIGO as 18:00 | 18/03/2018 | Stages | Custom Map |VENHA SER TOP TABOOS!

Link to post
Share on other sites

  • 4 weeks later...
  • Solution

Na pasta npc cria um arquivo Gabriel.xml e bota isso dentro:

<?xml version="1.0" encoding="UTF-8"?>
<npc name="Gabriel" script="data/npc/scripts/Gabriel.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="134" head="55" body="60" legs="50" feet="75" addons="3"/>
<parameters>
<parameter key="message_greet" value="Olá |PLAYERNAME|. Fale {trade} para ver minhas ofertas, {bless} para compra bless somente acima do level {40}, {premium} para compra 1 dia de premium account." />
<parameter key="message_decline" value="Adeus, |PLAYER NAME|." /> 
<parameter key="message_walkaway" value="Adeus, |PLAYER NAME|." />
<parameter key="module_keywords" value="1" />
<parameter key="keywords" value="bless;premium;" />
<parameter key="keyword_reply1" value="{first bless},{second bless},{third bless},{third bless},{fifth bless}" />
<parameter key="keyword_reply2" value="Eu troco varios itens como: ferramentas e itens necessários interessantes" />
<parameter key="shop_buyable" value="Amulet of Loss,2173,200000;"/>
</parameters>
</npc>

 

Vai em npc/scripts/ e cria um arquivo chamado Gabriel.lua e bota isso:

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)




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


if(msgcontains(msg, 'offer') or msgcontains(msg, 'price')) then
selfSay('Eu posso lhe dar 1 dias de premium por 2 crystal coins.', cid)
elseif(msgcontains(msg, 'premium') or msgcontains(msg, 'Premium')) then
selfSay('Você gostaria de comprar 1 dias de premium?', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if(doPlayerRemoveItem(cid, 2160, 2) == true) then
selfSay('Muito bem! Aproveite!', cid)
doPlayerAddPremiumDays(cid, 1)
talkState[talkUser] = 0
elseif(doPlayerRemoveItem(cid, 2152, 200) == true) then
selfSay('Muito bem! Aproveite!', cid)
doPlayerAddPremiumDays(cid, 1)
talkState[talkUser] = 0
elseif(doPlayerRemoveItem(cid, 2148, 20000) == true) then
selfSay('Muito bem! Aproveite!', cid)
doPlayerAddPremiumDays(cid, 1)
talkState[talkUser] = 0
else
selfSay('Desculpe, você não tem o {valor} necessário parar comprar uma premium.', cid)
talkState[talkUser] = 0
end
end
return TRUE
end


local node1 = keywordHandler:addKeyword({'first bless'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to buy the first blessing for 2000 (plus level depending amount) gold?'})
node1:addChildKeyword({'yes'}, StdModule.bless, {npcHandler = npcHandler, number = 1, premium = true, baseCost = 200000, levelCost = 6666, startLevel = 40, endLevel = 200})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Too expensive, eh?'})


local node2 = keywordHandler:addKeyword({'second bless'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to buy the second blessing for 2000 (plus level depending amount) gold?'})
node2:addChildKeyword({'yes'}, StdModule.bless, {npcHandler = npcHandler, number = 2, premium = true, baseCost = 200000, levelCost = 6666, startLevel = 40, endLevel = 200})
node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Too expensive, eh?'})


local node3 = keywordHandler:addKeyword({'third bless'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to buy the third blessing for 2000 (plus level depending amount) gold?'})
node3:addChildKeyword({'yes'}, StdModule.bless, {npcHandler = npcHandler, number = 3, premium = true, baseCost = 200000, levelCost = 6666, startLevel = 40, endLevel = 200})
node3:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Too expensive, eh?'})


local node4 = keywordHandler:addKeyword({'fourth bless'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to buy the fourth blessing for 2000 (plus level depending amount) gold?'})
node4:addChildKeyword({'yes'}, StdModule.bless, {npcHandler = npcHandler, number = 4, premium = true, baseCost = 200000, levelCost = 6666, startLevel = 40, endLevel = 200})
node4:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Too expensive, eh?'})


local node5 = keywordHandler:addKeyword({'fifth bless'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to buy the fifth blessing for 2000 (plus level depending amount) gold?'})
node5:addChildKeyword({'yes'}, StdModule.bless, {npcHandler = npcHandler, number = 5, premium = true, baseCost = 200000, levelCost = 666, startLevel = 40, endLevel = 200})
node5:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Too expensive, eh?'})


npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

@Edit

não testei qualquer error so fala...

Edited by jobsonmb (see edit history)

Que Ajuda? Me Contate.

Sou:

Programador

Script

Mapper

WebMaster

WebDesigner

E Muito Mais ;D 

 

Você tem o direito de falar o que pensa
Mas não tem o direito de julgar quem não conhece
Liberdade de expressão é um direito de todos
Mas em vez de falar, então faça algo que preste

 

~Charlie Brown Jr

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

Confirmação de Termo