• 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 Teleport Scrolls

Ninkobi

Owner /Founder of Syphera
Joined
Apr 5, 2008
Messages
206
Reaction score
1
Location
England
I made a script for teleport scrolls with battle check and time delay of 20 minutes. Here it is:
Code:
local exhausttime = 20 * 60 * 1000
local exhaust = createConditionObject(CONDITION_EXHAUSTED)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, exhausttime)

function onUse(cid, item, frompos, item2, topos)
temple = getPlayerMasterPos(cid)
pos = getPlayerPosition(cid)
	if hasCondition(cid, CONDITION_EXHAUSTED) == TRUE then
		doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
		return TRUE
end
if getCreatureCondition(cid, CONDITION_INFIGHT) == FALSE then
	doSendMagicEffect(pos,2)
	doTeleportThing(cid,temple)
	doSendMagicEffect(temple,10)
	doAddCondition(cid, exhaust)
			doRemoveItem(item.uid)
else
	doPlayerSendCancel(cid,"You have PZ lock.")
end
return 1
end

Not tested. Please test it.
 
tested on TFS 0.3

PHP:
[05/08/2008  00:38:11] Lua Script Error: [Action Interface] 
[05/08/2008  00:38:11] data/actions/scripts/tscroll.lua

[05/08/2008  00:38:11] luaCreateConditionObject(). Condition not found

[05/08/2008  00:38:11] Lua Script Error: [Action Interface] 
[05/08/2008  00:38:11] data/actions/scripts/tscroll.lua

[05/08/2008  00:38:11] luaSetConditionParam(). Condition not found

[05/08/2008  00:38:30] Lua Script Error: [Action Interface] 
[05/08/2008  00:38:30] data/actions/scripts/tscroll.lua:onUse

[05/08/2008  00:38:30] data/actions/scripts/tscroll.lua:6: attempt to call global 'getPlayerMasterPos' (a nil value)
[05/08/2008  00:38:30] stack traceback:
[05/08/2008  00:38:30] 	data/actions/scripts/tscroll.lua:6: in function <data/actions/scripts/tscroll.lua:5>

After changing: getPlayerMasterPos -> getPlayerTown


PHP:
[05/08/2008  01:02:32] Lua Script Error: [Action Interface] 
[05/08/2008  01:02:32] data/actions/scripts/tscroll.lua

[05/08/2008  01:02:32] luaCreateConditionObject(). Condition not found

[05/08/2008  01:02:32] Lua Script Error: [Action Interface] 
[05/08/2008  01:02:32] data/actions/scripts/tscroll.lua

[05/08/2008  01:02:32] luaSetConditionParam(). Condition not found

[05/08/2008  01:02:34] Lua Script Error: [Action Interface] 
[05/08/2008  01:02:34] data/actions/scripts/tscroll.lua:onUse

[05/08/2008  01:02:34] data/actions/scripts/tscroll.lua:8: attempt to call global 'hasCondition' (a nil value)
[05/08/2008  01:02:34] stack traceback:
[05/08/2008  01:02:34] 	data/actions/scripts/tscroll.lua:8: in function <data/actions/scripts/tscroll.lua:5>

After changing: HasCondition -> getCreatureCondition

PHP:
[05/08/2008  01:05:43] Lua Script Error: [Action Interface] 
[05/08/2008  01:05:43] data/actions/scripts/tscroll.lua

[05/08/2008  01:05:43] luaCreateConditionObject(). Condition not found

[05/08/2008  01:05:43] Lua Script Error: [Action Interface] 
[05/08/2008  01:05:43] data/actions/scripts/tscroll.lua

[05/08/2008  01:05:43] luaSetConditionParam(). Condition not found

[05/08/2008  01:05:45] Lua Script Error: [Action Interface] 
[05/08/2008  01:05:45] data/actions/scripts/tscroll.lua:onUse

