Ir para conteúdo
  • 0
adrenys

Scripting [Revscriptsys] Transformar StepIn > OnUse

Pergunta

adrenys    0
adrenys

Antes de fazer a sua pergunta, tenha certeza de ter lido as regras da seção e o guia abaixo:

https://forums.otserv.com.br/index.php?/forums/topic/168583-regras-da-seção/

https://forums.otserv.com.br/index.php?/forums/topic/165121-como-fazer-uma-pergunta-ou-o-grande-guia-do-usuário-com-dúvidas/

Obs: não delete esse formulário pré-definido, preencha-o corretamente para postar o seu tópico!

Descreva em algumas palavras a base utilizada. (Nome do servidor / Nome do cliente / Nome do website / etc.).

Base:

 

Qual é a sua pergunta?

Hola, me ayudan a transfomar esté script StepIn a OnUse, por favor

 

Você tem o código disponível? Se tiver poste-o na caixa de código que está dentro do spoiler abaixo:

Spoiler

local config = {
    [59810] = {position = Position(32211, 32076, 15)}
}

local nightmareCastle = MoveEvent()

function nightmareCastle.onStepIn(creature, item, position, fromPosition)
    local player = creature:getPlayer()
    if not player then
        return false
    end

    for index, value in pairs(config) do
        if item.actionid == index then
            if(item.actionid == 59810)then
                if(player:getStorageValue(Storage.DreamCourts.DreamScar.nightmareTimer) > os.time())then
                    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have faced this boss in the last 20 hours.")
                    player:teleportTo(fromPosition, true)
                    player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
                    return false
                end
            end
            doSendMagicEffect(player:getPosition(), CONST_ME_TELEPORT)
            player:teleportTo(value.position)
            doSendMagicEffect(value.position, CONST_ME_TELEPORT)        
        end
    end
end

nightmareCastle:type("stepin")

for index, value in pairs(config) do
    nightmareCastle:aid(index)
end

nightmareCastle:register()
 

 

Você tem alguma imagem que possa auxiliar no problema? Se sim, anexe-a dentro do spoiler abaixo:

Spoiler

 

 

Compartilhar este post


Link para o post
Compartilhar em outros sites

1 resposta a esta questão

Recommended Posts

  • 0
Majesty    1755
Majesty

Script:

Spoiler

 local config = {
    [59810] = {position = Position(32211, 32076, 15)}
}

local nightmareCastle = Action()

function nightmareCastle.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local player = creature:getPlayer()
    if not player then
        return false
    end

    for index, value in pairs(config) do
        if item.actionid == index then
            if(item.actionid == 59810)then
                if(player:getStorageValue(Storage.DreamCourts.DreamScar.nightmareTimer) > os.time())then
                    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have faced this boss in the last 20 hours.")
                    player:teleportTo(fromPosition, true)
                    player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
                    return false
                end
            end
            doSendMagicEffect(player:getPosition(), CONST_ME_TELEPORT)
            player:teleportTo(value.position)
            doSendMagicEffect(value.position, CONST_ME_TELEPORT)        
        end
    end
end

nightmareCastle:register()

 

 

Compartilhar este post


Link para o post
Compartilhar em outros sites
Visitante
Este tópico está impedido de receber novos posts.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×