Ir para conteúdo
  • 0

Ao Morrer Certo Item Vira Outro


godjean

Pergunta

Não sei em que parte fica mas to procurando isso que nem doido

Tipo é um script que se tiver um certo item no slot do cordão ao morre ele aparece outro tipo de cordão

Explicando melhor

Você ta com certo item X no slot do cordão ae quando você morre esse item X vira certo item Z.

Link para o comentário
Compartilhar em outros sites

  • Respostas 35
  • Created
  • Última resposta

Top Posters For This Question

Posts Recomendados

  • 0

talvez seja porque quando um monstro morre, esteja checando nele também, podendo resultar nesse bug.

 

tentar usar

 

if isPlayer(cid) then
...
end

Link para o comentário
Compartilhar em outros sites

  • 0

Vodkart o script ficaria assim?

if isPlayer(cid) then

local itemTransf = { -- id do item que tem que ter, id do item que vai transformar

[11962] = 2197,

[11963] = 2173,

[11964] = 2125

}

 

function onDeath(cid, corpse, killer)

 

if itemTransf[getPlayerSlotItem(cid, 2).itemid] then

doTransformItem(getPlayerSlotItem(cid, 2).uid, itemTransf[getPlayerSlotItem(cid, 2).itemid])

end

 

return true

end

Link para o comentário
Compartilhar em outros sites

  • 0
local itemTransf = { -- id do item que tem que ter, id do item que vai transformar
   [7890] = 1234,
   [8909] = 3452,
   [8976] = 5431
}

function onDeath(cid, corpse, killer)
if isPlayer(cid) then
if itemTransf[getPlayerSlotItem(cid, 2).itemid] then
   doTransformItem(getPlayerSlotItem(cid, 2).uid, itemTransf[getPlayerSlotItem(cid, 2).itemid])
end
end
return true
end

Link para o comentário
Compartilhar em outros sites

  • 0

é? que estranho, tenta assim:

 

local itemTransf = { -- id do item que tem que ter, id do item que vai transformar
   [7890] = 1234,
   [8909] = 3452,
   [8976] = 5431
}

function onDeath(cid, corpse, killer)
if isPlayer(cid) and getPlayerSlotItem(cid, 2).itemid > 0 and itemTransf[getPlayerSlotItem(cid, 2).itemid] then
   doTransformItem(getPlayerSlotItem(cid, 2).uid, itemTransf[getPlayerSlotItem(cid, 2).itemid])
end
return true
end

 

caso não der, quando eu chegar em casa eu refaço o script, beleza?

Link para o comentário
Compartilhar em outros sites

  • 0

Ainda continua =l não sei oque ta acontecendo

to pondo tudo certo

no creaturesscript.xml to pondo- <event type="death" name="aol" event="script" value="aol.lua"/>

e no login.lua to pondo - registerCreatureEvent(cid, "aol")

Tem algo errado?

Link para o comentário
Compartilhar em outros sites

  • 0

Eu tenho suspeita nesta linha:

 

doTransformItem(getPlayerSlotItem(cid, 2).uid, itemTransf[getPlayerSlotItem(cid, 2).itemid])

 

 

Jhon modifique os paramentos to bastante ocupado fazendo uma lista de funçoes com explicaçaoes de cada FUNÇAO.

Link para o comentário
Compartilhar em outros sites

  • 0

testei o script do jhon e está certo, não tem erros, eu acho que você não trocou o id dos items, por isso deve tar bugando, ou algum outro script pode estar bugando, não sei, mas o script do jhon está correto.

 

function onDeath(cid, corpse, deathList)
local itemTransf = { -- id do item que tem que ter, id do item que vai transformar
[2173] = 2130,
[2130] = 2135,
[2135] = 2173
}
   if isPlayer(cid) and itemTransf[getPlayerSlotItem(cid, 2).itemid] then
