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

Action Demon Helmet Quest

Oxious

Amateur Mapper & Scripter
Joined
Jan 25, 2009
Messages
89
Reaction score
0
Location
Germany
Greetings everyone!

I was searching the forums for something like this but didn't quite find it so I attempted to make it myself (check http://otland.net/f132/help-adding-timer-event-into-lua-action-20914/).

With the help and suggestions of StreamSide, xxgoosexx, Pitufo and Colandus I managed to modify the script to do as intended:

vhwcj5.jpg


When you hit the lever on the right (of course you'd have to assign it a uniqueID in your map aswell as inserting a line for it in actions.xml) a teleport will appear and the pink stone will disappear. You will not be able to use the lever again, however after 20 seconds it will flip itself back making the teleport vanish and the pink stone re-appear!

The code (tested with TFS 0.3beta3) is as thus:

PHP:
local pinkstonepos1 = {x=634, y=664, z=13}        -- Remember to
local TeleportToPos = { x = 645, y = 660, z = 12} -- adjust the
local TeleportInPos = { x = 636, y = 662, z = 13} -- coordinates here
local LeverPos      = { x = 647, y = 663, z = 13} -- to your map :)
local timeToRemove  = 20 -- in seconds

function onUse(cid, item, frompos, item2, topos)

local pinkstone1 = getTileItemById(pinkstonepos1, 1355) -- If you do not want a pink stone, change this itemID to whatever itemID you want to use
local teleport = getTileItemById(TeleportInPos, 1387)

        if item.itemid == 1945 then

            doRemoveItem(pinkstone1.uid, 1)
            doCreateTeleport(1387, TeleportToPos, TeleportInPos)
            doSendMagicEffect(TeleportInPos, CONST_ME_TELEPORT)
            doPlayerSendTextMessage(cid,22,"Click!")
            addEvent(doRemoveTeleport, timeToRemove * 1000)

    else if item.itemid == 1946 then

        doPlayerSendCancel(cid,"Sorry, not possible.")

    return 1

    end
end  

end

function doRemoveTeleport()

local teleport = getTileItemById(TeleportInPos, 1387)
local Lever = getTileItemById(LeverPos, 1946)

    if teleport.uid > 0 then

        doCreateItem(1355, 1, pinkstonepos1)
        doRemoveItem(teleport.uid)
        doSendMagicEffect(TeleportInPos, CONST_ME_POFF)
        doTransformItem(Lever.uid, 1945)

    end

end

Remember to change the coordinates according to your map aswell as the itemID's (incase you are not using a pink stone or use a different lever etc).

Have fun! :)
 
If you call yourself a scripter i sure would expect you to be able to edit this to 0.2 yourself.

@On topic:

Really nice script, most likly going to use it myself :D Thanks!
 
Back
Top