LE
pedido

npc promotion

Por leoperez011, 08 de fev. de 2013 em Scripts

7
1.6k
leoperez011L
08 de fevereiro de 2013 às 16:36

é 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 ?

RoksasR
08 de fevereiro de 2013 às 17:05

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

leoperez011L
08 de fevereiro de 2013 às 17:16

vlw cara você me ajudou mt Rep+ pra você

 

mais tipo é so pra uma vocation ou é para todas ?

Editado Fevereiro 8 por leoperez011

RoksasR
08 de fevereiro de 2013 às 17:48

Pra todas. pode ir um kina lá e falar first promotion, que ele vai fica ek, pode ir um pally falar second promotion, que vai virar DEPOIS DO ROYAL PALADIN

ta certin, só fazer as vocations agora ^^

leoperez011L
08 de fevereiro de 2013 às 17:50

ok vlw

 

Alguem fecha o topico por favor

RoksasR
08 de fevereiro de 2013 às 18:28

Dúvida sanada, reported.

SlicerS
08 de fevereiro de 2013 às 18:30

@ROK

OLHE ANTES DE POSTAR ALGU MANO!!! JA TA NA AREA DE MOVIDO!!! ¬¬