• 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!

Level for Talk

brunocastro1993

Bruno de Castro
Joined
May 29, 2017
Messages
28
Reaction score
1
I need to put this npc to level 200 so I can win the gift of npc santa claus, could anyone help me?


Lua:
random_items = {
{4,10503,1}, -- 0.4% to get surprise box
{5,2112,1}, -- 0.5% to get teddy bear
{20,6512,1}, -- 2% to get santa doll
{30,10503,1}, -- 3% to get surprise box
{40,2114,1}, -- 4% to get piggy bank
{85,10503,1}, -- 8,5% to get surprise box
{80,11249,1}, -- 8% to get santa teddy
{300,6531,1}, -- 30% to get santa hat
{400,7440,1}, -- 40% to get 1 exp event
{450,9693,1}, -- 45% to get 1 addon doll
{1000,11257,1} -- 100% to get santa backpack
}
PRESENT_STORAGE = 54164 -- storage ID

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 santaNPC(cid, message, keywords, parameters, node)
if(not npcHandler:isFocused(cid)) then
return false
end
if (parameters.present == true) then
if (getPlayerStorageValue(cid, PRESENT_STORAGE) < 1) then
local item = {}
local reward = 0
local count = ""
for i = 1, #random_items do
item = random_items[i]
if (math.random(0,999) < item[1]) then
reward = item[2]
subType = item[3]
if subType > 1 then
count = subType .. " "
end
break
end
end

doPlayerAddItem(cid, reward, subType)
setPlayerStorageValue(cid, PRESENT_STORAGE, 1)
npcHandler:say('HO HO HO por ser bueno este ano te dare ' .. count .. getItemNameById(reward) .. ' para ti.', cid)
else
npcHandler:say('yo ya te di tu regalo.', cid)
end
else
npcHandler:say('regresa cuando seas bueno.', cid)
end
npcHandler:resetNpc()
return true
end


npcHandler:setMessage(MESSAGE_GREET, "Feliz Navidad {|PLAYERNAME|}. HO HO HO Yo soy Santa Claus. Y te dare un regalo por ser un buen nino, talk {present}!")

local noNode = KeywordNode:new({'no'}, santaNPC, {present = false})
local yesNode = KeywordNode:new({'yes'}, santaNPC, {present = true})

local node = keywordHandler:addKeyword({'pre'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'fuistes bueno este ano?'})
node:addChildKeywordNode(yesNode)
node:addChildKeywordNode(noNode)
npcHandler:addModule(FocusModule:new())
 
not working guys, would have to have a message saying that can only win the items if it is level 200, can you help me?
Lua:
local random_items = {
    {4, 10503, 1}, -- 0.4% to get surprise box
    {5, 2112, 1}, -- 0.5% to get teddy bear
    {20, 6512, 1}, -- 2% to get santa doll
    {30, 10503, 1}, -- 3% to get surprise box
    {40, 2114, 1}, -- 4% to get piggy bank
    {85, 10503, 1}, -- 8,5% to get surprise box
    {80, 11249, 1}, -- 8% to get santa teddy
    {300, 6531, 1}, -- 30% to get santa hat
    {400, 7440, 1}, -- 40% to get 1 exp event
    {450, 9693, 1}, -- 45% to get 1 addon doll
    {1000, 11257, 1} -- 100% to get santa backpack
}
local PRESENT_STORAGE = 54164 -- storage ID

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 santaNPC(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
    if (parameters.present == true) then
        if getPlayerLevel(cid) < 200 then
            npcHandler:say('Need to be level 200+ to receive presents.', cid)
            return true
        end
        if (getPlayerStorageValue(cid, PRESENT_STORAGE) < 1) then
            npcHandler:say('yo ya te di tu regalo.', cid)
            return true
        end
        local item = {}
        local reward = 0
        local count = ""
        for i = 1, #random_items do
            item = random_items[i]
            if (math.random(0,999) < item[1]) then
                reward = item[2]
                subType = item[3]
                if subType > 1 then
                    count = subType .. " "
                end
                break
            end
        end  
        doPlayerAddItem(cid, reward, subType)
        setPlayerStorageValue(cid, PRESENT_STORAGE, 1)
        npcHandler:say('HO HO HO por ser bueno este ano te dare ' .. count .. getItemNameById(reward) .. ' para ti.', cid)
    else
        npcHandler:say('regresa cuando seas bueno.', cid)
    end
    npcHandler:resetNpc()
    return true
end

npcHandler:setMessage(MESSAGE_GREET, "Feliz Navidad {|PLAYERNAME|}. HO HO HO Yo soy Santa Claus. Y te dare un regalo por ser un buen nino, talk {present}!")

local noNode = KeywordNode:new({'no'}, santaNPC, {present = false})
local yesNode = KeywordNode:new({'yes'}, santaNPC, {present = true})

local node = keywordHandler:addKeyword({'pre'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'fuistes bueno este ano?'})
node:addChildKeywordNode(yesNode)
node:addChildKeywordNode(noNode)
npcHandler:addModule(FocusModule:new())
 
Back
Top