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

Action ghettobird's tp scroll, tps u to to temple!

Do you think ghettobird's scripting is good/useful?


  • Total voters
    28
No Item....
For example.
I want to to this with a unique id.

That i cann just put the unique id on a ground.
 
Code:
local newpos = {x=1000, y=1000, z=7}
local time = 50--in second
function onUse(cid, item, frompos, item2, topos)
local inFight = hasCondition(cid, CONDITION_INFIGHT)
if exhaustion.check(cid, 1605) then
return doPlayerSendCancel(cid, "Please Wait "..exhaustion.get(cid,1605)..".") and doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
end

if not inFight then
doSendMagicEffect(getPlayerPosition(cid), 2)
doTeleportThing(cid,newpos)
doCreatureSay(cid, "TELEPORTED!!" ,25)
exhaustion.set(cid, 1605, time)

else
doPlayerSendTextMessage(cid,25,"You can't use the teleport scroll if you are PZ LOCKED!!")
end
return true
end


My Tibia crashing when i use the scroll....
TFS 0.3.7 Tibia 9.8-9.86 Server Info

Please help
and the message when someone walk over a sqm dont work too..
Please help
 
But "doCreatureSay" works fine...
All works expect the Exhaust Time...
 
Hey otlanders, i had some free time today (again :p) so i made a scroll that teleports you to temple.

@Off Topic: a lot of people have been asking me where i learn lua while it's right in front of their eyes, so just to avoid any other question of that kind, here is what i DO WHEN I SCRIPT :-

1st: open http://otland.net/f481/scripting-guide-74030/
2nd: open lua functions (docs -> lua functions)
3rd: i just put them together... it's really easy if you try!
-------------------------------------------------------------------------------------------------


now since that's out of the way we can get back to track,

in your actions/scripts put this
Lua:
local newpos = {x=1000, y=1000, z=7}
function onUse(cid, item, frompos, item2, topos)
local inFight = hasCondition(cid, CONDITION_INFIGHT)
if not inFight then
      doSendMagicEffect(getPlayerPosition(cid), 2)
      doTeleportThing(cid,newpos)
      doCreatureSay(cid, "TELEPORTED!!" ,25)
    
else
doPlayerSendTextMessage(cid,25,"You can't use the teleport scroll if you are PZ LOCKED!!")
end
return true
end


now go to actions.xml and post this
Lua:
 <action itemid="itemidyouwant" event="script" value="yourscriptname.lua"/>

i really hope you guys like it, it really takes time (or at least for me) to make these scripts :)


anyway, ENJOY! :peace:
Change to
Lua:
doCreatureSay(cid, "TELEPORTED!!", TALKTYPE_ORANGE_1)
and
Lua:
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You can't use the teleport scroll if you are PZ LOCKED!!")
Else people (can) get debugged.
debuuged while using but character moved to pos temple
0.3.6
 
@ghettobird
i need to add exhausted time for it i mean use it every 1 mint
thx

Code:
local newpos = Position(32369,32241,7)
function onUse(cid, item, frompos, item2, topos)
local inFight = hasCondition(cid, CONDITION_INFIGHT)
local delay = 76000 -- random storage
    if not inFight and not getPlayerStorageValue(cid, delay) >= os.time() then
        doSendMagicEffect(getPlayerPosition(cid), 2)
        doTeleportThing(cid,newpos)
        doCreatureSay(cid, "TELEPORTED!!" , TALKTYPE_ORANGE_1)
        setPlayerStorageValue(cid, delay, os.time() + 60)
    elseif getPlayerStorageValue(cid, delay) >= os.time() then
    doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,"You are exhausted. You can only use once per minute!")
    else
    doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,"You can't use the teleport scroll if you are PZ LOCKED!!")
    end
return true
end
 
Code:
local newpos = Position(32369,32241,7)
function onUse(cid, item, frompos, item2, topos)
local inFight = hasCondition(cid, CONDITION_INFIGHT)
local delay = 76000 -- random storage
    if not inFight and not getPlayerStorageValue(cid, delay) >= os.time() then
        doSendMagicEffect(getPlayerPosition(cid), 2)
        doTeleportThing(cid,newpos)
        doCreatureSay(cid, "TELEPORTED!!" , TALKTYPE_ORANGE_1)
        setPlayerStorageValue(cid, delay, os.time() + 60)
    elseif getPlayerStorageValue(cid, delay) >= os.time() then
    doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,"You are exhausted. You can only use once per minute!")
    else
    doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,"You can't use the teleport scroll if you are PZ LOCKED!!")
    end
