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
Hey otlanders, i had some free time today (again ) 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! eace:
debuuged while using but character moved to pos templeChange to
andLua:doCreatureSay(cid, "TELEPORTED!!", TALKTYPE_ORANGE_1)
Else people (can) get debugged.Lua:doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You can't use the teleport scroll if you are PZ LOCKED!!")
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 OoCode: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
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
changed it and found this error when i use scrollChange:
to:Code:local newpos = Position(1000,1000,7)
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.luanUse
[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>
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 workingCode: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?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
Create a support thread for itAny possibility to make it 50 charges?