• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Action [RELEASE] Quest.lua with count & weight check [TFS]

Ezzam

New Member
Joined
Jan 16, 2008
Messages
213
Reaction score
2
(New script in quote, previous was bugged, now I have tested it, and it works 100%)

First, when you create quest put UniqueID=ItemID & ActionID=Count+100

Ex. Golden armor would be like this:

14500727zh5.png

AID=101(OBS: You must set AID, to only get 1 item write AID: 101)
UID=2466 (ID of g-arm)


(New script in quote, previous was bugged, now I have tested it, and it works 100%)

Save as "Quest.lua" in "...\data\actions\scripts\
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	price = item.uid
	count = item.actionid - 100

  if price > 1000 and price < 10000 then
    queststatus = getPlayerStorageValue(cid, price)
    local itemWeight = getItemWeight(price, count)
    local playerCap = getPlayerFreeCap(cid)

    if queststatus == -1 then
      if playerCap >= itemWeight then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have found ' .. count .. ' ' .. getItemName(price) .. '.')
        doPlayerAddItem(cid, price, count)
        setPlayerStorageValue(cid, price, 1)
      else
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have found ' .. count .. ' ' .. getItemName(item.uid) .. ' weighing ' .. itemWeight .. ' oz it\'s too heavy.')
      end
    else
      doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.")
    end
  end
  return TRUE
end

Put in "...\data\actions\actions.xml"

Code:
<action itemid="1740" script="Quest.lua"/>
<action fromid="1747" toid="1749" script="Quest.lua"/>

(New script in quote, previous was bugged, now I have tested it, and it works 100%)
 
Last edited:
This is better in TFS 0.2, there are still many ppl using 0.2 because it's more stable and less bugs because they have worked with it a long time.

It's true the 0.3 quest system is better, but i have no time learning it yet, when a more stable release of 0.3 comes, i might think it's not too good, mabye i edit the new system later, you never know.

But thx for comment your opinions i appreciate it.

*EDIT*
I made this because when i downloaded TFS 0.2 there was no Quest.lua script and i wanted a personal script i knew better.
 
Back
Top