TFS 0.X Change function for me

leo123456

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
22
Reaction score
174
change doRelocate(position, newPosition) to doTeleportThing(cid, newPosition)
 
OP
L

leo123456

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
22
Reaction score
174
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

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
22
Reaction score
174
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

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,323
Best answers
33
Reaction score
830
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
110
Best answers
0
Reaction score
39
Location
/root
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

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
110
Best answers
0
Reaction score
39
Location
/root
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