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

open chest in time

alissonfgp

LUA, C, C++, C#
Premium User
Joined
Jul 13, 2011
Messages
111
Reaction score
29
Location
Brazil
I need a script to open the chest he needs to kill the boss, and can only reopen after 20h and every time the player will need to kill the boss, the kind of warzones. For TFS 0.3 and 0.4
if possible?
REP++
 
Search the forum for the chest script.

I've made the onKill part for the boss. It will set the storage after you kill the boss and reset the storage after 20 hours.


data/creaturescripts/scripts/login.lua
Code:
registerCreatureEvent(cid, "[COLOR="#FF0000"]EVENT_NAME_HERE[/COLOR]")
data/creaturescripts/creaturescripts.xml
XML:
<event type="kill" name="EVENT_NAME_HERE" event="script" value="script.lua"/>
data/creaturescripts/scripts/script.lua
Lua:
local config = {
	time = 20 -- 20 hours
}
 
local t = {
	["rat"] = 44001 -- monster and storage
}
 
function onKill(cid, target, damage, flags)
	local k = getCreatureName(target)
	local m = t[string.lower(k)]
	if( (damage == true or bit.band(flags, 1) == 1) and (isMonster(target) and m) ) then
		if(getCreatureStorage(cid, m) < 0) then
			doCreatureSetStorage(cid, m, 1)
			addEvent(doCreatureSetStorage, config.time * 60 * 60 * 1000, m, -1)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Congratulations! You have " .. config.time .. " hours to open the reward chest!")
		end
	end
	return true
end
 
Last edited:
Back
Top