• 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
33
Best answers
0
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.
 

Sun

Knowledge is power - France is bacon
Joined
Jan 26, 2015
Messages
333
Best answers
21
Reaction score
178
change doRelocate(position, newPosition) to doTeleportThing(cid, newPosition)
 
OP
L

leo123456

New Member
Joined
Jun 13, 2009
Messages
33
Best answers
0
Reaction score
0
@Sun

Did not work buddy. The player is coming back.
 

Sun

Knowledge is power - France is bacon
Joined
Jan 26, 2015
Messages
333
Best answers
21
Reaction score
178
Give a proper explanation on what you're trying to do.
the only info you've provided is change doRelocate to doTeleportThing
 
OP
L

leo123456

New Member
Joined
Jun 13, 2009
Messages
33
Best answers
0
Reaction score
0
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.
 

Sun

Knowledge is power - France is bacon
Joined
Jan 26, 2015
Messages
333
Best answers
21
Reaction score
178
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?
 
OP
L

leo123456

New Member
Joined
Jun 13, 2009
Messages
33
Best answers
0
Reaction score
0
Because doRelocate crash my server. So I need change functions.

@Sun
 
Last edited:

StreamSide

Joseluis Gonzalez
Support Team
Joined
Aug 31, 2007
Messages
3,417
Best answers
41
Reaction score
916
Location
Arica - Chile
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)
 

messenoire

Active Member
Joined
Sep 26, 2015
Messages
119
Best answers
0
Reaction score
48
Location
127.0.0.1:7171
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.
 
OP
L

leo123456

New Member
Joined
Jun 13, 2009
Messages
33
Best answers
0
Reaction score
0
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]
 

messenoire

Active Member
Joined
Sep 26, 2015
Messages
119
Best answers
0
Reaction score
48
Location
127.0.0.1:7171
Dude you should've included the link in the first post, now that's information I can work with.

Upload your luascript.cpp please
 
Top