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

[help] Anihi quest

subyth

New Member
Joined
May 1, 2009
Messages
56
Reaction score
4
Well. I'm using a Tfs 0.4 3777 8.60

I have a script annihilator here. It apparently works standard .. From the exhaust on the lever, warns missing players etc .. But it is not teleporting to the room of Demons = /

Note: There appears no error in the distro.
OBS²: I just saw here, it will summon the Demons and when I click on the lever again it checks the demons in the room and summons only I killed with GOD.
OBS³: He's also checking if you have player in the room (I used the GM as test), it leaves not pull the lever and warns that has player in the room ^^

In this case, I think it's working all the same problem is only q teleports the player does not Uu
He has to teleport and gain storage tempAid (3029).

Code:
local c = {
daily = "no", -- Permitir apenas 1 entrada por dia
withEffects = "yes", -- Permitir Efeitos
onlyOnce = "yes", -- Permitir apenas 1x a entrada de um player (se ele terminar a quest, não pode entrar)
anniStor = 3030, -- Se onlyOnce for "yes" isto salvará o storage. Pode ser o mesmo U.ID da alavanca.
level = 100, -- player level
tempAid = 3029, -- Isto salvará o storage na porta e piso. Tem que ser diferente da anniStor e alavanca.
mob = "Demon", -- monster name
customMobs = "no", -- Sim para mobs aleatorios
normalMap = "no", -- Não mecha aqui. Risco de BUG
test = "yes", -- Coloque Yes caso queira testar com apenas 1 player ^^
fightTime = 15, -- Em minutos. Quanto tempo os players podem ficar na sala dos demons
exhaustion = 10, -- Em segundos. Exaust da alavanca
exhaustionStor = 3028, -- Salva storage do exaust da alavanca
entry = {
{x=194, y=118, z=9}, -- 1 player, The first position just behind switch!
{x=193, y=118, z=9},
{x=192, y=118, z=9},
{x=191, y=118, z=9}
},
des = {
{x=228, y=120, z=9}, -- 1 player
{x=229, y=120, z=9},
{x=230, y=120, z=9},
{x=231, y=120, z=9}
},
mobPos = { -- you cann ignore this if you have 'normalMap = "yes"'
{x=228, y=118, z=9},
{x=230, y=118, z=9}, -- here position opposite 1
{x=229, y=122, z=9}, -- here position opposite 2
{x=231, y=122, z=9},
{x=227, y=120, z=9},
{x=226, y=120, z=9}
},
customMobName = { -- you cann ignore this if you have 'customMobs = "no"'
"Rat",
"Rat",
"Cave Rat", -- where position opposite 1
"Cave Rat", -- where position opposite 2
"Rat",
"Rat"
}
}

c.daily = getBooleanFromString(c.daily)
c.withEffects = getBooleanFromString(c.withEffects)
c.onlyOnce = getBooleanFromString(c.onlyOnce)
c.customMobs = getBooleanFromString(c.customMobs)
c.normalMap = getBooleanFromString(c.normalMap)
c.test = getBooleanFromString(c.test)
local anniEvent = 0

function onUse(cid, item, fromPosition, itemEx, toPosition)
if(item.itemid == 1946) then
if(not c.daily) or c.test then
doTransformItem(item.uid, 1945)
else
doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
end
return true
end
if(item.itemid ~= 1945) then return true end
if(exhaustion.check(cid, c.exhaustionStor)) then return true end
exhaustion.set(cid, c.exhaustionStor, c.exhaustion)

local fighter = {}
fighter = getSpectators(c.des[1], 3, 3)
if fighter ~= nil then
for _, pid in ipairs(fighter) do
if isPlayer(pid) then
if(c.withEffects) then
doCreatureSay(cid, "Halo! Halo!\nWe are still fighting here!", TALKTYPE_MONSTER, nil, cid, c.des[1])
end
return doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
end
end
for _, pid in ipairs(fighter) do
if isCreature(pid) then
doRemoveCreature(pid)
end
end
end

