Ir para conteúdo

[SPELL] BUFF DE HP E DEF PARA PT


Posts Recomendados

Bem, para quem joga outros jogos já devem conhecer, ao dar a magia, o player buffa todo sua PT.

Esse buff da uma PORCENTAGEM de HP e SHIELD conforme os status de cada player...

 

ex: o Fulano tem 2000 de health e 50 de shield, com o buff ele ficará com 2400 de health e 70 de shield durante 5 segundos caso seja configurado com 20% e 5 segundos de tempo...

 

Primeiramente vá em data/creaturescript/scripts/login.lua e adicione:

	if ((getPlayerStorageValue(cid, 99971)) > 1) then			setCreatureMaxHealth(cid,getCreatureMaxHealth(cid) - getPlayerStorageValue(cid, 99971))			 doPlayerSetStorageValue(cid, 99971, 0)			 doCreatureAddHealth(cid, 1)		     doCreatureAddHealth(cid, -1)	end

 

Abra o data/spells/spells.xml e adicione a seguinte tag:

<instant name="HPDEF Party" words="utito mas hpdef" lvl="32" mana="60" prem="1" aggressive="0" selftarget="1" needlearn="0" event="script" value="party/hpdef.lua">		<vocation id="8"/>	</instant>

 

Crie um arquivo dentro da pasta data/spells/scripts/party/ com o nome hpdef.lua e cole o código:

 

local combat = createCombatObject()local area = createCombatArea(AREA_CROSS5X5)setCombatArea(combat, area)setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)local config = {cooldown = 15, -- tempo entre uma magia e outratempo = 5, -- tempo em segundos que ficará com o buffporcentohp = 100, --- porcentagem da vida que vai addporcentoshield = 100, --- porcentagem da vida que vai addstorage = 45382, -- storage do tempo strlife = 99971, -- storage da vida tempoparaacabar = 10,baseMana = 90,hardcoreManaSpent = getConfigValue("addManaSpentInPvPZone")}function onCastSpell(cid, var)		local pos, membersList = getCreaturePosition(cid), getPartyMembers(cid)	if(membersList == nil or type(membersList) ~= 'table' or table.maxn(membersList) <= 1) then		doPlayerSendDefaultCancel(cid, RETURNVALUE_NOPARTYMEMBERSINRANGE)		doSendMagicEffect(pos, CONST_ME_POFF)		return false	end	local affectedList = {}	for _, pid in ipairs(membersList) do		if(getDistanceBetween(getCreaturePosition(pid), pos) <= 36) then			table.insert(affectedList, pid)		end	end	local tmp = table.maxn(affectedList)	if(tmp <= 1) then		doPlayerSendDefaultCancel(cid, RETURNVALUE_NOPARTYMEMBERSINRANGE)		doSendMagicEffect(pos, CONST_ME_POFF)		return false	end	local mana = math.ceil((0.9 ^ (tmp - 1) * config.baseMana) * tmp)	if(getCreatureMana(cid) < mana) then		doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTENOUGHMANA)		doSendMagicEffect(pos, CONST_ME_POFF)		return false	end	if(not doCombat(cid, combat, var)) then		doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)		doSendMagicEffect(pos, CONST_ME_POFF)		return false	end	doCreatureAddMana(cid, -(mana - config.baseMana), false)	if(not getPlayerFlagValue(cid, PlayerFlag_NotGainMana) and (not getTileInfo(getThingPosition(cid)).hardcore or config.hardcoreManaSpent)) then		doPlayerAddSpentMana(cid, (mana - config.baseMana))	end	for _, pid in ipairs(affectedList) do	if os.time() - getPlayerStorageValue(pid, config.storage) >= config.cooldown thenlocal lifeMAX = math.ceil(getCreatureMaxHealth(pid) * (config.porcentohp)/100)local ShieldMAX = math.ceil(getPlayerSkill(pid, 5) * (config.porcentoshield)/100)  --- add % shieldlocal condition = createConditionObject(CONDITION_ATTRIBUTES)setConditionParam(condition, CONDITION_PARAM_SUBID, 2)setConditionParam(condition, CONDITION_PARAM_BUFF, true)setConditionParam(condition, CONDITION_PARAM_TICKS, 1000* config.tempoparaacabar)setConditionParam(condition, CONDITION_PARAM_SKILL_SHIELD, ShieldMAX) ------  --- add % hp ----addEvent(function()	if isCreature(pid) then	local pos = getPlayerPosition(pid)			doAddCondition(pid, condition)            setCreatureMaxHealth(pid,getCreatureMaxHealth(pid)+lifeMAX)			doPlayerSetStorageValue(pid, config.strlife, lifeMAX)			doCreatureAddHealth(pid, 1)			doCreatureAddHealth(pid, -1)            doSendAnimatedText(pos, "+"..lifeMAX , TEXTCOLOR_GREEN)				doSendAnimatedText(pos, "+"..ShieldMAX , TEXTCOLOR_YELLOW)					endend, 1* 1) -- instantaneo ---------  --- remove hp ---- addEvent(function()	if isCreature(pid) then	local pos = getPlayerPosition(pid)            setCreatureMaxHealth(pid,getCreatureMaxHealth(pid) - lifeMAX)			doPlayerSetStorageValue(pid, config.strlife, 0)			doCreatureAddHealth(pid, 1)			doCreatureAddHealth(pid, -1)			doSendAnimatedText(pos, "-"..lifeMAX , TEXTCOLOR_GREEN)			doSendAnimatedText(pos, "-"..ShieldMAX , TEXTCOLOR_YELLOW)			endend, 1000* config.tempoparaacabar)  doPlayerSetStorageValue(pid, config.strlife, 0)doPlayerSetStorageValue(pid, config.storage, os.time())elsedoPlayerSendCancel(pid, "Aguardem "..(config.cooldown - (os.time() - getPlayerStorageValue(cid, config.storage))).." segundos para usarnovamente.")end	end	return trueend

 

 

 

Acho que é isso! estou procurando algum servidor para ajudar, se alguém precisar... um grande abraço!

Editado por Ultron AV
Link para o comentário
Compartilhar em outros sites

  • 5 months later...
×
×
  • Criar Novo...