doTransformItem(getPlayerSlotItem(cid, 2).uid, itemTransf[getPlayerSlotItem(cid, 2).itemid])
end
   return true
end

 

 

--

 

veja se você não duplicou a tag no creaturescript.xml

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

  • 0

aff ainda ta bugado olha ae tudo oque eu mexi.

 

login.lua

local config = {
loginMessage = getConfigValue('loginMessage')
}

function onLogin(cid)
local loss = getConfigValue('deathLostPercent')
if(loss ~= nil) then
doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
end

local accountManager = getPlayerAccountManager(cid)
if(accountManager == MANAGER_NONE) then
local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
if(lastLogin > 0) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
else
str = str .. " Please choose your outfit."
doPlayerSendOutfitWindow(cid)
end

doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
elseif(accountManager == MANAGER_NAMELOCK) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, it appears that your

character has been namelocked, what would you like as your new name?")
elseif(accountManager == MANAGER_ACCOUNT) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to manage

your account and if you want to start over then type 'cancel'.")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to create an

account or type 'recover' to recover an account.")
end

if(not isPlayerGhost(cid)) then
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
end

registerCreatureEvent(cid, "Mail")
registerCreatureEvent(cid, "GuildMotd")
registerCreatureEvent(cid, "Idle")
registerCreatureEvent(cid, "SkullCheck")
registerCreatureEvent(cid, "ReportBug")
registerCreatureEvent(cid, "repKill")  
registerCreatureEvent(cid, "repLook")  
registerCreatureEvent(cid, "repMonster")


registerCreatureEvent(cid, "ArenaKill")
-- if he did not make full arena 1 he must start from zero
if getPlayerStorageValue(cid, 42309) < 1 then
	for i = 42300, 42309 do
		setPlayerStorageValue(cid, i, 0)
	end
end
-- if he did not make full arena 2 he must start from zero
if getPlayerStorageValue(cid, 42319) < 1 then
	for i = 42310, 42319 do
		setPlayerStorageValue(cid, i, 0)
	end
end
-- if he did not make full arena 3 he must start from zero
if getPlayerStorageValue(cid, 42329) < 1 then
	for i = 42320, 42329 do
		setPlayerStorageValue(cid, i, 0)
	end
end
if getPlayerStorageValue(cid, 42355) == -1 then
	setPlayerStorageValue(cid, 42355, 0) -- did not arena level
end
setPlayerStorageValue(cid, 42350, 0) -- time to kick 0
setPlayerStorageValue(cid, 42352, 0) -- is not in arena

registerCreatureEvent(cid, "aol")

return true
end

 

 

e Aol.lua

function onDeath(cid, corpse, deathList)
local itemTransf = { -- id do item que tem que ter, id do item que vai transformar
[11962] = 2197,
[11963] = 2173,
[11964] = 2125
}
	   if isPlayer(cid) and itemTransf[getPlayerSlotItem(cid, 2).itemid] then
	doTransformItem(getPlayerSlotItem(cid, 2).uid, itemTransf[getPlayerSlotItem(cid, 2).itemid])
end
	   return true
	end

 

Creaturescript.xml

<?xml version="1.0" encoding="UTF-8"?>
<creaturescripts>
<event type="login" name="PlayerLogin" event="script" value="login.lua"/>
<event type="login" name="PlayerLogin" event="script" value="login2.lua"/>
<event type="login" name="FirstItems" event="script" value="firstitems.lua"/>

<event type="kill" name="ArenaKill" event="script" value="arenakill.lua"/>

<event type="joinchannel" name="GuildMotd" event="script" value="guildmotd.lua"/>
<event type="receivemail" name="Mail" event="script" value="mail.lua"/>
<event type="reportbug" name="SaveReportBug" script="reportbug.lua"/>

<event type="think" name="Idle" event="script" value="idle.lua"/>
<event type="think" name="SkullCheck" event="script" value="skullcheck.lua"/>

	<!--reset -->
