strutZ
Australian OT Member {AKA Beastn}
- Joined
- Nov 16, 2014
- Messages
- 1,391
- Solutions
- 7
- Reaction score
- 550
Hello Otland!
I have rewrote the tele pad system original made by @Fresh which can be found HERE My one however is a bit different. It was inspired by Harry Potters Floo powder.
Example of how the system looks: (Gif rec screwed the colours and hides mouse.. Basically you have to use the floo powder bottle on yourself to activate the window.)
This script also requires @Non Sequitur modal window system which can be found HERE
You will have to install that in order to be able to use this system.
Why use this one instead?
Much cleaner then the last version you just need to add the action script and the lib files. There is no need to register the scripts on login.lua or add creaturescripts!
Information on the system
It has an easy config section for you to customize it how you would like it! You just need to fill out the config table found in the action script (pictured below)
Adding a Telepad Spot
To add a telepad you need to add a unique ID to the tile you want to to make as the spot.
CONFIG TABLE
Installation
1) Install the modal window helper HERE
2) Register the script in /data/actions/actions.xml by adding this line (Replacing "ITEMID" with the item you want to be required to use on yourself
Code:
<action itemid="ITEMID" script="floo_powder.lua"/>
3) Create a new text document in /data/actions/scripts and name it "floo_powder.lua" and paste the following:
4) Add the following line to your global.lua:
Code:
dofile('data/lib/floo_powder.lua')
5) Create a new text document in /data/lib/ and name it "floo_powder.lua" and paste the following:
6) Add the following line to /data/movements/movements.xml Replacing TILE ID with your telepad itemID
7) Make a new text file in /data/movements/scripts and name it floo_powder.lua
8) Paste the following:
Enjoy =)
I have rewrote the tele pad system original made by @Fresh which can be found HERE My one however is a bit different. It was inspired by Harry Potters Floo powder.
Example of how the system looks: (Gif rec screwed the colours and hides mouse.. Basically you have to use the floo powder bottle on yourself to activate the window.)
This script also requires @Non Sequitur modal window system which can be found HERE
You will have to install that in order to be able to use this system.
Why use this one instead?
Much cleaner then the last version you just need to add the action script and the lib files. There is no need to register the scripts on login.lua or add creaturescripts!
Information on the system
It has an easy config section for you to customize it how you would like it! You just need to fill out the config table found in the action script (pictured below)
Adding a Telepad Spot
To add a telepad you need to add a unique ID to the tile you want to to make as the spot.
CONFIG TABLE
Code:
floo_powder = {
tileID = 25262,
unlockMsg = "You have unlocked ",
-- Window Configuration
titleMsg = "Floo Powder Teleport System",
mainMsg = "Select a location to be teleported too.\n\nYou are currently at:\n",
-- End Window Configuration
-- Teleport Spots
teleport_spots = {
[1] = {
name = "Thais Depot", -- Name of the spot (What is shown in the window)
storage = 10001, -- This storage tells the system what spots are unlocked
uid = 2291, -- The unique ID of the teleport spot "This is more for your records really.. "
direction = DIRECTION_SOUTH, -- This is the direction your player will face when he is teleported to another pad IT MUST BE CAPITALS!
description = "The Thais Depot",
},
Installation
1) Install the modal window helper HERE
2) Register the script in /data/actions/actions.xml by adding this line (Replacing "ITEMID" with the item you want to be required to use on yourself
Code:
<action itemid="ITEMID" script="floo_powder.lua"/>
3) Create a new text document in /data/actions/scripts and name it "floo_powder.lua" and paste the following:
Code:
floo_powder = {
tileID = 25262,
unlockMsg = "You have unlocked ",
-- Window Configuration
titleMsg = "Floo Powder Teleport System",
mainMsg = "Select a location to be teleported too.\n\nYou are currently at:\n",
-- End Window Configuration
-- Teleport Spots
teleport_spots = {
[1] = {
name = "Thais Depot", -- Name of the spot (What is shown in the window)
storage = 10001, -- This storage tells the system what spots are unlocked
uid = 2291, -- The unique ID of the teleport spot "This is more for your records really.. "
direction = DIRECTION_SOUTH, -- This is the direction your player will face when he is teleported to another pad IT MUST BE CAPITALS!
description = "The Thais Depot",
},
[2] = {
name = "Harry Potter",
storage = 10023,
uid = 2311,
direction = DIRECTION_SOUTH,
description = "Shops!",
},
},
}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local tile = target:getTile()
local items = tile:getItems()
local spot = nil
if items then
for i = 1, #items do
if items[i]:getId() == floo_powder.tileID then
local spot = items[i]:getUniqueId()
if target:isPlayer() then
player:sendFlooPowderWindow(spot, target)
return true
else
player:say("Maybe I should get in the fireplace first..", TALKTYPE_MONSTER_SAY)
end
end
end
end
end
4) Add the following line to your global.lua:
Code:
dofile('data/lib/floo_powder.lua')
5) Create a new text document in /data/lib/ and name it "floo_powder.lua" and paste the following:
Code:
function Player:sendFlooPowderWindow(spot, target)
-- This loop is used to determine which teleport pad they are using.
local function buttonCallback(button, choice)
local spotName = nil
for i = 1, #floo_powder.teleport_spots do
if floo_powder.teleport_spots[i].uid == spot then
spotName = floo_powder.teleport_spots[i].name
break
end
end
-- Modal window functionallity
if button.text == "Confirm" then
if spotName == floo_powder.teleport_spots[choice.id].name then
self:say("I'm already at "..spotName, TALKTYPE_MONSTER_SAY)
return true
end
self:removeItem(25260, 1)
target:getPosition():sendMagicEffect(174)
target:say(floo_powder.teleport_spots[choice.realid].name, TALKTYPE_MONSTER_SAY)
self:teleportTo(Item(floo_powder.teleport_spots[choice.realid].uid):getPosition())
self:setDirection(floo_powder.teleport_spots[choice.realid].direction)
self:getPosition():sendMagicEffect(174)
self:say(floo_powder.teleport_spots[choice.realid].name, TALKTYPE_MONSTER_SAY)
end
if button.text == "Info" then
self:showTextDialog(25260, floo_powder.teleport_spots[choice.realid].description)
self:sendFlooPowderWindow(spot)
end
end
-- Modal window design
-- This loop is used to determine which teleport pad they are using.
local spotName = nil
for i = 1, #floo_powder.teleport_spots do
if floo_powder.teleport_spots[i].uid == spot then
spotName = floo_powder.teleport_spots[i].name
break
end
end
local window = ModalWindow {
title = floo_powder.titleMsg, -- Title of the modal window
message = floo_powder.mainMsg..spotName,
}
-- Add buttons to the window (Note: if you change the names of these you must change the functions in the modal window functionallity!)
window:addButton("Exit")
window:addButton("Info", buttonCallback)
window:addButton("Confirm", buttonCallback)
-- Set what button is pressed when the player presses enter or escape
window:setDefaultEnterButton("Confirm")
window:setDefaultEscapeButton("Exit")
-- Add choices from the action script
for i = 1, #floo_powder.teleport_spots do
if self:getStorageValue(floo_powder.teleport_spots[i].storage) > 0 then
local o = floo_powder.teleport_spots[i].name
local choice = window:addChoice(o)
choice.realid = i
end
end
-- Send the window to player
window:sendToPlayer(self)
end
6) Add the following line to /data/movements/movements.xml Replacing TILE ID with your telepad itemID
Code:
<movevent event="StepIn" itemid="TILE ID" script="floo_powder.lua"/>
8) Paste the following:
Code:
function onStepIn(player, item, position, fromPosition)
local index = nil
for i = 1, #floo_powder.teleport_spots do
if floo_powder.teleport_spots[i].uid == item.uid then
index = i
break
end
end
if index == nil then
print("Error::Cannot find the tile Unique ID in your config table.")
return true
end
if player:getStorageValue(floo_powder.teleport_spots[index].storage) < 1 then
player:setStorageValue(floo_powder.teleport_spots[index].storage, 1)
player:say(floo_powder.unlockMsg..floo_powder.teleport_spots[index].name.."!", TALKTYPE_MONSTER_SAY)
end
end
Enjoy =)
Last edited: