mattyx14 / otxserver

OTX Server from:
https://docs.opentibiabr.com
GNU General Public License v2.0
229 stars 194 forks source link

[OTX2-Any version] Bug muy raro en actions, parecido a que habia con los npc #415

Closed pasturryx closed 5 years ago

pasturryx commented 5 years ago

Bueno esto , aunque esta hace tiempo, ahora lo vengo a confirmar, por si me pueden ayudar El bug se reproduce asi Por ejemplo tu tienes un action que funciona, como la siguiente: <action uniqueid="3009" script="rook/sewer grate switch.lua" /> `function onUse(cid, item, frompos, item2, topos) tile1 = {x = 32100, y = 32205, z = 8, stackpos = 1} tile2 = {x = 32101, y = 32205, z = 8, stackpos = 1} local playerTile = {x = 32100, y = 32205, z = 8} local playerTile1 = {x = 32101, y = 32205, z = 8} gettile1 = getThingfromPos(tile1) gettile2 = getThingfromPos(tile2) if item.uid == 3009 and item.itemid == 1945 then doCreateItem(493,1,tile1) doCreateItem(493,1,tile2) doCreateItem(4799,1,tile1) doCreateItem(4797,1,tile2)
doRemoveItem(gettile1.uid,1) doRemoveItem(gettile2.uid,1)
if isCreature(getTopCreature(playerTile).uid) then doTeleportThing(getTopCreature(playerTile).uid, {x = 32099, y = 32205, z = 8}) end if isCreature(getTopCreature(playerTile1).uid) then doTeleportThing(getTopCreature(playerTile1).uid, {x = 32102, y = 32205, z = 8}) end doTransformItem(item.uid,item.itemid+1) elseif item.uid == 3009 and item.itemid == 1946 then doCreateItem(1284,1,tile1) doCreateItem(1284,1,tile2)

    doRemoveItem(gettile1.uid,1)
    doRemoveItem(gettile2.uid,1)

    doTransformItem(item.uid,item.itemid-1)        
else
    doPlayerSendCancel(cid,"Sorry, not possible.")
end

return 1

end`

lo raro es que si el mismo script lo pones en otro lugar, con exactamente las mismas caracteristicas lever 1945, misma cantidad de sqms los mismos ids todo igual, el segundo script no quiere correr lo eh probado con mas de 3 script y el 2do script agregado funciona de forma erronea , ya sea cambiando los AID O UID

testeado en 7.72 , 8.6, 8.7 aqui ni si quiera tengo idea de porque se pueda estar sucediendo esto

mattyx14 commented 5 years ago

eso es problema del scrip

pasturryx commented 5 years ago

te acuerdas que antes había un bug, que el npc si lo tenias en un lado no repsondia luego lo cambiabas a otro lado y si respondía? https://github.com/mattyx14/otxserver/issues/266 .

pasa algo similar... el script funciona pues lo tengo en un palanca 1945 aid( va direccionado a un puente) 4023 la jalo y sirve. luego otra lever 1045 el mismo script con otro aid 4022 (direccionado al mismo puente )y no funciona, el script lo copie y lo pege , obvio pense que lo copie mal lo hize denuebo ya revise map y todo lo mismo con otros script si es el mismo script otro id misma palanca el 2do script funciona, pero funciona mal o erroneo probe con otros scripts haciendo lo mismo y pasaba eso tengo otro server y funciona bien haciendo lo mismo tfs 0.4 7.72

RedDaniels commented 5 years ago

ALGUNA SOLUCION? @mattyx14 @REASON184

pasturryx commented 5 years ago

Pudiste reproducir este bug @RedDaniels ?

WeslleyKiyo commented 5 years ago

I do not understand anything you said. The script you are using is not good and may not work correctly. I use Otx2 8.60 and did not see this bug.

pasturryx commented 5 years ago

I do not understand anything you said. The script you are using is not good and may not work correctly. I use Otx2 8.60 and did not see this bug. @WeslleyKiyo @mattyx14

This bug its quite similar to this one related to npcs: npc bugs basically consists on that npcs wont respond of certain positions of the map etc ( the scripts of npcs were working good) it was an engine or module bugs. https://github.com/mattyx14/otxserver/issues/266 the script its okey because its working. Its an action on use lever 1945 with AID 4022 (the script remove and creates a brigde. the seccond lever its a COPY of the same script in another lever 1945 with another AID 4023 (the script should remove and create a brigde ON THE SAME POS but its working incorrectly xD) does not matter which script its execute firsts only the fist AID scripts works good the seccond works wrong.

Also i've tested the same with another copy pasted scripts and happens the same mostly on onUse actions

its really really weird

examples (videos)

Engine: OTHIRE (cloned scripts works good) https://youtu.be/SDZkPCHWJBo 0:00

Engine:OTX2 ( working wrong) https://youtu.be/34nR0HcW2yc 0:00

RedDaniels commented 5 years ago

@reason184

mattyx14 commented 5 years ago

@Felipe21 - I fix this on my old project for tibia7x https://github.com/mattyx14/RlMap77x/commit/03fb3e3d0751aa2a558aaca09d49744dd03726a5

RedDaniels commented 5 years ago

This work with 8.6?

mattyx14 commented 5 years ago

Otx 2 ... It is the same script code be 10.35 or 7.4

pasturryx commented 5 years ago

@Felipe21 - I fix this on my old project for tibia7x mattyx14/RlMap77x@03fb3e3

i don't know lua could you add 2 sqm more to it? i need 4 sqm in my scrip this t is not at rook and do not remove or edit 2 sqm i wil post my script if you can convert it `local items = { mud_border = 4799, water = 493, bridge = 1284 } local bridge_positions = { {x = 32410, y = 32231, z = 10}, {x = 32411, y = 32231, z = 10}, {x = 32410, y = 32232, z = 10}, {x = 32411, y = 32232, z = 10} } local relocate_position = {x = 32410, y = 32230, z = 10}

