LI

[Ajuda] Arma Que Suga Life Do Oponente .

Por Liah, 05 de abr. de 2012 em Scripts

arma vampire
script
23
4.4k
LiahL
05 de abril de 2012 às 23:58

Eu queria um Script que pode adicionar em uma arma que ela ,quando atingisse

o Hit ela ranca-se 10 % do sangue De player e monstros ,Como se fo-se um vampiro.

StyflerDrunouS
06 de abril de 2012 às 10:20

cara, todas as armas sugam life do oponente '-' voce pode explicar melhor?

 

Tipo seria uma boa ideia ela sugar life dele e transferir para voce, só que como eu não sou scripter.... nao tem como eu fazer mals.

apenas dei uma sugestao.

LiahL
06 de abril de 2012 às 14:26

é isso mesmo

Foi como eu coloquei como você fosse um vampiro

Pega-se 10% da vida do oponente

 

e quando acerta o hit no oponente que aparece o efeito 68 junto com o hit

Editado Abril 6 por Liah

beddyB
09 de abril de 2012 às 11:59

Bem, voce pode tentar colocar para essa arma usar LifeDrain no bixo.

Ghoul usa esta magia, tenta colocar ela em uma arma, parecendo wand.

Tentae é uma luz.

 

 

Ai esta um spell de lifedrain que voce pode tentar usar combinando com uma ARMA. (OBS é antigo este codigo, talvez seja nescessario modificar)

--[[
--    You can use this spell and copy and modify it.    --
--			    Created By SailorMoonLive			    --
--    But pls don't remove this comment			    --
]]
function onCastSpell(cid, var)
   local CreatureMaxHealth =    getCreatureMaxHealth(getCreatureTarget(cid))
if getCreatureTarget(cid)  then
   local CreatureHealth =	    getCreatureHealth(getCreatureTarget(cid))
   local critLife = CreatureMaxHealth/2
   local lifedraw = ( CreatureHealth / 10)
 if CreatureHealth >= critLife  then
	 local Target = getCreatureTarget(cid)
	 local targetPos = getPlayerPosition(Target)
		 doCreatureAddHealth(Target, -lifedraw, COMBAT_LIFEDRAIN)
		  doSendAnimatedText(targetPos, lifedraw , TEXTCOLOR_GOLD)
		 doSendMagicEffect(targetPos, 0)
	 local pos = getPlayerPosition(cid)
		 doCreatureAddHealth(cid, lifedraw, 1)
		 doSendAnimatedText(playerPos, lifedraw , TEXTCOLOR_GOLD)
	   doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
   else
	   doCreatureSay(getCreatureTarget(cid), "No Kill Me PLS", 1)
	   doCreatureSay(cid, "Vasa Daqui antes que eu mude de ideia", 1)		
 end
end
end

LiahL
09 de abril de 2012 às 14:54

Nem imagino como eu possa fazer isso ,pois a minha arma seria uma arrow.

SkyDangerousS
09 de abril de 2012 às 15:41

só colocar esse script na pasta weapons

 

function onCastSpell(cid, var)

 

trocar para

 

function onUseWeapon(cid, var)

Editado Abril 9 por SkyDangerous

jhon992J
09 de abril de 2012 às 16:59

Faiz assim:

 

Abra a pasta "data/creaturescripts/scripts" duplique um arquivo qualquer e renomeie para "weaponsugar" sem as aspas e nele cole:

-- <Script by jhon992> --

local weaponpar = {2377, 2378, 2379, 2380}  -- id dos items que sugarão life
local chancepar = 5 -- chance de sugar (10 = 10%, 20 = 20%, 30 = 30%, 1 = 1%, 5 = 5%) e assim por diante

function onAttack(cid, target)
if ((getCreaturePosition(target).x == getCreaturePosition(cid).x or getCreaturePosition(target).x == getCreaturePosition(cid).x+1 or getCreaturePosition(target).x == getCreaturePosition(cid).x-1) and (getCreaturePosition(target).y == getCreaturePosition(cid).y or getCreaturePosition(target).y == getCreaturePosition(cid).y+1 or getCreaturePosition(target).y == getCreaturePosition(cid).y-1)) then
    for i=0, #weaponpar do
    if (getPlayerSlotItem(cid, 5).itemid == weaponpar[i] or getPlayerSlotItem(cid, 6).itemid == weaponpar[i]) then
		    if (math.random(1,100) > (100 - chancepar)) then
                       life = (getCreatureHealth(target)*0.1)
				    doPlayerSendTextMessage(cid, 23, "Você sugou "..life.." de hp do "..getCreatureName(target)..".")
                       doSendMagicEffect(getCreaturePosition(target), 98)
                       doCreatureAddHealth(target, -life)
                       doCreatureAddHealth(cid, life)
				    return true
		    else
		    return true
		    end
    end
    end
end
return true
end

 

Agora no arquivo, "data/creaturescripts/creaturescripts.xml" cole a tag:

<event type="attack" name="WeaponSugar" event="script" value="weaponsugar.lua"/>

 

E por último, abra o arquivo login.lua que esta localizado em "data/creaturescripts/scripts" e cole a tag:

registerCreatureEvent(cid, "WeaponSugar")

 

Créditos pro cara desse tópico:

http://www.xtibia.com/forum/topic/175370-creaturescript-weapons-paralyze/

LiahL
09 de abril de 2012 às 18:52

Como eu saberei que funcionou

tipo eu queria que aparece-se um Simbolo

para falar que sugou tipo assim "---"

 

 

Descupe tava escrevendo antes de você postar

 

 

 

Darei rep + a todos que tentaram me ajudar .

 

 

To testando Já coloco se funcionou

 

 

 

-| Só funciona com player ou monstro também ?

Editado Abril 9 por Liah

jhon992J
09 de abril de 2012 às 19:13

Funciona com os 2. Quando acerta o sugar aparece uma msg no player de quanto sugou.

LiahL
09 de abril de 2012 às 19:25

Então acho que não deu certo não apareceu aqui

jhon992J
10 de abril de 2012 às 12:07

Acabei de testar, esta funcionando perfeitamente.

Só colocar os itens que tu quer que funcione e a chance.

LiahL
10 de abril de 2012 às 18:20

Está funcionando mas o problema e que eu queria coloca uma arrow .

e só funciona estando do lado dele.

Ou seja ele não funciona a mais de 1 sqm.

jhon992J
10 de abril de 2012 às 19:27

Fiz pra funcionar soh pra weapons dos slots de hand, se tu tivese explicado melhor tinha feito de arrow. Agora to sem tempo, quando tiver tempo eu faço se ninguem tiver feito antes.

LiahL
11 de abril de 2012 às 00:27

Estarei esperando .

 

Só mais uma coisa o efeito 68 também não aparece.

jhon992J
11 de abril de 2012 às 11:24
-- <Script by jhon992> --

local weaponpar = {2377, 2378, 2379, 2380}  -- id dos items que sugarão life
local arrows = {1234, 5463} -- coloca o id das arrows
local bows = {1234, 5463} -- coloque os ids das bows
local chancepar = 5 -- chance de sugar (10 = 10%, 20 = 20%, 30 = 30%, 1 = 1%, 5 = 5%) e assim por diante

function onAttack(cid, target)
if ((getCreaturePosition(target).x == getCreaturePosition(cid).x or getCreaturePosition(target).x == getCreaturePosition(cid).x+1 or getCreaturePosition(target).x == getCreaturePosition(cid).x-1) and (getCreaturePosition(target).y == getCreaturePosition(cid).y or getCreaturePosition(target).y == getCreaturePosition(cid).y+1 or getCreaturePosition(target).y == getCreaturePosition(cid).y-1)) then
if (isInArray(weaponpar, getPlayerSlotItem(cid, 5).itemid) or isInArray(weaponpar, getPlayerSlotItem(cid, 6).itemid)) then
	if (math.random(1,100) > (100 - chancepar)) then
		life = (getCreatureHealth(target)*0.1)
		doPlayerSendTextMessage(cid, 23, "Você sugou "..life.." de hp do "..getCreatureName(target)..".")
		doSendMagicEffect(getCreaturePosition(target), 68)
		doCreatureAddHealth(target, -life)
		doCreatureAddHealth(cid, life)
		return true
	else
		return true
	end
end
end

if (isInArray(bows, getPlayerSlotItem(cid, 5).itemid) or isInArray(bows, getPlayerSlotItem(cid, 6).itemid)) then
if (isInArray(arrows, getPlayerSlotItem(cid, 10).itemid)) then
	 if (math.random(1,100) > (100 - chancepar)) then
		life = (getCreatureHealth(target)*0.1)
		doPlayerSendTextMessage(cid, 23, "Você sugou "..life.." de hp do "..getCreatureName(target)..".")
		doSendMagicEffect(getCreaturePosition(target), 68)
		doCreatureAddHealth(target, -life)
		doCreatureAddHealth(cid, life)
		return true
	else
		return true
	end
end
end

return true
end

Editado Abril 11 por Jhon992