return true
end
mmm doesn't work Oo
[27/12/2014 02:21:55] [Error - Action Interface]
[27/12/2014 02:21:55] data/actions/scripts/yourscriptname.lua
[27/12/2014 02:21:55] Description:
[27/12/2014 02:21:55] data/actions/scripts/yourscriptname.lua:1: attempt to call global 'Position' (a nil value)
[27/12/2014 02:21:55] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/yourscriptname.lua)
[27/12/2014 02:21:55] data/actions/scripts/yourscriptname.lua:14: 'end' expected (to close 'function' at line 2) near '<eof>'
Code:
local newpos = Position(1000,1000,7)
function onUse(cid, item, frompos, item2, topos)
local inFight = hasCondition(cid, CONDITION_INFIGHT)
local delay = 76000 -- random storage
    if not inFight and not getPlayerStorageValue(cid, delay) >= os.time() then
        doSendMagicEffect(getPlayerPosition(cid), 2)
        doTeleportThing(cid,newpos)
        doCreatureSay(cid, "TELEPORTED!!" , TALKTYPE_ORANGE_1)
        setPlayerStorageValue(cid, delay, os.time() + 60)
    elseif getPlayerStorageValue(cid, delay) >= os.time() then
    doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,"You are exhausted. You can only use once per minute!")
    else
    doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,"You can't use the teleport scroll if you are PZ LOCKED!!")
    end
return true
end
 
Change:
Code:
local newpos = Position(1000,1000,7)
to:
Code:
local newpos = {x=1000, y=1000, z=7}
 
Change:
Code:
local newpos = Position(1000,1000,7)
to:
Code:
local newpos = {x=1000, y=1000, z=7}
changed it and found this error when i use scroll
[27/12/2014 02:37:18] [Error - Action Interface]
[27/12/2014 02:37:18] data/actions/scripts/yourscriptname.lua:eek:nUse
[27/12/2014 02:37:18] Description:
[27/12/2014 02:37:19] data/actions/scripts/yourscriptname.lua:5: attempt to compare number with boolean
[27/12/2014 02:37:19] stack traceback:
[27/12/2014 02:37:19] data/actions/scripts/yourscriptname.lua:5: in function <data/actions/scripts/yourscriptname.lua:2>
 
changed it and found this error when i use scroll
[27/12/2014 02:37:18] [Error - Action Interface]
[27/12/2014 02:37:18] data/actions/scripts/yourscriptname.lua:eek:nUse
[27/12/2014 02:37:18] Description:
[27/12/2014 02:37:19] data/actions/scripts/yourscriptname.lua:5: attempt to compare number with boolean
[27/12/2014 02:37:19] stack traceback:
[27/12/2014 02:37:19] data/actions/scripts/yourscriptname.lua:5: in function <data/actions/scripts/yourscriptname.lua:2>

Code:
local newpos = {x=1000, y=1000, z=7}
function onUse(cid, item, frompos, item2, topos)
local inFight = hasCondition(cid, CONDITION_INFIGHT)
local delay = 76000 -- random storage
    if not inFight and getPlayerStorageValue(cid, delay) <= os.time() then
        doSendMagicEffect(getPlayerPosition(cid), 2)
        doTeleportThing(cid,newpos)
        doCreatureSay(cid, "TELEPORTED!!" , TALKTYPE_ORANGE_1)
        setPlayerStorageValue(cid, delay, os.time() + 60)
    elseif getPlayerStorageValue(cid, delay) >= os.time() then
    doPlayerSendCancel(cid, "You are exhausted. You can only use once per minute!")
    else
    doPlayerSendCancel(cid, "You can't use the teleport scroll if you are PZ LOCKED!!")
    end
return true
end
 
Code:
local newpos = {x=1000, y=1000, z=7}
function onUse(cid, item, frompos, item2, topos)
local inFight = hasCondition(cid, CONDITION_INFIGHT)
local delay = 76000 -- random storage
    if not inFight and getPlayerStorageValue(cid, delay) <= os.time() then
        doSendMagicEffect(getPlayerPosition(cid), 2)
        doTeleportThing(cid,newpos)
        doCreatureSay(cid, "TELEPORTED!!" , TALKTYPE_ORANGE_1)
        setPlayerStorageValue(cid, delay, os.time() + 60)
    elseif getPlayerStorageValue(cid, delay) >= os.time() then
    doPlayerSendCancel(cid, "You are exhausted. You can only use once per minute!")
    else
    doPlayerSendCancel(cid, "You can't use the teleport scroll if you are PZ LOCKED!!")
    end
return true
end
thx working
 
Code:
local newpos = {x=1000, y=1000, z=7}
function onUse(cid, item, frompos, item2, topos)
local inFight = hasCondition(cid, CONDITION_INFIGHT)
local delay = 76000 -- random storage
    if not inFight and getPlayerStorageValue(cid, delay) <= os.time() then
        doSendMagicEffect(getPlayerPosition(cid), 2)
        doTeleportThing(cid,newpos)
        doCreatureSay(cid, "TELEPORTED!!" , TALKTYPE_ORANGE_1)
        setPlayerStorageValue(cid, delay, os.time() + 60)
    elseif getPlayerStorageValue(cid, delay) >= os.time() then
    doPlayerSendCancel(cid, "You are exhausted. You can only use once per minute!")
    else
    doPlayerSendCancel(cid, "You can't use the teleport scroll if you are PZ LOCKED!!")
    end
return true
end
Any possibility to make it 50 charges?
 
Back
Top