if(anniEvent ~= 0) then stopEvent(anniEvent) end
local players = {}
for _, position in ipairs(c.entry) do
local pid = getTopCreature(position).uid

if(pid == 0 or not isPlayer(pid) or getPlayerLevel(pid) < c.level) then
if(c.withEffects) then
doCreatureSay(cid, "Need a player with lvl "..c.level, TALKTYPE_MONSTER, nil)
doSendMagicEffect(position, CONST_ME_TUTORIALARROW)
end
return doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
elseif(c.onlyOnce and getCreatureStorage(pid, c.anniStor) > 0) then
if(c.withEffects) then
doCreatureSay(cid, "That fighter\ncan't do anni again.", TALKTYPE_MONSTER, nil)
doSendMagicEffect(position, CONST_ME_TUTORIALARROW)
end
return doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
end
table.insert(players, pid)
if c.test then break end
end

if normalMap then
local zmienne = {{'-3','-2'}, {'-1','-2'}, {'-2','2'}, {'0','2'}, {'1','0'}, {'2','0'}} -- horizontally
for i, pos in ipairs(zmienne) do
c.mobPos = c.des[1]
c.mobPos.x = c.mobPos.x + tonumber(pos[1])
c.mobPos.y = c.mobPos.y + tonumber(pos[2])
doCreateMonster(c.customMobs and c.customMobName or c.mob, c.mobPos)
end
else
for i, pos in ipairs(c.mobPos) do
doCreateMonster(c.customMobs and c.customMobName or c.mob, pos)
end
end

for i, pid in ipairs(players) do
doSendMagicEffect(c.entry, CONST_ME_POFF)
doTeleportThing(pid, c.des, false)
doSendMagicEffect(c.des, CONST_ME_ENERGYAREA)
doCreatureSetStorage(pid, c.tempAid, 1)
if c.test then break end
end
doTransformItem(item.uid, 1946)

anniEvent = addEvent(function()
for i, pid in ipairs(players) do
if getCreatureStorage(pid, c.tempAid) == 1 then
doCreatureSetStorage(pid, c.tempAid, -1)
doRemoveCondition(pid, CONDITION_INFIGHT)
local pos = getClosestFreeTile(cid, c.entry, false, false)
pos.y = pos.y +1
doTeleportThing(pid, pos, false)
doSendMagicEffect(getThingPosition(pid), CONST_ME_TELEPORT)
doCreatureSay(pid, "Time is up!", TALKTYPE_MONSTER)
end
end
doTransformItem(item.uid, 1945)
end, c.fightTime*60*1000)

return true
end

Sorry bad english!!
 
Code:
local stand_pos = { --Tiles the player stands on.
[1] = {x = 194, y = 118, z = 9},
[2] = {x = 193, y = 118, z = 9},
[3] = {x = 192, y = 118, z = 9},
[4] = {x = 191, y = 118, z = 9}
}

local teleport_pos = { --Where the players should be teleported.
[1] = {x = 228, y = 120, z = 9},
[2] = {x = 229, y = 120, z = 9},
[3] = {x = 230, y = 120, z = 9},
[4] = {x = 231, y = 120, z = 9},
[5] = {x = 232, y = 120, z = 9}, -- dont touch
[6] = {x = 233, y = 120, z = 9} -- dont touch
}

local position_monsters = { --Where the monsters spawn and the monster that spawns there.
[1] = {monster = "Demon", pos = {x = 228, y = 118, z = 9}},
[2] = {monster = "Demon", pos = {x = 230, y = 118, z = 9}},
[3] = {monster = "Demon", pos = {x = 226, y = 120, z = 9}},
[4] = {monster = "Demon", pos = {x = 227, y = 120, z = 9}},
[5] = {monster = "Demon", pos = {x = 229, y = 122, z = 9}},
[6] = {monster = "Demon", pos = {x = 231, y = 122, z = 9}}
}

