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

TFS 1.X+ Tfs 1.2 Chest give item with an actionID

MrVilhelm

Mafia Penguin
Joined
Dec 11, 2020
Messages
141
Solutions
1
Reaction score
113
Location
Sweden
GitHub
MrVilhelm
Ye as the title says, I want a chest that gives a key with a certain actionID.

Chest seem to work like this in tfs 1.2
ActionID: 2000
UniqueID: "Id of the item you want it to give"
 
Solution
You would need create a file that goes in data/actions/scripts called "chest.lua"

Code would look like this:

Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
  
    local item = player:addItem(2089) --whatever type of key here
  
    if player:getStorageValue(6020) == 1 then --whatever storage ID you want here
        player:sendTextMessage(MESSAGE_INFO_DESCR, 'The chest is empty.')
    else
        player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have found a copper key.')
        player:addItem(2089)
        item:setActionId(5821) --action ID you want the key to have here
        player:setStorageValue(6020, 1)
    end
    return true
end

then in actions.xml (set the action ID to something unique)...
You would need create a file that goes in data/actions/scripts called "chest.lua"

Code would look like this:

Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
  
    local item = player:addItem(2089) --whatever type of key here
  
    if player:getStorageValue(6020) == 1 then --whatever storage ID you want here
        player:sendTextMessage(MESSAGE_INFO_DESCR, 'The chest is empty.')
    else
        player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have found a copper key.')
        player:addItem(2089)
        item:setActionId(5821) --action ID you want the key to have here
        player:setStorageValue(6020, 1)
    end
    return true
end

then in actions.xml (set the action ID to something unique):

XML:
<action actionid="2008" script="quests/chest.lua" />

Finally, in RME, just set the chest to have the same action ID above that you set in actions.xml above.
 
Solution
Valentines Day Love GIF by GIPHY Studios Originals

Thanks for the help guys :p
 
Back
Top