- Joined
- Aug 11, 2008
- Messages
- 2,628
- Solutions
- 2
- Reaction score
- 240
Hello guys.
I decided to release a few of my scripts ( Training Booths , Vocation Booths , Teleportatin Spell ). These scripts were only tested on TFS Alpha 3.
Teleportatin Spell
This script is pretty easy to configure. All you really have to do is to modify and add new rows which looks like this:
["train"] = {x = 820, y = 962, z = 7, name = "Thais Training Booths", access = 1, level = 60, vip = true, cost = 2000, soul = 2},
["train"] = What you type to go there.
x, y, z = The positions of the new place.
name = The name of the new place.
access = What access is necessary to go there.
level = What level is necessary to go there.
vip = Check if the user is VIP (vocations 9,10,11,12) or not.
cost = How much money should it drain from the user.
soul = How many soulpoints should it drain from the user.
If an area is defined by gm ( ["gm"] ) and someone uses it, a small window will appear welcoming you to the gm island.
data/functions.lua
data/talkactions/scripts/teleport.lua
data/talkactions/talkactions.xml
There you go, have fun with it.
I decided to release a few of my scripts ( Training Booths , Vocation Booths , Teleportatin Spell ). These scripts were only tested on TFS Alpha 3.
Teleportatin Spell
This script is pretty easy to configure. All you really have to do is to modify and add new rows which looks like this:
["train"] = {x = 820, y = 962, z = 7, name = "Thais Training Booths", access = 1, level = 60, vip = true, cost = 2000, soul = 2},
["train"] = What you type to go there.
x, y, z = The positions of the new place.
name = The name of the new place.
access = What access is necessary to go there.
level = What level is necessary to go there.
vip = Check if the user is VIP (vocations 9,10,11,12) or not.
cost = How much money should it drain from the user.
soul = How many soulpoints should it drain from the user.
If an area is defined by gm ( ["gm"] ) and someone uses it, a small window will appear welcoming you to the gm island.
data/functions.lua
PHP:
function isVIP(cid)
if(isPlayer(cid) == FALSE) then
debugPrint("isVIP: Player not found.")
return false
end
return (isInArray({9,10,11,12}, getPlayerVocation(cid)) == TRUE)
end
data/talkactions/scripts/teleport.lua
PHP:
function onSay(cid, words, param)
-- Define possible teleport locations.
local teleport =
{
-- For regular players.
["depot"] = {x = 770, y = 997, z = 7, name = "Thais Depot", access = 1, level = 80, vip = false, cost = 3000, soul = 1},
["temple"] = {x = 793, y = 1014, z = 7, name = "Thais Temple", access = 1, level = 80, vip = false, cost = 3000, soul = 1},
["train"] = {x = 820, y = 962, z = 7, name = "Thais Training Booths", access = 1, level = 60, vip = true, cost = 2000, soul = 2},
-- For gamemasters.
["gm"] = {x = 1298, y = 897, z = 7, access = 4}
}
-- Check so the param is not nil.
if param ~= nil then
-- Check if param exists in table teleports.
if table.find(teleport, teleport[param]) then
-- Check what access is required for the new destination.
if teleport[param].access > 1 or getPlayerAccess(cid) >= teleport[param].access then
-- Check if the player has access above ordinary.
if getPlayerAccess(cid) >= teleport[param].access then
-- Check if the player has gone to the GM Island.
if param == "gm" then
-- Define character greeting.
if getPlayerSex(cid) == 0 then
greeting = "miss"
else
greeting = "mister"
end
-- Show a popup window.
doPlayerPopupFYI(cid, "Welcome to the GM Island, " .. greeting .. " " .. getPlayerName(cid) .. ".")
end
-- Teleport player to the wanted location.
doTeleportThing(cid, {x = teleport[param].x, y = teleport[param].y, z = teleport[param].z})
-- Send magic effect.
doSendMagicEffect(getCreaturePos(cid), 10)
end
else
-- Check if the player has the required level.
if getPlayerLevel(cid) >= teleport[param].level then
-- Check if the player has VIP.
if ( teleport[param].vip == true and isVIP(cid) ) or teleport[param].vip == false then
-- Check if the player has enough money on him.
if doPlayerRemoveMoney(cid, teleport[param].cost) == TRUE then
-- Check if the player has enough soulpoints.
if getPlayerSoul(cid) >= teleport[param].soul then
-- Remove soulpoints from the player.
doPlayerAddSoul(cid, - teleport[param].soul)
-- Check if the player is in a fight or not.
if getCreatureCondition(cid, CONDITION_INFIGHT) == 0 then
-- Teleport the player to the wanted location.
doTeleportThing(cid, {x = teleport[param].x, y = teleport[param].y, z = teleport[param].z})
-- Send magic effect.
doSendMagicEffect(getCreaturePos(cid), 10)
else
-- Send an error message.
doPlayerSendTextMessage(cid, 23, "You may not be in a fight while trying to alter your destination to " .. teleport[param].name .. ".")
-- Send magic effect.
doSendMagicEffect(getCreaturePos(cid), 2)
end
else
-- Send an error message.
doPlayerSendTextMessage(cid, 23, "You do not have enough soulpoints (" .. teleport[param].soul .. ") to alter your destination to " .. teleport[param].name .. ".")
-- Send magic effect.
doSendMagicEffect(getCreaturePos(cid), 2)
end
else
-- Send an error message.
doPlayerSendTextMessage(cid, 23, "You do not have enough money (" .. teleport[param].cost .. "gp) to alter your destination to " .. teleport[param].name .. ".")
-- Send magic effect.
doSendMagicEffect(getCreaturePos(cid), 2)
end
else
-- Send an error message.
doPlayerSendTextMessage(cid, 23, "You need a player with VIP privileges to alter your destination to " .. teleport[param].name .. ".")
-- Send magic effect.
doSendMagicEffect(getCreaturePos(cid), 2)
end
else
-- Send an error message.
doPlayerSendTextMessage(cid, 23, "You need to be atleast level " .. teleport[param].level .. " to alter your destination to " .. teleport[param].name .. ".")
-- Send magic effect.
doSendMagicEffect(getCreaturePos(cid), 2)
end
end
else
-- Send an error message.
doPlayerSendTextMessage(cid, 23, "Please use a valid destination.")
-- Send magic effect.
doSendMagicEffect(getCreaturePos(cid), 2)
end
else
-- Send an error message.
doPlayerSendTextMessage(cid, 23, "Please use a valid destination.")
-- Send magic effect.
doSendMagicEffect(getCreaturePos(cid), 2)
end
end
PHP:
<!-- Teleport -->
<talkaction filter="word" words="goto" script="teleport.lua"/>