Cargas Em Amuleto

lucas502
em Scripts

lucas502

avatar
Artesão
Artesão

INFOS

Grupo: ArtesãoRegistrado: 31/03/07Posts: 122

Olá galera, preciso de ajuda para colocar cargas no amuleto AOL Red/Black skull, como eu coloco cargas nesse amuleto? (10x cargas)

 

Script:

 

function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
if (getPlayerSlotItem(cid, 2).itemid == 2196) and getPlayerSkullType(cid) >= 4 then
doCreatureSetDropLoot(cid, false)
doPlayerSetLossPercent(cid, PLAYERLOSS_ITEMS, 0)
doPlayerSetLossPercent(cid, PLAYERLOSS_CONTAINERS, 0)
end
return true
end

 

login.lua

registerCreatureEvent(cid, "RedSkullAmulet")

 

creaturescripts tag

<event type="preparedeath" name="RedSkullAmulet" event="script" value="script.lua"/>

 

Item

<item id="2196" article="a" name="Red Skull Amulet">
<attribute key="weight" value="420" />
<attribute key="slotType" value="necklace" />

 

 

PS: Não testei colocar a tag

<attribute key="charges" value="10" />

pois acredito que não funcionaria por que o amuleto funciona em creaturescripts.

beddy

O fais TUDO...
avatar
Visconde
Visconde

INFOS

Grupo: ViscondeRegistrado: 21/12/06Posts: 355Gênero: Masculino

Não custa nada tentar neh... ;/

a.png

lucas502

avatar
Artesão
Artesão

INFOS

Grupo: ArtesãoRegistrado: 31/03/07Posts: 122

Na verdade já fiz isso com outro item em script também, não funcionou..

 

Tenho quase certeza que não vai funcionar '-'

andretoprox

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 29/10/11Posts: 53Char no Tibia: Razzor Master

mesmo que seja com script axo que vai funcionar, tenta colocar essas tags:

    <attribute key="showcharges" value="10" />
    <attribute key="showattributes" value="1" />

Fire_655a8d_1248569.gif

lucas502

avatar
Artesão
Artesão

INFOS

Grupo: ArtesãoRegistrado: 31/03/07Posts: 122

Testei, não deu certo

Vinc

The white fox
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 30/10/11Posts: 625Gênero: Masculino

tenta usa esse script

function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
item = getPlayerSlotItem(cid, 2)
if (item.itemid == 2196) and getPlayerSkullType(cid) >= 4 then
charges = getChargesByDescripition(item.uid)
if charges > 1 then
doRemoveChargeBydesc(item.uid)
doCreatureSetDropLoot(cid, false)
doPlayerSetLossPercent(cid, PLAYERLOSS_ITEMS, 0)
doPlayerSetLossPercent(cid, PLAYERLOSS_CONTAINERS, 0)
elseif charges == 1 then
doCreatureSetDropLoot(cid, false)
doPlayerSetLossPercent(cid, PLAYERLOSS_ITEMS, 0)
doPlayerSetLossPercent(cid, PLAYERLOSS_CONTAINERS, 0)
doRemoveItem(item.uid)
end
end
return true
end

function getChargesByDescripition(uid)
s = getItemDescriptions(uid))
charges = s:sub(s:find("charges ") +8,s:find("%.")-1)
k = tonumber(charges)
if k then
return k
else
return false
end


function doRemoveChargeBydesc(uid)
s = getItemDescriptions(uid))
k = getChargesByDescripition(uid)
s = s:sub(1, s:find("%d")-1)
doItemSetAttribute(uid,"description", ""..s..""..k..".")
return TRUE
end

dai se vai la no item.xml e coloca na description do item "charges 20."(sem aspas,mas com o ponto final),se o item n tive o attributo description adicione ele

^w^

lucas502

avatar
Artesão
Artesão

INFOS

Grupo: ArtesãoRegistrado: 31/03/07Posts: 122

testei seu script, deu erro:

 

[Error - LuaInterface::loadFile] data/creaturescripts/scripts/redskullamulet.lua:21: unexpected symbol near ')'

[Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/redskullamulet.lua)

data/creaturescripts/scripts/redskullamulet.lua21: unexpected symbol near ')'

Vodkart

Sumus Validus
avatar
Herói
Herói

INFOS

Grupo: HeróiRegistrado: 21/05/10Posts: 3406Gênero: Masculino

tenta assim:

 

 

Items.xml

<item id="2196" article="a" name="Red Skull Amulet">
<attribute key="weight" value="420" />
<attribute key="slotType" value="necklace" />
<attribute key="charges" value="10" />
<attribute key="showcharges" value="1" />
</item>

 

 

script

 

function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
local colar = getPlayerSlotItem(cid, 2)
if isPlayer(cid) and (colar.itemid == 2196) and getPlayerSkullType(cid) >= 4 then
if colar.type > 1 then
doChangeTypeItem(colar.uid, colar.type - 1)
else
doRemoveItem(colar.uid, 1)
end
doCreatureSetDropLoot(cid, false)
doPlayerSetLossPercent(cid, PLAYERLOSS_ITEMS, 0)
doPlayerSetLossPercent(cid, PLAYERLOSS_CONTAINERS, 0)
end
return true
end

bossisg.png

lucas502

avatar
Artesão
Artesão

INFOS

Grupo: ArtesãoRegistrado: 31/03/07Posts: 122

Funcionou Vodkart! vlw ;)

 

 

REP+ quando der (esgotou '-')

 

 

topico reportado.

Vilden

Loading. . .
avatar
Infante
Infante

INFOS

Grupo: InfanteRegistrado: 09/05/08Posts: 1597

Dúvida sanada, movido.

Atenciosamente, Vilden.