RO
pedido

como fazer look?

Por rohfagundes, 22 de abr. de 2013 em Scripts

script
8
1k
rohfagundesR
22 de abril de 2013 às 19:10

eu to querendo fazer um look de um item pra mostrar os %

 

a funcão do script é essa

 

 

 

function hasWater(cid, porcento)

if porcento > 100 then return false end

local pouch = getPlayerSlotItem(cid, 10)

if pouch.itemid == 4864 and (pouch.actionid == 0 and 100 or pouch.actionid-100) >= porcento then

newtype = (pouch.actionid == 0 and 200 or pouch.actionid) - porcento

if newtype == 100 then doTransformItem(pouch.uid, 4863) end

doSetItemActionId(pouch.uid, newtype)

doPlayerSendTextMessage(cid, 25, (newtype-100).. "% Rest")

return true

end

doPlayerSendTextMessage(cid, 25, "There is not enough water to perform this bending.")

return false

end

 

 

edit: e tb como eu posso fazer pra mostra uma mensagem pro player dos % q ainda tem quando ele usar uma spell?

 

edit²:eu ja consegui fazer os % quando usa spell mas

quando da look ainda n consegui

=/

ninguem sabe?

 

 

edit³: eu fiz um pra ver se dava certo mas deu esse erro

 

 

 

[22/4/2013 19:4:44] [Error - CreatureScript Interface]

[22/4/2013 19:4:44] data/creaturescripts/scripts/waterpouch.lua:onLook

[22/4/2013 19:4:44] Description:

[22/4/2013 19:4:44] data/creaturescripts/scripts/waterpouch.lua:5: attempt to perform arithmetic on global 'newtypee' (a nil value)

[22/4/2013 19:4:44] stack traceback:

[22/4/2013 19:4:44] data/creaturescripts/scripts/waterpouch.lua:5: in function <data/creaturescripts/scripts/waterpouch.lua:1>

 

 

o script é esse

 

function onLook(cid, thing, position, lookDistance)

if isCreature(thing.uid) then return true end

 

if thing.itemid == 4864 then

doSetItemAttribute(thing.uid, "description", "Você tem " .. (newtypee - 100) .. "% de agua.")

end

return true

end

 

 

alguem sabe o q esta errado?

na spell eu usei isso e o valor vai certo '-'

Editado Abril 22 por rohfagundes

SkymagnumS
22 de abril de 2013 às 19:13

no onLook a variável newTypee não existe por isso da o erro.

rohfagundesR
22 de abril de 2013 às 19:30

mas no caso ele n pega o q esta na function

pensei q tirando o local iria funcionar =X

vc pode me ajudar a fazer isso =X

pq eu ja tentei um monte de coisa pra fazer ele pegar o valor % em look e n to conseguindo

SkymagnumS
22 de abril de 2013 às 20:12

function onLook(cid, thing, position, lookDistance)

if isCreature(thing.uid) then return true end

 

if thing.itemid == 4864 then

doSetItemAttribute(thing.uid, "description", "Você tem " .. thing.actionid .. "% de agua.")

end

return true

end

rohfagundesR
22 de abril de 2013 às 21:27

ai da essa erro

 

 

[22/4/2013 20:15:47] [Error - CreatureScript Interface]

[22/4/2013 20:15:47] data/creaturescripts/scripts/waterpouch.lua:onLook

[22/4/2013 20:15:47] Description:

[22/4/2013 20:15:47] data/creaturescripts/scripts/waterpouch.lua:5: attempt to call global 'doSetItemAttribute' (a nil value)

[22/4/2013 20:15:47] stack traceback:

[22/4/2013 20:15:47] data/creaturescripts/scripts/waterpouch.lua:5: in function <data/creaturescripts/scripts/waterpouch.lua:1>

 

edit: procurei aqui mo tempao pra ver se acho o pq desse erro mas n achei

 

ninguem sabe arrumar ele n?

Editado Abril 22 por rohfagundes

SkymagnumS
22 de abril de 2013 às 22:45

Mano que erro zuado diz que o doSetItemAttribute está com um valor nil lol.

rohfagundesR
23 de abril de 2013 às 07:51

e vc sabe pq acontece isso?

ninguem sabe pq acontece isso?

=/

NocktalN
29 de abril de 2013 às 13:28

praque e isso da uma esplicadinha