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

No, we don't help with NPCs and scripts that are not original.

But in this case, I think an exception could be made.
As a matter of fact, I have scripted this NPC previously:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Zebron" script="Zebron.lua">
	<look type="128" head="95" body="15" legs="109" feet="76"/>
</npc>
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

local Topic = {}

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 thinkCallback(cid)
	if math.random(250) == 1 then
		selfSay("Hey mate, up for a game of dice?")
	end
	return true
end

function getCount(string)
	local b, e = string:find("%d+")
	return b and e and tonumber(string:sub(b, e)) or -1
end

function greetCallback(cid)
	Topic[cid] = 1
	return true
end

function creatureSayCallback(cid, type, msg)
	if(not npcHandler:isFocused(cid)) then
		return false
	elseif msgcontains(msg, "job") then
		npcHandler:say("Oh, I am just sitting around here and gamble now and then.", cid)
		Topic[cid] = 0
	elseif msgcontains(msg, "tavern") then
		npcHandler:say("It's a fine place to be around, isn't it?", cid)
		Topic[cid] = 0
	elseif msgcontains(msg, "name") then
		npcHandler:say("I am known as Zebron.", cid)
		Topic[cid] = 0
	elseif msgcontains(msg, "king") or msgcontains(msg, "tibianus") then
		npcHandler:say("Ah, our beloved king! Bless him for the gambling licence of Venore.", cid)
		Topic[cid] = 0
	elseif msgcontains(msg, "licence") then
		npcHandler:say("I don't care much for that law stuff, but as far as I know those Venore merchants got a royal gambling licence for the city.", cid)
		Topic[cid] = 0
	elseif msgcontains(msg, "venore") then
		npcHandler:say("Aaaah, Venore, Venore, what a wonderful town. Especially for someone with love for gambling like me.", cid)
		Topic[cid] = 0
	elseif msgcontains(msg, "army") then
		npcHandler:say("Hehe, they spent a good part of their salary here in the tavern.", cid)
		Topic[cid] = 0
	elseif msgcontains(msg, "excalibug") then
		npcHandler:say("I would not bet that anyone will ever find it.", cid)
		Topic[cid] = 0
	elseif msgcontains(msg, "thais") then
		npcHandler:say("Thais is a bit too conservative for me.", cid)
		Topic[cid] = 0
	elseif msgcontains(msg, "tibia") then
		npcHandler:say("What would I need more than that what I can get right here?", cid)
		Topic[cid] = 0
	elseif msgcontains(msg, "carlin") then
		npcHandler:say("Carlin, the beerless ... what a shame.", cid)
		Topic[cid] = 0
	elseif msgcontains(msg, "hugo") then
		npcHandler:say("I had a cousin named Hugo, why do you ask?", cid)
		Topic[cid] = 0
	elseif msgcontains(msg, "news") or msgcontains(msg, "rumors") or msgcontains(msg, "swamp") or msgcontains(msg, "amazon") then
		npcHandler:say("Bah, always the same chitchat. Swampelves this and amazons that ... blah blah.", cid)
		Topic[cid] = 0
	elseif msgcontains(msg, "gambl") or msgcontains(msg, "game") or (msgcontains(msg, "dice") and Topic[cid] ~= 2) then
		npcHandler:say("So you care for a civilized game of dice?", cid)
		Topic[cid] = 1
	elseif Topic[cid] == 1 then
		if msgcontains(msg, "yes") then
			npcHandler:say("Hmmm, would you like to play for money or for a chance to win your own dice?", cid)
			Topic[cid] = 2
		else
			npcHandler:say("Oh come on, don't be a child.", cid)
			Topic[cid] = 0
		end
	elseif Topic[cid] == 2 then
		if msgcontains(msg, "money") then
			npcHandler:say("I thought so. Okay, I will roll a dice. If it shows 6, you will get five times your bet. How much do you want to bet?", cid)
			Topic[cid] = 3
		elseif msgcontains(msg, "dice") then
			npcHandler:say("Hehe, good choice. Okay, the price for this game is 100 gold pieces. I will roll a dice. If I roll a 6, you can have my dice. Agreed?", cid)
			Topic[cid] = 4
		else
			npcHandler:say("Oh come on, don't be a child.", cid)
			Topic[cid] = 0
		end
	elseif Topic[cid] == 3 then
		if 0 < getCount(msg) and 100 > getCount(msg) then
			if doPlayerRemoveMoney(cid, getCount(msg)) == TRUE then
				local rand = math.random(6)
				if rand == 6 then
					npcHandler:say("Ok, here we go ... " .. rand .. "! You have won " .. getCount(msg)*5 .. ", congratulations. One more game?", cid)
					doPlayerAddMoney(cid, getCount(msg)*5)
				else
					npcHandler:say("Ok, here we go ... " .. rand .. "! You have lost. Bad luck. One more game?", cid)
				end
				doSendMagicEffect(getCreaturePosition(getNpcCid()), CONST_ME_CRAPS)
				Topic[cid] = 1
			else
				npcHandler:say("I am sorry, but you don't have so much money. How much do you want to bet?", cid)
				Topic[cid] = 2
			end
		else
			npcHandler:say("I am sorry, but I accept only bets between 1 and 99 gold. I don't want to ruin you after all. How much do you want to bet?", cid)
			Topic[cid] = 3
		end
	elseif Topic[cid] == 4 then
		if msgcontains(msg, "yes") then
			if doPlayerRemoveMoney(cid, 100) == TRUE then
				local rand = math.random(6)
				if rand == 6 then
					npcHandler:say("Ok, here we go ... " .. rand .. "! You have won a dice, congratulations. One more game?", cid)
					doPlayerAddItem(cid, 5792, 1)
				else
					npcHandler:say("Ok, here we go ... " .. rand .. "! You have lost. Bad luck. One more game?", cid)
				end
				doSendMagicEffect(getCreaturePosition(getNpcCid()), CONST_ME_CRAPS)
				Topic[cid] = 1
			else
				npcHandler:say("I am sorry, but you don't have so much money.", cid)
				Topic[cid] = 0
			end
		else
			npcHandler:say("Oh come on, don't be a child.", cid)
			Topic[cid] = 0
		end
	end
	return true
end

npcHandler:setMessage(MESSAGE_GREET, "Greetings, high roller. So you care for a game, |PLAYERNAME|?")
npcHandler:setMessage(MESSAGE_WALKAWAY, "Hey, you can't leave. Luck is smiling on you. I can feel it!")
npcHandler:setMessage(MESSAGE_FAREWELL, "Hey, you can't leave, |PLAYERNAME|. Luck is smiling on you. I can feel it!")

npcHandler:setCallback(CALLBACK_ONTHINK, thinkCallback)
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Last edited:
Wow thanks :)
Code:
You must spread some Reputation around before giving it to Cykotitan again.
:(

You forgot only about
LUA:
doPlayerAddItem(cid, 2148, getCount(msg)*5)



Where can I increase chance to roll 6?
 
Back
Top