Ir para conteúdo

Featured Replies

Postado

Alguem poderia me ajudar.. Não consigo fazer a vocation nova do meu servidor a usar potion(ultimate health potion),  Vocation nova ( Titan Gladiator) voc id="12"

 

script potion

 

local MIN = 900
local MAX = 1100
local EMPTY_POTION = 7635

local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if isPlayer(itemEx.uid) == FALSE then
        return FALSE
    end

    if hasCondition(cid, CONDITION_EXHAUST_HEAL) == TRUE then
        doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
        return TRUE
    end

    if((not(isKnight(itemEx.uid)) or getPlayerLevel(itemEx.uid) < 130) and getPlayerCustomFlagValue(itemEx.uid, PlayerCustomFlag_GamemasterPrivileges) == FALSE) then
        doCreatureSay(itemEx.uid, "Only knights of level 130 or above may drink this fluid.", TALKTYPE_ORANGE_1)
        return TRUE
    end

    if doCreatureAddHealth(itemEx.uid, math.random(MIN, MAX)) == LUA_ERROR then
        return FALSE
    end

    doAddCondition(cid, exhaust)
    doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_RED)
    doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
    return TRUE
end

 

Resolvido por vankk

Ir para solução
Postado

MMHUCMQ.png  Esta é uma mensagem automática, este tópico foi movido para a área correta.
  Regras do fórum: http://www.tibiaking.com/forum/topic/1281-regras-gerais/#comment-7680

Este tópico foi movido:
De: Scripting OTServ > OTServ > Actions e TalkActions
Para: Suporte OTServ > OTServ > Suporte de Scripts

--------------------------------------------------------------------------------------------------------------------------------

Tente usar assim:

local MIN = 900
local MAX = 1100
local EMPTY_POTION = 7635 
local vocations = {4, 8, 12}

local exhaust = createConditionObject(CONDITION_EXHAUST)
 setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100)) 

function onUse(cid, item, fromPosition, itemEx, toPosition)
     if isPlayer(itemEx.uid) == false then
        return false
     end 

    if hasCondition(cid, CONDITION_EXHAUST_HEAL) == true then
         doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
        return true
     end 

    if(not isInArray(vocations, getPlayerVocation(cid))) or getPlayerLevel(itemEx.uid) < 130) and getPlayerCustomFlagValue(itemEx.uid, PlayerCustomFlag_GamemasterPrivileges) == false) then
         doCreatureSay(itemEx.uid, "Only knights of level 130 or above may drink this fluid.", TALKTYPE_ORANGE_1)
        return true
     end 

    if doCreatureAddHealth(itemEx.uid, math.random(MIN, MAX)) == LUA_ERROR then
        return false
     end 

    doAddCondition(cid, exhaust)
    doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_RED)
    doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
   return true
end

 

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

Postado
  • Solução

Você está com problemas com a função isKnight, ela apenas checa o id de vocation 4,8. Tente atualizar, procure na lib do seu servidor, e atualize.

 

#edit

@Wakon

Para que utilizar um isInArray sendo que ele poderia simplesmente colocar um ,12 na lib? :p

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

discord.pngDiscord: vankk #7765

Precisando de ajuda? Entre em contato comigo via Discord.

 

Muitos vêm seus muitos dias de glória, mas poucos vêm seus muitos dias de luta.

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