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

[REQUEST] Item Teleports you to xyz and disappears

Status
Not open for further replies.

Apollo

Herban Legend
Joined
Jul 11, 2007
Messages
519
Reaction score
1
Location
Canada
I would like to request a small script that I can implement into the item of my choice.

What do I want this script to be able to do? Well, here you go:



  • Teleport you to a customized X,Y,Z Position on a map.
  • Item must disappear after it has been used ONCE.
  • Custom server message (green) to be sent to the player once he uses the item.
  • The script must work with TFS Mystic Spirit 0.2.x
Thanks for reading, I will give rep++ to whoever makes me the script first.

Cheers,

Apollo

Bump! I really need this!
 
Last edited by a moderator:
@JDB:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local item = getThingfromPos(cfg.itemPos)

Double item declaration.:p
 
That's basically what I wanted, but, I don't want the player to be in the certain position to use the item. Is there a way to remove that from the script? (Sorry, I really don't know that much about scripting lol)
 
I guess it's better to add the 2/3 other sqms around the teleport item then it will give u the same result u want. which is teleporting from any position


The Wild Lion (MaXwEl)
 
That's basically what I wanted, but, I don't want the player to be in the certain position to use the item. Is there a way to remove that from the script? (Sorry, I really don't know that much about scripting lol)
Lua:
local config = 
{
    itemId = XXXX, -- Item ID
    newPos = {x=1000, y=1000, z=7}, -- New Player Position
    itemPos = {x=1000, y=1000, z=7, stackpos = 255}, -- Item Position
    storage = 32768
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local getItem = getThingfromPos(config.itemPos)
    if getItem.itemid ~= config.itemId then
        doPlayerSendCancel(cid, "You must place the item on the correct position.")
    elseif getPlayerStorageValue(cid, config.storage) == 1 then
        doPlayerSendCancel(cid, "You have already done this quest.")
    else
        doTeleportThing(cid, config.newPos)
        doSendMagicEffect(config.newPos, CONST_ME_TELEPORT)
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have been teleported.")
        setPlayerStorageValue(cid, config.storage, 1)
        doRemoveItem(getItem.uid, 1)
    end
    return TRUE
end
 
Last edited:
Pyromental, why did you change my script?
It is pointless, what you did.

@Topic,
Btw, I removed the playerPos.
Should be working, the way you want.
 
Pyromental, why did you change my script?
It is pointless, what you did.

  • You did not define cfg.storage
  • Code:
    local item = getThingfromPos(cfg.[B][COLOR="Red"]itemId[/COLOR][/B])
    Ummh, enough said.. another bug ^
 
Fixed in my first post,
but you changed things that didn't need changed.

Anyway's, it doesn't matter.
 
Fixed in my first post,
but you changed things that didn't need changed.

Anyway's, it doesn't matter.
I changed the script as I saw fit, and also..
That's basically what I wanted, but, I don't want the player to be in the certain position to use the item. Is there a way to remove that from the script? (Sorry, I really don't know that much about scripting lol)
 
Sorry for realizing this so late, but I don't need the item to be used on a certain xyz coordinate. I just want them to be able to use it in their backpack or at anytime.
 
About as configurable as it can get.
Lua:
local config = 
{
    newPos = {x=1000, y=1000, z=7},
    teleportEffect = CONST_ME_TELEPORT,
    messageType = MESSAGE_INFO_DESCR,
    messageText = "You have been teleported.",
    removeItem = TRUE
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
    doTeleportThing(cid, config.newPos)
    doSendMagicEffect(config.newPos, config.teleportEffect)
    doPlayerSendTextMessage(cid, config.messageType, config.messageText)
    if config.removeItem == TRUE then
        doRemoveItem(item.uid, 1)
    end
    return TRUE
end
 
About as configurable as it can get.
Lua Code:
local config =
{
newPos = {x=1000, y=1000, z=7},
teleportEffect = CONST_ME_TELEPORT,
messageType = MESSAGE_INFO_DESCR,
messageText = "You have been teleported.",
removeItem = TRUE
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
doTeleportThing(cid, config.newPos)
doSendMagicEffect(config.newPos, config.teleportEffect)
doPlayerSendTextMessage(cid, config.messageType, config.messageText)
if config.removeItem == TRUE then
doRemoveItem(item.uid, 1)
end
return TRUE
end

I get the following error in the console when I start up my server:

Code:
[07/08/2009  11:11:13] Warning: [Event::loadScript] Can not load script. data/actions/scripts/Earth Set.lua
[07/08/2009  11:11:13] data/actions/scripts/Earth Set.lua:6: '}' expected (to close '{' at line 2) near 'Earth'
 
I get the following error in the console when I start up my server:

Code:
[07/08/2009  11:11:13] Warning: [Event::loadScript] Can not load script. data/actions/scripts/Earth Set.lua
[07/08/2009  11:11:13] data/actions/scripts/Earth Set.lua:6: '}' expected (to close '{' at line 2) near 'Earth'
If you modified the script, post it here.
 
Problem has been solved.
I wrote him a script and it works.

Close Thread.
 
Status
Not open for further replies.
Back
Top