Ir para conteúdo
  • 0

Criar combo/magias continuas


kelphs

Pergunta

Primeiramente, bom dia e feliz natal.

Eu tentei criar uma magia que tem varias etapas, e se a pessoa usar repetidamente ela cria combos, exemplo:

eu uso a spell:

 

 

local arr1 = {

{1, 1, 1},

{0, 0, 0},

{0, 0, 0},

 

 

uso denovo(tem q ser seguida, sem demorar)

 

local arr2 = {

{0, 0, 1},

{0, 0, 1},

{0, 0, 1},

 

e se eu usar ela denovo(dentro do tempo)

 

local arr3 = {

{0, 0, 0},

{0, 0, 0},

{1, 1, 1},

Link para o comentário
Compartilhar em outros sites

10 respostass a esta questão

Posts Recomendados

  • 0

local spell = {}

spell.config = {
[1] = {
	type = COMBAT_FIREDAMAGE,
	areaEffect = CONST_ME_FIREAREA,
	area = {
		{1, 1, 1},
		{0, 2, 0},
		{0, 0, 0}
	},
	formula = {5, 5, 1.2, 2}
},
[2] = {
	type = COMBAT_FIREDAMAGE,
	areaEffect = CONST_ME_FIREAREA,
	area = {
		{0, 0, 1},
		{0, 2, 1},
		{0, 0, 1}
	},
	formula = {5, 5, 1.2, 2}
},
[3] = {
	type = COMBAT_FIREDAMAGE,
	areaEffect = CONST_ME_FIREAREA,
	area = {
		{0, 0, 0},
		{0, 2, 0},
		{1, 1, 1}
	},
	formula = {5, 5, 1.2, 2}
},
[4] = {
	type = COMBAT_FIREDAMAGE,
	areaEffect = CONST_ME_FIREAREA,
	area = {
		{1, 0, 0},
		{1, 2, 0},
		{1, 0, 0}
	},
	formula = {5, 5, 1.2, 2}
}
}

spell.combats = {}
for _, config in ipairs(spell.config) do
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, (config.type or COMBAT_NONE))
setCombatParam(combat, COMBAT_PARAM_EFFECT, (config.areaEffect or CONST_ME_NONE))
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, (config.shootEffect or CONST_ANI_NONE))

local area = createCombatArea(config.area)
setCombatArea(combat, area)

setAttackFormula(combat, COMBAT_FORMULA_LEVELMAGIC, unpack(config.formula))
table.insert(spell.combats, combat)
end

function onCastSpell(cid, var)
local k, v = getCreatureStorage(cid, 70001), getCreatureStorage(cid, 70002)
if os.clock() > getCreatureStorage(cid, 70001) then
	doCombat(cid, spell.combats[1], var)
	doCreatureSetStorage(cid, 70001, os.clock() + 2)
	doCreatureSetStorage(cid, 70002, 2)
	return true
end
doCombat(cid, spell.combats[getCreatureStorage(cid, 70002)], var)
doCreatureSetStorage(cid, 70001, os.clock() + 2)
doCreatureSetStorage(cid, 70002, (getCreatureStorage(cid, 70002) == #spell.combats and 1 or (getCreatureStorage(cid, 70002) + 1)))
return true
end

 

Toma. Eu fiz de uma forma que se o jogador use a magia em até dois segundos depois do último uso, crie o tal combo.

 

Abraços.

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

  • 0

ars1 = {
{{1,2,0},
{0,0,0},
{0,0,}},
{{0,3,0},
{0,0,0},
{0,0,0}},
{{0,2,1},
{0,0,0},
{0,0,0}},
}
ars2 = {
{{0,2,1},
{0,0,0},
{0,0,0}},
{{0,3,0},
{0,0,0},
{0,0,0}},
{{1,2,0},
{0,0,0},
{0,0,0}},
}
ars3 = {
{{1,2,0},
{0,0,0},
{0,0,0}},
{{0,3,0},
{0,0,0},
{0,0,0}},
{{0,2,1},
{0,0,0},
{0,0,0}},

{{0,2,0},
{0,0,1},
{0,0,0}},
{{0,2,0},
{0,0,0},
{0,0,1}},
}
ars4 = {
{{0,2,1},
{0,0,0},
{0,0,0}},
{{0,3,0},
{0,0,0},
{0,0,0}},
{{1,2,0},
{0,0,0},
{0,0,0}},

{{0,2,0},
{1,0,0},
{0,0,0}},
{{0,2,0},
{0,0,0},
{1,0,0}},
}
ars5 = {
{{0,2,1},
{0,0,0},
{0,0,0}},
{{0,3,0},
{0,0,0},
{0,0,0}},
{{1,2,0},
{0,0,0},
{0,0,0}},

{{0,2,0},
{1,0,0},
{0,0,0}},
{{0,2,0},
{0,0,0},
{1,0,0}},
{{0,2,0},
{0,0,0},
{0,1,0}},
{{0,2,0},
{0,0,0},
{0,0,1}},
{{0,2,0},
{0,0,1},
{0,0,0}},
}
ars6 = {
{{0,2,0},
{0,0,0},
{0,1,0}},
{{0,2,0},
{0,0,0},
{0,0,1}},
{{0,2,0},
{0,0,0},
{0,0,0}},

{{0,2,0},
{0,0,1},
{0,0,0}},
{{0,2,1},
{0,0,0},
{0,0,0}},
{{0,3,0},
{0,0,0},
{0,0,0}},
{{1,2,0},
{0,0,0},
{0,0,0}},
{{0,2,0},
{1,0,0},
{0,0,0}},
}

combats1 = createCombatObjects(#ars1)
combats2 = createCombatObjects(#ars2)
combats3 = createCombatObjects(#ars3)
combats4 = createCombatObjects(#ars4)
combats5 = createCombatObjects(#ars5)
combats6 = createCombatObjects(#ars6)
for x=1,#combats1 do
setCombatParam(combats1[x], COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combats1[x], COMBAT_PARAM_EFFECT, 5)
setCombatFormula(combats1[x], COMBAT_FORMULA_LEVELMAGIC, -0.1, -2, -0.3, -4)
setCombatArea(combats1[x], createCombatArea(ars1[x]))
end
for x=1,#combats2 do
setCombatParam(combats2[x], COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combats2[x], COMBAT_PARAM_EFFECT, 5)
setCombatFormula(combats2[x], COMBAT_FORMULA_LEVELMAGIC, -0.1, -2, -0.3, -4)
setCombatArea(combats2[x], createCombatArea(ars2[x]))
end
for x=1,#combats3 do
setCombatParam(combats3[x], COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combats3[x], COMBAT_PARAM_EFFECT, 5)
setCombatFormula(combats3[x], COMBAT_FORMULA_LEVELMAGIC, -0.1, -2, -0.3, -4)
setCombatArea(combats3[x], createCombatArea(ars3[x]))
end
for x=1,#combats4 do
setCombatParam(combats4[x], COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combats4[x], COMBAT_PARAM_EFFECT, 5)
setCombatFormula(combats4[x], COMBAT_FORMULA_LEVELMAGIC, -0.1, -2, -0.3, -4)
setCombatArea(combats4[x], createCombatArea(ars5[x]))
end
for x=1,#combats5 do
setCombatParam(combats5[x], COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combats5[x], COMBAT_PARAM_EFFECT, 5)
setCombatFormula(combats5[x], COMBAT_FORMULA_LEVELMAGIC, -0.1, -2, -0.3, -4)
setCombatArea(combats5[x], createCombatArea(ars5[x]))
end
for x=1,#combats6 do
setCombatParam(combats6[x], COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combats6[x], COMBAT_PARAM_EFFECT, 5)
setCombatFormula(combats6[x], COMBAT_FORMULA_LEVELMAGIC, -0.1, -2, -0.3, -4)
setCombatArea(combats6[x], createCombatArea(ars6[x]))
end
combeaeats = {combats1, combats2, combats3, combats4, combats5, combats6}
function onCastSpell(cid, var)
local v = getPlayerStorageValue(cid, 150)
if v == -1 then v = 1 end
local xit = combeaeats[v]
for x=1,#xit do
addEvent(doCombat, 50*x, cid, xit[x], var)
end
setPlayerStorageValue(cid, 150, (v%#combeaeats)+1)
return TRUE
end

 

tenta essa se ajudei REP+

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

  • 0

não lembro se no 8.4 já tem a pasta lib, mas se tiver adiciona isso no arquivo 000-constant dentro da pasta lib se não tiver é no global.lua

 

 

function createCombatObjects(n)

local tabi = {}

if n > 1 then

for x=1, n do

table.insert(tabi, createCombatObject())

end

end

return tabi

end

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...