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

Lua Simple and Advanced quest help

bedlamos

New Member
Joined
Dec 11, 2018
Messages
24
Solutions
1
Reaction score
1
Location
USA
Apologies in advance, this will be long~
I'm using TFS 8.6 and Ramere's Map Editor.

So after messing around and looking through the files I've found out that actionid = 2000 is the chest quest.
What I can't figure out is how to make the chest quest give a unique item. For example, like in real tibia there are trees with keys inside of them, how does each tree give a unique key?
As far as I've gotten is:
  • Double click the tree and set the actionid to 2000 and the uniqueid to 1000 (for tree #2 I set the uniqueid to 1001).
  • Logged into the game and right clicked on the tree and this message popped up, "You have found a reward weighing 0oz. It is too heavy or you do not have enough space."
So within systems.lua I found the code:

if(doPlayerAddItemEx(cid, reward.uid, false) ~= RETURNVALUE_NOERROR) then
result = "You have found a reward weighing " .. getItemWeight(reward.uid) .. " oz. It is too heavy or you do not have enough space."
else
result = "You have found " .. result .. "."
setPlayerStorageValue(cid, storage, 1)
if(questsExperience[storage] ~= nil) then
doPlayerAddExp(cid, questsExperience[storage])
doSendAnimatedText(getCreaturePosition(cid), questsExperience[storage], TEXTCOLOR_WHITE)
end
end​

At this point I can't quite seem to figure out how to give the player the key to the door.

The more advanced side of the quest is there will be a stone with "items hidden underneath it." When you right click the stone a bag with boots, a rope, and a note saying "quest" text.
Is it possible to have a bag with items and a scroll with saved text on it?

Thanks very much if you read this, I look forward to your help!
 
Solution
Always use the code highlight when posting code:

fRH1lI6.png



I don't manage maps but as far as I know it works like this:
Action Id 2000 for a chest, unique id will be the storage used to keep track of which chests the player has already opened.

So if you set two different chests to the unique id 1001, the player will open the first one and won't be able to open the second one because the systems.lua would've already set the storage id 1001 to 1, which means he can't open any other chest with this unique id. (If you don't know what storages are, search on the forum there is a really great and complete post about it that explains it all)

As far as the items inside it goes, where you edit the action and...
Always use the code highlight when posting code:

fRH1lI6.png



I don't manage maps but as far as I know it works like this:
Action Id 2000 for a chest, unique id will be the storage used to keep track of which chests the player has already opened.

So if you set two different chests to the unique id 1001, the player will open the first one and won't be able to open the second one because the systems.lua would've already set the storage id 1001 to 1, which means he can't open any other chest with this unique id. (If you don't know what storages are, search on the forum there is a really great and complete post about it that explains it all)

As far as the items inside it goes, where you edit the action and unique id in RME you have some slots to add items. (You can add a bag and add items inside that bag aswell, all thorugh RME).

Resuming, both trees would have action id 2000, different unique ids and you'd have to add the key with its actionid inside the chest.
When adding the key to the chest, you set the actionid of the key to 1000 + the hundreads of that key.

For example: seting the action id of the key to 1030 would mean that key is the key 3030 (if I'm not mistaken, I could be wrong on the 1000, but I think that is correct, you'd have to test that yourself and see the result.)

You can always in game set the action id of an item, so just:
/i key (thats not the proper name, I think its silver key, idk)

Throw the key on the ground, face your GOD character towards it and use the command: /attr aid 1030 or /attr aid, 1030 maybe you need a comma in there

Now when you look at the key it will have a key value, see what happens and work around that.
 
Solution
This helped a lot, thank you! I can use this advice in a lot of ways.

Any idea how to make an item one of a kind? Like a secret item deep down inside of a cave that the first player who finds it keeps, but nobody else can?
 
Back
Top