• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Npc Blessing Evolution 7.8

Kaspeer

New Member
Joined
Jul 10, 2007
Messages
12
Reaction score
0
Creditos Otservhispano

Create one archive bless.lua

and copy this

Code:
---- 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())



Bless Seller.xml and copy this

Code:
<npc name="Bless Seller" script="data/npc/scripts/bless.lua" autowalk="1" floorchange="0" access="5" level="1" maglevel="1">
    <health now="150" max="150"/>
    <look type="134" head="57" body="59" legs="40" feet="76" corpse="2212"/>
    <parameters>
        <parameter key="message_greet" value="Hello |PLAYERNAME|. I can give you 5 different blessings, each bless cost 10k, just say help to know how to buy." />
        
    </parameters>
</npc>
 
Nice npc keep up the good work now can you make an "sexchange npc" that would be really apreaciated :D
 
Back
Top