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

Lua Temple scroll not working, why?

Santi

Theres no way im stopping
Joined
Aug 29, 2010
Messages
1,975
Reaction score
152
Location
00
I need some help to know whats wrong here. Im still learning LUA, thats why I got no idea of whats wrong.

Lua:
local temple = {x=160, y=50, x=7}
local level = 50

function Onuse(cid, frompos, item, topos, item2)
if getPlayerLevel >= level then
doTeleportThing(cid,temple,TRUE)
doSendMagicEffect(fromPosition,math.random(1,60))
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"Teleported")
doRemoveItem(uid,1)
elseif hasCondition(cid, CONDITION_INFIGHT) == TRUE then
doPlayerSendCancel(cid,"You mustnt be in a fight in order to travel!")
end
return true
end

I been trying to change it, so I have got different errors.
Code:
[10/11/2010 15:52:49] [Warning - Event::loadScript] Event onUse not found (data/actions/scripts/temple scroll.lua)
[10/11/2010 15:43:51] [Error - LuaScriptInterface::loadFile] data/actions/scripts/temple scroll.lua:5: 'end' expected (to close 'function' at line 4) near 'elseif'
[10/11/2010 15:43:51] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/temple scroll.lua)
[10/11/2010 15:43:51] data/actions/scripts/temple scroll.lua:5: 'end' expected (to close 'function' at line 4) near 'elseif'

Thanks in advanced, rep+ for thelp
 
Just tr to add a another "end" in the end.. :
(I guess)

PHP:
local temple = {x=160, y=50, x=7}
local level = 50
 
function Onuse(cid, frompos, item, topos, item2)
if getPlayerLevel >= level then
doTeleportThing(cid,temple,TRUE)
doSendMagicEffect(fromPosition,math.random(1,60))
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"Teleported")
doRemoveItem(uid,1)
elseif hasCondition(cid, CONDITION_INFIGHT) == TRUE then
doPlayerSendCancel(cid,"You mustnt be in a fight in order to travel!")
end
return true
end
end
 
Tried that, but now Im getting another error
Code:
[10/11/2010 16:01:05] [Error - LuaScriptInterface::loadFile] data/actions/scripts/temple scroll.lua:15: '<eof>' expected near 'end'
[10/11/2010 16:01:05] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/temple scroll.lua)
[10/11/2010 16:01:05] data/actions/scripts/temple scroll.lua:15: '<eof>' expected near 'end'

Thank you anyway!
 
Lua:
local temple = {x=160, y=50, x=7}
local level = 50
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if not hasCondition(cid, CONDITION_INFIGHT) then
		doPlayerSendCancel(cid, 'You must not be in a fight in order to travel!')
	elseif getPlayerLevel(cid) >= level then
		doTeleportThing(cid,temple)
		doSendMagicEffect(fromPosition, math.random(60))
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Teleported')
		doRemoveItem(item.uid)
	else
		doPlayerSendCancel(cid, 'You must be level ' .. level .. ' or higher in order to travel!')
	end
	return true
end
 
Last edited:
For some reason it isnt working.
It does say teleported and if I do not have the level or im in-fight condition it wont let me use it, nevertheless it wont teleport me to temple for some reason.
No errors in console. Using TFS 0.3.6
 
Anyways, here. Try this.

Lua:
function onUse(cid, item, frompos, item2, topos)
ppos = getPlayerPosition(cid)
temple = getPlayerMasterPos(cid)
if (getCreatureCondition(cid, CONDITION_INFIGHT) == FALSE) then
doTeleportThing(cid, temple, TRUE)
doSendMagicEffect(ppos,66)
doSendAnimatedText(frompos,'Teleport!',16)
else
doPlayerSendCancel(cid,"You can't teleport immediately after fight.")
doSendMagicEffect(ppos,2)
end
return 1
end
 
Back
Top