• TibiaFace

    Tibiaface | Una comunidad Open Tibia donde encontras : mapas, scripts, Otserver, npc y amigos etc ...

    .
    demo menumenu

    Afiliados



    Votar:

    Scrip para bless

    Compartir:

    Ver el tema anterior Ver el tema siguiente Ir abajo  Mensaje (Página 1 de 1.)

    1default Scrip para bless el Dom Jul 29, 2018 6:04 am

    Joel98

    avatar
    Nuevo Miembro
    Nuevo Miembro
    Alguien que me ayude para poner que un npc venda todas las bless por favor
    Gracias

    Ver perfil de usuario

    2default Re: Scrip para bless el Dom Jul 29, 2018 9:47 pm

    [Admin] God Maya

    avatar
    Administrador
    Administrador
    aqui lo tienes

    Código:

    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
     
    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 = 2000, levelCost = 200, startLevel = 30, endLevel = 120})
        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 = 2000, levelCost = 200, startLevel = 30, endLevel = 120})
        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 = 2000, levelCost = 200, startLevel = 30, endLevel = 120})
        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 = 2000, levelCost = 200, startLevel = 30, endLevel = 120})
        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 = 2000, levelCost = 200, startLevel = 30, endLevel = 120})
        node5:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Too expensive, eh?'})
     
    npcHandler:addModule(FocusModule:new())
     



    Ver perfil de usuario http://www.tibiaface.com

    3default Re: Scrip para bless el Lun Jul 30, 2018 7:52 pm

    Joel98

    avatar
    Nuevo Miembro
    Nuevo Miembro
    Cuando compres las bless dices que ya las tiene y no te da nada

    Ver perfil de usuario

    4default Re: Scrip para bless el Lun Jul 30, 2018 8:04 pm

    [Admin] God Maya

    avatar
    Administrador
    Administrador
    [Tienes que estar registrado y conectado para ver este vínculo] escribió:Cuando compres las bless dices que ya las tiene y no te da nada

    test

    Código:
    ---- Script Made by Tatu Hunter ----
    ---- Thx to jkotni6 for formula of money -----
    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
        bless1 = getPlayerBlessing(cid,1)
        bless2 = getPlayerBlessing(cid,2)
        bless3 = getPlayerBlessing(cid,3)
        bless4 = getPlayerBlessing(cid,4)
        bless5 = getPlayerBlessing(cid,5)
        tbless = 'Sorry, but you already have this blessing.'
        pbless = 'Sorry, you need a premium account to buy blessings.'
        obless = 'Do you have 10000 gold coins to buy this blessing?'
        mbless = 'Sorry, but you need 10000 gold coins to buy this blessing.'
        gbless = 'Now the Gods blessed you.'
        player_gold = getPlayerItemCount(cid,2148)
        player_plat = getPlayerItemCount(cid,2152)*100
        player_crys = getPlayerItemCount(cid,2160)*10000
        player_money = player_gold + player_plat + player_crys
     
        if msgcontains(msg, 'blessing') or msgcontains(msg, 'blessings') then
            selfSay('I can give you 5 blessing, and each blessing cost 10000 gold coins. Just say help to know how to buy.')
        elseif msgcontains(msg, 'help') or msgcontains(msg, 'ajuda') then
            selfSay('To buy the blessings say, first bless, second bless, third bless, fouth bless and fifth bless.')
        elseif msgcontains(msg, 'first bless') then
            if isPremium(cid) then
                if player_money >= 10000 then
                    selfSay(obless)
                    talk_state = 1
                else
                    selfSay(mbless)
                    talk_state = 0
                end
            else
                selfSay(pbless)
                talk_state = 0
            end
        elseif msgcontains(msg, 'second bless') then
            if isPremium(cid) then
                if player_money >= 10000 then
                    selfSay(obless)
                    talk_state = 2
                else
                    selfSay(mbless)
                    talk_state = 0
                end
            else
                selfSay(pbless)
                talk_state = 0
            end
        elseif msgcontains(msg, 'third bless') then
            if isPremium(cid) then
                if player_money >= 10000 then
                    selfSay(obless)
                    talk_state = 3
                else
                    selfSay(mbless)
                    talk_state = 0
                end
            else
                selfSay(pbless)
                talk_state = 0
            end
        elseif msgcontains(msg, 'fourth bless') then
            if isPremium(cid) then
                if player_money >= 10000 then
                    selfSay(obless)
                    talk_state = 4
                else
                    selfSay(mbless)
                    talk_state = 0
                end
            else
                selfSay(pbless)
                talk_state = 0
            end
        elseif msgcontains(msg, 'fifth bless') then
            if isPremium(cid) then
                if player_money >= 10000 then
                    selfSay(obless)
                    talk_state = 5
                else
                    selfSay(mbless)
                    talk_state = 0
                end
            else
                selfSay(pbless)
                talk_state = 0
            end
    ------------------------------ Confirm yes ---------------------------------
        elseif msgcontains(msg, 'yes') and talk_state == 1 then
            talk_state = 0
            if bless1 then
                selfSay(tbless)
            else
                if pay(cid,10000) then
                    doPlayerAddBlessing(cid, 1)
                    selfSay(gbless)
                else
                    selfSay(mbless)
                end
            end
        elseif msgcontains(msg, 'yes') and talk_state == 2 then
            talk_state = 0
            if bless2 then
                selfSay(tbless)
            else
                if pay(cid,10000) then
                    doPlayerAddBlessing(cid, 2)
                    selfSay(gbless)
                else
                    selfSay(mbless)
                end
            end
        elseif msgcontains(msg, 'yes') and talk_state == 3 then
            talk_state = 0
            if bless3 then
                selfSay(tbless)
            else
                if pay(cid,10000) then
                    doPlayerAddBlessing(cid, 3)
                    selfSay(gbless)
                else
                    selfSay(mbless)
                end
            end
        elseif msgcontains(msg, 'yes') and talk_state == 4 then
            talk_state = 0
            if bless4 then
                selfSay(tbless)
            else
                if pay(cid,10000) then
                    doPlayerAddBlessing(cid, 4)
                    selfSay(gbless)
                else
                    selfSay(mbless)
                end
            end
        elseif msgcontains(msg, 'yes') and talk_state == 5 then
            talk_state = 0
            if bless5 then
                selfSay(tbless)
            else
                if pay(cid,10000) then
                    doPlayerAddBlessing(cid, 5)
                    selfSay(gbless)
                else
                    selfSay(mbless)
                end
            end
    ------------------------------------------------ confirm no ------------------------------------------------
        elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 5) then
            selfSay('Ok than.')
            talk_state = 0
        end
        -- 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.
        return true
    end
     
    npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
    npcHandler:addModule(FocusModule:new())



    Ver perfil de usuario http://www.tibiaface.com

    5default Re: Scrip para bless el Lun Jul 30, 2018 8:21 pm

    Joel98

    avatar
    Nuevo Miembro
    Nuevo Miembro
    No jalo no se si el problema es que ningun npc te vende las bless (como eremo cuando le dices solitude te dice que si se la quieres comprar y cuando le pones yes ya no te responde)

    Ver perfil de usuario

    6default Re: Scrip para bless el Lun Jul 30, 2018 8:51 pm

    [Admin] God Maya

    avatar
    Administrador
    Administrador
    [Tienes que estar registrado y conectado para ver este vínculo] escribió:No jalo no se si el problema es que ningun npc te vende las bless (como eremo cuando le dices solitude te dice que si se la quieres comprar y cuando le pones yes ya no te responde)

    Código:
    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)

    if isInArray({"bless"}, msg) then

    if not isPremium(cid) then
    npcHandler:say("Necesita Premium Account!", cid)
    talkState[talkUser] = 0
    return true
    end

    if getPlayerMoney(cid) < 30000 then
    npcHandler:say("usted necesita 30k para comprar bless.", cid)
    talkState[talkUser] = 0
    return true
    end

    doPlayerRemoveMoney(cid, 30000)
    doPlayerAddBlessing(cid, 6)
    else
    npcHandler:say("usted ya tiene bles!", cid)
    talkState[talkUser] = 0
    return true
    end

    return true
    end
    npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
    npcHandler:addModule(FocusModule:new())


    ahi tiene test



    Ver perfil de usuario http://www.tibiaface.com

    Contenido patrocinado


    Ver el tema anterior Ver el tema siguiente Volver arriba  Mensaje (Página 1 de 1.)

    Permisos de este foro:
    No puedes responder a temas en este foro.

     

    BienvenidosTibiaFace es una comunidad de Open Tibia. Para participar debes estar registrado (click para Regístrate).