AL
pedido

Ao atacar mudar outfit

Por Allangod, 16 de jan. de 2013 em Scripts

otserv
tibia
18
3.7k
AllangodA
16 de janeiro de 2013 às 09:02

Gostaria de pedir um system que ao atacar usando arma melee (De perto) o player mudaria de outfit por um segundo (Copiando a cor do outfit normal, pq normalmente ele fica cinza).

Que nem esse video aqui

Eu sei que ja tem um Attack System aki no xtibia mas nao funfo aqui (Nenhum player consegue pegar target de ngm,ou seja, nao ataca).

Podem olhar se quiserem http://www.xtibia.co...-attack-system/

Uso forgotten server 8.54.

Vlws e REP+ para quem conseguir.

Editado Janeiro 16 por Allangod

OneshotO
16 de janeiro de 2013 às 11:29

local outfits = {
       [136] = 137,
       [128] = 129,
}

function onAttack(cid, target)
       local tmp = getCreatureOutfit(cid)
       if outfits[tmp.lookType] then
               tmp.lookType = outfits[tmp.lookType]
               doSetCreatureOutfit(cid, tmp, 900)
       end
       return true
end

 

registerCreatureEvent(cid, "AttackAnimation")

 

<event type="attack" name="AttackAnimation" event="script" value="attackanimation.lua"/>

 

Testado e funcional.

 

Coloquei como exemplo, se o jogador está com a outfit Citizen, muda para Hunter por 900 milissegundos, ficaria bem mais realista se mudasse conforme o attackspeed do jogador, mas não existe uma função que retorne o attackspeed.

 

Abraços.

AllangodA
16 de janeiro de 2013 às 11:58

Puts cara muito bom! Tem como modificar pra tpw... só trocar de roupa se tiver colado no cara?

tonynamoralT
16 de janeiro de 2013 às 12:05

E como faz para o player trocar de outfit de acordo com a direçao dele?

SnowszS
16 de janeiro de 2013 às 12:13

Use getPlayerLookDir(cid)

tonynamoralT
16 de janeiro de 2013 às 12:14

Nao teria como usar tabelas para isso?

SlicerS
16 de janeiro de 2013 às 12:25

pra soh mudar quando ta perto coloca..

if getDistanceBetween(getPlayerPosition(cid), getPlayerPosition(target)) > 1 then
return true
end

 

tony

da sim pra usar tabelas pra isso...

tonynamoralT
16 de janeiro de 2013 às 12:37

local outfits = {

[123] = {[0] , lookType = 124}

}

local get = getCreatureOutfit(cid)

local dir = getCreatureLookDir(cid)

 

doSetCreatureOutfit(cid,outfits[get][dir].lookType,-1)

 

assim?

SlicerS
16 de janeiro de 2013 às 13:37

hã.. nao! kk +/- assim..

 

local outfits = {
[123] = {
		  [0] = {lookType = 124},
		  [1] = {lookType = 125},
		  [2] = {lookType = 126},
		  [3] = {lookType = 127},
		},
[150] = {
		  [0] = {lookType = 151},
		  [1] = {lookType = 152},
		  [2] = {lookType = 153},
		  [3] = {lookType = 154},
		},
}
local get = getCreatureOutfit(cid)
local dir = getCreatureLookDir(cid)

if outfits[get.lookType] then
doSetCreatureOutfit(cid, outfits[get.lookType][dir], 900)
end

 

 

edit: odeio esse CODE --' bem q podiam da um jeito nele kk

Editado Janeiro 16 por Slicer

tonynamoralT
16 de janeiro de 2013 às 13:39

tyyyyyyy

AllangodA
16 de janeiro de 2013 às 14:10

Pra finalizar tem como vc fazer igualzinho esse só q só troca a outfit se for de perto?

Igual a esse \/ só q só usar se tiver de perto

 

 

 

local outfits = {

[136] = 137,

[128] = 129,

}

 

function onAttack(cid, target)

local tmp = getCreatureOutfit(cid)

if outfits[tmp.lookType] then

tmp.lookType = outfits[tmp.lookType]

doSetCreatureOutfit(cid, tmp, 900)

end

return true

end

Editado Janeiro 16 por Allangod

SlicerS
16 de janeiro de 2013 às 14:45

ja flei q eh soh por isso..

if getDistanceBetween(getPlayerPosition(cid), getPlayerPosition(target)) > 1 then
return true
end

AllangodA
16 de janeiro de 2013 às 14:57

Assim?

local outfits = {

[136] = 137,

[128] = 129,

}

 

function onAttack(cid, target)

if getDistanceBetween(getPlayerPosition(cid), getPlayerPosition(target)) > 1 then

return true

end

local tmp = getCreatureOutfit(cid)

if outfits[tmp.lookType] then

tmp.lookType = outfits[tmp.lookType]

doSetCreatureOutfit(cid, tmp, 900)

end

return true

end

Editado Janeiro 16 por Allangod

SlicerS
16 de janeiro de 2013 às 14:59

em tese, sim

AllangodA
16 de janeiro de 2013 às 15:28

Ok, vou testar e jaja te falo

 

Funfo perfeitamente. Ja dei meu REP+ pro Oneshot e amanha dou pra vc slicer

Podem mover