Ir para conteúdo

Posts Recomendados

qual jeito certo de fazer essa spell pra ela ficar centralizada

e com o dano naquela area q ta ai?

 

esse efeito é igual do Flamethrower do poketibia

 

 

 

local combat1 = createCombatObject()

setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)

setCombatParam(combat1, COMBAT_PARAM_EFFECT, 99)

setCombatFormula(combat1, COMBAT_FORMULA_LEVELMAGIC, -6.0, 0, -5.3, 0)

 

 

local combat2 = createCombatObject()

setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)

setCombatParam(combat2, COMBAT_PARAM_EFFECT, 102)

setCombatFormula(combat2, COMBAT_FORMULA_LEVELMAGIC, -6.0, 0, -4.3, 0)

 

 

local combat3 = createCombatObject()

setCombatParam(combat3, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)

setCombatParam(combat3, COMBAT_PARAM_EFFECT, 100)

setCombatFormula(combat3, COMBAT_FORMULA_LEVELMAGIC, -6.0, 0, -4.3, 0)

 

 

local combat4 = createCombatObject()

setCombatParam(combat4, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)

setCombatParam(combat4, COMBAT_PARAM_EFFECT, 101)

setCombatFormula(combat4, COMBAT_FORMULA_LEVELMAGIC, -6.0, 0, -4.3, 0)

 

 

arr1s = {

{1, 1, 1},

{1, 1, 1},

{1, 1, 1},

{0, 2, 0},

{0, 0, 0}

}

 

 

local area1s = createCombatArea(arr1s)

setCombatArea(combat1, area1s)

setCombatArea(combat2, area1s)

setCombatArea(combat3, area1s)

setCombatArea(combat4, area1s)

 

 

local function onCastSpell1(parameters)

doCombat(parameters.cid, combat1, parameters.var)

end

 

local function onCastSpell2(parameters)

doCombat(parameters.cid, combat2, parameters.var)

end

 

local function onCastSpell3(parameters)

doCombat(parameters.cid, combat3, parameters.var)

end

 

local function onCastSpell4(parameters)

doCombat(parameters.cid, combat4, parameters.var)

end

 

 

function onCastSpell(cid, var)

local parameters = { cid = cid, var = var}

 

if getCreatureLookDir(cid) == 0 then

addEvent(onCastSpell1, 000, parameters)

 

elseif getCreatureLookDir(cid) == 1 then

addEvent(onCastSpell2, 000, parameters)

 

 

elseif getCreatureLookDir(cid) == 2 then

addEvent(onCastSpell3, 000, parameters)

 

elseif getCreatureLookDir(cid) == 3 then

addEvent(onCastSpell4, 000, parameters)

 

end

return TRUE

end

 

 

 

 

 

n sei fazer spell com efeito maior q 32x32 e queria entender alguem pode fazer pra mim?

 

 

edit:

tem essa q tem q colocar o dano certo

porem n consigo =X

 

 

 

 

local flamen = createCombatArea{

{0, 0, 2, 0, 0},

{0, 1, 1, 1, 0},

{0, 1, 1, 1, 0},

{0, 1, 1, 1, 0},

{0, 0, 0, 0, 0}

}

local flames = createCombatArea{

{0, 0, 0, 0, 0},

{0, 1, 1, 1, 0},

{0, 1, 1, 1, 0},

{0, 1, 1, 1, 0},

{0, 0, 2, 0, 0}

}

local flamew = createCombatArea{

{0, 0, 0, 0, 0},

{0, 1, 1, 1, 0},

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

{0, 1, 1, 1, 0},

{0, 0, 0, 0, 0}

}

local flamee = createCombatArea{

{0, 0, 0, 0, 0},

{0, 1, 1, 1, 0},

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

{0, 1, 1, 1, 0},

{0, 0, 0, 0, 0}

}

 

function onCastSpell(cid, var)

 

doCreatureSay(cid, "FLAMETHROWER!", TALKTYPE_MONSTER)

if getPlayerStorageValue(cid, 3) >= 1 then

doSendAnimatedText(getThingPos(cid), "MISS", 215)

setPlayerStorageValue(cid, 3, -1)

return true

end

