Jump to content
Close
underewarr

Scripting [Action] Help Problem

Recommended Posts

.Qual servidor ou website você utiliza como base? 

OTX3

 

Qual o motivo deste tópico? 

 

Era para adicionar as 3 condições no jogador mas ele só esta adicionando a condição bullseye alguem pode me dar um help?

é um food.

 

Você tem o código disponível? Se tiver publique-o aqui: 

local foods = {
    [29043] = {1, 'Crunch.'}, -- NEW FOOD
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local food = foods[item.itemid]
    if not food then
        return false
    end

    --player:removeCondition(CONDITION_REGENERATION, CONDITIONID_DEFAULT)

    local berserker = Condition(CONDITION_ATTRIBUTES)
    berserker:setParameter(CONDITION_PARAM_TICKS, 10 * 60 * 30000)
    berserker:setParameter(CONDITION_PARAM_SKILL_MELEE, 30 )
    local mastermind = Condition(CONDITION_ATTRIBUTES)
    mastermind:setParameter(CONDITION_PARAM_TICKS, 10 * 60 * 30000)
    mastermind:setParameter(CONDITION_PARAM_STAT_MAGICPOINTS, 30)
    local bullseye = Condition(CONDITION_ATTRIBUTES)
    bullseye:setParameter(CONDITION_PARAM_TICKS, 30 * 60 * 30000)
    bullseye:setParameter(CONDITION_PARAM_SKILL_DISTANCE, 30)
    local condition = player:getCondition(CONDITION_REGENERATION, CONDITIONID_DEFAULT)
    
    local config = {
    [29043] = berserker,
    [29043] = mastermind,
    [29043] = bullseye
}
    local useItem = config[item.itemid]
    if not useItem then
        return true
    end
    
    if condition and math.floor(condition:getTicks() / 30000 + (food[1] * 12)) >= 1200 then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, 'You are full.')
        return true
    end

    player:feed(food[1] * 12)
    player:say(food[2], TALKTYPE_MONSTER_SAY)
    player:addCondition(useItem)
    player:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
    item:remove(1)

    local client = player:getClient()
    if client.version > 1140 then
        player:updateSupplyTracker(item)
    end

    return true
end

 

 

Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui. 

 


Edited by underewarr (see edit history)

Share this post


Link to post
Share on other sites

@luanluciano93 exatamente, pensei que daria pela tabela das 3 condições lincada para o unico item mas não funcionou.

Tentei aqui de outras maneiras essa foi a unica que chegou a "funcionar"


Share this post


Link to post
Share on other sites

@luanluciano93 sim 30 minutos.


Share this post


Link to post
Share on other sites
local foods = {
    [29043] = {1, 'Crunch.'}, -- NEW FOOD
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local food = foods[item.itemid]
    if not food then
        return false
    end

    --player:removeCondition(CONDITION_REGENERATION, CONDITIONID_DEFAULT)

    local conditionFood = Condition(CONDITION_ATTRIBUTES)
    conditionFood:setParameter(CONDITION_PARAM_TICKS, 30 * 60 * 30000)
    conditionFood:setParameter(CONDITION_PARAM_SKILL_MELEE, 30)
    conditionFood:setParameter(CONDITION_PARAM_STAT_MAGICPOINTS, 30)
    local condition = player:getCondition(CONDITION_REGENERATION, CONDITIONID_DEFAULT)
    
    if condition and math.floor(condition:getTicks() / 30000 + (food[1] * 12)) >= 1200 then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, 'You are full.')
        return true
    end

    player:feed(food[1] * 12)
    player:say(food[2], TALKTYPE_MONSTER_SAY)
    player:addCondition(conditionFood)
    player:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
    item:remove(1)

    local client = player:getClient()
    if client.version > 1140 then
        player:updateSupplyTracker(item)
    end

    return true
end

 



[OTX3 - 8.60] Projeto STYLLER 2019 (Download)

 

Share this post


Link to post
Share on other sites

@luanluciano93 Funcionou , mas eu adicionei uma linha para skill distance parou de funcionar

