Jump to content
×
×
  • Create New...
  • 0

Transformar Runa em Instant + Erro com magia que usar vida


Question

Versão do Servidor: TFS - 0.4
Tipo de Script: spell
Código:
 

    

Prezados, boa tarde.

Venho recorrer à vocês mais uma vez para sanar dúvidas de script de spells.

Primeiramente, gostaria de criar uma spell igual ao exori mort mas que consume vida no lugar de mana. Tentei usar o código abaixo mas o servidor crasha, imagino que seja por causa do doCreatureAddHealth(cid, -10) já que a magia é target creio que isso esteja causando algum tipo de conflito.

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH)

function onGetFormulaValues(cid, level, skill, attack, factor)													
local mina, minb, maxa, maxb, minl, maxl, minm, maxm = -1, -10, -1, -20, 5, 5, 1.4, 2.1
local lvl = getPlayerLevel(cid)
local preta = getPlayerSkillLevel(cid, 3)
	min = ((lvl / minl + preta * minm) * 1. * mina + minb)
	max = ((lvl / maxl + preta * maxm) * 1. * maxa + maxb) * 1.5
	return min, max
end

setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

function onCastSpell(cid, var)
	if getCreatureHealth(cid) >= 11 then
     return doCombat(cid, combat, var), doCreatureAddHealth(cid, -10)
	 else
	 doPlayerSendCancel(cid, "Você não possui vida suficiente.")
	 return false
	 end
end

No outro caso, gostaria de transformar runas em magias instants e target. Como exemplo, segue o script da Fireball e Fire Bomb. (exemplo: o player casta a spell e o efeito é como se ele estivesse usando a runa centrada no target que ele está atacando).

Fireball:

Script Fireball:

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_FIREATTACK)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -1, -10, -1, -15, 5, 5, 1.8, 3, -20, -40)

function onCastSpell(cid, var)
	return doCombat(cid, combat, var)
end

Tag xml Fireball:
	<conjure name="Fireball" words="adori flam" lvl="27" mana="460" soul="3" prem="1" reagentId="2260" conjureId="2302" conjureCount="5" exhaustion="1000" needlearn="1" event="function" value="conjureRune">
		<vocation id="1"/>
		<vocation id="5"/>
	</conjure>

Fire Bomb:

Script Fire Bomb:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HITBYFIRE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)
setCombatParam(combat, COMBAT_PARAM_CREATEITEM, 1492)

local area = createCombatArea(AREA_SQUARE1X1)
setCombatArea(combat, area)

function onCastSpell(cid, var)
	return doCombat(cid, combat, var)
end

Tag xml Fire Bomb:
	<conjure name="Firebomb" words="adevo mas flam" lvl="27" mana="600" soul="4" reagentId="2260" conjureId="2305" conjureCount="2" exhaustion="1000" needlearn="1" event="function" value="conjureRune">
		<vocation id="1"/>
		<vocation id="2"/>
		<vocation id="5"/>
		<vocation id="6"/>
	</conjure>

Grato pela atenção!

Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now