if getPlayerStorageValue(cid, 5) >= 1 then

if math.random(1,100) <= 33 then

doSendAnimatedText(getThingPos(cid), "SELF HIT", 180)

if isPlayer(getCreatureTarget(cid)) then

huah = getPlayerLevel(getCreatureTarget(cid))

else

huah = getPlayerLevel(getCreatureMaster(getCreatureTarget(cid)))

end

local levels = huah

doTargetCombatHealth(getCreatureTarget(cid), cid, COMBAT_PHYSICALDAMAGE, -(math.random((levels*3),(levels*5))), -((math.random((levels*3),(levels*5))+10)), 3)

return true

end

end

if getCreatureName(cid) == "Charmeleon" then

xxx = 240

elseif getCreatureName(cid) == "Charmander" then

xxx = 100

else

xxx = 400

end

local x = xxx

if getCreatureLookDir(cid) == 0 then

local flamepos = getThingPos(cid)

flamepos.x = flamepos.x+1

flamepos.y = flamepos.y-1

doSendMagicEffect(flamepos, 99)

doAreaCombatHealth(cid, FIREDAMAGE, getThingPos(cid), flamen, -(x), -(x+20), 255)

elseif getCreatureLookDir(cid) == 1 then

local flamepos = getThingPos(cid)

flamepos.x = flamepos.x+3

flamepos.y = flamepos.y+1

doSendMagicEffect(flamepos, 102)

doAreaCombatHealth(cid, FIREDAMAGE, getThingPos(cid), flamee, -(x), -(x+20), 255)

elseif getCreatureLookDir(cid) == 2 then

local flamepos = getThingPos(cid)

flamepos.x = flamepos.x+1

flamepos.y = flamepos.y+3

doSendMagicEffect(flamepos, 100)

doAreaCombatHealth(cid, FIREDAMAGE, getThingPos(cid), flames, -(x), -(x+20), 255)

elseif getCreatureLookDir(cid) == 3 then

local flamepos = getThingPos(cid)

flamepos.x = flamepos.x-1

flamepos.y = flamepos.y+1

doSendMagicEffect(flamepos, 101)

doAreaCombatHealth(cid, FIREDAMAGE, getThingPos(cid), flamew, -(x), -(x+20), 255)

end

end

 

 

 

 

edit:

assim essa spell detecta life de monstros, players por perto

e marca no mapa a posiçao q eles estao

eu queria saber se tem como colocar pra depois de 10 secs

remover a marcaçao q fez no mapa

tem como?

 

 

--This script is part of DetectLifeSpell

-- Copyright © 2011 AbouTibia, Skyen Hasus

--

-- This program is free software: you can redistribute it and/or modify

-- it under the terms of the GNU General Public License as published by

-- the Free Software Foundation, either version 3 of the License, or

-- (at your option) any later version.

--

-- This program is distributed in the hope that it will be useful,

-- but WITHOUT ANY WARRANTY; without even the implied warranty of

-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

-- GNU General Public License for more details.

--

-- You should have received a copy of the GNU General Public License

-- along with this program. If not, see <http://www.gnu.org/licenses/>.

 

-- Radius of floors that will be detected by the spell

local floors = 0

 

-- Magic effect shown on detected creatures

local effect = CONST_ME_MAGIC_BLUE

 

-- Message sent as a warning to detected players, false to deactivate

local warn = "You feel like you're being watched."

 

-- Message sent when no living creature is found nearby

local nolife = "You detected no signs of life nearby."

 

-- If true, the message will show in detail how many creatures of each type are in each direction.

local detailed = false

 

local area = {

{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},

{0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0},

{0, 0, 0, 0, 0, 0, 8, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 0, 0, 0, 0, 0, 0},

{0, 0, 0, 0, 0, 8, 8, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 0, 0, 0, 0, 0},

{0, 0, 0, 0, 8, 8, 8, 8, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0},

{0, 0, 0, 8, 8, 8, 8, 8, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0},

{0, 0, 8, 8, 8, 8, 8, 8, 8, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0},

{0, 0, 8, 8, 8, 8, 8, 8, 8, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0},

{0, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 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, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},

}

 

