Ir para conteúdo

Featured Replies

Postado

Eu adaptei(ou pelomenos tentei) o sistema de critical (se não me engano, do xWhiteWolf). Meu objetivo era um sistema de critical que pudesse ser upado a partir de ataque.

E ao atacar, ter uma chance de upar o level dessa skill.

Maas, não obtive sucesso. Todo dano causado está causando critical, e a skill não está upando.

Segue o código :

local lvlcrit = 48913
local multiplier = 1.5


function onStatsChange(cid, attacker, type, combat, value)
if isPlayer(attacker) and (not (attacker == cid)) and (type == STATSCHANGE_HEALTHLOSS or type == STATSCHANGE_MANALOSS)  then
if (getPlayerStorageValue(attacker, lvlcrit)*3) >= math.random (0,1000) then
dano = math.ceil(value*(multiplier))
doTargetCombatHealth(attacker, cid, combat, -dano, -dano, 255)
doSendAnimatedText(getCreaturePos(attacker), "DANO CRITICO!", 144)
return false
end
end
return true
end




  local config = {
   effectonuse = 14, -- efeito que sai
   levelscrit = 100,  --- leveis que terão
   storagecrit = 48913 -- storage que será verificado
   }


function onTarget(cid, target)
    if getPlayerStorageValue(cid, config.storagecrit) < config.levelscrit then
doSendMagicEffect(target,config.effectonuse)
doPlayerSendTextMessage(cid,22,"You advanced to critical level ["..(getPlayerStorageValue(cid, config.storagecrit)+1).."/"..config.levelscrit.."].")
setPlayerStorageValue(cid, config.storagecrit, getPlayerStorageValue(cid, config.storagecrit)+1)
elseif getPlayerStorageValue(cid, config.storagecrit) >= config.levelscrit then
doPlayerSendTextMessage(cid,22,"You advanced to critical level [100].")
    return 0
    end
return 1
end

Poderiam me ajudar ?

Postado

Não testei, porém tenta aí, se retornar algum erro, posta para analisarmos.

 

local config = {
lvlcrit = 48913
local multiplier = 1.5
levelscrit = 100
effectonuse = 14
}

function onStatsChange(cid, attacker, type, combat, value)
	if isPlayer(attacker) and (not (attacker == cid)) and (type == STATSCHANGE_HEALTHLOSS or type == STATSCHANGE_MANALOSS)  then
		if (getPlayerStorageValue(attacker, config.lvlcrit)*3) >= math.random (0,1000) then
		dano = math.ceil(value*(config.multiplier))
		doTargetCombatHealth(attacker, cid, combat, -dano, -dano, 255)
		doSendAnimatedText(getCreaturePos(attacker), "DANO CRITICO!", 144)
			return false
		end
	end
	if getPlayerStorageValue(cid, config.storagecrit) < config.levelscrit then
		doSendMagicEffect(target,config.effectonuse)
		doPlayerSendTextMessage(cid,22,"You advanced to critical level ["..(getPlayerStorageValue(cid, config.storagecrit)+1).."/"..config.levelscrit.."].")
		setPlayerStorageValue(cid, config.storagecrit, getPlayerStorageValue(cid, config.storagecrit)+1)
		elseif getPlayerStorageValue(cid, config.storagecrit) >= config.levelscrit then
		doPlayerSendTextMessage(cid,22,"You advanced to critical level [100].")
	end
		return true
end

 

 

Postado
  • Autor
31 minutos atrás, EddyHavoc disse:

Não testei, porém tenta aí, se retornar algum erro, posta para analisarmos.

 


local config = {
lvlcrit = 48913
local multiplier = 1.5
levelscrit = 100
effectonuse = 14
}

function onStatsChange(cid, attacker, type, combat, value)
	if isPlayer(attacker) and (not (attacker == cid)) and (type == STATSCHANGE_HEALTHLOSS or type == STATSCHANGE_MANALOSS)  then
		if (getPlayerStorageValue(attacker, config.lvlcrit)*3) >= math.random (0,1000) then
		dano = math.ceil(value*(config.multiplier))
		doTargetCombatHealth(attacker, cid, combat, -dano, -dano, 255)
		doSendAnimatedText(getCreaturePos(attacker), "DANO CRITICO!", 144)
			return false
		end
	end
	if getPlayerStorageValue(cid, config.storagecrit) < config.levelscrit then
		doSendMagicEffect(target,config.effectonuse)
		doPlayerSendTextMessage(cid,22,"You advanced to critical level ["..(getPlayerStorageValue(cid, config.storagecrit)+1).."/"..config.levelscrit.."].")
		setPlayerStorageValue(cid, config.storagecrit, getPlayerStorageValue(cid, config.storagecrit)+1)
		elseif getPlayerStorageValue(cid, config.storagecrit) >= config.levelscrit then
		doPlayerSendTextMessage(cid,22,"You advanced to critical level [100].")
	end
		return true
end

 

 

Nada.. Consegui fazê-lo de modo que não bugasse. Agora só me resta adicionar o sistema de leveis.. obrigado !

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.7k

Informação Importante

Confirmação de Termo