Ir para conteúdo
Entre para seguir isso  
Lithium

Addon Npc Para Forgotten Server

Recommended Posts

Lithium    0
Lithium

Oi galera

estou postando aqui um script de NPC de Addons para o Forgotten Server</span>

100% feito por mim!

 

vamos ao script

 

Crie um arquivo chamado Varkhal.xml em data/npc/ e cole isso:

<?xml version="1.0"?>
     <npc name="Varkhal" script="data/npc/scripts/addon.lua" autowalk="1" floorchange="0">
         <health now="100" max="100"/>
         <look type="134" head="78" body="88" legs="0" feet="88" addons="3" />
     </npc>

 

Crie um arquivo chamado addon.lua em data/npc/scripts/ e cole isso:

------------------------------------------------------------------------
------------- Addon NPC for Forgotten Server ---------------
---------------------- Script by Lithium --------------------------
------------------------------------------------------------------------
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

-- OTServ event handling functions start
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
-- OTServ event handling functions end

function creatureSayCallback(cid, type, msg)
    -- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
    if(npcHandler.focus ~= cid) then
        return false
    end

      if msgcontains(msg, 'addons') or msgcontains(msg, 'addon')  or msgcontains(msg, 'addoner') then
          selfSay('I sell the first addon for 5k and the second addon for 10k.')
    elseif getPlayerPremiumDays(cid) > 0 then
        if msgcontains(msg, 'first addon') then
            selfSay('Do you want to buy the first addon for 5k?')
            talk_state = 1
        elseif msgcontains(msg, 'second addon') then
            selfSay('Do you want to buy the second addon for 10k?')
            talk_state = 2            
        elseif talk_state == 1 then
            if msgcontains(msg, 'yes') then
                  if doPlayerRemoveMoney(cid,5000) then
                    if getPlayerSex(cid) == 1 then
                        for x = 128, 134 do
                            doPlayerAddOutfit(cid, x, 1)
                        end
                        for y = 143, 146 do
                            doPlayerAddOutfit(cid, y, 1)
                        end        
                        for z = 151, 154 do
                            doPlayerAddOutfit(cid, z, 1)                     
                        end                 
                    else
                        for x = 136, 142 do
                            doPlayerAddOutfit(cid, x, 1)
                        end
                        for y = 147, 150 do
                            doPlayerAddOutfit(cid, y, 1)
                        end        
                        for z = 155, 158 do
                            doPlayerAddOutfit(cid, z, 1)
                        end
                    end
                    selfSay('You have now the first addon!')
                else
                    selfSay('Sorry, you don\'t have enough money.')
                end
             end
            talk_state = 0
        elseif talk_state == 2 then
            if msgcontains(msg, 'yes') then
                if doPlayerRemoveMoney(cid,10000) then
                    if getPlayerSex(cid) == 1 then
                        for x = 128, 134 do
                            doPlayerAddOutfit(cid, x, 2)
                        end
                        for y = 143, 146 do
                            doPlayerAddOutfit(cid, y, 2)
                        end        
                        for z = 151, 154 do
                            doPlayerAddOutfit(cid, z, 2)                     
                        end                 
                    else
                        for x = 136, 142 do
                            doPlayerAddOutfit(cid, x, 2)
                        end
                        for y = 147, 150 do
                            doPlayerAddOutfit(cid, y, 2)
                        end        
                        for z = 155, 158 do
                            doPlayerAddOutfit(cid, z, 2)
                        end
                    end
                    selfSay('You have now the second addon!')
                else
                    selfSay('Sorry, you don\'t have enough money.')
                end
             end
            talk_state = 0            
        elseif msgcontains(msg, 'bye') then
            selfSay('Good bye!')

            talk_state = 0
        end
    else
        selfSay('You need a premium account to buy \'addons\', there\'s nothing else you can do here..')
    end
    return TRUE
end

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

 

Creditos: 100% Lithium

 

<span style="color:Blue">Comentários please wink.gif

Compartilhar este post


Link para o post
Giko    0
Giko

@Lith

 

Aprovado.

 

Tópico movido.

Compartilhar este post


Link para o post
Lugano The Fakke    0
Lugano The Fakke

vlw cara... odeio akeles npc que em q da addon por item... um droga... gosto desse ai vou por aki no OT!! vlw

Compartilhar este post


Link para o post
Chronos    0
Chronos

lith melhoro nos npc ein?

xD

 

mto bom

 

//CR

Compartilhar este post


Link para o post
Xgeneration    1
Xgeneration

aE Cara Mto Bom!!!!

 

:]~

 

Se num tem o ke Vende Premmy Nao e Algum q COmpre/Venda Itens...Baxei o Forgotten Server e ainda n me acostumei com akeles scripst dos npcs ¬¬

 

ai se vc tiver posta ae pq vai da pra eu me basear neles =P

 

Vlw!!

 

Mto bom Trabalho

 

;*

Compartilhar este post


Link para o post
HeberPcL    3
HeberPcL
aE Cara Mto Bom!!!!

 

:]~

 

Se num tem o ke Vende Premmy Nao e Algum q COmpre/Venda Itens...Baxei o Forgotten Server e ainda n me acostumei com akeles scripst dos npcs ¬¬

 

ai se vc tiver posta ae pq vai da pra eu me basear neles =P

 

Vlw!!

 

Mto bom Trabalho

 

;*[/b]

 

tive o mesmo problema com os npcs

 

se conseguir me avisa tb

 

=p

Compartilhar este post


Link para o post
cnecjoao    0
cnecjoao

eu gostei mto, odeio aqueles outros.... eh mto exagerado, esse eh mais util... aprovadissimo.

Compartilhar este post


Link para o post
EL Cachaceiro    0
EL Cachaceiro

eu gostei mto, odeio aqueles outros.... eh mto exagerado, esse eh mais util... aprovadissimo

Compartilhar este post


Link para o post
Combine    0
Combine

to com preguiça de faze isso =P, sabe eu tbm baixei esse forgothen server, mas venho sem mapa, alguem ae me da um mapa pls!!!

Compartilhar este post


Link para o post
Haron    0
Haron

ai kra naum consegui colocar esse npc para funcionar quando eu abro o meu ot da esse erro:

 

can not load script. data/npc/scripts/addon.lua

can not open data/npc/scripts/addon.lua: No such file or directory

 

o q sera q eu estou fazendo de errado????

 

vlw!!!

Compartilhar este post


Link para o post
Entre para seguir isso  
  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×