• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

docreaturesay on ultimate healing rune

zxzxzx

New Member
Joined
Mar 12, 2011
Messages
334
Reaction score
3
hello! I want to add something like this "doCreatureSay(cid, "+"..math.floor(rand).." hp", TALKTYPE_ORANGE_1)" to this script:

Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)
combat:setParameter(COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_PARALYZE)

function onGetFormulaValues(player, level, maglevel)
    local min = (level * 13) + (maglevel * 100) + 100
    local max = (level * 15) + (maglevel * 200) + 100
    return min, max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(creature, var, isHotkey)
    return combat:execute(creature, var)
end

how to do it?

rep for help++
 
What kind of error? It looks very simple script..


but nvm you can try
Code:
return doCombat(creature, combat, var)
 
like this:

Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)
combat:setParameter(COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_PARALYZE)

function onGetFormulaValues(player, level, maglevel)
    local min = (level * 13) + (maglevel * 100) + 100
    local max = (level * 15) + (maglevel * 200) + 100
    return min, max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(creature, var, isHotkey)
doCreatureSay(cid, "+"..math.floor(rand).." mana", TALKTYPE_ORANGE_1)
    return combat:execute(creature, var)
end


dont working, "bad argument @1"
 
error

" line 17 - bad argument #1 to "floor" number expected, got nil)

CJ at 0x7ff643829260
CJ in function "floor" lua 16/17

tfs 1.2 (10.77)
 
like this:

Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)
combat:setParameter(COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_PARALYZE)

function onGetFormulaValues(player, level, maglevel)
    local min = (level * 13) + (maglevel * 100) + 100
    local max = (level * 15) + (maglevel * 200) + 100
    return min, max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(creature, var, isHotkey)
    return combat:execute(creature, var)
end


dont working, "bad argument @1"

random function is totally wrong, and there's no "cid" in the script only creature/player.
and doCreatureSay is old function, while it stills work in tfs 1.1 we want to use creature:say()

this is how the script should be:
Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)
combat:setParameter(COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_PARALYZE)

function onGetFormulaValues(player, level, maglevel)
    local min = (level * 13) + (maglevel * 100) + 100
    local max = (level * 15) + (maglevel * 200) + 100
    local heal = math.floor(math.random(min, max))
    player:say("+ "..heal.." mana", TALKTYPE_ORANGE_1)
    player:addHealth(heal)
    return
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(creature, var, isHotkey)
    return combat:execute(creature, var)
end

this works.
 
Last edited:
Back
Top