[Talkaction] Potions con cargas
2 participantes
[Talkaction] Potions con cargas
Sáb Mayo 19, 2012 11:29 am
Hola amigos de OTHispano, busque y busque este script, pero lo encontraba todo mal D:, me puse a arreglarlo, tarde mucho tiempo,pero quedo;)
En que consiste?
Si alguna vez, has jugado Necroxia Origin, sabras de que te hablo , potions con cargas, para no tener todo amontonado, ni en bps y eso , acontinuacion los scripts.
actions/scripts/liquids/potions.lua
van a sustituir lo que ustedes tienen, por esto:
talkactions/scripts/potions.lua
talkactions.xml
Imagenes;
Comandos;
!cargar gmp, cantidad <-- cargar potions
!cargar <-- muestra la informacion, cuales puedes cargar, y como.
Creditos
Falcon
En que consiste?
Si alguna vez, has jugado Necroxia Origin, sabras de que te hablo , potions con cargas, para no tener todo amontonado, ni en bps y eso , acontinuacion los scripts.
actions/scripts/liquids/potions.lua
van a sustituir lo que ustedes tienen, por esto:
- Código:
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 = {50, 100}, storage = 49990}, -- small health potion
[7618] = {empty = 7636, splash = 2, health = {100, 200}, storage = 49989}, -- health potion
[7588] = {empty = 7634, splash = 2, health = {200, 400}, level = 50, vocations = {3, 4, 7, 8}, vocStr = "knights and paladins", storage = 49988}, -- strong health potion
[7591] = {empty = 7635, splash = 2, health = {500, 700}, level = 80, vocations = {4, 8}, vocStr = "knights", storage = 49987}, -- great health potion
[8473] = {empty = 7635, splash = 2, health = {800, 1000}, level = 130, vocations = {4, 8}, vocStr = "knights", storage = 49986}, -- ultimate health potion
[7620] = {empty = 7636, splash = 7, mana = {70, 130}, storage = 49985}, -- mana potion
[7589] = {empty = 7634, splash = 7, mana = {110, 190}, level = 50, vocations = {1, 2, 3, 5, 6, 7}, vocStr = "sorcerers, druids and paladins", storage = 49984}, -- strong mana potion
[7590] = {empty = 7635, splash = 7, mana = {200, 300}, level = 80, vocations = {1, 2, 5, 6}, vocStr = "sorcerers and druids", storage = 49983}, -- great mana potion
[8472] = {empty = 7635, splash = 3, health = {200, 400}, mana = {110, 190}, level = 80, vocations = {3, 7}, vocStr = "paladins", 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
talkactions/scripts/potions.lua
- Código:
--Fixed by falcon--
function onSay(cid, words, param, channel)
--configuration --
local items =
{
['hp'] = {cost = 45, storage = 49989},
['shp'] = {cost = 100, storage = 49988},
['ghp'] = {cost = 190, storage = 49987},
['uhp'] = {cost = 310, storage = 49986},
['mp'] = {cost = 50, storage = 49985},
['smp'] = {cost = 80, storage = 49984},
['gmp'] = {cost = 120, storage = 49983},
['gsp'] = {cost = 190, storage = 49982}
}
-- Fin configuration --
local t = string.explode(param, ",")
local item = items[t[1]]
local amount = tonumber(t[2])
-- Checks if we can buy that itemname --
if item then
-- Checks if the player has enough money --
if doPlayerRemoveMoney(cid, item.cost*amount) == LUA_NO_ERROR then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You have bought '..amount..' '..t[1]..' charges for '..(item.cost*amount)..' golden pieces.')
setPlayerStorageValue(cid, item.storage, getPlayerStorageValue(cid, item.storage)+amount)
else
doPlayerSendCancel(cid, 'You dont have enough money to buy that many charges.')
doSendMagicEffect(getPlayerPosition (cid), CONST_ME_POFF)
end
else
-- Sends the player a message wich includes items he can buy --
text = "Charges you can buy:\n"
-- Getting the all itemnames and prics --
for item1 in pairs (items) do
-- Sends a message with each itemname and price --
text = text .. "\n" .. item1
end
text = text .. "\n\nexample: type '!charges gmp,100' para comprar 100 gmp."
doPlayerPopupFYI(cid, text)
end
return true
end
talkactions.xml
- Código:
<talkaction words="!cargar" event="script" value="potions.lua"/>
Imagenes;
Comandos;
!cargar gmp, cantidad <-- cargar potions
!cargar <-- muestra la informacion, cuales puedes cargar, y como.
Creditos
Falcon
- uG.~DjMajestickMiembro
- Mensajes : 2
Re: [Talkaction] Potions con cargas
Sáb Mayo 19, 2012 11:31 am
gracias weon ;*
+Rep
+Rep
Permisos de este foro:
No puedes responder a temas en este foro.