Ir para conteúdo

Editar Essa Action Pra Ela Atira Na Target


evairloko

Posts Recomendados

Nessa action ela atira pra frente mais eu quero que ela atire na target vlw (para ficar = a do tibia gta)

video da action como ela esta

 

function isWalkable(pos, creature, proj, pz)-- by Nord

if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end

if getTopCreature(pos).uid > 0 and creature then return false end

if getTileInfo(pos).protection and pz then return false, true 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 doShootEffect(distancetotarget, effect, l, y) -- l = localpos(lookdirpos), y = dirvalue

for i = 0, distancetotarget-1 do

if isInArray({0,3}, y) then

local _J = y == 0 and {x = l.x, y = l.y-i, z = l.z} or y == 3 and {x = l.x-i, y = l.y, z = l.z}

doSendMagicEffect(_J, effect)

else

_J = y == 1 and {x = l.x+i, y = l.y, z = l.z} or y == 2 and {x = l.x, y = l.y+i, z = l.z}

doSendMagicEffect(_J, effect)

end

end

return true

end

local items = {

[2534] = {

balaid = 2545,

level = 1,

skillup = 5,

mindamage = -1,

maxdamage = -5255,

damagetype = COMBAT_HOLYDAMAGE,

}

}

local _MIT = {}

local shootmode = "shooteffect mode" -- "effect mode" or "shooteffect mode"

function onUse(cid, item, fromPosition, itemEx, toPosition)

local function getFirstThingInArea(pos)

for areax = pos.x, pos.x do

for areay = pos.y, pos.y do

local area = {x = areax, y = areay, z = pos.z}

if isCreature(getTopCreature(area).uid) or not isWalkable(area) then

table.insert(_MIT, getThingFromPos(area).uid)

for s = 1, #_MIT-1 do

table.remove(_MIT, s+1)

end

end

end

end

return true

end

local l = getPlayerLookPos(cid)

local y = getCreatureLookDirection(cid)

local g = items[item.itemid]

if g then

if getPlayerLevel(cid) < g.level then

return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need level ".. g.level .." or higher.")

end

if getTilePzInfo(getCreaturePosition(cid)) then

return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You cannot use a gun in a protection zone.")

end

if item.uid ~= getPlayerSlotItem(cid, 5).uid then

return doPlayerSendCancel(cid, "Equip your gun on gun slot.")

end

if getPlayerSlotItem(cid, 10).itemid == g.balaid then

doRemoveItem(getPlayerSlotItem(cid, 10).uid, 1)

doPlayerAddSkillTry(cid, g.skillup, 1)

for T = 0, 20 do

local _g = y == 0 and {x = l.x, y = l.y-T, z = l.z} or y == 3 and {x = l.x-T, y = l.y, z = l.z} or y == 1 and {x = l.x+T, y = l.y, z = l.z} or y == 2 and {x = l.x, y = l.y+T, z = l.z}

getFirstThingInArea(_g)

end

if #_MIT >= 1 then

local mpos = getThingPos(_MIT[1])

local ppos = getDistanceBetween(mpos, l)

local ft = y == 0 and {x = l.x, y = l.y-ppos, z = l.z} or y == 1 and {x = l.x+ppos, y = l.y, z = l.z} or y == 2 and {x = l.x, y = l.y+ppos, z = l.z} or y == 3 and {x = l.x-ppos, y = l.y, z = l.z}

if isCreature(getTopCreature(mpos).uid) then

doAreaCombatHealth(0, g.damagetype, ft, 0, g.mindamage, g.maxdamage, 0)

else

doSendMagicEffect(ft, 3)

end

if shootmode == "shooteffect mode" then

doShootEffect(ppos, 12, l, y)

elseif shootmode == "effect mode" then

doSendDistanceShoot(l, mpos, 40)

end

table.remove(_MIT, 1)

end

else

doPlayerSendCancel(cid, "You do not have munition.")

end

end

return true

end

 

Cole isso agora em action.xml

--------------------------------------------------------------------------

<action itemid="2534" event="script" value="arma.lua"/>

-------------------------------------------------------------------------

Explicação:

local shootmode <-- Pode trocar para effect mode

[2534] = { <-- ID DA ARMA

balaid = 2545, <-- ID DA BALA

level = 1, <-- Level para usar

skillup = 5, <-- SKILL UP

mindamage = -1, <-- MINIMO DE DANO

maxdamage = -5255, <-- MAXIMO DE DANO

damagetype = COMBAT_HOLYDAMAGE, <-- EFEITO DO TIRO

 

em verde é a action original

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...