Light Relief
New Member
- Joined
- May 5, 2024
- Messages
- 2
- Reaction score
- 2
Hi guys,
Sorry if there is already an answer posted somewhere for this but I'm struggling.
I was following this thread regarding vocation doors:
The OP came across an error similar to the one I'm having below:
Lua Script Error: [Action Interface]
data/actions/scripts/other/berserkerdoor.lua
nUse
data/actions/scripts/other/berserkerdoor.lua:24: attempt to index global 'player' (a nil value)
stack traceback:
[C]: in function '__index'
data/actions/scripts/other/berserkerdoor.lua:24: in function <data/actions/scripts/other/berserkerdoor.lua:3>
In the thread, they changed 1 line of code and then reported it was working for them.
I changed that line of code and still get the exact same error.
I have 1 door for each of the 7 vocations I've made(and no voc able to open all doors). Apart from actually being able to open the door that matches your vocation, it seems to be working fine.
Am I missing something obvious? Here is the one I'm using for berserker(0 = no voc, 9 = berserker):
Thank you in advance!
Sorry if there is already an answer posted somewhere for this but I'm struggling.
I was following this thread regarding vocation doors:
Hello guys, i have 2 vocations doors, one for knights and paladins, and the other for sorcerer and druid (and ofc the promotion versions)
this one of them:
this one of them:
Code:
-- Sorcerer Vocation Door by Vagox edited by Streamside (iam not scripter) --
function onUse(cid, item, frompos, item2, topos)
pvoc = getPlayerVocation(cid)
if item.aid == 5001 then
if pvoc == 3 or pvoc == 4 or pvoc == 7 or pvoc == 8 then
doPlayerSendTextMessage(cid, 22, "You can pass, you are a paladin or knight.")
pos = getPlayerPosition(cid)
if pos.x == topos.x then
if pos.y < topos.y then
pos.y = topos.y + 1
else
pos.y = topos.y...
The OP came across an error similar to the one I'm having below:
Lua Script Error: [Action Interface]
data/actions/scripts/other/berserkerdoor.lua

data/actions/scripts/other/berserkerdoor.lua:24: attempt to index global 'player' (a nil value)
stack traceback:
[C]: in function '__index'
data/actions/scripts/other/berserkerdoor.lua:24: in function <data/actions/scripts/other/berserkerdoor.lua:3>
In the thread, they changed 1 line of code and then reported it was working for them.
I changed that line of code and still get the exact same error.
I have 1 door for each of the 7 vocations I've made(and no voc able to open all doors). Apart from actually being able to open the door that matches your vocation, it seems to be working fine.
Am I missing something obvious? Here is the one I'm using for berserker(0 = no voc, 9 = berserker):
LUA:
local vocations = {0, 9}
local dir = 1 --1 = north/south door....2 = east/west door
function onUse(cid, item, fromPos, item2, toPos)
if not isInArray(vocations, getPlayerVocation(cid)) then
return doPlayerSendTextMessage(cid, 22, "You must be a berserker to pass here.")
end
local pPos = getPlayerPosition(cid)
if dir == 1 then
if pPos.y < toPos.y then
pos = {x = toPos.x, y = toPos.y + 1, z = toPos.z}
elseif pPos.y > toPos.y then
pos = {x = toPos.x, y = toPos.y - 1, z = toPos.z}
end
else
if pPos.x < toPos.x then
pos = {x = toPos.x + 1, y = toPos.y, z = toPos.z}
elseif pPos.x > toPos.x then
pos = {x = toPos.x - 1, y = toPos.y, z = toPos.z}
end
end
if pos then
player:teleportTo(pos)
doSendMagicEffect(toPos, 12)
end
return true
end
Thank you in advance!