Ir para conteúdo
Banner com Efeitos

Featured Replies

Postado

Fiz uma variação dessa spell, uma que no caso Puxa ao inves de empurrar.
Mas ela só ta puxando 1 sqm, enquanto a que empurra 3sqm..

Não sei onde alterar pra puxar também 3sqm :/

local combat = createCombatObject()setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_COMBAT_NONE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, 2)
 
 
local arr = {
{1, 1, 1},
{1, 1, 1},
{1, 1, 1},
{1, 1, 1},
{0, 3, 0},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
}
 
 
local area = createCombatArea(arr)
setCombatArea(combat, area)
 
 
local function doPushCreature(uid,direction,distance,time)
   if isCreature(uid) == TRUE then
   local rand = (2*math.random(0,1))-1
   local rand2 = math.random(-1,0)
      if direction == 0 then
      signal = {0,rand,-rand,rand,-rand,0,-1,-1,-1,0,0,0}
      elseif direction == 1 then
      signal = {1,1,1,0,0,0,0,rand,-rand,rand,-rand,0}
      elseif direction == 2 then
      signal = {0,rand,-rand,rand,-rand,0,1,1,1,0,0,0}
      elseif direction == 3 then
      signal = {-1,-1,-1,0,0,0,0,rand,-rand,rand,-rand,0}
      elseif direction == 4 then
      signal = {-1,rand2,(-rand2)-1,0,1,rand2+1,rand2,0}
      elseif direction == 5 then
      signal = {1,-rand2,-((-rand2)-1),0,1,rand2+1,rand2,0}
      elseif direction == 6 then
      signal = {-1,rand2,(-rand2)-1,0,-1,(-rand2)-1,rand2,0}
      else
      signal = {1,-rand2,-((-rand2)-1),0,-1,(-rand2)-1,rand2,0}
      end
   local pos = getThingPos(uid)
   nsig = #signal
   nvar = 0
   
   repeat
   nvar = nvar+1
   
   newpos = {x=pos.x-(signal[nvar]),y=pos.y-(signal[(nsig/2)+nvar]),z=pos.z}
   newtile = {x=newpos.x,y=newpos.y,z=newpos.z,stackpos=0}
    until getTileThingByPos(newtile).uid ~= 0 and hasProperty(getTileThingByPos(newtile).uid,3) == FALSE and queryTileAddThing(uid,newpos) == 1 or nvar == (nsig/2) 
   
   
   if canWalk(newpos) == TRUE then
      if distance == nil or distance == 1 then
      doTeleportThing(uid,newpos,TRUE)   
      else
      distance = distance-1
      doTeleportThing(uid,newpos,TRUE)
         if time ~= nil then
         addEvent(doPushCreature,time,uid,direction,distance,time)
         else
         addEvent(doPushCreature,100,uid,direction,distance,100)
         end       
      end
   end  
end
end 
 
 
 
 
local function getPosfromArea(cid,area)
icenter = math.floor(table.getn(area)/2)+1
jcenter = math.floor(table.getn(area[1])/2)+1
center = area[icenter]
ivar = table.getn(area)
jvar = table.getn(area[1])
i = table.getn(area)^2
j = table.getn(area[1])^2
 
 
   if center[jcenter] == 3 then
      if getPlayerLookDir(cid) == 0 then
      signal = {-1,1,1,2}
      elseif getPlayerLookDir(cid) == 1 then
      signal = {1,-1,2,1}
      elseif getPlayerLookDir(cid) == 2 then
      signal = {1,-1,1,2}
      else
      signal = {-1,1,2,1}
      end
   else
   signal = {-1,1,1,2}
   end
 
 
POSITIONS = {}  
P = 0 
   
repeat
pvar = {0,0}
I = area[ivar]
J = I[jvar]
i = i-1
j = j-1
   if J == 1 then
      if jvar < jcenter then  
      pvar[signal[3]] = signal[1]*math.abs((jcenter-jvar)) 
      elseif jvar > jcenter then  
      pvar[signal[3]] = signal[2]*math.abs((jcenter-jvar)) 
      end
      
      if ivar < icenter then  
      pvar[signal[4]] = signal[1]*math.abs((icenter-ivar)) 
      elseif ivar > icenter then
      pvar[signal[4]] = signal[2]*math.abs((icenter-ivar))
      end
   end      
   if jvar > 1 then
   jvar = (jvar-1)
   elseif ivar > 1 then
   jvar = table.getn(area[1])
   ivar = (ivar-1)
   end  
local pos = getThingPos(cid)
local areapos = {x=pos.x+(pvar[1]),y=pos.y+(pvar[2]),z=pos.z}  
   if pos.x ~= areapos.x or pos.y ~= areapos.y then
   P = P+1
   POSITIONS[P] = areapos
   end   
until i <= 0 and j <= 0
 
 
return POSITIONS
end
 
 
function canWalk(pos, creature, pz, proj) -- nord
if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end
local creature = getTopCreature(pos)
if creature.type > 0 then return false end
if getTilePzInfo(pos) and not pz then return false end
local n = not proj and 3 or 2
for i = 0, 255 do
pos.stackpos = i
local tile = getTileThingByPos(pos)
if tile.itemid ~= 0 and not isCreature(tile.uid) then
if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
return false
end
end
end
return true
end
 
 
 
 
 
 
function onCastSpell(cid, var)
pos = getPosfromArea(cid,arr)
n = 0
 
 
while n < #pos do
n = n+1
 
 
thing = {x=pos[n].x,y=pos[n].y,z=pos[n].z,stackpos=253}
   if isCreature(getThingfromPos(thing).uid) == TRUE then
   doPushCreature(getThingfromPos(thing).uid,getPlayerLookDir(cid))
   end
end
 
 
return doCombat(cid, combat, var)end



 tumblr_mwfeg45FIV1qk4cb3o4_500.gif

  • Respostas 35
  • Visualizações 6.9k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • remove isso do script  setCombatParam(combat, COMBAT_PARAM_EFFECT, 2) agora procura essa parte:   if getPlayerLookDir(cid) == 0 then       signal = {-1,1,1,2}       elseif getPlayerLookDir(cid) ==

  • local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_COMBAT_NONE) local arr = { {1, 1, 1}, {1, 1, 1}, {1, 1, 1}, {0, 1, 0}, {0, 3, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0

  • ele só sai só pra baixo se vc esquecer de botar direction="1" na tag do xml.

Postado
  • Autor

pra mudar isso teria que mudar o script inteiro e esse script é super complicado de se mexer :/ se quiser puxar o target faz um range e doTeleportThing que fica mil vezes mais fácil

Todos os meus trabalhos importantes estão na seção "Sobre mim" no meu perfil; Dá uma passada lá!

"Há três caminhos para o fracasso: não ensinar o que se sabe, não praticar o que se ensina, e não perguntar o que se ignora." - São Beda

I7Pm6ih.png

(obg ao @Beeny por fazer essa linda sign <3)

Postado

Hm.

Eu percebi um pequeno bug na sua magia que não sei como tirar.
Ela atinge 2 sqms extras, que não ta no arr.
Já aumentei/diminui, mas sempre vem +2 extras próximo ao personagem..
HRP4BEp.png
Onde coloquei o risco é onde a magia também acerta, mesmo sem ter eles no range do arr.


@EDIT
Ela não atinge quem tá nos últimos sqms da spell.
Ela tem +2 sqm extra de range próximo pois tirou dos últimos

Editado por Danves (veja o histórico de edições)



 tumblr_mwfeg45FIV1qk4cb3o4_500.gif

Postado
  • Autor

então @Danves, isso não é muito bem um bug e sim uma consequência de uma limitação do script.

local function getPosfromArea(cid,area)
icenter = math.floor(table.getn(area)/2)+1
jcenter = math.floor(table.getn(area[1])/2)+1

Se você mexer nessa parte vc percebe que o "bug" se resolve mas vai começar a empurrar o cara mesmo estando do lado dele kkk a forma de fazer isso dar certo dessa maneira especificamente é essa, se fosse pra tentar resolver isso seria necessário jogar esse script fora e começar um do 0 (oque não é viável).. eu gosto de pensar nisso não como um bug mas sim como um ponto positivo da spell já que os players são arrastados pela corrente de vento mesmo sem estar na área da spell haha

Todos os meus trabalhos importantes estão na seção "Sobre mim" no meu perfil; Dá uma passada lá!

"Há três caminhos para o fracasso: não ensinar o que se sabe, não praticar o que se ensina, e não perguntar o que se ignora." - São Beda

I7Pm6ih.png

(obg ao @Beeny por fazer essa linda sign <3)

  • 3 weeks later...

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo