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

MoveEvent [TFS 1.X] Reward Room Teleport

Extrodus

|| Blazera.net ||
Joined
Dec 22, 2008
Messages
2,750
Solutions
7
Reaction score
552
Location
Canada
This script will teleport the player to the reward position if they have all the storage values in config.

Currently it is set to only check if the storage is (storageID) = 1

If the storage you want is say 7 (ex: 17001, 7) than just modify the script from (player:getStorageValue(storage) == 1) to (player:getStorageValue(storage) >= 1)
This will change it to check if the storage value is equal to or greater than 1.

Note: See where it says "if config.count == 6" - this is where it checks to see if the player has the number of storages you enter. So if you only enter 3 storages in the config, change this number to 3; and so on.

Set the Teleport Unique ID to 1500 with no coordinates set in the map editor.

movements.xml
Code:
<movevent event="StepIn" uniqueid="1500" script="reward_room.lua"/>

Config Info:
Room = Where the player is teleported.
Kick = If player does not have the storages, he will be teleported here.
Storages = Storage values you wish to use.
Count = *Do not edit this number*

movements/reward_room.lua
Code:
function onStepIn(creature, item, position, fromPosition)
    local config = {
        room = {x=955, y=968, z=9},
        kick = {x=994, y=995, z=8},
        storages = {37113, 37114, 37115, 37116, 37117, 37118},
        count = 0
    }
     
    local player = creature:getPlayer()
    for _, storage in ipairs(config.storages) do
        if (player:getStorageValue(storage) == 1) then
               config.count = config.count + 1
        end
    end
    if config.count == 6 then
            creature:teleportTo(config.room)
            player:sendTextMessage(MESSAGE_INFO_DESCR, 'Congratulations adventurer, claim your reward for your many efforts!')
        else
            player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have not completed the task yet.')
            creature:teleportTo(config.kick)

    end
end

Hopefully someone could use this, I'm just getting started with figuring out how to script so anything I create that I find might be useful - Ill post for you guys to try out ;D

Tested on TFS 1.2 build #721
 
Last edited:
Back
Top