• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

[Request] Token for Premium Days

Oldschool'er

Tibia since 1998'
Joined
Dec 14, 2010
Messages
2,198
Reaction score
149
Location
United States
Hello im looking for a NPC so when you give a "Vampire Lord Token" you get 2 premium days also if possible to get 1 token every certain amount of levels. Levels 100, 200, 300, and 350 if possible
 
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Token Trader" script="tokentrader.lua" walkinterval="2000" floorchange="0">
   <health now="100" max="100"/>
   <look type="130" head="0" body="113" legs="114" feet="114" addons="3"/>
   <parameters>
     <parameter key="message_greet" value="Hello |PLAYERNAME|, I trade vampire lord {tokens} for premium days."/>
   </parameters>
</npc>

Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}

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, 'token')) then
         selfSay('Do you want to trade a vampire lord token for 2 premium days?', cid)
         talkState[talkUser] = 1
     elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
         if(doPlayerRemoveItem(cid, 9020, 1)) then
             doPlayerAddPremiumDays(cid, 2)
             selfSay('Here you are, 2 extra premium days!', cid)
         else
             selfSay('You don\'t have vampire lord tokens.', cid)
         end
         talkState[talkUser] = 0
     elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser])) then
         selfSay('Ah, well then keep them!', cid)
         talkState[talkUser] = 0
     end
     return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())


For the tokens on new level you can use any reward on lvl up script and edit the ids.
http://otland.net/threads/reward-on-level-made-by-havoc.181362/
http://otland.net/threads/points-and-reward-for-level.146898/
http://otland.net/threads/get-an-item-after-reaching-lvl-xxx.140150/#post-1352354
http://otland.net/threads/reward-on-reaching-a-certain-level.134607/#post-13071
 
Last edited:
Back
Top