• 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] Sweaty Cyc that makes players wait 24 hours for amulet

kessykins

Intermediate OT User
Joined
Mar 15, 2010
Messages
297
Reaction score
105
Hey,

I'm looking for the Sweaty Cyc LUA that makes players wait 24 hours before giving them the 'mended' amulet for the blue legs quest. If possible I need the npc to give the player a countdown on when their amulet will be ready.

IE: "Your amulet will be ready in xx hr, xx minutes, xx seconds."

++ REP!
 
it is storage.wait
Try that
LUA:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
local hasItems = {}
local amuletStatus = 12000
local items = {
	[1] = {8264, 1},
	[2] = {8263, 1},
	[3] = {8262, 1},
	[4] = {8265, 1}
}
local wait = {
	storage = 12001,
	_time = 24 * 3600
}
 
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
	if(msgcontains(msg, 'amulet') and getCreatureStorage(cid, amuletStatus) <= 0) then
		selfSay('Do you want me to forge all the amulet pieces?', cid)
		talkState[talkUser] = 3
	elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 3) then
		hasItems[talkUser] = true
		for _, data in ipairs(items) do
			if(getPlayerItemCount(cid, data[1]) < data[2]) then
				hasItems[talkUser] = false
			end
		end
		if(hasItems[talkUser]) then
			for _, data in ipairs(items) do
				doPlayerRemoveItem(cid, data[1], data[2])
			end
			exhaustion.set(cid, wait.storage, wait._time)
			doCreatureSetStorage(cid, amuletStatus, 2)
			selfSay('Great, come back in 24 hours and ill have the amulet forged.', cid)
		else
			selfSay('You don\'t have required items.', cid)
		end
		hasItems[talkUser] = nil
		talkState[talkUser] = nil
	elseif(msgcontains(msg, 'amulet') and getCreatureStorage(cid, amuletStatus) == 2) then

		if(not exhaustion.get(cid, wait.storage)) then
			doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN)
			doCreatureSetStorage(cid, amuletStatus, 3)
			doPlayerAddItem(cid, 8266, 1)
			selfSay('Just in time! Your amulet is forged and ready.', cid)
		else
			selfSay("Oh! you came sooner than i expected, I still need "..table.concat(string.timediff(exhaustion.get(cid, wait.storage))) ..".", cid)
		end
	end
 
	return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

No rep to me :p
 
Back
Top