local keys = {

[1] = "north",

[2] = "northeast",

[3] = "east",

[4] = "southeast",

[5] = "south",

[6] = "southwest",

[7] = "west",

[8] = "northwest",

}

 

function is_index(t, index)

for i, v in ipairs(t) do

if index == i then

return true

end

end

return false

end

 

local function get_message(life, keys)

local msg

local add = {}

 

if life.total == 0 then

return false

end

 

for key, direction in ipairs(keys) do

local keymsg = ""

local keyadd = {}

 

if life[key].players == 1 then

if not msg then

msg = "There is "

end

table.insert(keyadd, "a player")

elseif life[key].players > 1 then

if not msg then

msg = "There are "

end

table.insert(keyadd, life[key].players .. " players")

end

 

if life[key].monsters == 1 then

if not msg then

msg = "There is "

end

table.insert(keyadd, "a monster")

elseif life[key].monsters > 1 then

if not msg then

msg = "There are "

end

table.insert(keyadd, life[key].monsters .. " monsters")

end

 

if life[key].npcs == 1 then

if not msg then

msg = "There is "

end

table.insert(keyadd, "a NPC")

elseif life[key].npcs > 1 then

if not msg then

msg = "There are "

end

table.insert(keyadd, life[key].npcs .. " NPCs")

end

 

for i = 1, #keyadd do

if i == #keyadd and #keyadd > 1 then

keymsg = keymsg .. " and "

elseif i ~= 1 then

keymsg = keymsg .. ", "

end

keymsg = keymsg .. keyadd

end

 

if #keyadd > 0 then

table.insert(add, keymsg .. " by the " .. keys[key])

end

end

 

for i = 1, #add do

if i == #add and #add > 1 then

msg = msg .. " and "

elseif i ~= 1 then

msg = msg .. ", "

end

msg = msg .. add

end

 

return msg .. "."

end

 

local function detect_life(cid, area, keys, pos, floors, effect, warn)

local detected = {}

local center = {}

 

-- Make sure the area is large enought and has a center

if #area < 1 or #area[1] < 1 or #area % 2 == 0 or #area[1] % 2 == 0 then

error("The size of the area is invalid.")

return false

end

 

center.y = math.ceil(#area / 2)

center.x = math.ceil(#area[1] / 2)

detected.total = 0

 

for key, value in pairs(keys) do

detected[key] = {

players = 0,

monsters = 0,

npcs = 0,

}

end

 

for z = -floors, floors do

for y = 1, #area do

-- Make sure that the size of the area doesn't vary

if #area[y] ~= #area[1] then

error("The size of the area varies.")

return false

end

for x = 1, #area[y] do

local dpos = {}

local key = area[y][x]

 

dpos.x = pos.x - center.x + x

dpos.y = pos.y - center.y + y

dpos.z = pos.z + z

dpos.stackpos = STACKPOS_TOP_CREATURE

 

local thing = getThingFromPos(dpos, false)

if thing.uid ~= 0 and is_index(keys, key) and not isPlayerGhost(thing.uid) then

if isPlayer(thing.uid) then

if warn then

doPlayerSendTextMessage(thing.uid, MESSAGE_EVENT_ADVANCE, warn)

end

detected[key].players = detected[key].players + 1

elseif isMonster(thing.uid) then

detected[key].monsters = detected[key].monsters + 1

elseif isNpc(thing.uid) then

detected[key].npcs = detected[key].npcs + 1

end

detected.total = detected.total + 1

doSendMagicEffect(dpos, effect)

doPlayerAddMapMark(cid, dpos, MAPMARK_FLAG, getCreatureName(thing.uid))

end

end

end

end

return detected

end

 

function onCastSpell(cid, var)

local pos = getThingPosition(cid)

local life = detect_life(cid, area, keys, pos, floors, effect, warn)

 

if not life then

return false

end

 

local message = "There " .. (life.total == 1 and "is " or "are ") .. life.total .. " creatures nearby."

if detailed then

message = get_message(life, keys)

end

if life.total == 0 then

message = nolife

end

 

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, message)

 

return true

end

 

 

Editado por rohfagundes
Link para o comentário
https://xtibia.com/forum/topic/205225-qual-jeito-certo-de-fazer-essa-spell/
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...