Ir para conteúdo

Featured Replies

Postado

Prezados, bom dia!

Eu gostaria de saber se é possível criar um script de tile que enxe a stamina?

 

 

Por exemplo, a minha idéia é botar um actionid nos tiles dos treiners que a cada 2 minutos vai adicionar 1 minuto de stamina para o player. Dai o player não precisaria deslogar para recuperar a stamina.

Obrigado desde já!

Editado por grafit (veja o histórico de edições)

Resolvido por Elwyn

Ir para solução
  • Respostas 14
  • Visualizações 3.1k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • eventsId = {} local function rechargeStamina(cid)     if not isPlayer(cid) then         eventsId[cid] = nil         return     end     doPlayerSetStamina(cid, getPlayerStamina(cid) + 1)     eventsI

  • Adriano SwaTT
    Adriano SwaTT

    Teste este: Registre em movements.xml as tags abaixo: <movevent type="StepIn" actionid="12129" event="script" value="tile_stamina.lua"/>     <movevent type="StepOut" actionid="12129" even

  • TFS 1.1:   TFS 0.3.6 ~ 0.4: OTX 2:   Salve como stamina_tile.lua em movements/script   movements.xml:     <movevent event="StepIn" itemid="407" script="stamina_tile.lua" /&gt

Postado

TFS 1.1:

eventsId = {}

local function rechargeStamina(cid)
    local player = Player(cid)

    if not player then
        eventsId[cid] = nil
        return
    end

    player:setStamina(player:getStamina() + 1)

    eventsId[cid] = addEvent(rechargeStamina, 60 * 1000, cid)
end

function onStepIn(creature, item, position, fromPosition)
    if creature:isPlayer() then
        local cid = creature:getId()
        eventsId[cid] = addEvent(rechargeStamina, 60 * 1000, cid)
    end

    return true
end

function onStepOut(creature, item, pos, fromPosition)
    if creature:isPlayer() then
        local cid = creature:getId()
        stopEvent(eventsId[cid])
        eventsId[cid] = nil
    end

    return true
end

 

TFS 0.3.6 ~ 0.4:

OTX 2:

 

eventsId = {}

local function rechargeStamina(cid)
    if not isPlayer(cid) then
        eventsId[cid] = nil
        return
    end

    doPlayerSetStamina(cid, getPlayerStamina(cid) + 1)

    eventsId[cid] = addEvent(rechargeStamina, 1000, cid)
end

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
    if isPlayer(cid) then
        eventsId[cid] = addEvent(rechargeStamina, 1000, cid)
        print("eventsId (stepIn): " .. eventsId[cid])
    end

    return true
end

function onStepOut(cid, item, position, lastPosition, fromPosition, toPosition, actor)
    if isPlayer(cid) then
        stopEvent(eventsId[cid])
        eventsId[cid] = nil
    end

    return true
end

Salve como stamina_tile.lua em movements/script

 

movements.xml:

    <movevent event="StepIn" itemid="407" script="stamina_tile.lua" />
    <movevent event="StepOut" itemid="407" script="stamina_tile.lua" />

Mude itemid="407" para o itemid desejado, caso queira actionid é só mudar de itemid="id do item" para actionid="id da action".

Editado por elwyn (veja o histórico de edições)

Postado
  • Autor

TFS 1.1:

eventsId = {}

local function rechargeStamina(cid)
    local player = Player(cid)

    if not player then
        eventsId[cid] = nil
        return
    end

    player:setStamina(player:getStamina() + 1)

    eventsId[cid] = addEvent(rechargeStamina, 60 * 1000, cid)
end

function onStepIn(creature, item, position, fromPosition)
    if creature:isPlayer() then
        local cid = creature:getId()
        eventsId[cid] = addEvent(rechargeStamina, 60 * 1000, cid)
    end

    return true
end

function onStepOut(creature, item, pos, fromPosition)
    if creature:isPlayer() then
        local cid = creature:getId()
        stopEvent(eventsId[cid])
        eventsId[cid] = nil
    end

    return true
end

 

TFS 0.3.6 ~ 0.4:

OTX 2:

 

eventsId = {}

local function rechargeStamina(cid)
    if not isPlayer(cid) then
        eventsId[cid] = nil
        return
    end

    doPlayerSetStamina(cid, getPlayerStamina(cid) + 1)

    eventsId[cid] = addEvent(rechargeStamina, 1000, cid)
end

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
    if isPlayer(cid) then
        eventsId[cid] = addEvent(rechargeStamina, 1000, cid)
        print("eventsId (stepIn): " .. eventsId[cid])
    end

    return true
end

function onStepOut(cid, item, position, lastPosition, fromPosition, toPosition, actor)
    if isPlayer(cid) then
        stopEvent(eventsId[cid])
        eventsId[cid] = nil
    end

    return true
end

Salve como stamina_tile.lua em movements/script

 

movements.xml:

    <movevent event="StepIn" itemid="407" script="stamina_tile.lua" />
    <movevent event="StepOut" itemid="407" script="stamina_tile.lua" />

Mude itemid="407" para o itemid desejado, caso queira actionid é só mudar de itemid="id do item" para actionid="id da action".

Testei e não funcionou!

Não adicionou a stamina, e apareceu as mensagens no console:

eventsId (stepIn): 1002
eventsId (stepIn): 1003
eventsId (stepIn): 1004
eventsId (stepIn): 1005
eventsId (stepIn): 1006
eventsId (stepIn): 1007
eventsId (stepIn): 1008
eventsId (stepIn): 1010
eventsId (stepIn): 1011
eventsId (stepIn): 1012
eventsId (stepIn): 1013
eventsId (stepIn): 1014
eventsId (stepIn): 1125
eventsId (stepIn): 1145

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo