• 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+ 1.2 coding help (key tree)

bedlamos

New Member
Joined
Dec 11, 2018
Messages
24
Solutions
1
Reaction score
1
Location
USA
I have been working on a quest for the past couple of days where when you right click a tree there is a secret quest.

I've gotten to the point where the tree gives the key AID 1501 (You see a key (1501)), but now the key won't open the door 1501 saying "The key does not match."

in actions.xml I have -
Code:
<action actionid="1500" script="quests/door1500.lua" />

(I know the quest name is 1500, but the door is in fact AID 1501)

In door1500.lua I have -

Code:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)    --This is mostly used to state the script executes onUse (right-clicking an object)
    if player:getStorageValue(storage) == -1 then    --Here we just check if the Player has the storage value we mentioned before, -1 means that the player DOESN'T have the value
        player:addItem(2087, 1):setActionId(1501)
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have found a key hidden inside of the tree!")    --This is just a message so the player knows something happened.
        player:setStorageValue(storage, 1)    --We set the storage value to 1
    else    --What happens if the value is already assigned to that player (He already received the reward)
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Aside from some squirming larvae, there's nothing of interest here.")    --Only shows this message
    end
return true
end

Any ideas what I did wrong?
 
what door type are you using

Code:
01:44 You see a closed door.
It is locked.
Item ID: 1210, Action ID: 1501.

01:44 You see a wooden key (Key:1501).
It weighs 1.00 oz.
Item ID: 2087, Action ID: 1501.

Default code works ok for me "other/doors.lua" with "doors = {" being declared in globa.lua
 
/i 5284
/attr aid,1501
19:32 Lee [0]: > player:addItem(2087, 1):setActionId(1501)


Code:
19:32 You see a closed door.
Item ID: 5284, Action ID: 1501.
Position: 32338, 32222, 7

19:32 You see a wooden key (Key:1501).
It weighs 1.00 oz.
Item ID: 2087, Action ID: 1501.
Position: 32339, 32222, 7

ecMhdzE.gif


Could you post your doors.lua.
also post the top of your global.lua the arrays that are door related.
doors, and keys.
 
Back
Top