TI
dúvida

Potion heal por porcentagen error

Por tiagotjsk, 03 de mar. de 2013 em Scripts

resolvido
otserv
tibia
script
21
1.4k
tiagotjskT
03 de março de 2013 às 21:52

tenho essa script que achei aqui mesmo no xtibia so que ativo ela da nisso creo que alguem pode me ajuda :D rep garantido

 

 

local efeito = 189

local php = getCreatureMaxHealth(cid)

local pmp = getCreatureMaxMana(cid)

local porcentagem = 8 -- Porcentagem de heal

local infinita = "sim" -- Infinita? Sim ou nao

local c = porcentagem/100

 

local exhaust = createConditionObject(CONDITION_EXHAUST)

setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

 

function onUse(cid, item, fromPosition, itemEx, toPosition)

if isPlayer(itemEx.uid) == FALSE then

return FALSE

end

 

if hasCondition(cid, CONDITION_EXHAUST_HEAL) == TRUE then

doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)

return TRUE

end

 

if infinita == "nao" then

doRemoveItem(item.uid, 1)

end

doCreatureAddHealth(itemEx.uid, php*c)

doCreatureAddMana(itemEx.uid, pmp*c)

doAddCondition(cid, exhaust)

doSendMagicEffect(getThingPos(itemEx.uid), efeito)

return TRUE

end

 

 

 

da este error

 

 

[03/03/2013 21:48:17] [Error - Action Interface]

[03/03/2013 21:48:17] data/actions/scripts/pills.lua

[03/03/2013 21:48:17] Description:

[03/03/2013 21:48:17] (luaGetCreatureMaxHealth) Creature not found

GearsG
03 de março de 2013 às 21:53

Você está tentando executar esse comando de /ghost, ou de god?

tiagotjskT
03 de março de 2013 às 21:58

Esse erro da na hora de abrir o server ou da reload , e o item nao consigo usar nao sei se é isso mais pode ate cer pelo que vi na script ta pmp e php eu quero ponha essa script para um item apenas

GearsG
03 de março de 2013 às 22:02

Ja colocou a tag no actions.xml? Senão, bote :)

 

<action itemid="xxx2" script="tools/xxx1.lua"/>

 

No xxx1 voce bota o nome do arquivo, e no xxx2 você bota o id do item, flwww

tiagotjskT
03 de março de 2013 às 22:12

coloquei renicie o servidor e nisso

 

[03/03/2013 22:08:57] [Error - LuaScriptInterface::loadFile] cannot open data/actions/scripts/tools/pills.lua: No such file or directory

[03/03/2013 22:08:57] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/tools/pills.lua)

[03/03/2013 22:08:57] cannot open data/actions/scripts/tools/pills.lua: No such file or directory

 

hmm eu nao tinha posto o arquivo na pasta tools agora que ponhei deu de novo isto

 

 

[03/03/2013 22:11:03] [Error - Action Interface]

[03/03/2013 22:11:03] data/actions/scripts/tools/pills.lua

[03/03/2013 22:11:03] Description:

[03/03/2013 22:11:03] (luaGetCreatureMaxHealth) Creature not found

 

[03/03/2013 22:11:04] [Error - Action Interface]

[03/03/2013 22:11:04] data/actions/scripts/tools/pills.lua

[03/03/2013 22:11:04] Description:

[03/03/2013 22:11:04] (luaGetCreatureMaxMana) Creature not found

[03/03/2013 22:11:04] Reloaded actions.

GearsG
03 de março de 2013 às 22:15

coloquei renicie o servidor e nisso

 

[03/03/2013 22:08:57] [Error - LuaScriptInterface::loadFile] cannot open data/actions/scripts/tools/pills.lua: No such file or directory

[03/03/2013 22:08:57] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/tools/pills.lua)

[03/03/2013 22:08:57] cannot open data/actions/scripts/tools/pills.lua: No such file or directory

 

hmm eu nao tinha posto o arquivo na pasta tools agora que ponhei deu de novo isto

 

 

[03/03/2013 22:11:03] [Error - Action Interface]

