• 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 Annihilator Action Script Help

AustinD

New Member
Joined
Oct 25, 2015
Messages
16
Reaction score
1
Server: TFS 0.3.6

The script I am using for the annihilator quest is only teleporting the player that pulls the lever. I receive no errors in console. I have triple checked all x,y,z points and they are all correct. Everything else seems to be working fine. Any help is greatly appreciated! Thanks for your time.

https://imgur.com/a/RZjGJ - before and after pulling lever images.

Script: custom/customanni.lua
Code:
-- Annihilator by Shawak v2.1

-- CONFIG --

local room = { -- room with demons
fromX = 32088,
fromY = 32146,
fromZ = 14,
--------------
toX = 32093,
toY = 32151,
toZ = 14
}

local monster_pos = {
[1] = {pos = {32089, 32146, 14}, monster = "Demon"},
[2] = {pos = {32091, 32146, 14}, monster = "Demon"},
[3] = {pos = {32088, 32150, 14}, monster = "Demon"},
[4] = {pos = {32090, 32150, 14}, monster = "Demon"},
[5] = {pos = {32092, 32148, 14}, monster = "Demon"},
[6] = {pos = {32093, 32148, 14}, monster = "Demon"},
}

local players_pos = {
{x = 32089, y =32153, z = 10, stackpos = 253},
{x = 32090, y =32153, z = 10, stackpos = 253},
{x = 32091, y =32153, z = 10, stackpos = 253},
{x = 32092, y =32153, z = 10, stackpos = 253}
}

local new_player_pos = {
{x = 32088, y = 32148, z = 14},
{x = 32089, y = 32148, z = 14},
{x = 32090, y = 32148, z = 14},
{x = 32091, y = 32148, z = 14}
}

local playersOnly = "no"
local questLevel = 101

------------------------------------------------------
--- CONFIG END ---------------------------------------
------------------------------------------------------

function onUse(cid, item, fromPosition, itemEx, toPosition)
local all_ready, monsters, player, level = 0, 0, {}, 0
if item.itemid == 1945 then
for i = 1, #players_pos do
table.insert(player, 0)
end
for i = 1, #players_pos do
player = getThingfromPos(players_pos)
if player.itemid > 0 then
if string.lower(playersOnly) == "yes" then
if isPlayer(player.uid) == TRUE then
all_ready = all_ready+1
else
monsters = monsters+1
end
else
all_ready = all_ready+1
end
end
end
if all_ready == #players_pos then
for i = 1, #players_pos do
player = getThingfromPos(players_pos)
if isPlayer(player.uid) == TRUE then
if getPlayerLevel(player.uid) >= questLevel then
level = level+1
end
else
level = level+1
end
end
if level == #players_pos then
if string.lower(playersOnly) == "yes" and monsters == 0 or string.lower(playersOnly) == "no" then
for _, area in pairs(monster_pos) do
doSummonCreature(area.monster,{x=area.pos[1],y=area.pos[2],z=area.pos[3]})
end
for i = 1, #players_pos do
doSendMagicEffect(players_pos, CONST_ME_POFF)
doTeleportThing(player.uid, new_player_pos, FALSE)
doSendMagicEffect(new_player_pos, CONST_ME_ENERGYAREA)
doTransformItem(item.uid,1946)
end
else
doPlayerSendTextMessage(cid,19,"Only players can do this quest.")
end
else
doPlayerSendTextMessage(cid,19,"All Players have to be level "..questLevel.." to do this quest.")
end
else
doPlayerSendTextMessage(cid,19,"You need "..table.getn(players_pos).." players to do this quest.")
end
elseif item.itemid == 1946 then
local player_room = 0
for x = room.fromX, room.toX do
for y = room.fromY, room.toY do
for z = room.fromZ, room.toZ do
local pos = {x=x, y=y, z=z,stackpos = 253}
local thing = getThingfromPos(pos)
if thing.itemid > 0 then
if isPlayer(thing.uid) == TRUE then
player_room = player_room+1
end
end
end
end
end
if player_room >= 1 then
doPlayerSendTextMessage(cid,19,"There is already a team in the quest room.")
elseif player_room == 0 then
for x = room.fromX, room.toX do
for y = room.fromY, room.toY do
for z = room.fromZ, room.toZ do
local pos = {x=x, y=y, z=z,stackpos = 253}
local thing = getThingfromPos(pos)
if thing.itemid > 0 then
doRemoveCreature(thing.uid)
end
end
end
end
doTransformItem(item.uid,1945)
end
end
return TRUE
end


Actions.xml :
Code:
<action uniqueid="5000" event="script" value="custom/customanni.lua"/>
 
Last edited by a moderator:
You can try using another Annihilator script, this one works perfectly, you only need to configure the positions, etc.

Code:
function onUse(cid, item, frompos, item2, topos)

if item.uid == 7100 and item.itemid == 1945 then
player1pos = {x=214, y=146, z=8, stackpos=253}
player1 = getThingfromPos(player1pos)

player2pos = {x=214, y=147, z=8, stackpos=253}
player2 = getThingfromPos(player2pos)

player3pos = {x=214, y=148, z=8, stackpos=253}
player3 = getThingfromPos(player3pos)

player4pos = {x=214, y=149, z=8, stackpos=253}
player4 = getThingfromPos(player4pos)


if player1.itemid > 0 and player2.itemid > 0 and player3.itemid > 0 and player4.itemid > 0 then
queststatus1 = getPlayerStorageValue(player1.uid,7100)
queststatus2 = getPlayerStorageValue(player2.uid,7100)
queststatus3 = getPlayerStorageValue(player3.uid,7100)
queststatus4 = getPlayerStorageValue(player4.uid,7100)

if queststatus1 == -1 and queststatus2 == -1 and queststatus3 == -1 and queststatus4 == -1 then
nplayer1pos = {x=211, y=148, z=10}
nplayer2pos = {x=212, y=148, z=10}
nplayer3pos = {x=213, y=148, z=10}
nplayer4pos = {x=214, y=148, z=10}

doSendMagicEffect(player1pos,2)
doSendMagicEffect(player2pos,2)
doSendMagicEffect(player3pos,2)
doSendMagicEffect(player4pos,2)

doTeleportThing(player1.uid,nplayer1pos)
doTeleportThing(player2.uid,nplayer2pos)
doTeleportThing(player3.uid,nplayer3pos)
doTeleportThing(player4.uid,nplayer4pos)

doSendMagicEffect(nplayer1pos,10)
doSendMagicEffect(nplayer2pos,10)
doSendMagicEffect(nplayer3pos,10)
doSendMagicEffect(nplayer4pos,10)

doTransformItem(item.uid,item.itemid+1)
else
doPlayerSendCancel(cid,"Somebody in your team has already done this quest.")
end
else
doPlayerSendCancel(cid,"You need four players for this quest.")
end

elseif item.uid ==7100 and item.itemid == 1946 then
if getPlayerAccess(cid) > 0 then
doTransformItem(item.uid,item.itemid-1)
else
doPlayerSendCancel(cid,"Sorry, not possible.")
end
else
return 0
end

return 1
end
/code]
 
Back
Top