Hermes
dziwki kola gramy w lola
Hello AGAIN ,
I have fixed (ty 4 Marcinek Palladinek) already like 4 errors in annihilator script, but there are, perhaps, two last. When I'm using a chest error appears:
The second problem is that anyone can push the lever many times as he want. Ex. some team is doing anhi, and when they kill demon, someone push the lever up and demon appear again. I'd like the script that you can do annihilator one time for a hour (timer in a lever) with message on cancel "The quest could be done only one time for a hour." except gamemaster, who can change the position on the lever and can allow team to start before times reacher another hour.
This /\ thing makes an error just when server can't summon more demons than one on one tile ; p
@edit
Sorry, i was late on tenis lesson so I forgot to paste my anhi script!
Here it is!
Thanks all for help with previous errors ;> HAIL OTLAND!,
Hermes
I have fixed (ty 4 Marcinek Palladinek) already like 4 errors in annihilator script, but there are, perhaps, two last. When I'm using a chest error appears:
Code:
[20/10/2008 18:03:46] Lua Script Error: [Action Interface]
[20/10/2008 18:03:46] data/actions/scripts/quests/annihilator.lua:onUse
[20/10/2008 18:03:46] data/actions/scripts/quests/annihilator.lua:93: attempt to index local 'item' (a number value)
[20/10/2008 18:03:46] stack traceback:
[20/10/2008 18:03:46] data/actions/scripts/quests/annihilator.lua:93: in function <data/actions/scripts/quests/annihilator.lua:83>
[20/10/2008 18:03:46] (tail call): ?
The second problem is that anyone can push the lever many times as he want. Ex. some team is doing anhi, and when they kill demon, someone push the lever up and demon appear again. I'd like the script that you can do annihilator one time for a hour (timer in a lever) with message on cancel "The quest could be done only one time for a hour." except gamemaster, who can change the position on the lever and can allow team to start before times reacher another hour.
This /\ thing makes an error just when server can't summon more demons than one on one tile ; p
@edit
Sorry, i was late on tenis lesson so I forgot to paste my anhi script!
Here it is!
Code:
local starting= {x = 1070, y = 1171, z = 7} -- edit this to the top left sqm of ur annhilator room
local ending= {x = 1073, y = 1175, z = 7} -- edit this to the bottom right sqm of ur annhilator room
local playerPos = { -- oldPositions; positions of players before they get teleported.
{x = 1070, y = 1173, z = 6},
{x = 1071, y = 1173, z = 6},
{x = 1072, y = 1173, z = 6},
{x = 1073, y = 1173, z = 6}
}
local newPlayerPos = { -- Positions for where players should be teleported, make sure it's in the same order as oldPositions
{x = 1070, y = 1173, z = 7},
{x = 1071, y = 1173, z = 7},
{x = 1072, y = 1173, z = 7},
{x = 1073, y = 1173, z = 7}
}
local creaturePos = { -- Name and position of monsters to summon.
{"Demon", {x = 1070, y = 1171, z = 7}},
{"Demon", {x = 1072, y = 1171, z = 7}},
{"Demon", {x = 1074, y = 1173, z = 7}},
{"Demon", {x = 1075, y = 1173, z = 7}},
{"Demon", {x = 1071, y = 1175, z = 7}},
{"Demon", {x = 1073, y = 1175, z = 7}}
}
if(#playerPos ~= #newPlayerPos) then
error("Annhilator has not been properly configured.")
end
--- Preferably, do not edit anything below this line unless you know exactly what you are doing.
local player = {}
function onUse(cid, item, frompos, item2, topos)
if(item.uid == 5000) then --- change to different item.uid according to ur mapeditor
if(item.itemid == 1945) then
for i, pos in ipairs(playerPos) do -- add player id's to table
player[i] = getTopCreature(pos)
end
local ret, players = checkPlayers(cid)
if(ret) then
local ret, player = checkLevel(100)
if(ret) then
local ret, player = checkStorage(100)
if(ret) then
summonCreatures(creaturePos)
teleportPlayers(2, 10) -- 2 stands for the effect on old pos, 10 for the effect on new pos.
doTransformItem(item.uid, 1946)
else
sendPlayersText(players, getPlayerName(player) .. " has already done this quest.")
end
else
sendPlayersText(players, getPlayerName(player) .. " is too low.")
end
else
sendPlayersText(players, "You need " .. #playerPos .. " players to do this quest.")
end
elseif(item.itemid == 1946) then -- preferably, to be the id of the lever added by mapeditor.
if(cleanArea()) then
doTransformItem(item.uid, 1945)
else
return FALSE
end
end
return TRUE
--- Chests.
elseif(item.uid == 5001) then -- demon armor
return questChestPrize(cid, 2494, 1)
elseif(item.uid == 5002) then -- magic sword
return questChestPrize(cid, 2400, 1)
elseif(item.uid == 5003) then -- stonecutter's axe
return questChestPrize(cid, 2431, 1)
elseif(item.uid == 5004) then -- present box
return questChestPrize(cid, 1990, 1)
end
end
function sendPlayersText(players, text)
for _, player in ipairs(players) do
doPlayerSendCancel(player, text)
end
end
function questChestPrize(cid, itemid, storage)
if(getPlayerStorageValue(cid, storage) < TRUE) then
if itemid == 1990 then
container = doPlayerAddItem(cid, itemid, 1)
doAddContainerItem(container, 2326, 1)
else
doPlayerAddItem(cid, itemid, 1)
end
setPlayerStorageValue(cid, storage, TRUE)
local item = getItemDescriptions(itemid)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found a " .. item.name .. "")
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.")
end
return TRUE
end
function checkLevel(minLevel)
for _, player in ipairs(player) do
if(getPlayerLevel(player) < minLevel) then
return false, player
end
end
return true
end
function checkStorage(storageValue)
for _, player in ipairs(player) do
if(getPlayerStorageValue(player, storageValue) ~= TRUE) then
return false, player
end
end
return true
end
function cleanArea()
local checking= {x = starting.x, y = starting.y, z = starting.z, stackpos = 253}
local monster = {}
while(checking.y <= ending.y) do
local creature = getTopCreature(checking)
if(isCreature(creature) == TRUE) then
if(isPlayer(creature) == TRUE) then
return false
else
table.insert(monster, creature)
end
end
if(checking.x == ending.x) then
checking.x = starting.x
checking.y = checking.y + 1
end
checking.x = checking.x + 1
end
for i, c in ipairs(monster) do
doRemoveCreature(c)
end
return true
end
function summonCreatures(parameters)
for _, monster in ipairs(parameters) do
doSummonCreature(monster[1], monster[2])
end
end
function teleportPlayers(effect1, effect2)
for currentPlayer = 1, table.getn(player) do
doTeleportThing(player[currentPlayer], newPlayerPos[currentPlayer])
doSendMagicEffect(playerPos[currentPlayer], effect1) -- send animation after teleport, players teleported won't see it anyways
doSendMagicEffect(newPlayerPos[currentPlayer], effect2)
end
end
function checkPlayers(cid)
local ret = {}
table.insert(ret, cid)
for _, curPlayer in ipairs(player) do
if(isPlayer(curPlayer) == TRUE) then
if(curPlayer ~= cid) then
table.insert(ret, curPlayer)
end
else
return false, ret
end
end
return true, ret
end
Thanks all for help with previous errors ;> HAIL OTLAND!,
Hermes
Last edited: