Ir para conteúdo
  • 0

Script Pra Uma Sword


Mattziin

Pergunta

Posts Recomendados

  • 0

creaturescripts.xml:

 

<event type="statschange" name="ManaDrain" event="script" value="manadrain.lua"/>

 

manadrain.lua:

 

-- Script by LuckOake com ajuda de Vodkart

function onStatsChange(cid, attacker, type)

local x = {1234, 4321} -- IDs das armas

local mana = 100 -- Mana Obtida

 

if isInArray(x,getPlayerSlotItem(cid, CONST_SLOT_LEFT).itemid) or isInArray(x,getPlayerSlotItem(cid, CONST_SLOT_RIGHT).itemid) then

if type == STATSCHANGE_HEALTHLOSS and isPlayer(attacker) then

doPlayerAddMana(attacker, mana)

doSendAnimatedText(getCreaturePos(attacker), "+"..mana.."", TEXTCOLOR_LIGHTBLUE)

if isPlayer(cid) then

doPlayerAddMana(cid, -mana)

doSendAnimatedText(getCreaturePos(cid), "-"..mana.."", TEXTCOLOR_PURPLE)

elseif isMonster(cid) then

doSendAnimatedText(getCreaturePos(cid), "-"..mana.."", TEXTCOLOR_PURPLE)

end

end

end

return true

end

 

 

login.lua:

 

registerCreatureEvent(cid, "ManaDrain")

Editado por LuckOake
Link para o comentário
Compartilhar em outros sites

  • 0

Algum erro no console?

 

PS: Você configurou o ID das armas direito?

 

~~ Edit ~~

 

Esqueci de um detalhe:

 

login.lua:

 

registerCreatureEvent(cid, "ManaDrain")

Editado por LuckOake
Link para o comentário
Compartilhar em outros sites

  • 0

Algum erro no console?

 

PS: Você configurou o ID das armas direito?

 

~~ Edit ~~

 

Esqueci de um detalhe:

 

login.lua:

 

registerCreatureEvent(cid, "ManaDrain")

 

eu fiz isso e continua a nao pegar :S

 

Obs: Nao aparece nenhum erro no distro :S

Link para o comentário
Compartilhar em outros sites

  • 0

Tenta assim:

 

 

-- Script by LuckOake com ajuda de Vodkart

function onStatsChange(cid, attacker, type)

local x = {1234, 4321} -- IDs das armas

local mana = 100 -- Mana Obtida

 

if isInArray(x,getPlayerSlotItem(cid, CONST_SLOT_LEFT).itemid) or isInArray(x,getPlayerSlotItem(cid, CONST_SLOT_RIGHT).itemid) then

doPlayerAddMana(attacker, mana)

doSendAnimatedText(getCreaturePos(attacker), "+"..mana.."", TEXTCOLOR_LIGHTBLUE)

if isPlayer(cid) then

doPlayerAddMana(cid, -mana)

doSendAnimatedText(getCreaturePos(cid), "-"..mana.."", TEXTCOLOR_PURPLE)

elseif isMonster(cid) then

doSendAnimatedText(getCreaturePos(cid), "-"..mana.."", TEXTCOLOR_PURPLE)

end

end

return true

end

 

 

PS: Lembre-se de configurar os IDs das armas nessa linha:

 

local x = {1234, 4321} -- IDs das armas

Editado por LuckOake
Link para o comentário
Compartilhar em outros sites

  • 0
local weaponpar = {2377, 2378, 2379, 2380}  -- id dos items que sugarão life
local chancepar = 5

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 = (getPlayerMana(target)*0.1)
									    doPlayerSendTextMessage(cid, 23, "Você sugou "..life.." de Mana do "..getCreatureName(target)..".")
				    doSendMagicEffect(getCreaturePosition(target), 98)
				    doPlayerAddMana(target, -life)
				    doPlayerAddMana(cid, life)
									    return true
					    else
					    return true
					    end
	    end
	    end
end
return true
end

Link para o comentário
Compartilhar em outros sites

  • 0