local storage_quest = 3030 --Storage for anni quest
local storage_hold = 3031 --random storage

local fight_time = 15 --minutes
local level_req = 100

local msg_start = "Good Luck!"
local magic_effect_player = CONST_ME_WATERSPLASH
local magic_effect_monster = CONST_ME_FLAM

function onUse(cid, item, fromPosition, itemEx, toPosition)

    if item.itemid == 1945 then
        doTransformItem(item, 1946)
    else
        doTransformItem(item, 1945)
    end

    PLAYER1 = getThingFromPos(stand_pos[1]).uid
    PLAYER2 = getThingFromPos(stand_pos[2]).uid
    PLAYER3 = getThingFromPos(stand_pos[3]).uid
    PLAYER4 = getThingFromPos(stand_pos[4]).uid
   
    if getPlayerPosition(cid) ~= stand_pos[1] then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You cannot start the quest standing here.")
    return false
    end
   
    if getGlobalStorageValue(storage_hold) > 0 then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "A team is already in this quest.")
    return false
    end
   
    if not isPlayer(PLAYER1) or isPlayer(PLAYER2) or isPlayer(PLAYER3) or isPlayer(PLAYER4) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You do not have 4 players.")
    return false
    end
   
    if getPlayerLevel(PLAYER1) < level_req or getPlayerLevel(PLAYER2) < level_req or getPlayerLevel(PLAYER3) < level_req or getPlayerLevel(PLAYER4) < level_req then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "All players must be level 100 or higher.")
    return false
    end
   
    if getPlayerStorageValue(PLAYER1, storage_quest) > 0 or getPlayerStorageValue(PLAYER2, storage_quest) > 0 or getPlayerStorageValue(PLAYER3, storage_quest) > 0 or getPlayerStorageValue(PLAYER4, storage_quest) > 0 then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "One of the players has already completed this quest.")
    return false
    end
   
   
    for i = 1, #positions_monsters do
        doCreateMonster(position_monsters[i].monster, position_monsters[i].pos)
    end
   
    doTeleportThing(PLAYER1, teleport_pos[1])
    doTeleportThing(PLAYER2, teleport_pos[2])
    doTeleportThing(PLAYER3, teleport_pos[3])
    doTeleportThing(PLAYER4, teleport_pos[4])
    setGlobalStorageValue(storage_hold, 1)
   
    doPlayerSendTextMessage(PLAYER1, MESSAGE_STATUS_CONSOLE_BLUE, msg_start)
    doPlayerSendTextMessage(PLAYER2, MESSAGE_STATUS_CONSOLE_BLUE, msg_start)
    doPlayerSendTextMessage(PLAYER3, MESSAGE_STATUS_CONSOLE_BLUE, msg_start)
    doPlayerSendTextMessage(PLAYER4, MESSAGE_STATUS_CONSOLE_BLUE, msg_start)
   
    for i = 1, #teleport_pos do
        doSendMagicEffect(teleport_pos[i], magic_effect_player)
    end
   
    for i = 1, #position_monsters do
        doSendMagicEffect(position_monsters[i].pos, magic_effect_monster)
    end
   
    addEvent(stopQuest, fight_time * 60 * 1000)
return true
end


function stopQuest()
if getGlobalStorageValue(storage_hold) == 1 then
    for i = 1, #position_monsters do
        if isMonster(getThingFromPos(position_monsters[i]).uid) then
            doRemoveCreature(getThingFromPos(position_monsters[i]).uid)
        end
    end
   
    for i = 1, #teleport_pos do
        if isPlayer(getThingFromPos(teleport_pos[i]).uid) then
            doTeleportThing(getThingFromPos(teleport_pos[i]).uid, start_pos[2])
        end
    end
   
    setGlobalStorageValue(storage_hold, 0)
end
end

Edit* just make it so when the players complete the quest (click on chest/door) it changes the storage_hold to 0 again.
 
Last edited:
Back
Top