I want to do rox quest
it is solo quest , its mean that one player stay on sqm push and it tp him to the room where ushuriel appears. When he is atking ushuriel no one can enter to this room.
I already use this script
but in engine i have some errors :/
and it doesnt work :/
I already use this script
local pstr_anipos = 52000
local ppos = {}
local player = {}
local monster = {}
local error_txt = ""
local anni_frompos = {}
local anni_topos = {}
local monster_pos = {}
local monster_name = {}
local anni_time = {}
local block_quest = {}
local block_level = {}
local quest_r_uid = {}
local kick_on_enter = {}
anni_frompos[1] = {52003}
anni_topos[1] = {52004}
monster_pos[1] = {52005}
monster_name[1] = {'ushuriel'}
anni_time[1] = 5
block_quest[1] = 1
block_level[1] = 90
quest_r_uid[1] = 1100
kick_on_enter[1] = TRUE
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.itemid == 1945 or item.itemid == 1946 then
local quest_id = item.uid - 52000
local anni_frompos = anni_frompos[quest_id]
local anni_topos = anni_topos[quest_id]
local monster_pos = monster_pos[quest_id]
local monster_name = monster_name[quest_id]
local anni_time = anni_time[quest_id]
local block_quest = block_quest[quest_id]
local block_level = block_level[quest_id]
local quest_r_uid = quest_r_uid[quest_id]
local kick_on_enter = kick_on_enter[quest_id]
local do_quest = TRUE
if getGlobalStorageValue(item.uid) < os.time() then
if kick_on_enter == TRUE then
for i=1,#anni_frompos do -- teleportuje graczy ktorzy sa w pokoju
player = getGlobalStorageValue(anni_frompos)
if isPlayer(player) == TRUE then
if getPlayerStorageValue(player, pstr_anipos) == anni_frompos then
doTeleportThing(player, fromPosition, TRUE)
setPlayerStorageValue(player, pstr_anipos, 0)
end
end
end
end
else
error_txt = "Already other team is in this annihilator. Teleport is blocked. Wait until " .. os.date("%H:%M:%S", getGlobalStorageValue(item.uid)) .. "."
do_quest = FALSE
end
if do_quest == FALSE then
local leftanni = 0
for i=1,#anni_frompos do
if getGlobalStorageValue(anni_frompos) <= 0 or (isPlayer(getGlobalStorageValue(anni_frompos)) == FALSE or (isPlayer(getGlobalStorageValue(anni_frompos)) == TRUE and getPlayerStorageValue(getGlobalStorageValue(anni_frompos), pstr_anipos) == 0)) then
leftanni = leftanni + 1
end
end
if leftanni == #anni_frompos then
do_quest = TRUE
end
end
if do_quest == TRUE then
for i=1,#monster_pos do -- usun potwory
monster = getGlobalStorageValue(monster_pos)
if isCreature(monster) == TRUE then
doRemoveCreature(monster)
end
end
for i=1,#anni_frompos do -- sprawdza czy gracze moga wejsc do pokoju
ppos = getThingPos(anni_frompos)
player = getThingFromPos({x=ppos.x, y=ppos.y, z=ppos.z, stackpos=STACKPOS_TOP_CREATURE})
if isPlayer(player.uid) == TRUE then
if getPlayerLevel(player.uid) >= block_level then
if not(block_quest == 0 or (block_quest == 1 and getPlayerStorageValue(player.uid, quest_r_uid) ~= 1)) then
error_txt = "Player " .. getCreatureName(player.uid) .. " did this annihilator. (S)He can\'t go with you."
do_quest = FALSE
break
end
else
error_txt = "Player " .. getCreatureName(player.uid) .. " has " .. getPlayerLevel(player.uid) .. " level. This annihilator require " .. block_level .. " level."
do_quest = FALSE
break
end
else
error_txt = "Players must stand at all teleport positions. Position " .. i .. " is empty."
do_quest = FALSE
break
end
end
end
if do_quest == TRUE then
if item.itemid == 1945 then
doTransformItem(item.uid, 1946)
else
doTransformItem(item.uid, 1945)
end
for i=1,#monster_pos do -- summonuje potwory i zapisuje ich uid w storage
setGlobalStorageValue(monster_pos, doSummonCreature(monster_name, getThingPos(monster_pos)))
end
for i=1,#anni_frompos do -- teleportuje graczy do pokoju
ppos = getThingPos(anni_frompos)
player = getThingFromPos({x=ppos.x, y=ppos.y, z=ppos.z, stackpos=STACKPOS_TOP_CREATURE})
if isPlayer(player.uid) == TRUE then
doTeleportThing(player.uid, getThingPos(anni_topos), TRUE)
setPlayerStorageValue(player.uid, pstr_anipos, anni_frompos)
setGlobalStorageValue(anni_frompos, player.uid)
end
end
setGlobalStorageValue(item.uid, os.time()+anni_time*60)
doPlayerSendTextMessage(cid, 24, "You got " .. anni_time .. " minutes.")
else
doPlayerSendTextMessage(cid, 24, error_txt)
end
end
return TRUE
end
but in engine i have some errors :/
[06/05/2010 19:33:46] [Error - Action Interface]
[06/05/2010 19:33:46] data/actions/scripts/xbass/questone.luanUse
[06/05/2010 19:33:46] Description:
[06/05/2010 19:33:46] data/actions/scripts/xbass/questone.lua:68: attempt to get length of local 'monster_pos' (a nil value)
[06/05/2010 19:33:46] stack traceback:
[06/05/2010 19:33:46] data/actions/scripts/xbass/questone.lua:68: in function <data/actions/scripts/xbass/questone.lua:27>
and it doesnt work :/