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

Request script trophy description

dervin13

Active Member
Joined
Apr 26, 2008
Messages
458
Solutions
1
Reaction score
28
anyone know how to do a quest that when player open the chest he gets a trophy with his name?
 
anyone know how to do a quest that when player open the chest he gets a trophy with his name?
You've been around since 2008, how many threads have you seen where people requested a script but never got an answer, because they never mentioned the server version..
 
I tried to make my first script ever. Tested on TFS 1.0

data/actions/actions.xml
Code:
<action uniqueid="5454" script="trophy.lua"/>

data/actions/scripts/trophy.lua
Code:
local storage = 47476

function onUse(cid, item, fromPosition, target, toPosition, isHotkey)
    local player = Player(cid)
    if player:getStorageValue(storage) == -1 then
        player:setStorageValue(storage, 1)
        player:addItem(7369, 1):setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, "This trophy belongs to "..player:getName()..".")
        player:sendTextMessage(MESSAGE_INFO_DESCR, "You found a trophy.")
    else
        player:sendTextMessage(MESSAGE_INFO_DESCR, "This chest is empty.")
        player:getPosition():sendMagicEffect(CONST_ME_POFF)
    end
    return true
end

To add it ingame just create a chest and add uniqueid. 5454
 
if tfs 0.4

doItemSetAttribute(doPlayerAddItem(cid, 7369), "name", "trophy "..getCreatureName(cid).."! Congratulations!")
 
Back
Top