Extrodus
|| Blazera.net ||
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
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
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
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: