Ir para conteúdo
Entre para seguir isso  
Lwkass

Limit Break System (v2) !

Recommended Posts

Lwkass    1
Lwkass

┌──────────────────────────────────────────────────┐

Nome: Limit Break

Versão do script: 2.0.0

Tipo do script: Creature Script

Servidor Testado: The Forgotten Server 0.4 Doomed Elderberry

Autor: Lwkass

──────────────────────────────────────────────────┘

 

 

O Script é simples e baseado em um sistema do FF7, a cada hit que o player levar, ele carrega uma porcentagem de limit break e quando chegar a 100% o próximo hit melee (melee = ataque normal) liberará o Limit Break.

 

Caracteristicas:

~ O Player precisa perder 70% da vida total para carregar 100% do limit break, precisa perder e não necessariamente estar com 30% da vida.

~ O Hit do Limit Break tem uma formula propria que se baseia no level, no attack da arma que está sendo usada e no level do Limit Break.

+ Formula de dano Min = (Level*2.5+(WeaponAttack + WeaponExtraAttack)*0.8+LimitBreakLevel*3.6)

+ Formula de dano Max = (Level*3.5+(WeaponAttack + WeaponExtraAttack)*0.8+LimitBreakLevel*4.9)

~ Quanto mais se usa o Limit Break, mais forte ele fica !

~ Pode-se usar tanto dano melee ou definir uma magia especifica para o Limit Break (requer ativação no script e ter minha Lib de Spell)

Scripts:

 

Na pasta data/creaturescripts/scripts, salve os dois scripts abaixo:

 

limitbreaker.lua

------------------------------------------------
-- Limit Breaker System
-- By: Lwkass from OTServBrasil

dofile("data/lib/limitBreakerLib.lua")

function onStatsChange(cid, attacker, type, combat, value) 
if (combat == COMBAT_HEALING) then return true end
   multiplier = (combat == COMBAT_PHYSICALDAMAGE  and 1 or 1.5)
   limitBreak = LimitBreak:get(cid)

   if (limitBreak.percent < 100) then
   	limitBreak(limitBreak.percent + math.ceil(((value*100)/(getCreatureMaxHealth(cid)*0.7)) * multiplier))
       doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You charged +' .. math.ceil(((value*100)/(getCreatureMaxHealth(cid)*0.7)) * multiplier) .. '% of Limit Break [' .. limitBreak.percent .. '%/100%]' .. (isCreature(attacker) and (' by a attack of ' .. getCreatureName(attacker)) or '') .. '.')
   else
       doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your Limit Break is full !")
       doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_RED)
   end
   return true
end

-- By: Lwkass from OTServBrasil

--

limitbreaker_release.lua

------------------------------------------------
-- Limit Breaker System
-- By: Lwkass from OTServBrasil

dofile("data/lib/limitBreakerLib.lua")

function onAttack(cid, target)
limitBreak = LimitBreak:get(cid)

   if (limitBreak.percent >= 100) then
   	if (getDistanceBetween(getThingPos(cid), getThingPos(target)) <= 1) then
	    doCreatureSay(cid, "Arghh!", TALKTYPE_MONSTER)
	    doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_RED)
	    limitBreak:cast(target)
	    limitBreak(0)
	    limitBreak:addExp(1)
       else
       	doPlayerSendDefaultCancel(cid, RETURNVALUE_DESTINATIONOUTOFREACH)
       end
   end
   return true
end

-- By: Lwkass from OTServBrasil

 

Agora no arquivo creaturescripts.xml da pasta data/creaturescripts, adicione:

    <event type="statschange" name="limitbreaker" event="script" value="limitbreaker.lua"/>
   <event type="attack" name="limitbreaker_release" event="script" value="limitbreaker_release.lua"/>

Aproveitando, na pasta data/creaturescripts/scripts, no arquivo login.lua do seu servidor, adicione essas linhas antes do return:

    registerCreatureEvent(cid, "limitbreaker")
   registerCreatureEvent(cid, "limitbreaker_release")

Só mais uma coisinha, na pasta data/lib (caso não exista a pasta lib, crie) crie um arquivo com o nome limitBreakerLib.lua e salve isso dentro:

------------------------------------------------
-- Limit Breaker System
-- By: Lwkass from OTServBrasil

local config = {
OPTION_CAST_SPELL = false, -- Cast spell when limit break is full
EXP_RATING = 1, -- Exp rating of limit break exp || (exp * rating).
   STORAGE_LIMIT_PERCENT = 13015,
   STORAGE_LIMIT_LEVEL = 13016,
   STORAGE_LIMIT_EXP = 13017
}

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

LimitBreak = {}

function LimitBreak:get(cid)
_lb = setmetatable({
	player = cid,
	level = getPlayerStorageValue(cid, config.STORAGE_LIMIT_LEVEL),
	percent = getPlayerStorageValue(cid, config.STORAGE_LIMIT_PERCENT)
},  { 
	__index = self,
	__call = function(t, p) if (p > 100) then p = 100 end rawset(t, 'percent', p); setPlayerStorageValue(cid, config.STORAGE_LIMIT_PERCENT, p) end 
})

if (config.OPTION_CAST_SPELL) then
	-- spell
	limitBreak_spell = Spell:create("Limit Break", SPELL_TYPE_AREA, { maxDistance = 1 })
	local weapon = (getPlayerWeapon(cid).uid > 0 and (((getItemInfo(getPlayerWeapon(cid).itemid)["attack"]) + getItemInfo(getPlayerWeapon(cid).itemid)["extraAttack"])*0.8) or 1)
	limitBreak_spell:setDefaultTile(SpellTile:create(COMBAT_PHYSICALDAMAGE, 34, {min = -(getPlayerLevel(cid)*3.6 + weapon), max = -(getPlayerLevel(cid)*4.9 + weapon)}))
	limitBreak_spell:setArea({
		{1, 1, 1},
		{1, 3, 1},
		{1, 1, 1}
	})

	_lb:setSpell(limitBreak_spell)
end
return _lb
end

function LimitBreak:getSpell() 			return self.spell 		end
function LimitBreak:setSpell(spell) 	self.spell = spell 		end

function LimitBreak:cast(target)
if (self:getLevel() < 0) then self:setLevel(1) end
   if (self:getExp() < 0) then self:setExp(0) end

if (config.OPTION_CAST_SPELL and self:getSpell()) then
	self:getSpell():cast(self.player)
else
	local weapon = (getPlayerWeapon(self.player).uid > 0 and (((getItemInfo(getPlayerWeapon(self.player).itemid)["attack"]) + getItemInfo(getPlayerWeapon(self.player).itemid)["extraAttack"])*0.8) or 0)
	doTargetCombatHealth(self.player, target, COMBAT_PHYSICALDAMAGE, -(getPlayerLevel(self.player) * 2.5 + weapon + self:getLevel() * 3.6), -(getPlayerLevel(self.player) * 3.5 + weapon + self:getLevel() * 4.9), 34)
end
end

function LimitBreak:setLevel(lvl) 	setPlayerStorageValue(self.player, config.STORAGE_LIMIT_LEVEL, lvl) 		end
function LimitBreak:getLevel()		return getPlayerStorageValue(self.player, config.STORAGE_LIMIT_LEVEL)	 	end
function LimitBreak:addLevel(n)		n = n or 1; self:setLevel(self:getLevel() + n) 								end

function LimitBreak:setExp(xp)		setPlayerStorageValue(self.player, config.STORAGE_LIMIT_EXP, xp)			end
function LimitBreak:getExp()		return getPlayerStorageValue(self.player, config.STORAGE_LIMIT_EXP) 		end
function LimitBreak:addExp(xp)
xp = (xp or 1) * config.EXP_RATING
self:setExp(self:getExp() + xp)	
if (self:getExp() >= (self:getLevel() * 2)) then
	self:setExp(0)
	self:addLevel()
	doPlayerSendTextMessage(self.player, MESSAGE_EVENT_ORANGE, "Your Limit Break is level " .. self:getLevel() .. " now.")
       doSendMagicEffect(getThingPos(self.player), CONST_ME_MAGIC_GREEN)
end
end

-- By: Lwkass from OTServBrasil

Fiz uma lib pra ficar mais organizado.

 

A spell deve ser definida no arquivo limitBreakerLib.lua onde está marcado "--spell", funciona apenas com a minha Lib de Spell, mas, por padrão está definida uma magia que pega em volta do player (foto abaixo).

Precisa também ir na parte das configurações do Limit Break e definir OPTION_CAST_SPELL como true (na linha 6 do limitBreakerLib.lua)

 

----

 

Screenshot:

statuss.png

Mensagem quando se leva algum hit.

 

limibreak01.png

Limit Break como Dano Melee.

 

limibreak02.png

Limit Break como Spell.

 

ChangeLog:

03/09/11 - v2.0.0:

- Nível do Limit Break adicionado.

- Pode-se definir uma spell quando ativar o Limit Break (requer ativação no script e ter minha Lib de Spell).

- Formula modificada, agora também se baseia no nível do Limit Break.

- Mensagens e efeitos modificados.

- Agora a mensagem quando o Limit Break está cheio fica aparecendo enquanto não usar.

- Quando se perde dano por fields (fire field, energy field, etc...) também se ganha porcentagem de Limit Break.

- Só se pode ativar o Limit quando o target estiver a no máximo 1 sqm de distancia.

- Agora usando "POO".

 

Prontinho

Qualquer dúvida/sugestão só falar

Ta simplesinho o sistema, mas é provável que eu adicione mais coisas depois

Editado por Lwkass

Compartilhar este post


Link para o post
Socket    0
Socket

Simplesmente incrível, script simples porém genial. Nada mais a dizer.

 

Atenciosamente, Socket.

Compartilhar este post


Link para o post
gpedro    47
gpedro

Niiiice,

thanks for posting.

Compartilhar este post


Link para o post
josejunior23    2
josejunior23

Ótima idea!!! Parabéns!

Compartilhar este post


Link para o post
boladuu    0
boladuu

Muito bom, nao so o script mas tmb a ideia. Meus parabens

 

Edit@

 

Eu testei e funcionou, so que o problema é que nao da pra usar potions mais, a versao que testei foi a do Globr

 

Msg do console:

[02/08/2011 14:56:20] [Error - CreatureScript Interface]

[02/08/2011 14:56:20] data/creaturescripts/scripts/limitbreaker.lua:onStatsChange

[02/08/2011 14:56:20] Description:

[02/08/2011 14:56:20] (luaGetCreatureName) Creature not found

 

[02/08/2011 14:56:20] [Error - CreatureScript Interface]

[02/08/2011 14:56:20] data/creaturescripts/scripts/limitbreaker.lua:onStatsChange

[02/08/2011 14:56:20] Description:

[02/08/2011 14:56:20] data/creaturescripts/scripts/limitbreaker.lua:12: attempt to concatenate a boolean value

[02/08/2011 14:56:20] stack traceback:

[02/08/2011 14:56:20] data/creaturescripts/scripts/limitbreaker.lua:12: in function <data/creaturescripts/scripts/limitbreaker.lua:7>

Editado por boladuu

Compartilhar este post


Link para o post
Bloodslayer    0
Bloodslayer

legal, gostei da ideia.

Compartilhar este post


Link para o post
Captha    0
Captha

cara, mt perfect, simples e bem bolado, Parabens.

Compartilhar este post


Link para o post
Lwkass    1
Lwkass

@boladuu:

tenta ver se vc instalou corretamente, mas em qualquer caso tenta substituir o script limitbreaker.lua por esse:

 

------------------------------------------------
-- Limit Breaker System
-- By: Lwkass from OTServBrasil

dofile("data/lib/limitBreakerLib.lua")

function onStatsChange(cid, attacker, type, combat, value)
   multiplier = (combat == COMBAT_HEALING and 0 or (combat == COMBAT_PHYSICALDAMAGE  and 1 or 1.5))

   if (getLimitPercent(cid) < 100) then
       addLimitPercent(cid, math.ceil(((value*100)/(getCreatureMaxHealth(cid)*0.7)) * multiplier))
       doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You charged +' .. math.ceil(((value*100)/(getCreatureMaxHealth(cid)*0.7)) * multiplier) .. '% of Limit Breaker [' .. getLimitPercent(cid) .. '%/100%] ' .. (if attacker and ('by a attack of ' .. getCreatureName(attacker) .. '.') or ''))
   elseif (getLimitPercent(cid) == 100) then
       doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your Limit Breaker is Full !")
       doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_GREEN)
       setLimitPercent(cid, 101)
   end
   return true
end

-- By: Lwkass from OTServBrasil

Compartilhar este post


Link para o post
Biozard    0
Biozard

parece que o limitbreaker.lua nao esta funcionando...eu ataco e nao ganho as %...porem se eu fazer um setPlayerStorageValue(cid, 13015, 101) ele da o ataque limit break...

Compartilhar este post


Link para o post
Lwkass    1
Lwkass

#Biozard:

Então, diga qual erro apareceu no seu console (se caso apareceu) e a versão do seu servidor

Compartilhar este post


Link para o post
Biozard    0
Biozard
#Biozard:

Então, diga qual erro apareceu no seu console (se caso apareceu) e a versão do seu servidor

 

 

Não aparece erro, e to usando TFS 0.3.6 8.54

 

 

@Edit

Agora que vi vc fez no TFS 0.4...

Compartilhar este post


Link para o post
Lwkass    1
Lwkass

#Biozard:

Mesmo assim, acredito eu que era pra ter funcionado ou aparecido algum erro, tente reinstalar o sistema, pode estar faltando alguma coisa

Compartilhar este post


Link para o post
asumamen    0
asumamen

Show vlw por posta

vo testa aki no ot

Compartilhar este post


Link para o post
Biozard    0
Biozard
#Biozard:

Mesmo assim, acredito eu que era pra ter funcionado ou aparecido algum erro, tente reinstalar o sistema, pode estar faltando alguma coisa

 

Ja reinstalei, onde vc pego esse server que crio o sistema?

Compartilhar este post


Link para o post
Chrisbp    0
Chrisbp

Continuando dando uma olhada no forum, n pude passar aqui sem deixar essa msg. Ótimo o script, realmente cara vc manda mt bem no que faz!

Compartilhar este post


Link para o post
Biozard    0
Biozard

@Lwkass

 

Testei no server que voce mando...tb nao deu, deu o mesmo problema que no TFS 0.3.6

Compartilhar este post


Link para o post
Lwkass    1
Lwkass

#Biozard:

Tente verificar novamente se você instalou tudo certinho e adicionou as tags corretas no xml, caso tenha feito isso, ai já não sei dizer qual pode ser o problema ;s

Compartilhar este post


Link para o post
bregola    0
bregola

Lwkass, cara gostei muito do teu script, mas tem um problema, ele sempre da erro no console, quando o char levar dano por ex: de um fire field... ai vai fica aparecendo "<getcreaturename> creature not found", entao seria interessante que voce tentasse contornar essa situação, fora isso, parabens, ficou muito interessante.

 

@EDIT: Bom, consegui contornar a situaçao, mas tive que sacrificar o <getcreaturename>... agora ficando assim...

 

"17:56 You charged +1% of Limit Breaker [15%/100%]"

 

e a adaptaçao...

 

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

-- Limit Breaker System

-- By: Lwkass from OTServBrasil

 

dofile("data/lib/limitBreakerLib.lua")

 

function onStatsChange(cid, attacker, type, combat, value)

multiplier = (combat == COMBAT_HEALING and 0 or (combat == COMBAT_PHYSICALDAMAGE and 1 or 1.5))

 

if (getLimitPercent(cid) < 100) then

addLimitPercent(cid, math.ceil(((value*100)/(getCreatureMaxHealth(cid)*0.7)) * multiplier))

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You charged +' .. math.ceil(((value*100)/(getCreatureMaxHealth(cid)*0.7)) * multiplier) .. '% of Limit Breaker [' .. getLimitPercent(cid) .. '%/100%]')

elseif (getLimitPercent(cid) == 100) then

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your Limit Breaker is Full !")

doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_GREEN)

setLimitPercent(cid, 101)

end

return true

end

 

-- By: Lwkass from OTServBrasil

Editado por bregola

Compartilhar este post


Link para o post
Lwkass    1
Lwkass

#bregola:

Nossa realmente, não tinha pensado nesse caso de ser field, mas eu tinha postado essa versão para arrumar um erro que era parecido com esse que você teve, tente usar esse:

------------------------------------------------
-- Limit Breaker System
-- By: Lwkass from OTServBrasil

dofile("data/lib/limitBreakerLib.lua")

function onStatsChange(cid, attacker, type, combat, value)
   multiplier = (combat == COMBAT_HEALING and 0 or (combat == COMBAT_PHYSICALDAMAGE  and 1 or 1.5))

   if (getLimitPercent(cid) < 100) then
       addLimitPercent(cid, math.ceil(((value*100)/(getCreatureMaxHealth(cid)*0.7)) * multiplier))
       doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You charged +' .. math.ceil(((value*100)/(getCreatureMaxHealth(cid)*0.7)) * multiplier) .. '% of Limit Breaker [' .. getLimitPercent(cid) .. '%/100%] ' .. (if attacker and ('by a attack of ' .. getCreatureName(attacker) .. '.') or ''))
   elseif (getLimitPercent(cid) == 100) then
       doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your Limit Breaker is Full !")
       doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_GREEN)
       setLimitPercent(cid, 101)
   end
   return true
end

 

Só vai aparecer o nome se for uma criatura, mas eu não testei ainda, não dou 100% de certeza que esteja funcionando corretamente.

Mas obrigado por avisar sobre essa falha o/

Compartilhar este post


Link para o post
Visitante
Este tópico está impedido de receber novos posts.
Entre para seguir isso  
  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×