[05/08/2008  01:05:45] attempt to index a number value
[05/08/2008  01:05:45] stack traceback:
[05/08/2008  01:05:45] 	[C]: in function 'doTeleportThing'
[05/08/2008  01:05:45] 	data/actions/scripts/tscroll.lua:14: in function <data/actions/scripts/tscroll.lua:5>
 
Last edited:
make it work on TFS 0.3
and make it to check if player is on a battle, and it would be a nice script :)
Use:
local function isSkulled(cid)
 
Fast made but maybe this should work
PHP:
local exhausttime = 20 * 60 * 1000
local exhaust = createConditionObject(CONDITION_EXHAUSTED)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, exhausttime)

function onUse(cid, item, frompos, item2, topos)
temple = getPlayerTown(cid)
effect = math.random (1, 215)
pos = getPlayerPosition(cid)
	if getCreatureCondition(cid, CONDITION_EXHAUSTED) == TRUE then
		doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
		return TRUE
end
if getCreatureCondition(cid, CONDITION_INFIGHT) == FALSE then
	doSendMagicEffect(pos,2)
	doTeleportThing(cid, temple)
	doSendAnimatedText(temple,"Temple", effect)
	doSendMagicEffect(temple, 10)
	doAddCondition(cid, exhaust)
			doRemoveItem(item.uid)
else
	doPlayerSendCancel(cid,"You are in a fight!")
end
return 1
end
 
and if the player only will be teleported if he do a quest? (Ex. storagevalue 12345)

P.S.: Sorry for my english D:
 
if getPlayerStorageValue(cid, 12345) == 1 then
-- the code here
end
 
Fast made but maybe this should work
PHP:
local exhausttime = 20 * 60 * 1000
local exhaust = createConditionObject(CONDITION_EXHAUSTED)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, exhausttime)

function onUse(cid, item, frompos, item2, topos)
temple = getPlayerTown(cid)
effect = math.random (1, 215)
pos = getPlayerPosition(cid)
	if getCreatureCondition(cid, CONDITION_EXHAUSTED) == TRUE then
		doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
		return TRUE
end
if getCreatureCondition(cid, CONDITION_INFIGHT) == FALSE then
	doSendMagicEffect(pos,2)
	doTeleportThing(cid, temple)
	doSendAnimatedText(temple,"Temple", effect)
	doSendMagicEffect(temple, 10)
	doAddCondition(cid, exhaust)
			doRemoveItem(item.uid)
else
	doPlayerSendCancel(cid,"You are in a fight!")
end
return 1
end

Here's fixed one: (Tested on TFS 0.3 bta2)

PHP:
local exhausttime = 20 * 60 * 1000
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, exhausttime)

function onUse(cid, item, frompos, item2, topos)
temple = getPlayerTown(cid)
effect = math.random (1, 215)
pos = getPlayerPosition(cid)
    if getCreatureCondition(cid, CONDITION_EXHAUSTED) == TRUE then
        doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
        return TRUE
end
if getCreatureCondition(cid, CONDITION_INFIGHT) == FALSE then
    doSendMagicEffect(pos,2)
    doTeleportThing(cid, [B]{x = 504, y = 504, z = 7}[/B])
    doRemoveItem(cid, (item.uid), 1)
    doAddCondition(cid, exhaust)
            doRemoveItem(item.uid, 1)
else
    doPlayerSendCancel(cid,"You are in a fight!")
end
return 1
end


just change {x = 504, y = 504, z = 7}
to ur temples cords ;)
 
how to make it working with any players temple position?

every time i use functions with town temple pos i get these errors:

Code:
Lua Script Error: [Action Interface]
data/actions/scripts/other/scroll.lua:onUse

attempt to index a number value
stack traceback:
[C]: in function 'doTeleportThing'
data/actions/scripts/other/scroll.lua:15: in function <data/actions/scripts/other/scroll.lua:5>


im using new tfs
 
Back
Top