Ir para conteúdo

Featured Replies

Postado

.Qual servidor ou website você utiliza como base? 

tfs 0.4

Qual o motivo deste tópico? 

Estou com problema na script

Está surgindo algum erro? Se sim coloque-o aqui. 

Citar

[Error - Spell Interface]
data/spells/scripts/PH/Silence.lua:onCastSpell
Description:
data/spells/scripts/PH/Silence.lua:20: attempt to call global 'Creature' (a nil value)
stack traceback:
        data/spells/scripts/PH/Silence.lua:20: in function <data/spells/scripts/PH/Silence.lua:19>
 

 

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

Spoiler

local tarmonster = true -- Can we cast this spell on monsters. Default is true
local ptime = 8000 -- This is how long the spell will last on a Player. Default is 8 seconds = 8000
local mtime = 10000 -- This is how long the spell will last on a Monster. Default is 10 seconds = 10000

local pcombat = createCombatObject()
setCombatParam(pcombat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
setCombatParam(pcombat, COMBAT_PARAM_AGGRESSIVE, true)
local pcondition = createConditionObject(CONDITION_MUTED)
setConditionParam(pcondition, CONDITION_PARAM_TICKS, ptime)
setCombatCondition(pcombat, pcondition)

local mcombat = createCombatObject()
setCombatParam(mcombat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
setCombatParam(mcombat, COMBAT_PARAM_AGGRESSIVE, true)
local mcondition = createConditionObject(CONDITION_MUTED)
setConditionParam(mcondition, CONDITION_PARAM_TICKS, mtime)
setCombatCondition(mcombat, mcondition)

function onCastSpell(cid, var)
local creature = Creature(cid)
local tar = creature:getTarget()

    if tar:getCondition(CONDITION_MUTED) then -- check right away if muted
        creature:sendTextMessage(MESSAGE_STATUS_SMALL, "This creature is already muted")
        return false
    else -- if not muted
        if tar:isPlayer() then -- check if player
            tar:say("^SILENCED^",TALKTYPE_MONSTER_SAY)
            return doCombat(tar, pcombat, var) -- return the combat
        end
        if tar:isMonster() and tarmonster then -- check if it effects monster and if it is a monster
            tar:say("^SILENCED^",TALKTYPE_MONSTER_SAY)
            return doCombat(tar, mcombat, var) -- return the combat
        else
            creature:sendTextMessage(MESSAGE_STATUS_SMALL, "You can only use this spell on Players.")
            return false
        end
    end
end

 

Ela deveria dar silence no player.

 

 

----------------EDIT-------------------

Consegui outra magia que funciona, mas queria fazer umas alterações nela, o player que recebe o muted, aparece em cima do personagem (você foi silenciado por x segundos).

Spoiler

local condition = createConditionObject(CONDITION_MUTED)
setConditionParam(condition, CONDITION_PARAM_TICKS, 2000)

local chance = 60

function silence(tar, text)
    if(isCreature(tar) == true) then
        doSendAnimatedText(getCreaturePosition(tar), text, 215)
        doAddCondition(tar, condition)
    end
    return true
end


function onCastSpell(cid, var)
    local tar = getCreatureTarget(cid)
    if hasCondition(tar, CONDITION_MUTED) == true then
        return false
    else
        if isCreature(tar) == true then
if math.random(1,100) <= chance then
local text = "SILENCE"
                    silence(tar, text)     
else
local text = "MISS"
doSendAnimatedText(getCreaturePosition(tar), text, 215)
end
        else
            if isPlayer(cid) == true then
                doPlayerSendCancel(cid, "Silence can be cast only on other creatures.")
            end
            return false
        end
    end
    return true
end 

 

 

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

  • Respostas 5
  • Visualizações 1.3k
  • Created
  • Última resposta

Top Posters In This Topic

Postado

Testa Ai:

Obs: Adicionei Um Exhaustion De 30 Segundos Dentro Do Spell Mesmo

Spoiler

-- Edited By Thony .D Serv
local condition = createConditionObject(CONDITION_MUTED)
setConditionParam(condition, CONDITION_PARAM_TICKS, 3000)

local chance = 75 -- Para Alterar A Chance De Acerto Mude O (75)

function silence(tar, text)
    if(isCreature(tar) == true) then
        doSendAnimatedText(getCreaturePosition(tar), text, 215)
        doAddCondition(tar, condition)
    end
    return true
end

function onCastSpell(cid, var)
	if exhaustion.check(cid, 13117) == TRUE then
		doPlayerSendCancel(cid, "Podera usar novamente dentro de 30 segundos.")
		doSendMagicEffect(getCreaturePosition(cid), 2)
		return false
	end
	local tar = getCreatureTarget(cid)
	if hasCondition(tar, CONDITION_MUTED) == true then
		return false
	else
		if isCreature(tar) == true then
			if math.random(1,100) <= chance then
				local text = "Muted 30s"
				silence(tar, text)     
			else
				local text = "MISS"
				doSendAnimatedText(getCreaturePosition(tar), text, 215)
			end
			else
				if isCreature(cid) == true then
					doPlayerSendCancel(cid, "Silence can be cast only on other creatures.")
				end
			return false
		end
	end
	exhaustion.set(cid, 13117, 30.0) -- Para Altera O Tempo De Exhaustion Mude O (30.0) --
	return true
end

 

 

Se Solucionar Seu Problema Não Esquece De Marcar Como Melhor Resposta E Meu Rep++ <3

Editado por Thony D. Serv (veja o histórico de edições)

  • 2 years later...
Postado

Desculpa reviver esse tópico, mas teria alguma forma de fazer esse script além de aparecer o texto (SILENCE) no target também soltar 1 efeito? 


 

Citar

 

local condition = createConditionObject(CONDITION_MUTED)
setConditionParam(condition, CONDITION_PARAM_TICKS, 3000)

local chance = 99

function silence(tar, text)
    if(isCreature(tar) == true) then
        doSendAnimatedText(getCreaturePosition(tar), text, 215)
        doAddCondition(tar, condition)
    end
    return true
end

function onCastSpell(cid, var)
    if exhaustion.check(cid, 13117) == TRUE then
        doPlayerSendCancel(cid, "Podera usar novamente dentro de 30 segundos.")
        doSendMagicEffect(getCreaturePosition(cid), 2)
        return false
    end
    local tar = getCreatureTarget(cid)
    if hasCondition(tar, CONDITION_MUTED) == true then
        return false
    else
        if isCreature(tar) == true then
            if math.random(1,100) <= chance then
                local text = "SILENCE"
                silence(tar, text)     
            else
                local text = "MISS"
                doSendAnimatedText(getCreaturePosition(tar), text, 215)
            end
            else
                if isCreature(cid) == true then
                    doPlayerSendCancel(cid, "Silence can be cast only on other creatures.")
                end
            return false
        end
    end
    exhaustion.set(cid, 13117, 30.0)
    return true
end

 

 

Postado
37 minutos atrás, King Laker disse:

@xwarlleyx abaixo de "local text" coloque
 


doSendMagicEffect(getCreaturePosition(tar), NUMERO DO EFFECT)

 

Desta forma? 

Citar

local condition = createConditionObject(CONDITION_MUTED)
setConditionParam(condition, CONDITION_PARAM_TICKS, 3000)

local chance = 99

function silence(tar, text)
    if(isCreature(tar) == true) then
        doSendAnimatedText(getCreaturePosition(tar), text, 215)
        doAddCondition(tar, condition)
    end
    return true
end

function onCastSpell(cid, var)
    if exhaustion.check(cid, 13117) == TRUE then
        doPlayerSendCancel(cid, "Podera usar novamente dentro de 30 segundos.")
        doSendMagicEffect(getCreaturePosition(cid), 2)
        return false
    end
    local tar = getCreatureTarget(cid)
    if hasCondition(tar, CONDITION_MUTED) == true then
        return false
    else
        if isCreature(tar) == true then
            if math.random(1,100) <= chance then
                local text = "SILENCE"
                doSendMagicEffect(getCreaturePosition(tar), 742)
                silence(tar, text)     
            else
                local text = "MISS"
                doSendAnimatedText(getCreaturePosition(tar), text, 215)
            end
            else
                if isCreature(cid) == true then
                    doPlayerSendCancel(cid, "Silence can be cast only on other creatures.")
                end
            return false
        end
    end
    exhaustion.set(cid, 13117, 30.0)
    return true
end

 

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.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo