SK
dúvida

Potions

Por SkyDarkyes, 25 de set. de 2013 em Scripts

resolvido
49
6.7k
25 de setembro de 2013 às 17:39

Galera gostaria de saber como colocar para o potion healar MANA E VIDA

 

Gostaria de saber como eu add para a healar mana e vida,mas apenas oque eu escolher

local config = { 
        removeOnUse = "yes", 
        usableOnTarget = "yes", -- can be used on target? (fe. healing friend) 
        splashable = "no", 
        realAnimation = "no", -- make text effect visible only for players in range 1x1 
        healthMultiplier = 1.0, 
        manaMultiplier = 1.0 
} 
 
config.removeOnUse = getBooleanFromString(config.removeOnUse) 
config.usableOnTarget = getBooleanFromString(config.usableOnTarget) 
config.splashable = getBooleanFromString(config.splashable) 
config.realAnimation = getBooleanFromString(config.realAnimation) 
 
local POTIONS = { 
        [2150] = {empty = 7478, splash = 2, health = {5000, 5000}}, -- heal potion 
        [2151] = {empty = 7478, splash = 2, health = {20000, 20000}}, -- heal strong potion
        [2144] = {empty = 7478, splash = 7, mana = {5000, 5000}}, -- strong mana potion 
        [2149] = {empty = 7478, splash = 7, mana = {15000, 15000}}, -- great mana potion 
} 
 
local exhaust = createConditionObject(CONDITION_EXHAUST) 
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100)) 
 
function onUse(cid, item, fromPosition, itemEx, toPosition) 
        local potion = POTIONS[item.itemid] 
        if(not potion) then 
                return false 
        end 
        if(not isPlayer(itemEx.uid) or (not config.usableOnTarget and cid ~= itemEx.uid)) then 
                if(not config.splashable) then 
                        return false 
                end 
                if(toPosition.x == CONTAINER_POSITION) then 
                        toPosition = getThingPos(item.uid) 
                end 
                doDecayItem(doCreateItem(2016, potion.splash, toPosition)) 
                doTransformItem(item.uid, potion.empty) 
                return TRUE 
        end 
        if(hasCondition(cid, CONDITION_EXHAUST_HEAL)) then 
                doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED) 
                return TRUE 
        end 
        if(((potion.level and getPlayerLevel(cid) < potion.level) or (potion.vocations and not isInArray(potion.vocations, getPlayerVocation(cid)))) and 
                not getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES)) 
        then 
                doCreatureSay(itemEx.uid, "Only " .. potion.vocStr .. (potion.level and (" of level " .. potion.level) or "") .. " or above may drink this fluid.", TALKTYPE_ORANGE_1) 
                return TRUE 
        end 
        local health = potion.health 
        if(health and not doCreatureAddHealth(itemEx.uid, math.ceil(math.random(health[1], health[2]) * config.healthMultiplier))) then 
                return false 
        end 
        local mana = potion.mana 
        if(mana and not doPlayerAddMana(itemEx.uid, math.ceil(math.random(mana[1], mana[2]) * config.manaMultiplier))) then 
                return false 
        end 
        doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE) 
        if(not realAnimation) then 
                doCreatureSay(itemEx.uid, "I feel better!", TALKTYPE_ORANGE_1) 
        else 
                for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do 
                        if(isPlayer(tid)) then 
                                doCreatureSay(itemEx.uid, "I feel better!", TALKTYPE_ORANGE_1, false, tid) 
                        end 
                end 
        end 
        doAddCondition(cid, exhaust) 
        if(not potion.empty or config.removeOnUse) then 
        doRemoveItem(item.uid, 1) 
        return TRUE 
        end 
 
        doRemoveItem(item.uid, 0) 
        doPlayerAddItem(cid, potion.empty, 0) 
        doPlayerRemoveItem(cid, potion.empty, getPlayerItemCount(cid, potion.empty)) 
        doPlayerAddItem(cid, potion.empty, getPlayerItemCount(cid, potion.empty)) 
        return TRUE 
end

Tambem gostaria de saber para que serve

 

 

local config = { 
        removeOnUse = "yes", 
        usableOnTarget = "yes", -- can be used on target? (fe. healing friend) 
        splashable = "no", 
        realAnimation = "no", -- make text effect visible only for players in range 1x1 
        healthMultiplier = 1.0, 
        manaMultiplier = 1.0 
} 

Editado Setembro 25 por SkyDarkyes

netinhossdN
25 de setembro de 2013 às 17:46

voce gostaria que o health potion, subisse a mana e hp ao msm tempo certo?


voce quer que todas as classes usem? ou nao?

25 de setembro de 2013 às 17:50

Sim isso mesmo,para todas as classes e healasse hp+mana junto tipo assim

 

[2149] = {empty = 7478, splash = 7, mana/vida = {15000, 15000}}, -- great mana potion
}

netinhossdN
25 de setembro de 2013 às 17:53

bom vc n ta me respondendo entao vou esplicar o que conseguir entender ok?

 

local config = {
removeOnUse
= "yes", ---------- se vai remover a potion vazia (empty potion).
usableOnTarget
= "yes", ------------------------ se vc consegue usar em algum player / bixo (monster).
splashable
= "no", ------------------------------- se ele espalha no chao tipo uma poça de sangue ao matar 1 rato (usa-lo no chao sem target (alvo) ele ira soltar a pot no chao.
realAnimation
= "no" -------------- se voce usar uma potion, e o player estiver a 5 sqm (quadrados) ele nao vira o efeito da potion.
healthMultiplier = 1.0, ------------------------------------- quanto ira multiplicar a quantia de heal (cura) da potion.. ex: health potion cura 200 x 5 (esse multiplier) = 1k (1.000)
manaMultiplier
= 1.0 -------------------- vale o mesmo para mana potion 200 x 5 = 1k (1.000)


vou fazer aqui

rapidin lhe entrego

 

da 1 lida pra ver se vc entende ai tah?


voce quer todas as classes e para qualquer level? tipo lvl 1 usar ultimate health potion? ou o level requerido mesmo 130?

25 de setembro de 2013 às 17:55

Bom entendi +- ^^

netinhossdN
25 de setembro de 2013 às 18:03

mas as potions voce quer para qualquer level?

pq se n eu tenho q fazer diferente aqui!


olha aqui vai...
procure na sua pasta data/actions/scripts/liquids/ultimate health potion... cole isso la e veja se deu tudo ok,se sim me fale que lhe enviarei o restante
local MINHP = 800
local MAXHP = 1000
local MAXMP = 600
local MAXMP - 1000
local EMPTY_POTION = 7635
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((not(isKnight(itemEx.uid)) or getPlayerLevel(itemEx.uid) < 130) and getPlayerCustomFlagValue(itemEx.uid, PlayerCustomFlag_GamemasterPrivileges) == FALSE) then
doCreatureSay(itemEx.uid, "Only knights of level 130 or above may drink this fluid.", TALKTYPE_ORANGE_1)
return TRUE
end
if doCreatureAddHealth(itemEx.uid, math.random(MINHP, MAXHP)) == LUA_ERROR then
return FALSE
end
if doCreatureAddMana(itemEx.uid, math.random(MINMP, MAXMP)) == LUA_ERROR then
return FALSE
end
doAddCondition(cid, exhaust)
doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
doRemoveItem(item.uid, 1)
doPlayerAddItem(cid, EMPTY_POTION, 1)
pot_count = getPlayerItemCount(cid, EMPTY_POTION)
doPlayerRemoveItem(cid, EMPTY_POTION, pot_count)
doPlayerAddItem(cid, EMPTY_POTION, pot_count)
return TRUE
end
25 de setembro de 2013 às 18:07

Ah man mais ai ira healar de x tanto de x tanto,queria que healasse uma quantidade certa

netinhossdN
25 de setembro de 2013 às 18:13

entao é so voce mudar la assim...

 

minhp = 900

maxhp = 900

minmp = 900

maxmp = 900


agora va na mesma pasta...

data/actions/scripts/liquids/potions ------------ (agora abra potions.lua)

 

dentro dela estara assim :::

 

 

local POTIONS = {

[8704] = {empty = 7636, splash = 2, health = {50, 100}, storage = 49990}, -- small health potion - normal
[7618] = {empty = 7636, splash = 2, health = {100, 200}, storage = 49989}, -- health potion - normal
[7588] = {empty = 7634, splash = 2, health = {200, 400}, level = 50, vocations = {3, 4, 7, 8}, vocStr = "knights and paladins", storage = 49988}, -- strong health potion
1 voce fara o seguinte...
onde esta de azul é o level requerido para usar o SHP (STRONG HEALTH POTION) se colocar 1 todos usam
onde esta de amarelo é a vocação dos players:
1 é sorcerer
2 é druid
3 é paladin
4 é knight
obs: nao precisa colocar as vocações quando haver promote (elder druid / master sorcerer ...) o sistema .lua le isso normal para todas as vocações.
e onde esta de verde é o nome de tal vocação...tipo se voce colocou só para 1, 2, 3 ou seja voce tera que colocar no vocstr sorcerer, druid and paladins.
consegue entender?

voce tera que mudar no potions esse exemplo ai da vocação... eu cortei o restante para nao ficar mt extensivo, voce pode ir mudando ai tbm ^^ ok?

qualquer duvida pode responder...

25 de setembro de 2013 às 18:14

Man assim não da [2149] = {empty = 7478, splash = 7, mana = {15000, 15000}, health = {15000, 15000}}, -- great mana potion

 

?

netinhossdN
25 de setembro de 2013 às 18:26

--------------------------------------------------

editei aqui pra vc so salvair isso em potions.lua

 

 

 

local config = {
removeOnUse = "no",
usableOnTarget = "yes", -- can be used on target? (fe. healing friend)
splashable = "no",
realAnimation = "no", -- make text effect visible only for players in range 1x1
healthMultiplier = 1.0,
manaMultiplier = 1.0
}
config.removeOnUse = getBooleanFromString(config.removeOnUse)
config.usableOnTarget = getBooleanFromString(config.usableOnTarget)
config.splashable = getBooleanFromString(config.splashable)
config.realAnimation = getBooleanFromString(config.realAnimation)
local POTIONS = {
[8704] = {empty = 7636, splash = 2, health = {500, 500}, mana = {500, 500}, storage = 49990}, -- small health potion
[7618] = {empty = 7636, splash = 2, health = {500, 500}, mana = {500, 500}, storage = 49989}, -- health potion
[7588] = {empty = 7634, splash = 2, health = {500, 500}, mana = {500, 500}, level = 1, vocations = {1, 2, 3, 4, 5, 6, 7, 8}, vocStr = "use to all vocations", storage = 49988}, -- strong health potion
[7591] = {empty = 7635, splash = 2, health = {500, 500}, mana = {500, 500}, level = 1, vocations = {1, 2, 3, 4, 5, 6, 7, 8}, vocStr = "all vocations", storage = 49987}, -- great health potion
[8473] = {empty = 7635, splash = 2, health = {1000, 1000}, mana = {1000, 1000}, level = 1, vocations = {1, 2, 3, 4, 5, 6, 7, 8}, vocStr = "all vocations", storage = 49986}, -- ultimate health potion
[7620] = {empty = 7636, splash = 7, mana = {500, 500}, health = {500, 500}, storage = 49985}, -- mana potion
[7589] = {empty = 7634, splash = 7, mana = {500, 500}, health = {500, 500}, level = 1, vocations = {1, 2, 3, 5, 6, 7}, vocStr = "all vocations", storage = 49984}, -- strong mana potion
[7590] = {empty = 7635, splash = 7, mana = {500, 500}, health = {500, 500}, level = 1, vocations = {1, 2, 3, 4, 5, 6, 7, 8}, vocStr = "all vocations", storage = 49983}, -- great mana potion
[8472] = {empty = 7635, splash = 3, health = {500, 500}, mana = {500, 500}, level = 1, vocations = {1, 2, 3, 4, 5, 6, 7, 8}, vocStr = "all vocations", storage = 49982} -- great spirit potion
}
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))
function onUse(cid, item, fromPosition, itemEx, toPosition)
local potion = POTIONS[item.itemid]
if(not potion) then
return false
end
if(not isPlayer(itemEx.uid) or (not config.usableOnTarget and cid ~= itemEx.uid)) then
if(not config.splashable) then
return false
end
if(toPosition.x == CONTAINER_POSITION) then
toPosition = getThingPos(item.uid)
end
doDecayItem(doCreateItem(2016, potion.splash, toPosition))
doTransformItem(item.uid, potion.empty)
return true
end
if(hasCondition(cid, CONDITION_EXHAUST_HEAL)) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
return true
end
if(((potion.level and getPlayerLevel(cid) < potion.level) or (potion.vocations and not isInArray(potion.vocations, getPlayerVocation(cid)))) and
not getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES))
then
doCreatureSay(itemEx.uid, "Only " .. potion.vocStr .. (potion.level and (" of level " .. potion.level) or "") .. " or above may drink this fluid.", TALKTYPE_ORANGE_1)
return true
end
if getPlayerStorageValue(cid, potion.storage) > 1 then
local health = potion.health
if(health and not doCreatureAddHealth(itemEx.uid, math.ceil(math.random(health[1], health[2]) * config.healthMultiplier))) then
return false
end
local mana = potion.mana
if(mana and not doPlayerAddMana(itemEx.uid, math.ceil(math.random(mana[1], mana[2]) * config.manaMultiplier))) then
return false
end
setPlayerStorageValue(cid, potion.storage, getPlayerStorageValue(cid, potion.storage)-1)
doPlayerSendTextMessage(cid, 19, "Haz usado una potion de "..getPlayerStorageValue(cid, potion.storage).." charges.")
else
doPlayerSendTextMessage(cid, 19, "Se te han acabado las cargas, compra mas diciendo: !charges |type|,|amount|.")
return false
end
doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
if(not realAnimation) then
doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
else
for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do
if(isPlayer(tid)) then
doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1, false, tid)
end
end
end
doAddCondition(cid, exhaust)
return true
end

editado amigo pode só colocar no arquivo potions.lua (nesse que voce pegou esse exemplo) e salvar

se quiser editar

a mana e o hp

é so vc procurar mana = 500 , 500, <---------- coloque a quantida que voce queira / mana ou hp ok? se der certo que tal 1 rep? xP the first kk vlw

25 de setembro de 2013 às 18:29

Da pra tirar essas tag nao?

vocations = {1, 2, 3, 4, 5, 6, 7, 8}, vocStr = "all vocations"

Editado Setembro 25 por SkyDarkyes

netinhossdN
25 de setembro de 2013 às 18:41

nao,pois é oque iria fazer ler que é para todas as vocações :)


testa ai e me diz ok?

aguardando


e ai? testou?

25 de setembro de 2013 às 18:44

Man voce add pra healar mana e vida em todos aff nao era assim,eu que ia add novos potions ai neles ia heala mana e vida

netinhossdN
25 de setembro de 2013 às 18:46

ah cara entendi que voce queria que todos healassem entende? :\

quais as potions que voce quer q use para healar mp/hp?

manda o id que eu adiciono pra vc aqui

MaenilseM
25 de setembro de 2013 às 18:47

cara usa

[./spoiler] ou [.code] [./code]

qnd for postar o script, assim o topico nao fica tao longo.

 

sem o ponto.

Editado Setembro 25 por Maenilse