• TibiaFace

    Tibiaface | Una comunidad Open Tibia donde encontras : mapas, scripts, Otserver, npc y amigos etc ...

    .
    demo menumenu

    Afiliados



    Votar:

    [Actions] [Actions] problema con script

    Compartir:

    Ver el tema anterior Ver el tema siguiente Ir abajo  Mensaje (Página 1 de 1.)

    1[Actions] [Actions] problema con script Empty [Actions] [Actions] problema con script Miér Jun 22, 2022 10:06 pm

    akane

    akane
    Miembro
    Miembro
    Descripcion escribió:hola a todos, tengo problemas con el siguiente script
    Código:
    function isHandItem(uid) -- NW based on Mock
             uid = uid or 0
            if isInArray({1,2,3,4,5,6}, getItemWeaponType(uid)) then
                 return true
             end
             return false
    end


    function getItemDodgePercent(itemuid)
    return getItemAttribute(itemuid, "dodgePercent") or 0
    end


    function setItemDodgePercent(uid, percent)
    doItemSetAttribute(uid, "description", "[Dodge: "..percent.."%]")
    doItemSetAttribute(uid, "dodgePercent", percent)
    end








    function onUse(cid, item, fromPosition, itemEx, toPosition)
    level = 0
    local upgrade = {
    [1] = {min = 1, max = 5, chance = 100},
    [2] = {min = 5, max = 10, chance = 80},
    [3] = {min = 10, max = 20, chance = 60},
    [4] = {min = 20, max = 40, chance = 40},
    [5] = {min = 40, max = 50, chance = 20}
    }


    function isWearing(uid) -- NW based on Mock
             uid = uid or 0
            if isInArray({uid}, getPlayerSlotItem(cid, 1).uid) or isInArray({uid}, getPlayerSlotItem(cid, 4).uid) or isInArray({uid}, getPlayerSlotItem(cid, 7).uid) or isInArray({uid}, getPlayerSlotItem(cid, 8).uid) then
                 return true
             end
             return false
    end




    if isItem(itemEx.uid) or isWearing(itemEx.uid) then
    local name = getItemName(itemEx.uid)
    local atual = math.floor(getItemDodgePercent(itemEx.uid)*10)/10
    for i = 1, #upgrade do
    if string.find(tostring(name),"+".. i .."") then
    level = i
    end
    end


    if level >= #upgrade then
    doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,"Your item is already on max level, you can't upgrade it any further.")
    return true
    end




    if math.random(0,100) <= upgrade[level + 1].chance then
    doRemoveItem(item.uid, 1)
    doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,"You leveled your item to ".. level+1 ..".")
    setItemDodgePercent(itemEx.uid, atual + (math.random(upgrade[level+1].min,upgrade[level+1].max))/10)
    doItemSetAttribute(itemEx.uid,'name'..(level+1))
    doSendMagicEffect(toPosition, math.random(28,30))
    else
    doRemoveItem(itemEx.uid, 1)
    doRemoveItem(item.uid, 1)
    doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,"Your item has failed and destroyed it in the process")
    doSendMagicEffect(toPosition, 4)
    end


    else
    doPlayerSendTextMessage(cid, 24,"You cant refine this item.")
    end
    return true
    end

    por el momento da la funcion de que da dodge a un item y tambien lo refleja en la descrpcion del item.

    pero tiene problemas al quitar o destruir en este caso el item si falla el upgrade (solo baja el %) pero no lo elimina .

    Tampoco muestra el mensaje en caso de que falle por lo que no se sabe en que momento falla el upgrade

    y por ultimo y mas grave es que se le puede dar upgrade a todo tipo de items (puertas, walls, etc) y no solo al equipo como debe ser (solo helmet, armor, legs, y boots).

    si pudieran ayudarme uso otx 3.10.

    PD: tampoco arroja la animacion de dodge por lo que tampoco se sabe si funciona o no.
    Captura del Error escribió:Imagen del error: [Actions] [Actions] problema con script Empty
    El error radica en: Actions

    Ver el tema anterior Ver el tema siguiente Volver arriba  Mensaje (Página 1 de 1.)

    Permisos de este foro:
    No puedes responder a temas en este foro.

     

    BienvenidosTibiaFace es una comunidad de Open Tibia. Para participar debes estar registrado (click para Regístrate).