<event type="login" name="Reset" event="script" value="reset.lua"/>

<event type="death" name="aol" event="script" value="aol.lua"/>

</creaturescripts>

 

Tem Algo errado?

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

  • 0

estranho, vamos fazer diferente, deleta todos os script que você usou, e vou te mandar um mod e veja se funciona

 

 

 

Mods

 

TransAmulet.xml

<?xml version="1.0" encoding="UTF-8"?>  
<mod name="TransAmulet" version="1.0" author="Jhon" contact="xtibia.com" enabled="yes">  
<config name="trans_func"><![CDATA[

itemTransf = { -- id do item que tem que ter, id do item que vai transformar
   [2173] = 2130,
   [2130] = 2135,
   [2135] = 2173
}
]]></config>
<event type="login" name="TransformRegister" event="script"><![CDATA[
function onLogin(cid)
registerCreatureEvent(cid, "TransDeath")
   return true
   end]]></event>       
<event type="death" name="TransDeath" event="script"><![CDATA[
domodlib('trans_func')
function onDeath(cid, corpse, deathList)
      if isPlayer(cid) and itemTransf[getPlayerSlotItem(cid, 2).itemid] then
   doTransformItem(getPlayerSlotItem(cid, 2).uid, itemTransf[getPlayerSlotItem(cid, 2).itemid])
end
      return true
   end
]]></event>
</mod>

Link para o comentário
Compartilhar em outros sites

  • 0

OMG deu erro denovo vo manda tudo oque tme relacionado ao item>

Esse é no item.xml

<item id="2197" article="a" name="elemental necklace">
 <attribute key="weight" value="4200"/>
 <attribute key="slotType" value="necklace"/>
 <attribute key="absorbPercentAll" value="10"/>
 <attribute key="increaseMagicPercent" value="10"/>
 <attribute key="healthGain" value="1"/>
 <attribute key="healthTicks" value="1"/>
 <attribute key="manaGain" value="1"/>
 <attribute key="manaTicks" value="1"/>
 <attribute key="armor" value="2"/>
 <attribute key="description" value="It's a item maked by Isolta, medium Elemental essenses, a mixture of all necklace. [Abs.All 10%, Inc.Magic 10%, Regen.Life 1/1, Regen.Mana 1/1]"/>
</item>
<item id="2173" article="an" name="spirit elemental amulet">
 <attribute key="weight" value="4200"/>
 <attribute key="slotType" value="necklace"/>
 <attribute key="absorbPercentAll" value="20"/>
 <attribute key="increaseMagicPercent" value="20"/>
 <attribute key="healthGain" value="2"/>
 <attribute key="healthTicks" value="1"/>
 <attribute key="manaGain" value="2"/>
 <attribute key="manaTicks" value="1"/>
 <attribute key="armor" value="4"/>
 <attribute key="description" value="It's a item maked by Isolta, medium Elemental essenses, a mixture of all necklace. [Abs.All 20%, Inc.Magic 20%, Regen.Life 2/1, Regen.Mana 2/1]"/>
</item>
<item id="2125" article="a" name="magic elemental amulet">
 <attribute key="weight" value="4200"/>
 <attribute key="slotType" value="necklace"/>
 <attribute key="absorbPercentAll" value="30"/>
 <attribute key="increaseMagicPercent" value="30"/>
 <attribute key="healthGain" value="3"/>
 <attribute key="healthTicks" value="1"/>
 <attribute key="manaGain" value="3"/>
 <attribute key="manaTicks" value="1"/>
 <attribute key="armor" value="6"/>
 <attribute key="description" value="It's a item maked by Isolta, medium Elemental essenses, a mixture of all necklace. [Abs.All 30%, Inc.Magic 30%, Regen.Life 3/1, Regen.Mana 3/1]"/>
