Jump to content
  • 0

spell q empurra


rohfagundes

Question

6 answers to this question

Recommended Posts

  • 0

Só não esquece de colocar isso no spells.xml

 

direction="1"

 

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_POFF)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -1, 0, -1, 0)

local area = createCombatArea({
{0, 1, 0},
{0, 1, 0},
{0, 1, 0},
{0, 3, 0},
})
setCombatArea(combat, area)

function onTargetCreature(cid, target)
if not isNpc(target) then
	local player_position = getThingPosition(cid)
	local target_position = getThingPosition(target)
	local x = (target_position.x < player_position.x and -1 or (target_position.x == player_position.x and 0 or 1))
	local y = (target_position.y < player_position.y and -1 or (target_position.y == player_position.y and 0 or 1))

	local to_position = {x = target_position.x + x, y = target_position.y + y, z = target_position.z}
	if doTileQueryAdd(target, to_position) == RETURNVALUE_NOERROR then
	    doTeleportThing(target, to_position, true)
	end
end
end
setCombatCallback(combat, CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature")

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

Edited by Oneshot
Link to comment
Share on other sites

  • 0

se usar desse jeito q vc fez

ele empurra certo

 

local area = createCombatArea({

{0, 1, 0},

{0, 1, 0},

{0, 1, 0},

{0, 3, 0},

})

 

setCombatArea(combat, area)

 

 

 

só q se eu fizer isso

ele vai empurrar em diagonal

e n em horizontal

 

local area = createCombatArea({

{1, 0, 1},

{1, 0, 1},

{1, 0, 1},

{1, 2, 1},

})

setCombatArea(combat, area)

 

no caso eu tava querendo q empurra-se sempre em horizontal

Link to comment
Share on other sites

  • 0
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_POFF)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -1, 0, -1, 0)

local area = createCombatArea({
       {1, 0, 1},
       {1, 0, 1},
       {1, 0, 1},
       {1, 2, 1},
})
setCombatArea(combat, area)

local function push(cid, target)
       local direction = getCreatureLookDirection(cid)
       local x = (direction == 1 and 1 or (direction == 3 and -1 or 0))
       local y = (direction == 0 and -1 or (direction == 2 and 1 or 0))

       local position = getCreaturePosition(target)
       position.x = position.x + x
       position.y = position.y + y
       if doTileQueryAdd(target, position) == RETURNVALUE_NOERROR then
           doTeleportThing(target, position, true)
       end
end

function onTargetCreature(cid, target)
       if not isNpc(target) then
               addEvent(push, 100, cid, target)
       end
end
setCombatCallback(combat, CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature")

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

Link to comment
Share on other sites

  • 0

Tem como atualizar para TFS 1.3?

 

Coloquei aqui no servidor e saiu o efeito e deu dano, porém não puxou o alvo e também deu erro na distro:

 

Citar

Lua Script Error: [Spell Interface]
in callback: data/spells/scripts/support/pull.lua:onTargetCreature
(Unknown scriptfile)
LuaScriptInterface::luaAddEvent(). Arguments #3 and #4 are unsafe
stack traceback:
        [C]: in function 'addEvent'
        data/spells/scripts/support/pull.lua:29: in function <data/spells/scripts/support/pull.lua:27>
        [C]: at 0x7ff732fa1ee0

Lua Script Error: [Main Interface]
in a timer event called from:
(Unknown scriptfile)
data/spells/scripts/support/pull.lua:15: attempt to call global 'getCreatureLookDirection' (a nil value)
stack traceback:
        [C]: in function 'getCreatureLookDirection'
        data/spells/scripts/support/pull.lua:15: in function <data/spells/scripts/support/pull.lua:14>

 

Link to comment
Share on other sites

×
×
  • Create New...