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

[Action] Addons/Mounts by click on X Item.

UsftRaizer

UnsineSoft
Joined
Sep 5, 2014
Messages
22
Reaction score
9
Location
Mexico
Hello everyone!

I was looking this script. As the name says: I wanna get X Addon or Mount when i click on X item(For quest or whatever you want). When i was young i saw this script, but i tried to found it without any progress.

I'm working on TFS 1.2, but if u can do it for TFS 1.x, i guess more players than me will happy with your script.

This used to be the X item whichs adds your addon.
Q0yPYoa.png


Greetings, Raizer
 
register an action id and use some code like this
Code:
function onUse(...)
if storage value (action id) >= 1 then
return false
else
addMount/addOutfit
set storage value (action id, 1)
end
return true

or if you want many of these items to give rewards, you can register the item id and use a table where a specific action id gives a specific reward
 
I tried to add it, but doesnt work :c
Code:
function onUse(player, cid) <-- IDK what the hell comes here xD
if player:StorageValue (500) >= 1 then <-- I added storage 500 and change the "StorageValue"
return false
else
player:addMount(2)
player:setStorageValue (500, 1)
end
return true
end
 
Code:
local storage = storage
local mountid = mountid
local itemid = itemid

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if item.itemid == itemid and player:getStorageValue(storage) ~= 1 then
        player:sendTextMessage("You got mount.", MESSAGE_EVENT_ADVANCE)
        player:addMount(mountid)
        player:setStorageValue(storage, 1)
    else
        return player:sendTextMessage("Quest is empty.", MESSAGE_EVENT_ADVANCE)
    end

    return true
end
 
I quickly wrote this up for you with explanations possible. Good luck, if you are coding you will have to clean out the cobwebs

People using item.itemid isn't required since you will declare the item being used in actions.xml. This will be used as a new script for everytime you want a played to earn a new outfit
Code:
function onUse(player, item)
   local storage = item.actionid --will add a storage based off actionid so player can re use, if you want custom storage, set unique id on item and swap item.actionid with item.uniqueid
   if not player:getStorageValue(storage) == nil then return true end --player will recieve "Not possible" if storage has a value, meaning player already used
   --remove functions you dont want
   player:addOutfit(outfitID)--you will have to add both male and female outfit with seperate functions, meaning youll have addOutfit for both sexs
   player:addOutfitAddon(outfit, addon) --same as above, need 1 for each sex
   player:addMount(mountID)

   player:setStorageValue(storage, 1) --storage was declared above with "local storage"
 
   return true
end
 
Back
Top