Spoiler

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local food = food[item.itemid]
    if not food then
        return false
    end

    --player:removeCondition(CONDITION_REGENERATION, CONDITIONID_DEFAULT)

    local conditionFood = Condition(CONDITION_ATTRIBUTES)
    conditionFood:setParameter(CONDITION_PARAM_TICKS, 30 * 60 * 30000)
    conditionFood:setParameter(CONDITION_PARAM_SKILL_MELEE, 30)
    conditionFood:setParameter(CONDITION_PARAM_STAT_MAGICPOINTS, 30)
	conditionFood:setParameter(CONDITION_PARAM_SKILL_DISTANCE, 30)
    local condition = player:getCondition(CONDITION_REGENERATION, CONDITIONID_DEFAULT)
    
    if condition and math.floor(condition:getTicks() / 30000 + (food[1] * 12)) >= 1200 then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, 'You are full.')
        return true
    end

    player:feed(food[1] * 12)
    player:say(food[2], TALKTYPE_MONSTER_SAY)
    player:addCondition(conditionFood)
    player:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
    item:remove(1)

    local client = player:getClient()
    if client.version > 1140 then
        player:updateSupplyTracker(item)
    end

    return true
end

 

 

@luanluciano93 esta adicionando só a skill de sword axe e club, a magic level, não chega a ser adicionada no personagem.

bd4e2ea91c050f863e920fd602a07d82.gif

@luanluciano93 tentei fazer 2 condiçoes mas ai ele remove toda a skill do personagem para 10

Spoiler

local foods = {
    [29043] = {1, 'Crunch.'}, -- NEW FOOD
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local food = foods[item.itemid]
    if not food then
        return false
    end

    --player:removeCondition(CONDITION_REGENERATION, CONDITIONID_DEFAULT)

    local conditionFood = Condition(CONDITION_ATTRIBUTES)
    conditionFood:setParameter(CONDITION_PARAM_TICKS, 30 * 60 * 30000)
    conditionFood:setParameter(CONDITION_PARAM_SKILL_MELEE, 30)
	
	 local conditionFood1 = Condition(CONDITION_ATTRIBUTES)
    conditionFood1:setParameter(CONDITION_PARAM_TICKS, 30 * 60 * 30000)
    conditionFood1:setParameter(CONDITION_PARAM_STAT_MAGICPOINTS, 30)
	
    local condition = player:getCondition(CONDITION_REGENERATION, CONDITIONID_DEFAULT)
    
    if condition and math.floor(condition:getTicks() / 30000 + (food[1] * 12)) >= 1200 then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, 'You are full.')
        return true
    end

    player:feed(food[1] * 12)
    player:say(food[2], TALKTYPE_MONSTER_SAY)
    player:addCondition(conditionFood)
	player:addCondition(conditionFood1)
    player:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
    item:remove(1)

    local client = player:getClient()
    if client.version > 1140 then
        player:updateSupplyTracker(item)
    end

    return true
end

 

 

1896eb7168df673c3b244238fb07ddd2.gif


Edited by underewarr (see edit history)

Share this post


Link to post
Share on other sites
local foods = {
    [29043] = {1, 'Crunch.'}, -- NEW FOOD
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local food = foods[item.itemid]
    if not food then
        return false
    end

    local conditionFood = Condition(CONDITION_ATTRIBUTES)
    conditionFood:setParameter(CONDITION_PARAM_TICKS, 30 * 60 * 30000)
    conditionFood:setParameter(CONDITION_PARAM_SKILL_CLUB, 30)
	conditionFood:setParameter(CONDITION_PARAM_SKILL_SWORD, 30)
	conditionFood:setParameter(CONDITION_PARAM_SKILL_AXE, 30)
    conditionFood:setParameter(CONDITION_PARAM_STAT_MAGICPOINTS, 30)
	conditionFood:setParameter(CONDITION_PARAM_BUFF_SPELL, true)
    local condition = player:getCondition(CONDITION_REGENERATION, CONDITIONID_DEFAULT)
    
    if condition and math.floor(condition:getTicks() / 30000 + (food[1] * 12)) >= 1200 then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, 'You are full.')
        return true
    end

    player:feed(food[1] * 12)
    player:say(food[2], TALKTYPE_MONSTER_SAY)
    player:addCondition(conditionFood)
    player:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
    item:remove(1)

    local client = player:getClient()
    if client.version > 1140 then
        player:updateSupplyTracker(item)
    end

    return true
end

 



[OTX3 - 8.60] Projeto STYLLER 2019 (Download)

 

Share this post


Link to post
Share on other sites

@luanluciano93 Funcionou eu adicionei a skill distance que tambem funcionou agora, porem a magic level ainda não é adicionada.

sera um problema na source com o condition?

Spoiler

local foods = {
    [29043] = {1, 'Crunch.'}, -- NEW FOOD
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local food = foods[item.itemid]
    if not food then
        return false
    end

    local conditionFood = Condition(CONDITION_ATTRIBUTES)
    conditionFood:setParameter(CONDITION_PARAM_TICKS, 30 * 60 * 30000)
    conditionFood:setParameter(CONDITION_PARAM_SKILL_CLUB, 30)
	conditionFood:setParameter(CONDITION_PARAM_SKILL_SWORD, 30)
	conditionFood:setParameter(CONDITION_PARAM_SKILL_AXE, 30)
    conditionFood:setParameter(CONDITION_PARAM_STAT_MAGICPOINTS, 30)
	conditionFood:setParameter(CONDITION_PARAM_SKILL_DISTANCE, 30)
	conditionFood:setParameter(CONDITION_PARAM_BUFF_SPELL, true)
    local condition = player:getCondition(CONDITION_REGENERATION, CONDITIONID_DEFAULT)
    
    if condition and math.floor(condition:getTicks() / 30000 + (food[1] * 12)) >= 1200 then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, 'You are full.')
        return true
    end

    player:feed(food[1] * 12)
    player:say(food[2], TALKTYPE_MONSTER_SAY)
    player:addCondition(conditionFood)
    player:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
    item:remove(1)

    local client = player:getClient()
    if client.version > 1140 then
        player:updateSupplyTracker(item)
    end

    return true
end

 

fafca5064c4e20854ad3d7792f6c0d5e.gif

@luanluciano93aparemente mente é um problema na source porque o mastermind potion tambem não adiciona a magic level

770f1942aca8a2a09facbac999a31847.gif

Spoiler

local berserker = Condition(CONDITION_ATTRIBUTES)
berserker:setParameter(CONDITION_PARAM_TICKS, 10 * 60 * 1000)
berserker:setParameter(CONDITION_PARAM_SKILL_MELEE, 5)
berserker:setParameter(CONDITION_PARAM_SKILL_SHIELD, -10)

local mastermind = Condition(CONDITION_ATTRIBUTES)
mastermind:setParameter(CONDITION_PARAM_TICKS, 10 * 60 * 1000)
mastermind:setParameter(CONDITION_PARAM_STAT_MAGICPOINTS, 3)
mastermind:setParameter(CONDITION_PARAM_SKILL_SHIELD, -10)

local bullseye = Condition(CONDITION_ATTRIBUTES)
bullseye:setParameter(CONDITION_PARAM_TICKS, 30 * 60 * 1000)
bullseye:setParameter(CONDITION_PARAM_SKILL_DISTANCE, 5)
bullseye:setParameter(CONDITION_PARAM_SKILL_SHIELD, -10)

local config = {
	[7439] = berserker,
	[7440] = mastermind,
	[7443] = bullseye
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)

	local useItem = config[item.itemid]
	if not useItem then
		return true
	end

	if item.itemid == 7440 then
		if not player:isMage() then
			player:say('Only sorcerers and druids may drink this fluid.', TALKTYPE_MONSTER_SAY)
			return true
		end
	end

	player:addAchievementProgress('Potion Addict', 100000)
	player:addCondition(useItem)
	player:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)

	item:remove(1)
	return true
end

 

 


Share this post


Link to post
Share on other sites
16 minutos atrás, underewarr disse:

@luanluciano93 Vlw vou dar uma olhada no que esta acontecendo la então se eu solucionar eu volto aqui com o fix. tmj

 

 


Edited by underewarr (see edit history)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


Open Tibia Server

Quer aprender a criar seu próprio servidor de Tibia? Então está no lugar certo, aqui você encontrará milhares de tutorias, scripts, códigos, mapas e utilitários para que você possa fazer o seu próprio servidor de Tibia partindo do zero.

Redes Sociais

Anuncie no Tibia King

Precisa de mais visibilidade em seus projetos? Quer publicidade para o seu servidor? Anuncie no Tibia King e faça sua divulgação, possuímos centenas de acessos simultâneos e milhares diários, com certeza será a sua solução! A publicação do seu anuncio é instantânea!

×
×
  • Create New...