function onUse(cid, item, fromPosition, itemEx, toPosition) if getTileItemById(bridge_positions[1], items.water).uid ~= 0 and item.itemid == 1945 then for i = 1, 4 do if not (i % 2 == 0) then doTransformItem(getTileItemById(bridge_positions[i], items.mud_border).uid, 0) end doTransformItem(getTileItemById(bridge_positions[i], items.water).uid, items.bridge) end elseif getTileItemById(bridge_positions[1], items.bridge).uid ~= 0 and item.itemid == 1946 then for i = 1, 4 do doRelocate(bridge_positions[i], relocate_position, true) if not (i % 2 == 0) then doCreateItem(items.mud_border, 1, bridge_positions[i]) end doTransformItem(getTileItemById(bridge_positions[i], items.bridge).uid, items.water) end end doTransformItem(item.uid, item.itemid == 1946 and 1945 or 1946) return true end` and anyway this still being a bug why did you closed it?

mattyx14 commented 5 years ago

why is it a Lua error not from the server ... post your script and I update it for you

pasturryx commented 5 years ago

if its lua error why it works good in others servers ? and in otx works only in one lever but in other it works wrong? also its ofc a bug because it would be a shit that we cannot use same scripts in others actions /movements with another AID OR UID

i posted the script above

here its :

local items = { mud_border = 4799, water = 493, bridge = 1284 } local bridge_positions = { {x = 32410, y = 32231, z = 10}, {x = 32411, y = 32231, z = 10}, {x = 32410, y = 32232, z = 10}, {x = 32411, y = 32232, z = 10} } local relocate_position = {x = 32410, y = 32230, z = 10}

function onUse(cid, item, fromPosition, itemEx, toPosition) if getTileItemById(bridge_positions[1], items.water).uid ~= 0 and item.itemid == 1945 then for i = 1, 4 do if not (i % 2 == 0) then doTransformItem(getTileItemById(bridge_positions[i], items.mud_border).uid, 0) end doTransformItem(getTileItemById(bridge_positions[i], items.water).uid, items.bridge) end elseif getTileItemById(bridge_positions[1], items.bridge).uid ~= 0 and item.itemid == 1946 then for i = 1, 4 do doRelocate(bridge_positions[i], relocate_position, true) if not (i % 2 == 0) then doCreateItem(items.mud_border, 1, bridge_positions[i]) end doTransformItem(getTileItemById(bridge_positions[i], items.bridge).uid, items.water) end end doTransformItem(item.uid, item.itemid == 1946 and 1945 or 1946) return true end

PD: ADDING VIA CODE ITS NOT WORKING SO I POSTED IT THIS WAY , IM SORRY

pasturryx commented 5 years ago

when are u going to help me with this @mattyx14 D;?

mattyx14 commented 5 years ago

Step to step

pasturryx commented 5 years ago

?

pasturryx commented 5 years ago

bump

pasturryx commented 5 years ago

I took old tfs 0.4 system few libs im pretty sure now that otx its bugged , liked no one belived im me i not gonna share the fix but this shit is bugged so check it guys because its working for me now like it used to be in anothers otservers

pasturryx commented 5 years ago

if you are interested let me know , otherwise i give a fuck.. anyway im still contributing to the project i have solved many bugs

mattyx14 commented 5 years ago

oralesjejeje

mattyx14 commented 5 years ago

El script puede ser simplificado pero esto te puede ayudar

actions.xml

<action uniqueid="50129-50130" script="leverBridge.lua"/>

leverBridge.lua

local bridgeID = 1284
local back = {
    x = 32409, y = 32231, z = 10
}

bridgePos = {
    [1] = {x = 32410, y = 32231, z = 10},
    [2] = {x = 32411, y = 32231, z = 10},
    [3] = {x = 32412, y = 32231, z = 10},
    [4] = {x = 32410, y = 32232, z = 10},
    [5] = {x = 32411, y = 32232, z = 10},
    [6] = {x = 32412, y = 32232, z = 10}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if item.itemid == 1945 then
        for i = 50129, 50130 do
            doTransformItem(i, 1946)
        end

        doCreateItem(bridgeID, bridgePos[2])
        if getTileItemById(bridgePos[1], 4799).itemid ~= nil then
            doTransformItem(getTileItemById(bridgePos[1], 4799).uid, bridgeID)
        end

        if getTileItemById(bridgePos[3], 4668).itemid > 0 then
            doTransformItem(getTileItemById(bridgePos[3], 4668).uid, bridgeID)
        end

        doCreateItem(bridgeID, bridgePos[5])
        if getTileItemById(bridgePos[4], 4799).itemid ~= nil then
            doTransformItem(getTileItemById(bridgePos[4], 4799).uid, bridgeID)
        end

        if getTileItemById(bridgePos[6], 4668).itemid > 0 then
            doTransformItem(getTileItemById(bridgePos[6], 4668).uid, bridgeID)
        end
    elseif item.itemid == 1946 then
        for i = 50129, 50130 do
            doTransformItem(i, 1945)
        end

        for p = 1, #bridgePos do
            doRelocate(bridgePos[p], back)
        end

        for z = 1, #bridgePos do
            bridgePos[z].stackpos = 254
            if getThingFromPos(bridgePos[z]).itemid > 1000 then
                doRemoveItem(getThingFromPos(bridgePos[z]).uid)
            end

            bridgePos[z].stackpos = 1
            if getThingFromPos(bridgePos[z]).itemid > 1000 then
                doRemoveItem(getThingFromPos(bridgePos[z]).uid)
            end
        end

        -- L-Water
        doCreateItem(4615, bridgePos[1])
        doCreateItem(4615, bridgePos[4])
        -- Centre-water
        doCreateItem(4615, bridgePos[2])
        doCreateItem(4615, bridgePos[5])
        -- R-water
        doCreateItem(4615, bridgePos[3])
        doCreateItem(4615, bridgePos[6])

        -- L-Borders-dirt
        doCreateItem(4799, bridgePos[1])
        doCreateItem(4799, bridgePos[4])
        -- R-Borders-dirt
        doCreateItem(4668, bridgePos[3])
        doCreateItem(4668, bridgePos[6])
    end

    return true
end

También es cuestión de separar las palancas. Pero eso ya es otra historia

mattyx14 commented 5 years ago

@Felipe21