• 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 0.X Change function for me

leo123456

New Member
Joined
Jun 13, 2009
Messages
29
Reaction score
0
Hello

Our friend @Gesior.pl asked me to change the dorelocate function to
'doTeleportThing' but I do not know how to do that. Can someone help me?

Script:
Lua:
function onStepOut(cid, item, position, fromPosition)
    local newPosition = {x = position.x, y = position.y, z = position.z}
    if(isInArray(verticalOpenDoors, item.itemid)) then
        newPosition.x = newPosition.x + 1
    else
        newPosition.y = newPosition.y + 1
    end

    doRelocate(position, newPosition)
    local tmpPos = {x = position.x, y = position.y, z = position.z, stackpos = -1}
    local tileCount = getTileThingByPos(tmpPos)

    local i = 1
    local tmpItem = {uid = 1}
    while(tmpItem.uid ~= 0 and i < tileCount) do
        tmpPos.stackpos = i
        tmpItem = getTileThingByPos(tmpPos)
        if(tmpItem.uid ~= item.uid and tmpItem.uid ~= 0 and isMoveable(tmpItem.uid)) then
            doRemoveItem(tmpItem.uid)
        else
            i = i + 1
        end
    end

    doTransformItem(item.uid, item.itemid - 1)
    return true
end

thanks everybody.
 
change doRelocate(position, newPosition) to doTeleportThing(cid, newPosition)
 
Give a proper explanation on what you're trying to do.
the only info you've provided is change doRelocate to doTeleportThing
 
Give a proper explanation on what you're trying to do.
the only info you've provided is change doRelocate to doTeleportThing
My intention is to replace the function doRelocate with doTeleportThing so that it has the same purpose.
So change a function but do the same thing.
 
what do you mean so they have the same purpose? It's 2 different functions
doTeleportThing will move 1 creature only
doRelocate will move everything (creatures & items) found on a position to another position

Then again you didn't explain what you're trying to do. For what purpose do you want to change functions?
 
you should check for the position and then check what you want to get (getThingPos, etc), after that you use the function that gesior told doTeleportThing(POSITION_VAR, newPosition)
 
I don't want to discourage you but this is pretty basic and if you already struggle... I don't know, man.
You know that that function crashes your server. Why? Is it because it doesn't exist in your server's source code? Or is it because you gave it data that your server cannot handle?
Is is the former? Is there a function that does the same thing? What data does it expect?
Is it the latter? Have you looked up what kind of data this functions expects in the source code/documentation?
Do you have any error message in your console? Have you tried debugging your code(be it with print statements)?
It's not like we can't "make it for you" but you won't get anywhere if aren't capable of solving problems.
 
I don't want to discourage you but this is pretty basic and if you already struggle... I don't know, man.
You know that that function crashes your server. Why? Is it because it doesn't exist in your server's source code? Or is it because you gave it data that your server cannot handle?
Is is the former? Is there a function that does the same thing? What data does it expect?
Is it the latter? Have you looked up what kind of data this functions expects in the source code/documentation?
Do you have any error message in your console? Have you tried debugging your code(be it with print statements)?
It's not like we can't "make it for you" but you won't get anywhere if aren't capable of solving problems.
TFS 0.X - OTX error - crash [segmentation fault]
 
Back
Top