TI
pedido

Ajuda Script Spell Que Puxa o Target

Por Tiagone, 10 de jun. de 2013 em Scripts

resolvido
script
18
3.2k
TiagoneT
10 de junho de 2013 às 21:44

Ai Pessoal Queria Sabe Como Que Fais Um Spells Que Puxa o Target Se Puderem Ajuda Rep+ Pra Quem Ajuda e o Server é 854

luccagomesL
10 de junho de 2013 às 22:06

Tipo um exeta res?

TiagoneT
10 de junho de 2013 às 22:36

é assim o script que eu quero ao player fala Tendou ele puxa o player q esta no target

SkymagnumS
10 de junho de 2013 às 22:42

function onCastSpell(cid, var)

 

local target = getCreatureTarget(cid)

 

if(target > 0 then)

doTeleportThing(target, getThingPos(cid))

end

 

return true

end

10 de junho de 2013 às 22:49

function onCastSpell(cid, var)

 

local target = getCreatureTarget(cid)

 

if(target > 0 then)

doTeleportThing(target, getThingPos(cid))

end

 

return true

end

 

Teria como fazer uma que o player troca-se de lugar com o target?

SkymagnumS
10 de junho de 2013 às 23:03

function onCastSpell(cid, var)

 

local target = getCreatureTarget(cid)

local tPos = {x = getThingPos(target).x, y = getThingPos(target).y, z = getThingPos(target).z}

 

if(target > 0) then

doTeleportThing(target, getThingPos(cid))

doTeleportThing(cid, tPos)

end

 

return true

end

Editado Junho 10 por Skymagnum

TiagoneT
10 de junho de 2013 às 23:07

cara aki deu erro :C tem como ajuda?

function onCastSpell(cid, var)

 

local target = getCreatureTarget(cid)

 

if(target > 0 then)

doTeleportThing(target, getThingPos(cid))

end

 

return true

end

Editado Junho 10 por Tiagone

SlicerS
10 de junho de 2013 às 23:11

if(target > 0 then)

 

sky isso nao eh C++

 

if isCreature(target) then

SkymagnumS
10 de junho de 2013 às 23:12

function onCastSpell(cid, var)

 

local target = getCreatureTarget(cid)

 

if(target > 0) then

doTeleportThing(target, getThingPos(cid))

end

 

return true

end

TiagoneT
10 de junho de 2013 às 23:17

Funfou Certinho Podem Fecha o Topico e Rep+ pra tu Sky tem como ajuda em otra magia que , Atinge Direto No Mana?

Editado Junho 10 por Tiagone

10 de junho de 2013 às 23:23

function onCastSpell(cid, var)

 

local target = getCreatureTarget(cid)

local tPos = {x = getThingPos(target).x, y = getThingPos(target).y, z = getThingPos(target).z}

 

if(target > 0) then

doTeleportThing(target, getThingPos(cid))

doTeleportThing(cid, tPos)

end

 

return true

end

 

MAN merece 3 reps :D

Mas tem como qnd trocar o player ficar com 10% de life e 10% de mana? Pq se n fica mt roubado só gastar mana pra trocar de lugar da pra trapar os outros fazer varias coisas :S (add aqui nos favoritos amanha te do teus reps)

 

EDIT:

Usei varias vezes e crashou o servidor =(

apareceu esses erros

 

 

[Error - Spell Interface]

data/spells/scripts/changeposition.lua:onCastSpell

Description:

<luaGetThingPosition> Thing not found

 

[Error - Spell Interface]

data/spells/scripts/changeposition.lua:onCastSpell

data/spells/scripts/changeposition.lua:4: attempt to index a boolean value

stack traceback

data/spells/scripts/changeposition.lua:4: in function <data/spells/scripts/changeposition.lua:1>

 

 

Editado Junho 10 por znotewebsite

brun123B
10 de junho de 2013 às 23:53

adiciona isso:

 

if not target then
return not doPlayerSendCancel(cid, "You need a target.")
end

 

embaixo de:

 

local target = getCreatureTarget(cid)

SkymagnumS
11 de junho de 2013 às 00:01

Nem manjo das matematica mas acho q da certo.

function onCastSpell(cid, var)

local target = getCreatureTarget(cid)
if not target then
return not doPlayerSendCancel(cid, "You need a target.")
end
local tPos = {x = getThingPos(target).x, y = getThingPos(target).y, z = getThingPos(target).z}
local hp = getCreatureHealth(cid) * 10 / 100 
local mana = getCreatureMana(cid) * 10 / 100 

doTeleportThing(target, getThingPos(cid))
doTeleportThing(cid, tPos)
doCreatureAddHealth(cid, - getCreatureHealth(cid) - hp)
doCreatureAddMana(cid, - getCreatureMana(cid) - mana)

return true
end

11 de junho de 2013 às 01:35

Nem manjo das matematica mas acho q da certo.

function onCastSpell(cid, var)

local target = getCreatureTarget(cid)
if not target then
return not doPlayerSendCancel(cid, "You need a target.")
end
local tPos = {x = getThingPos(target).x, y = getThingPos(target).y, z = getThingPos(target).z}
local hp = getCreatureHealth(cid) * 10 / 100
local mana = getCreatureMana(cid) * 10 / 100

doTeleportThing(target, getThingPos(cid))
doTeleportThing(cid, tPos)
doCreatureAddHealth(cid, - getCreatureHealth(cid) - hp)
doCreatureAddMana(cid, - getCreatureMana(cid) - mana)

return true
end

 

Se eu usar a magia sem ter nenhum target da o mesmo erro antigo!

 

E quando eu uso até funciona, só que quando eu troco de posição eu morro por Mana Drain :S

SlicerS
11 de junho de 2013 às 09:30
function onCastSpell(cid, var)
  local target = getCreatureTarget(cid)

  if not isCreature(target) then
  doPlayerSendCancel(cid, "You need a target.")
  return true
  end
  local tPos = {x = getThingPos(target).x, y = getThingPos(target).y, z = getThingPos(target).z}
  local hp = getCreatureMaxHealth(cid) / 100 * 10
  local mana = getCreatureMaxMana(cid) / 100 * 10

  doTeleportThing(target, getThingPos(cid))
  doTeleportThing(cid, tPos)
  doCreatureAddHealth(cid, - hp)
  doCreatureAddMana(cid, - mana)
return true
end

Editado Junho 11 por Slicer