• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Add some thing ;)

Mera Mero

Guess Who?
Joined
Dec 27, 2014
Messages
417
Reaction score
86
Hello otlanders i've got script and i need to add somethings one it ,This script will take you from one place to the condition that you have special things and this script works well, What I want is if the player put these things by mistake, I mean in the wrong location instead of the real place these things will disappear and be created monsters on X / Y / Z and If these things are put in correct places Tp will appear in place X and take you to the place Y for some seconds Z
i hope you help me !!here you are the script
@Flatlander
@Limos
Code:
local config = {
{pos = {x = 979, y = 975, z = 7}, itemid = 3251},
{pos = {x = 971, y = 975, z = 7}, itemid = 3252},
{pos = {x = 970, y = 981, z = 7}, itemid = 3253},
{pos = {x = 979, y = 981, z = 7}, itemid = 3254}
}

function onStepIn(cid, item, position, fromPosition)
local amount = 0
for x = 1, #config do
if getTileItemById(config[x].pos, config[x].itemid).uid > 0 then
amount = amount + 1
    else
        doPlayerSendCancel(cid, "You need to add items at first to make teleport to hidden place")
    end
end
if amount == #config then
for x = 1, #config do
doRemoveItem(getTileItemById(config[x].pos, config[x].itemid).uid, 1)
end
doTeleportThing(cid, {x = 975, y = 978, z = 6}) -- where it should go
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You found a hidden area.")
end
return true
end
Certainly i do not want to forget any of legends names, but that's all I know till now:p
 
Last edited:
Instead of doTeleportThing, create a teleport with doCreateTeleport and remove it with addEvent after some time, like with the "kill monster create teleport" scripts.
For the monster summon, write else for the if statement with "amount == #config" (so under the textmessage) and the function to summon the monster.
You forgot to post your server version btw.
 
Instead of doTeleportThing, create a teleport with doCreateTeleport and remove it with addEvent after some time, like with the "kill monster create teleport" scripts.
For the monster summon, write else for the if statement with "amount == #config" (so under the textmessage) and the function to summon the monster.
You forgot to post your server version btw.
its 0.3.6
 
Instead of doTeleportThing, create a teleport with doCreateTeleport and remove it with addEvent after some time, like with the "kill monster create teleport" scripts.
For the monster summon, write else for the if statement with "amount == #config" (so under the textmessage) and the function to summon the monster.
You forgot to post your server version btw.
@Limos
That's all i done till now but got error ,may you check it?
Code:
local config = {
{pos = {x = 979, y = 975, z = 7}, itemid = 2001},
{pos = {x = 971, y = 975, z = 7}, itemid = 2002},
{pos = {x = 970, y = 981, z = 7}, itemid = 2003},
{pos = {x = 979, y = 981, z = 7}, itemid = 2004}
}

function onStepIn(cid, item, position, fromPosition)
local amount = 0
for x = 1, #config do
if getTileItemById(config[x].pos, config[x].itemid).uid > 0 then
amount = amount + 1
    else
        doPlayerSendCancel(cid, "You need to add items at first to make teleport to hidden place")
    end
end
elseif amount == #config then
doCreateMonster(Monk, pos)
for x = 1, #config do
doRemoveItem(getTileItemById(config[x].pos, config[x].itemid).uid, 1)
end
doCreateTeleport(cid, {x = 975, y = 978, z = 6}),time = 60 )
addEvent(deleteTeleport, monster.time * 1000, monster.tpPos)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You found a hidden area.")
end
return true
end
Code:
[08/02/2015 18:42:53] [Error - LuaScriptInterface::loadFile] data/movements/scripts/justesting.lua:17: 'end' expected (to close 'function' at line 8) near 'elseif'
[08/02/2015 18:42:53] [Warning - Event::loadScript] Cannot load script (data/movements/scripts/justesting.lua)
[08/02/2015 18:42:54] data/movements/scripts/justesting.lua:17: 'end' expected (to close 'function' at line 8) near 'elseif'
 
With tabbing, you can find the error with ease:

Code:
local config = {
    {pos = {x = 979, y = 975, z = 7}, itemid = 2001},
    {pos = {x = 971, y = 975, z = 7}, itemid = 2002},
    {pos = {x = 970, y = 981, z = 7}, itemid = 2003},
    {pos = {x = 979, y = 981, z = 7}, itemid = 2004}
    }

function onStepIn(cid, item, position, fromPosition)
    local amount = 0
    for x = 1, #config do
        if getTileItemById(config[x].pos, config[x].itemid).uid > 0 then
            amount = amount + 1
        else
            doPlayerSendCancel(cid, "You need to add items at first to make teleport to hidden place")
        end
    end
    elseif amount == #config then
        doCreateMonster(Monk, pos)
        for x = 1, #config do
            doRemoveItem(getTileItemById(config[x].pos, config[x].itemid).uid, 1)
        end
        doCreateTeleport(cid, {x = 975, y = 978, z = 6}),time = 60 )
        addEvent(deleteTeleport, monster.time * 1000, monster.tpPos)
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You found a hidden area.")
    end
    return true
end

Note that there's an elseif that isn't following an if.
Do you think this:
Code:
    elseif amount == #config then
Should become this?
Code:
    if amount == #config then
 
Instead of doTeleportThing, create a teleport with doCreateTeleport and remove it with addEvent after some time, like with the "kill monster create teleport" scripts.
For the monster summon, write else for the if statement with "amount == #config" (so under the textmessage) and the function to summon the monster.
You forgot to post your server version btw.
With tabbing, you can find the error with ease:

Code:
local config = {
    {pos = {x = 979, y = 975, z = 7}, itemid = 2001},
    {pos = {x = 971, y = 975, z = 7}, itemid = 2002},
    {pos = {x = 970, y = 981, z = 7}, itemid = 2003},
    {pos = {x = 979, y = 981, z = 7}, itemid = 2004}
    }

function onStepIn(cid, item, position, fromPosition)
    local amount = 0
    for x = 1, #config do
        if getTileItemById(config[x].pos, config[x].itemid).uid > 0 then
            amount = amount + 1
        else
            doPlayerSendCancel(cid, "You need to add items at first to make teleport to hidden place")
        end
    end
    elseif amount == #config then
        doCreateMonster(Monk, pos)
        for x = 1, #config do
            doRemoveItem(getTileItemById(config[x].pos, config[x].itemid).uid, 1)
        end
        doCreateTeleport(cid, {x = 975, y = 978, z = 6}),time = 60 )
        addEvent(deleteTeleport, monster.time * 1000, monster.tpPos)
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You found a hidden area.")
    end
    return true
end

Note that there's an elseif that isn't following an if.
Do you think this:
Code:
    elseif amount == #config then
Should become this?
Code:
    if amount == #config then
i made like Limos said
 
Write else for that if statement, not change the if statement to elseif, write else under the textmessage and then the createmonster function under that, so you have if... else... end.
 
Write else for that if statement, not change the if statement to elseif, write else under the textmessage and then the createmonster function under that, so you have if... else... end.
ah sorry misunderstanding ,this is new script with new error and check it please if there is something wrong before with docreatemonster(Monk,pos) i mean does i need to add something more on it?
Code:
local config = {
{pos = {x = 979, y = 975, z = 7}, itemid = 2001},
{pos = {x = 971, y = 975, z = 7}, itemid = 2002},
{pos = {x = 970, y = 981, z = 7}, itemid = 2003},
{pos = {x = 979, y = 981, z = 7}, itemid = 2004}
}

function onStepIn(cid, item, position, fromPosition)
local amount = 0
for x = 1, #config do
if getTileItemById(config[x].pos, config[x].itemid).uid > 0 then
amount = amount + 1
        doPlayerSendCancel(cid, "You need to add items at first to make teleport to hidden place")
        else
        doCreateMonster(Monk, pos)
if amount == #config then
for x = 1, #config do
doRemoveItem(getTileItemById(config[x].pos, config[x].itemid).uid, 1)
doCreateTeleport(cid, {x = 975, y = 978, z = 6} ,time = 60 )
addEvent(deleteTeleport, monster.time * 1000, monster.tpPos)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You found a hidden area.")
end
return true
end
Code:
[08/02/2015 19:33:23] [Error - LuaScriptInterface::loadFile] data/movements/scripts/justesting.lua:19: ')' expected near '='
[08/02/2015 19:33:23] [Warning - Event::loadScript] Cannot load script (data/movements/scripts/justesting.lua)
[08/02/2015 19:33:23] data/movements/scripts/justesting.lua:19: ')' expected near '='
i know the problem with = but i don't know what is the problem with it its same thing with all scripts that i have with time
 
Code:
if amount == #config then
     -- for loop that removes the items
     -- create the teleport
else
     -- summon the monster
end
so what is the problem now?!
Code:
local config = {
{pos = {x = 979, y = 975, z = 7}, itemid = 2001},
{pos = {x = 971, y = 975, z = 7}, itemid = 2002},
{pos = {x = 970, y = 981, z = 7}, itemid = 2003},
{pos = {x = 979, y = 981, z = 7}, itemid = 2004}
}

function onStepIn(cid, item, position, fromPosition)
local amount = 0
for x = 1, #config do
if getTileItemById(config[x].pos, config[x].itemid).uid > 0 then
amount = amount + 1
        doPlayerSendCancel(cid, "You need to add items at first to make teleport to hidden place")
        else
        doCreateMonster(Monk, pos)
if amount == #config then
doRemoveItem(getTileItemById(config[x].pos, config[x].itemid).uid, 1)
doCreateTeleport(cid, {x = 975, y = 978, z = 6})
else
doCreateMonster(Monk, pos)
for x = 1, #config do
addEvent(deleteTeleport, monster.time * 1000, monster.tpPos)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You found a hidden area.")
end
return true
end
Code:
[08/02/2015 19:55:16] [Error - LuaScriptInterface::loadFile] data/movements/scripts/justesting.lua:26: 'end' expected (to close 'if' at line 11) near '<eof>'
[08/02/2015 19:55:16] [Warning - Event::loadScript] Cannot load script (data/movements/scripts/justesting.lua)
[08/02/2015 19:55:16] data/movements/scripts/justesting.lua:26: 'end' expected (to close 'if' at line 11) near '<eof>'
 
Code:
function onStepIn(cid, item, position, fromPosition)
     local amount = 0
     for x = 1, #config do
         if getTileItemById(config[x].pos, config[x].itemid).uid > 0 then
             amount = amount + 1
         else
             doPlayerSendCancel(cid, "You need to add items at first to make teleport to hidden place")
         end
     end
     if amount == #config then -- if all items are found then
         for x = 1, #config do
             doRemoveItem(getTileItemById(config[x].pos, config[x].itemid).uid, 1)
         end
         -- create the teleport
         -- addevent to delete the teleport
         doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You found a hidden area.")
     else -- if not all items are found
         -- summon the monster
     end
     return true
end
 
Code:
function onStepIn(cid, item, position, fromPosition)
     local amount = 0
     for x = 1, #config do
         if getTileItemById(config[x].pos, config[x].itemid).uid > 0 then
             amount = amount + 1
         else
             doPlayerSendCancel(cid, "You need to add items at first to make teleport to hidden place")
         end
     end
     if amount == #config then -- if all items are found then
         for x = 1, #config do
             doRemoveItem(getTileItemById(config[x].pos, config[x].itemid).uid, 1)
         end
         -- create the teleport
         -- addevent to delete the teleport
         doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You found a hidden area.")
     else -- if not all items are found
         -- summon the monster
     end
     return true
end
this script loaded without errors but when i stepin i found this error when i replaced all items and without it the system what i need is to check if there are items on these POS docreatetp with time and if these items are correct and if is not docreatemonsters but this system must check if there are items ON cuz this script they may use it to summon monsters without puting items
Code:
[08/02/2015 20:38:29] [Error - MoveEvents Interface]
[08/02/2015 20:38:29] data/movements/scripts/justesting.lua:onStepIn
[08/02/2015 20:38:29] Description:
[08/02/2015 20:38:29] attempt to index a nil value
[08/02/2015 20:38:29] stack traceback:
[08/02/2015 20:38:29]     [C]: in function 'doCreateMonster'
[08/02/2015 20:38:29]     data/movements/scripts/justesting.lua:25: in function <data/movements/scripts/justesting.lua:8>
sorry for my bad english but i hope you understand did i say
EDITED
Code:
local config = {
{pos = {x = 979, y = 975, z = 7}, itemid = 2001},
{pos = {x = 971, y = 975, z = 7}, itemid = 2002},
{pos = {x = 970, y = 981, z = 7}, itemid = 2003},
{pos = {x = 979, y = 981, z = 7}, itemid = 2004}
}

function onStepIn(cid, item, position, fromPosition)
     local amount = 0
     for x = 1, #config do
         if getTileItemById(config[x].pos, config[x].itemid).uid > 0 then
             amount = amount + 1
         else
             doPlayerSendCancel(cid, "You need to add items at first to make teleport to hidden place")
         end
     end
     if amount == #config then -- if all items are found then
         for x = 1, #config do
             doRemoveItem(getTileItemById(config[x].pos, config[x].itemid).uid, 1)
         end
         doCreateTeleport(cid, {x = 975, y = 978, z = 6})
         addEvent(deleteTeleport, monster.time * 1000, monster.tpPos)
         doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You found a hidden area.")
     else -- if not all items are found
         doCreateMonster(Monk, pos)
     end
     return true
end
 
Last edited:
Code:
doCreateMonster("Monk", position)
If it should only create the monster if there is atleast 1 item correct or any item added, you check that again with a loop after else or check for elseif amount >= 1 then.
 
Code:
doCreateMonster("Monk", position)
If it should only create the monster if there is atleast 1 item correct or any item added, you check that again with a loop after else or check for elseif amount >= 1 then.
mm this script is working good now with docreatemonsters without any error but i need to create monsters if these items that listed UP isn't on correct place not any other item for example if i put Item ID 2001 on {x = 971, y = 975, z = 7} and other items on correct place except this item ,must create them cuz i created these monsters without put any item , i just stepin TILE after then i found script created them and please i need to create them only once till they die cuz it keep create monster if i stepin TILE
Code:
local config = {
{pos = {x = 979, y = 975, z = 7}, itemid = 2001},
{pos = {x = 971, y = 975, z = 7}, itemid = 2002},
{pos = {x = 970, y = 981, z = 7}, itemid = 2003},
{pos = {x = 979, y = 981, z = 7}, itemid = 2004}
}

function onStepIn(cid, item, position, fromPosition)
     local amount = 0
     for x = 1, #config do
         if getTileItemById(config[x].pos, config[x].itemid).uid > 0 then
             amount = amount + 1
         else
             doPlayerSendCancel(cid, "You need to add items at first to make teleport to hidden place")
         end
     end
     if amount == #config then -- if all items are found then
         for x = 1, #config do
             doRemoveItem(getTileItemById(config[x].pos, config[x].itemid).uid, 1)
         end
         doCreateTeleport(cid, {x = 975, y = 978, z = 6})
         addEvent(deleteTeleport, monster.time * 1000, monster.tpPos)
         doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You found a hidden area.")
     else -- if not all items are found
        doCreateMonster("Monk", position)
        doCreateMonster("Monk", position)
        doCreateMonster("Monk", position)
        doCreateMonster("Monk", position)
     end
     return true
end
 
Code:
local config = {
{pos = {x = 979, y = 975, z = 7}, itemid = 2001},
{pos = {x = 971, y = 975, z = 7}, itemid = 2002},
{pos = {x = 970, y = 981, z = 7}, itemid = 2003},
{pos = {x = 979, y = 981, z = 7}, itemid = 2004}
}

function deleteTeleport(tpUid)
    doRemoveItem(tpUid)
end

function onStepIn(cid, item, position, fromPosition)
     local amount = 0
     for x = 1, #config do
         if getTileItemById(config[x].pos, config[x].itemid).uid > 0 then
             amount = amount + 1
         else
             doPlayerSendCancel(cid, "You need to add items at first to make teleport to hidden place")
         end
     end
     if amount == #config then -- if all items are found then
         for x = 1, #config do
             doRemoveItem(getTileItemById(config[x].pos, config[x].itemid).uid, 1)
         end
        teleTime = 5000 -- 5 seconds
         teleUid = doCreateTeleport(1387, {x = 975, y = 978, z = 6}, {x = 975, y = 978, z = 6}) -- identifier for created portal
         addEvent(deleteTeleport, teleTime, teleUid) -- delete portal in 5 seconds, using UID
         doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You found a hidden area.")
     else -- if not all items are found
        creatures = string.explode(getStorage(1337), "|")
        if( getStorage(1337) == -1 or (not isCreature(creatures[1]) and not isCreature(creatures[2]) and not isCreature(creatures[3]) and not isCreature(creatures[4]) ) ) then
            monk1 = doCreateMonster("Monk", position)
            monk2 = doCreateMonster("Monk", position)
            monk3 = doCreateMonster("Monk", position)
            monk4 = doCreateMonster("Monk", position)
            doSetStorage(1337, monk1.."|"..monk2.."|"..monk3.."|"..monk4) -- set global 1337 to true/1
        end
     end
     return true
end

This should work
 
Last edited:
Back
Top