agora deu erro , os negos sem arma consegui tirar mana e com a arma q eu queria nao dá :S o id da arma é 2413 e eu botei certo só q nao vai ;S

 

 

Olha o erro q aparece

 

 

[29/08/2012 22:12:53] [Error - CreatureScript Interface]

[29/08/2012 22:12:53] data/creaturescripts/scripts/swordespecial.lua:onStatsChange

[29/08/2012 22:12:53] Description:

[29/08/2012 22:12:53] (luaGetThingPosition) Thing not found

[29/08/2012 22:12:53] [Error - CreatureEvent::executeStatsChange] Call stack overflow.

Editado por Mattziin
Link para o comentário
Compartilhar em outros sites

  • 0

local weaponpar = {2377, 2378, 2379, 2380}  -- id dos items que sugarão life
local chancepar = 5

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 = (getPlayerMana(target)*0.1)
										doPlayerSendTextMessage(cid, 23, "Você sugou "..life.." de Mana do "..getCreatureName(target)..".")
					doSendMagicEffect(getCreaturePosition(target), 98)
					doPlayerAddMana(target, -life)
					doPlayerAddMana(cid, life)
										return true
						else
						return true
						end
		end
		end
end
return true
end

 

esse ai nao ta funfando aqui :S nao aparece nada

 

@Mattziin

 

Em qual dos scripts deu erro? No meu ou no do Mulizeu?

 

No Seu man , Foi mal na proxima eu boto seu nome kkk

Link para o comentário
Compartilhar em outros sites

  • 0

Certeza que n ta funfando, pq ele n solta efeito quando suga tem que prestar a tenção na mana!

 

 

Com efeito

 

 


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 = (getPlayerMana(target)*0.1)
																				    doPlayerSendTextMessage(cid, 23, "Você sugou "..life.." de Mana do "..getCreatureName(target)..".")
										    doSendMagicEffect(getCreaturePosition(target), 98)
										    doPlayerAddMana(target, -life)
										    doPlayerAddMana(cid, life)
										    doSendMagicEffect(getCreaturePosition(cid),10)
																				    return true
												    else
												    return true
												    end
				    end
				    end
end
return true
end

Link para o comentário
Compartilhar em outros sites

  • 0

Certeza que n ta funfando, pq ele n solta efeito quando suga tem que prestar a tenção na mana!

 

 

Com efeito

 

 


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 = (getPlayerMana(target)*0.1)
																					doPlayerSendTextMessage(cid, 23, "Você sugou "..life.." de Mana do "..getCreatureName(target)..".")
											doSendMagicEffect(getCreaturePosition(target), 98)
											doPlayerAddMana(target, -life)
											doPlayerAddMana(cid, life)
											doSendMagicEffect(getCreaturePosition(cid),10)
																					return true
													else
													return true
													end
					end
					end
end
return true
end

 

Nao funcionou Man :S

Link para o comentário
Compartilhar em outros sites

  • 0
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 (math.random(1,100) > (100 - 5)) then
										    mana = (getPlayerMana(target)*0.1)
											 doPlayerSendTextMessage(cid, 23, "Você sugou "..mana.." de Mana do "..getCreatureName(target)..".")
										    doSendMagicEffect(getCreaturePosition(target), 98)
										    doPlayerAddMana(target, -mana)
										    doPlayerAddMana(cid, mana)
										    doSendMagicEffect(getCreaturePosition(cid),10)
							 return true
					   else
				 return true
		   end

end
return true
end

Link para o comentário
Compartilhar em outros sites

  • 0

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 (math.random(1,100) > (100 - 5)) then
											mana = (getPlayerMana(target)*0.1)
											 doPlayerSendTextMessage(cid, 23, "Você sugou "..mana.." de Mana do "..getCreatureName(target)..".")
											doSendMagicEffect(getCreaturePosition(target), 98)
											doPlayerAddMana(target, -mana)
											doPlayerAddMana(cid, mana)
											doSendMagicEffect(getCreaturePosition(cid),10)
							 return true
					   else
				 return true
		   end

end
return true
end

 

 

Lek nao tá pegando :S

Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...