</item>
<item id="11962" name="elemental necklace">
<attribute key="weight" value="4200"/>
<attribute key="slotType" value="necklace"/>
    <attribute key="absorbPercentAll" value="10"/>
    <attribute key="increaseMagicPercent" value="10"/>
<attribute key="healthGain" value="1"/>
<attribute key="healthTicks" value="1"/>
<attribute key="manaGain" value="1"/>
<attribute key="manaTicks" value="1"/>
    <attribute key="preventLoss" value="1"/>
<attribute key="armor" value="2"/>
    <attribute key="description" value="It's a item maked by Isolta, medium Elemental essenses, a mixture of all necklace. [Abs.All 10%, Inc.Magic 10%, Regen.Life 1/1, Regen.Mana 1/1, Pre.Loss]"/>
</item>
<item id="11963" name="spirit elemental amulet">
<attribute key="weight" value="4200"/>
<attribute key="slotType" value="necklace"/>
    <attribute key="absorbPercentAll" value="20"/>
    <attribute key="increaseMagicPercent" value="20"/>
<attribute key="healthGain" value="2"/>
<attribute key="healthTicks" value="1"/>
<attribute key="manaGain" value="2"/>
<attribute key="manaTicks" value="1"/>
    <attribute key="preventLoss" value="1"/>
<attribute key="armor" value="4"/>
    <attribute key="description" value="It's a item maked by Isolta, medium Elemental essenses, a mixture of all amulets. [Abs.All 20%, Inc.Magic 20%, Regen.Life 2/1, Regen.Mana 2/1, Pre.Loss]"/>
</item>
<item id="11964" name="magic elemental amulet">
<attribute key="weight" value="4200"/>
<attribute key="slotType" value="necklace"/>
    <attribute key="absorbPercentAll" value="30"/>
    <attribute key="increaseMagicPercent" value="30"/>
<attribute key="healthGain" value="3"/>
<attribute key="healthTicks" value="1"/>
<attribute key="manaGain" value="3"/>
<attribute key="manaTicks" value="1"/>
    <attribute key="preventLoss" value="1"/>
<attribute key="armor" value="6"/>
    <attribute key="description" value="It's a item maked by Isolta, medium Elemental essenses, a mixture of all amulets. [Abs.All 30%, Inc.Magic 30%, Regen.Life 3/1, Regen.Mana 3/1, Pre.Loss]"/>
</item>

E ae o Movement.xml

<movevent type="Equip" itemid="11962" slot="necklace" event="function" value="onEquipItem"/>
<movevent type="DeEquip" itemid="11962" slot="necklace" event="function" value="onDeEquipItem"/>
<movevent type="Equip" itemid="11963" slot="necklace" event="function" value="onEquipItem"/>
<movevent type="DeEquip" itemid="11963" slot="necklace" event="function" value="onDeEquipItem"/>
<movevent type="Equip" itemid="11964" slot="necklace" event="function" value="onEquipItem"/>
<movevent type="DeEquip" itemid="11964" slot="necklace" event="function" value="onDeEquipItem"/>
<movevent type="Equip" itemid="2125" slot="necklace" event="function" value="onEquipItem"/>
<movevent type="DeEquip" itemid="2125" slot="necklace" event="function" value="onDeEquipItem"/>
<movevent type="Equip" itemid="2173" slot="necklace" event="function" value="onEquipItem"/>
<movevent type="DeEquip" itemid="2173" slot="necklace" event="function" value="onDeEquipItem"/>
<movevent type="Equip" itemid="2197" slot="necklace" event="function" value="onEquipItem"/>
<movevent type="DeEquip" itemid="2197" slot="necklace" event="function" value="onDeEquipItem"/>

Link para o comentário
Compartilhar em outros sites

  • 0

tem certeza que dá para usar caracteres em items.xml?

 

[Abs.All 20%, Inc.Magic 20%, Regen.Life 2/1, Regen.Mana 2/1]

 

"[","%","/" e "]" dão para usar?

Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.

×
×
  • Criar Novo...