kaparzo231
New Member
Hey,
I have a working script on manarune and I try to do the same with super uh but it's not working.
Tibia 10.98
theforgottenserver-v1.2-win64
data/actions
data/actions/scripts/other/manarune.lua
Script on manarune:
I have no such thing as "getPlayerHealth" in "compat.lua" but i have this:
and
What do I need to change for the script to work?
I have tried to do it in spells it's worked but uh do not end, so i tried to remake manarune.
This worked:
data/spells.xml
Script:
Sorry for my english, sometimes i have to use translator
I have a working script on manarune and I try to do the same with super uh but it's not working.
Tibia 10.98
theforgottenserver-v1.2-win64
data/actions
XML:
<action itemid="2270" script="other/manarune.lua" />
data/actions/scripts/other/manarune.lua
Script on manarune:
Lua:
function getPlayerManaMax(cid)
manaNow = getPlayerMana(cid)
doPlayerAddMana(cid,10000)
manaMax = getPlayerMana(cid)
doPlayerAddMana(cid,manaNow-manaMax)
return manaMax
end
function onUse(cid, item, frompos, item2, topos)
local config = {
ended = true,
effect_enable = true,
effect = 13,
text_enable = true,
text_colour = 191,
exh =
{
exh_enable = true,
exh_time = 1.4,
storage = 12345, -- liczba przechowujaca exhausted
}
}
local voctab =
{
{minn=5, maxx=750, lvmul=2, mlmul=35},
{minn=150, maxx=550, lvmul=12, mlmul=1},
{minn=50, maxx=550, lvmul=5, mlmul=45},
{minn=150, maxx=1550, lvmul=3, mlmul=15}
}
topos.stackpos = 253
player = getThingfromPos(topos)
playerpos = getPlayerPosition(player.uid)
cidpos = getPlayerPosition(cid)
used = false
canUse = true
maglv = getPlayerMagLevel(cid)
voc = getPlayerVocation(cid)
lv=getPlayerLevel(cid)
vocc=voctab[voc]
addminn=vocc.minn +(vocc.lvmul*lv)+(vocc.mlmul*maglv)
addmaxx=vocc.maxx +(vocc.lvmul*lv)+(vocc.mlmul*maglv)
add=math.random(addminn,addmaxx)
if player.uid > 0 then
if getPlayerMana(player.uid) == getPlayerManaMax(player.uid) then
doPlayerSendCancel(cid, "Mana "..getPlayerName(player.uid).." is full!")
return 1
end
else
if getPlayerMana(cid) == getPlayerManaMax(cid) then
doPlayerSendCancel(cid, "Your mana is full.")
return 1
end
end
if(os.time() < getPlayerStorageValue(cid, config.exh.storage)) then
doPlayerSendCancel(cid,"You are exhausted.")
canUse = false
end
if (canUse) then
if player.itemid > 0 then
if (config.effect_enable) then
doSendMagicEffect(playerpos, config.effect)
end
if (config.text_enable) then
doCreatureSay(cid, add, TALKTYPE_ORANGE_1)
end
doPlayerAddMana(player.uid,add)
used = true
else
if config.effect_enable then
doSendMagicEffect(cidpos, config.effect)
end
if (config.text_enable) then
doCreatureSay(cid, add, TALKTYPE_ORANGE_1)
end
doPlayerAddMana(cid,add)
used = true
end
end
if (used) and (canUse) then
if (config.exh.exh_enable) then
setPlayerStorageValue(cid, config.exh.storage, os.time() + config.exh.exh_time)
end
if (config.ended) then
if item.type > 1 then
doChangeTypeItem(item.uid,item.type-1)
else
doRemoveItem(item.uid,1)
end
end
end
return 1
end
I have no such thing as "getPlayerHealth" in "compat.lua" but i have this:
Lua:
function getCreatureHealth(cid) local c = Creature(cid) return c ~= nil and c:getHealth() or false end
and
Lua:
function getCreatureMaxHealth(cid) local c = Creature(cid) return c ~= nil and c:getMaxHealth() or false end
What do I need to change for the script to work?
Post automatically merged:
I have tried to do it in spells it's worked but uh do not end, so i tried to remake manarune.
This worked:
data/spells.xml
XML:
<rune group="healing" spellid="4" name="Super uh" id="2265" allowfaruse="1" charges="1" lvl="15" maglv="1" cooldown="2000" groupcooldown="2000" aggressive="0" needtarget="1" blocktype="solid" script="healing/superuh.lua" />
Script:
Lua:
local combat = createCombatObject()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_PARALYZE)
combat:setParameter(COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false)
function onGetFormulaValues(player, level, maglevel)
local min = (level / 5) + (maglevel * 7.3) + 42
local max = (level / 5) + (maglevel * 12.4) + 90
if min < 10000 then
min = 10000
max = 10000
end
return min, max
end
setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
function onCastSpell(creature, variant, isHotkey)
return combat:execute(creature, variant)
end
Sorry for my english, sometimes i have to use translator
Last edited: