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

TFS 1.0 Script help.

Jabra

Banned User
Joined
Jan 11, 2014
Messages
19
Reaction score
0
I have an script thats dont give errors but its crash the client.


This one is that you need to use a oil on it you get it work but its crash the client and if anyone goes there it will crash for them to..

Item to use is 11106 and map setup is Lever id: 10044 with actionid: 8013
PHP:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if(item.itemid == 11106 and itemEx.actionid == 8013) then
        if(getPlayerStorageValue(cid, 1050) == 16) then
            lever = toPosition.y - 31122
            leverChange = {
                [1] = {1, 3, 2, 4},
                [2] = {2, 1, 3, 4},
                [3] = {2, 3, 1, 4},
                [4] = {3, 2, 4, 1},
                [5] = {4, 2, 1, 3}
            }
            tmp = {}
            pos = {
                {x = 33355, y = 31126, z = 7, stackpos = STACKPOS_GROUND},
                {x = 33356, y = 31126, z = 7, stackpos = STACKPOS_GROUND},
                {x = 33357, y = 31126, z = 7, stackpos = STACKPOS_GROUND},
                {x = 33358, y = 31126, z = 7, stackpos = STACKPOS_GROUND}
            }
            for i = 1, 4 do
                tmp[1] = getThingfromPos(pos[i]).itemid
            end
            for i = 1, 4 do
                doTransformItem(getThingfromPos(pos[i]).uid, tmp[leverChange[lever][i]])
                doSendMagicEffect(pos[i], CONST_ME_POFF)
            end
            pass = 0
            configuration = {
                10850,
                10853,
                10856,
                10855
            }
            for i = 1, 4 do
                if(getThingfromPos(pos[i]).itemid == configuration[i]) then
                    pass = pass + 1
                end
            end
            if(pass == 4) then
                setPlayerStorageValue(cid, 1050, 17)
                doCreatureSay(cid, "You found the right combination. You should report to Zalamon.", TALKTYPE_ORANGE_1)
            end
            doTransformItem(itemEx.uid, itemEx.itemid == 10044 and 10045 or 10044, 1)
        end
    end
    return true
end
 
Last edited:
Try doing something with this:
Code:
doTransformItem(itemEx.uid, itemEx.itemid == 10044 and 10045 or 10044, 1)
I'd try to correct your code, but I don't know what it was supposed to do.
 
Try doing something with this:
Code:
doTransformItem(itemEx.uid, itemEx.itemid == 10044 and 10045 or 10044, 1)
I'd try to correct your code, but I don't know what it was supposed to do.

Its for this quest: http://tibia.wikia.com/wiki/Children_of_the_Revolution_Quest/Spoiler

And it says this will be done:

Note: You can do this part during the previous mission and also talk to Zalamon about symbols while giving report of mission 3.
Head back to NPC Zalamon and say to him "strange symbols". He'll ask you get a Flask of Extra Greasy Oil from his storage room to the west. Go back to the building in Muggy Plains to the room with the levers and use the grease on them. Then use the levers to arrange the symbols in the center of the room to match the symbols on the bottom floor. You will get a red message when you have done it right. Report back to Zalamon. He will give you a Tome of Knowledge as a reward for completing this mission.


So the Flask of Extra Greasy Oil with item id: 11106 shall be used on those Levers that has itemid: 10044 and actionid: 8013

Then you will need tofind right position and that will change something on the mark.


Thanks for trying to help me :)
 
replace:
Code:
doTransformItem(itemEx.uid, itemEx.itemid == 10044 and 10045 or 10044, 1)
to:
Code:
if itemEx.itemid == 10044 then
doTransformItem(itemEx.uid, 10045)
else
doTransformItem(itemEx.uid, 10044)
end
 
replace:
Code:
doTransformItem(itemEx.uid, itemEx.itemid == 10044 and 10045 or 10044, 1)
to:
Code:
if itemEx.itemid == 10044 then
doTransformItem(itemEx.uid, 10045)
else
doTransformItem(itemEx.uid, 10044)
end

Dident work it crash the client. :/
 
oh, I read that wrong
you meant client, not server executable file

something is wrong with this:
Code:
doTransformItem(getThingfromPos(pos[i]).uid, tmp[leverChange[lever][i]])
try to add this above doTransformItem(in for loop) to see what item it makes:
Code:
print( tmp[leverChange[lever][i]])
so you'll get reference point
 
oh, I read that wrong
you meant client, not server executable file

something is wrong with this:
Code:
doTransformItem(getThingfromPos(pos[i]).uid, tmp[leverChange[lever][i]])
try to add this above doTransformItem(in for loop) to see what item it makes:
Code:
print( tmp[leverChange[lever][i]])
so you'll get reference point

10850
nil
nil
nil
In server console

And client crash :)

Added like this
PHP:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if(item.itemid == 11106 and itemEx.actionid == 8013) then
        if(getPlayerStorageValue(cid, 1050) == 16) then
            lever = toPosition.y - 31122
            leverChange = {
                [1] = {1, 3, 2, 4},
                [2] = {2, 1, 3, 4},
                [3] = {2, 3, 1, 4},
                [4] = {3, 2, 4, 1},
                [5] = {4, 2, 1, 3}
            }
            tmp = {}
            pos = {
                {x = 33355, y = 31126, z = 7, stackpos = STACKPOS_GROUND},
                {x = 33356, y = 31126, z = 7, stackpos = STACKPOS_GROUND},
                {x = 33357, y = 31126, z = 7, stackpos = STACKPOS_GROUND},
                {x = 33358, y = 31126, z = 7, stackpos = STACKPOS_GROUND}
            }
            for i = 1, 4 do
                tmp[1] = getThingfromPos(pos[i]).itemid
            end
            for i = 1, 4 do
                print( tmp[leverChange[lever][i]])
                doTransformItem(getThingfromPos(pos[i]).uid, tmp[leverChange[lever][i]])
                doSendMagicEffect(pos[i], CONST_ME_POFF)
            end
            pass = 0
            configuration = {
                10850,
                10853,
                10856,
                10855
            }
            for i = 1, 4 do
                if(getThingfromPos(pos[i]).itemid == configuration[i]) then
                    pass = pass + 1
                end
            end
            if(pass == 4) then
                setPlayerStorageValue(cid, 1050, 17)
                doCreatureSay(cid, "You found the right combination. You should report to Zalamon.", TALKTYPE_ORANGE_1)
            end
            if itemEx.itemid == 10044 then
              doTransformItem(itemEx.uid, 10045)
              else
              doTransformItem(itemEx.uid, 10044)
              end
        end
    end
    return true
end
 
There is 5 Leverls with itemid: 10044 with actionid: 8013

You will use itemid: 11106 on those levers.

When you use the levers with that item it will transform the ground and when you find right combination you will revice the storageid.

Hope you understand how it should work :)
 
tmp[1] replace to tmp[.i]
(without .)

Works! Thanks alot! :D

If you intressted to help with last one last script i will be glad. :)

PHP:
local pos = {
    {x = 33253, y = 31081, z = 8},
    {x = 33259, y = 31090, z = 8},
    {x = 33266, y = 31085, z = 8},
    {x = 33263, y = 31094, z = 8}
}

function doClearMissionArea(fromPos, toPos)
    for x = fromPos.x, toPos.x do
        for y = fromPos.y, toPos.y do
            for z = fromPos.z, toPos.z do
                if(getTopCreature({x = x, y = y, z = z}).uid > 0) then
                    if(isPlayer(getTopCreature({x = x, y = y, z = z}).uid)) then
                        doTeleportThing(getTopCreature({x = x, y = y, z = z}).uid, {x = 33353, y = 31410, z = 8})
                        doSendMagicEffect({x = 33353, y = 31410, z = 8}, CONST_ME_TELEPORT)
                        setPlayerStorageValue(getTopCreature({x = x, y = y, z = z}).uid, 1050, 20)
                    else
                        doRemoveCreature(getTopCreature({x = x, y = y, z = z}).uid)
                    end
                end
            end
        end
    end
    return true
end

function onStepIn(cid, item, position, lastPosition)
    start = false
    if(getPlayerStorageValue(cid, 1050) == 19) then
        if(item.actionid == 8014) then
            for i = 1, 4 do
                if(getTopCreature(pos[i]).uid > 0) then
                    if(isPlayer(getTopCreature(pos[i]).uid)) then
                        if(getGlobalStorageValue(8014) < 1) then
                            doCreatureSay(getTopCreature(pos[i]).uid, "A clicking sound tatters the silence.", TALKTYPE_ORANGE_1)
                            start = true
                        end
                    end
                end
            end               
            if(start == true) then               
                doTransformItem(getTileItemById({x = 33265, y = 31116, z = 8}, 3653).uid), 3687)
                addEvent(doTransformItem, 30 * 1000, getTileItemById({x = 33265, y = 31116, z = 8}, 3687).uid), 3653)
                setGlobalStorageValue(8014, 1)
                addEvent(setGlobalStorageValue, 8014, 0)
                creature = ""
                for k = 1, 4 do
                    for j = 1, 20 do
                        if(k < 3) then
                            creature = "eternal guardian"
                        else
                            creature = "lizard chosen"
                        end
                        summonPos = {x = math.random(33239, 33295), y = math.random(31100, 31132), z = 7}
                        addEvent(doSummonCreature, k * 30 * 1000, creature, summonPos)
                        addEvent(doSendMagicEffect, k * 30 * 1000, summonPos, CONST_ME_TELEPORT)
                    end
                end
                addEvent(doClearMissionArea, 5 * 30 * 1000, {x = 33239, y = 31100, z = 7}, {x = 33295, y = 31132, z = 7})
            end
        end
    end
    return true
end

Its give an error at

[Warning - Event::checkScript] Can not load script: scripts/children of the revolution quest/childrenOfTheRevolutionQuestClick.lua
...e revolution quest/childrenOfTheRevolutionQuestClick.lua:42: syntax error near ','


Once agian thanks alot!!!
 
getTileItemById({x = 33265, y = 31116, z = 8}, 3687).uid), 3653)

.uid) << this ")" don't have pair so you should remove it
 
Back
Top