Lurk
Active Member
- Joined
- Dec 4, 2017
- Messages
- 336
- Reaction score
- 48
Hello everyone, I love tibia and this community has given me a lot and I finally feel like I have something to give back, this code can be improved a lot (if you do improve it please comment here so we can all improve together). The idea behind this event is that I head the name Click up in a conversation, apparently it was a popular event in another server. I didn't see the original but I made what I thought would be the ideal thing, this event is a good break from hunting non stop and it also free the players to chat during its duration! (tho most people set a bot and go eat or something)
During this event (duration which you can choose) if a player clicks on a pre-determined crystal with a determined action, he'll gain a few levels each x seconds (an exhaust is necessary to prevent abuses from players using bots/auto clicks) and on my version, each 2 clicks will also give an item (event coin) but you can remove that completely or choose a new item. I'll be also providing the elfbot hotkey your players can use to automatically click.
on globalevents.xml add
on globalevents/scripts, create a new file and name it clickupend.lua
on globalevents/scripts, create a new file and name it clickupstart.lua
now on actions.xml add this tag
and on actions/scripts create a new file and name it clickup.lua and put this inside
now you need to open your world.otbm and create an area for the event, be sure to add the action
elfbot hotkey IF you're using the crystal with the same id as me (9779)
During this event (duration which you can choose) if a player clicks on a pre-determined crystal with a determined action, he'll gain a few levels each x seconds (an exhaust is necessary to prevent abuses from players using bots/auto clicks) and on my version, each 2 clicks will also give an item (event coin) but you can remove that completely or choose a new item. I'll be also providing the elfbot hotkey your players can use to automatically click.
on globalevents.xml add
XML:
<globalevent name="clickupstart" time="19:00" event="script" value="clickupstart.lua"/>
<globalevent name="clickupclose" time="19:15" event="script" value="clickupend.lua"/>
on globalevents/scripts, create a new file and name it clickupend.lua
Lua:
local storage = 64242 -- storage
function onTime()
setGlobalStorageValue (storage, -1)
doBroadcastMessage("THE CLICK UP EVENT HAS ENDED")
return true
end
on globalevents/scripts, create a new file and name it clickupstart.lua
Lua:
local storage = 64242 -- storage que você quer zerar.
function onTime()
setGlobalStorageValue (storage, 1)
doBroadcastMessage("THE CLICK UP EVENT HAS STARTED")
return true
end
now on actions.xml add this tag
XML:
<action actionid="42113" script="clickup.lua"/>
and on actions/scripts create a new file and name it clickup.lua and put this inside
Lua:
local tempo = 2 -- exhaust to click again and get levels
function onUse(cid, item, frompos, item2, topos)
if getGlobalStorageValue(64242) == 1 then
if getPlayerStorageValue(cid, 45890) > os.time() or getPlayerLevel(cid) >= 717217 then -- if the player is on cooldown or has already reached max level
return doPlayerSendCancel(cid, "You must wait "..(getPlayerStorageValue(cid, 45890) - os.time()).. " seconds to use again or you have already reached maximum level.")
end
if getPlayerStorageValue(cid, 45891) < 1 then
doPlayerAddLevel(cid, 32)
doCreatureSay(cid, "LEVEL UP", TALKTYPE_ORANGE_1, true, cid)
setPlayerStorageValue(cid, 45890, 2 + os.time())
local bah = getPlayerStorageValue(cid, 45891)
doPlayerSetStorageValue(cid, 45891, bah+1)
return true
else
doPlayerAddLevel(cid, 32)
doCreatureSay(cid, "LEVEL UP + EVENT COIN", TALKTYPE_ORANGE_1, true, cid)
doPlayerAddItem(cid,10558,1) -- if you don't want players to get items you can remove this line, or change the item id to a new one
setPlayerStorageValue(cid, 45890, 2 + os.time())
doPlayerSetStorageValue(cid, 45891, -1)
return true
end
else -- msg when the event isn't happening
return doPlayerSendCancel(cid, "The event haven't started yet.")
end
end
now you need to open your world.otbm and create an area for the event, be sure to add the action
42113
to the item your players have to click to gain levels, I recommend some imovable crystal/statue/stone (I'm using 9779)elfbot hotkey IF you're using the crystal with the same id as me (9779)
Code:
auto 200 listas 'Evento' | usegrounditem 8865