[03/03/2013 22:11:03] data/actions/scripts/tools/pills.lua

[03/03/2013 22:11:03] Description:

[03/03/2013 22:11:03] (luaGetCreatureMaxHealth) Creature not found

 

[03/03/2013 22:11:04] [Error - Action Interface]

[03/03/2013 22:11:04] data/actions/scripts/tools/pills.lua

[03/03/2013 22:11:04] Description:

[03/03/2013 22:11:04] (luaGetCreatureMaxMana) Creature not found

[03/03/2013 22:11:04] Reloaded actions.

HMMMMMMMMMM LEGAAAAAAAAL, mas isso ai não tem nada haver com o script que vc postou, o script que vc postou nem se quer tem a função getCreatureMaxMana(cid, quant) e outra, esse script de potion pode botar em scripts normais ou em liquids

flw

tiagotjskT
03 de março de 2013 às 22:18

Mais como eu faria isso pode me ajudar ? onde eu ponharia o getcreaturemax ~~

GearsG
03 de março de 2013 às 23:18

Mano o principo BÁSICO BÁÁÁÁAÁSICO, para alguem te ajudar é vc postar o script que vc quer ajuda, ou fazer um pedido, até agr não entendi nada desse tópico, no começo é um script, no erro fala outro script, explica ai?

tiagotjskT
04 de março de 2013 às 08:23

Obrigado pela ajuda eu achei oque queria ,em outro topico mais vlw :D Rep+ pra voce ^^

Editado Março 4 por tiagotjsk

VincV
04 de março de 2013 às 12:14

o problema é que

"local php = getCreatureMaxHealth(cid)

local pmp = getCreatureMaxMana(cid)"

estam antes do "function onUse",dae são executadas quando carrega o script e n exite a varival cid.

 

e meio complicado explica,mas era só coloca aquela parte depoius de "function onUse(cid, item, fromPosition, itemEx, toPosition)" que arrumava

tiagotjskT
04 de março de 2013 às 12:25

Muito obrigado rep+ para voce tbm

 

Lord debug Voce poderia editar a script e me mandar?

RoksasR
04 de março de 2013 às 12:44

Por favor, sempre use spoilers amigo, tente assim:

 

 

local exhaust = createConditionObject(CONDITION_EXHAUST)

setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

 

function onUse(cid, item, fromPosition, itemEx, toPosition)

 

local efeito = 189

local itemEx = cid

local php = getCreatureMaxHealth(cid)

local pmp = getCreatureMaxMana(cid)

local porcentagem = 8 -- Porcentagem de heal

local infinita = "sim" -- Infinita? Sim ou nao

local c = porcentagem/100

 

if isPlayer(itemEx.uid) == FALSE then

return FALSE

end

 

if hasCondition(cid, CONDITION_EXHAUST_HEAL) == TRUE then

doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)

return TRUE

end

 

if infinita == "nao" then

doRemoveItem(item.uid, 1)

end

doCreatureAddHealth(itemEx.uid, php*c)

doCreatureAddMana(itemEx.uid, pmp*c)

doAddCondition(cid, exhaust)

doSendMagicEffect(getThingPos(itemEx.uid), efeito)

return TRUE

end

 

tiagotjskT
04 de março de 2013 às 12:53

Nao deu erro mais nao funfo o item queria um geito mais facil essa script funciona perfeitament

voce poderia addicionar local para efeito nela ?

 

function onUse(cid, item, itemEx)

 

local percent = 8 -- Porcentagem de cura

local type = "ambos" -- Tipo de cura (health / mana / ambos)

local exha = 1 -- Tempo de exhaustion em segundos

 

if exhaustion.check(cid, 7322) then

doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED) return true

elseif itemEx.uid == cid then

doPlayerSendCancel(cid, "You may only use this potion on yourself.") return true

end

if type == "health" then

doCreatureAddHealth(cid, getCreatureMaxHealth(cid)*(percent/100))

elseif type == "mana" then

doPlayerAddMana(cid, getPlayerMaxMana(cid)*(percent/100))

elseif type == "ambos" then

doCreatureAddHealth(cid, getCreatureMaxHealth(cid)*(percent/100))

doPlayerAddMana(cid, getPlayerMaxMana(cid)*(percent/100))

end

exhaustion.set(cid, 7322, exha)

doCreatureSay(cid, "Aaaah...", TALKTYPE_MONSTER)

doRemoveItem(item.uid, 1)

return true

end

 

 

e me desculpe por nao ponhar em spolier porque nao sei faser isto ja tentei mais nada ja deixa esplicado para min tbm obrigado

RoksasR
04 de março de 2013 às 13:16

Tentae assim, akele script lá de cima:

 

 

local exhaust = createConditionObject(CONDITION_EXHAUST)

setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

 

function onUse(cid, item, fromPosition, itemEx, toPosition)

 

local efeito = 189

local cider = cid

local itemEx = cid

local php = getCreatureMaxHealth(cid)

local pmp = getCreatureMaxMana(cid)

local porcentagem = 8 -- Porcentagem de heal

local infinita = "sim" -- Infinita? Sim ou nao

local c = porcentagem/100

 

if isPlayer(itemEx.uid) == FALSE then

return FALSE

end

 

if hasCondition(cid, CONDITION_EXHAUST_HEAL) == TRUE then

doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)

return TRUE

end

 

if infinita == "nao" then

doRemoveItem(item.uid, 1)

end

doCreatureAddHealth(cid, getCreatureMaxHealth(cid)*(percent/100))

doCreatureAddHealth(cider, getCreatureMaxHealth(cid)*(percent/100))

doPlayerAddMana(cider, getPlayerMaxMana(cid)*(percent/100))

doAddCondition(cid, exhaust)

doSendMagicEffect(getThingPos(itemEx.uid), efeito)

return TRUE

end

 

 

E esse que vc postou agora, tente assim:

 

 

function onUse(cid, item, itemEx)

 

local percent = 8 -- Porcentagem de cura

local type = "ambos" -- Tipo de cura (health / mana / ambos)

local exha = 1 -- Tempo de exhaustion em segundos

local effect = 189

 

if exhaustion.check(cid, 7322) then

doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED) return true

elseif itemEx.uid == cid then

doPlayerSendCancel(cid, "You may only use this potion on yourself.") return true

end

if type == "health" then

doCreatureAddHealth(cid, getCreatureMaxHealth(cid)*(percent/100))

elseif type == "mana" then

doPlayerAddMana(cid, getPlayerMaxMana(cid)*(percent/100))

elseif type == "ambos" then

doCreatureAddHealth(cid, getCreatureMaxHealth(cid)*(percent/100))

doPlayerAddMana(cid, getPlayerMaxMana(cid)*(percent/100))

doSendMagicEffect(getThingPos(itemEx.uid), effect)

end

exhaustion.set(cid, 7322, exha)

doCreatureSay(cid, "Aaaah...", TALKTYPE_MONSTER)

doRemoveItem(item.uid, 1)

return true

end

 

 

Para adicionar spoilers:

 

Escreva [spoiler ] CODIGO AKI

 

tiagotjskT
04 de março de 2013 às 13:26

Ah primeira ae o erro perciste esquece ela , a segunda continua do mesmo geito tipo no debug lua fala q ta com esse poblema

 

 

INFO: Starting OTScript Debug.lua

ERROR: pills.lua:24: '<eof>' expected near 'end'

INFO: Stopping OTScript Debug.lua

 

sera que é isto ??

 

 

e seu rep ja ta garantido hoje de manha dei um para voce eu poder dou mais outro :D

 

hmm eu ponhei ela completa agr e deu isto quando uso o item ele cura perfeitament so q nao da efeito e aparece isso

 

 

 

[04/03/2013 13:27:59] [Error - Action Interface]

[04/03/2013 13:27:59] data/actions/scripts/tools/pills.lua:onUse

[04/03/2013 13:27:59] Description:

[04/03/2013 13:27:59] (luaGetThingPosition) Thing not found

Editado Março 4 por tiagotjsk