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

Vocation based chest simple script! TFS 1.4.2

eardrums

Member
Joined
May 27, 2010
Messages
94
Solutions
1
Reaction score
10
Hey guys,

So can anyone take a look at this script for me because im new to this tfs version. Its a simple chest that should give me a full eq set with a different weapon according to the vocation. I use to use 0.4 and I dont know what im doing wrong.
the chest gives me items but it wont change them according to the vocation. it always just gives me the list of the top items regardless of my voc.
also how do i make it so some of the items go inside a bag because when i tried the items wouldnt get created at all.

I know I should probably use variables but im still trying to learn so dont want to confuse myself.
the 3 vocations are custom thats why I wrote Mage, Warrior, Hunter

and dont mind the storage values i was testing so i kept switching between == 1 and == 2 so i can open it again to test


function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if item.uid == 1004 and
player:getVocation(Mage)and
player:getStorageValue(30000) == 2 then

player:addItem(2461)
player:addItem(2467)
player:addItem(2649)
player:addItem(2643)
player:addItem(2512)
player:addItem(2182)
player:addItem(1987)
player:setStorageValue(30000, 1)
player:sendTextMessage(MESSAGE_INFO_DESCR, "here you go.")

elseif item.uid == 1004 and
player:getVocation(Warrior) and
player:getStorageValue(30000) == 2 then

player:addItem(2461)
player:addItem(2467)
player:addItem(2649)
player:addItem(2643)
player:addItem(2512)
player:addItem(13829)
player:addItem(1987)
player:setStorageValue(30000, 1)
player:sendTextMessage(MESSAGE_INFO_DESCR, "here you go.")

elseif item.uid == 1004 and
player:getVocation(Hunter) and
player:getStorageValue(30000) == 2 then

player:addItem(2461)
player:addItem(2467)
player:addItem(2649)
player:addItem(2643)
player:addItem(2512)
player:addItem(2389)
player:addItem(1987)
player:setStorageValue(30000, 1)
player:sendTextMessage(MESSAGE_INFO_DESCR, "here you go.")
else
player:sendTextMessage(MESSAGE_INFO_DESCR, "This one is empty.")

end
return true
end
 
Last edited:
Maybe it will work for you:
 
thank you man that worked! Is there a way in the code to use the name instead of the id?

like using this getName() ?
 
Back
Top