• 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!

TalkAction Healing spells in talkactions

Fare

Advanced OT User
Joined
Apr 3, 2008
Messages
2,387
Reaction score
151
Location
Ukraine
As ots didn't have tibia exhausted working propetly for attacking\healing spells I tryed to make healing spells in talkactions. I just maked first spell(Divine healing), i post it here, I ask someone look, maybe I forgot something, or maked wrong ;] (I know, my scripts are complicated, but I just started :D )

PHP:
function onSay(cid, words, param)
local mana = 210
local level = getPlayerLevel(cid)
local maglevel = getPlayerMagLevel(cid)
local mini = (level * 3 + maglevel * 3) * 2.08
local maxi = (level * 3 + maglevel * 3) * 2.7
local pos = getCreaturePosition(cid)
local voc = getPlayerVocation(cid)
local storevalue = 9995 
local exhausttime = 1 
local mananow = getPlayerMana(cid)


if mananow >= mana then
	if level > 34 and getPlayerPremiumDays(cid) > 0 then 
		if voc == 3 or voc == 7 then
			if (exhaust(cid, storevalue, exhausttime) == 1) then
	doCreatureAddHealth(cid, math.random(mini,maxi))
	doCreatureAddMana(cid, -mana)
	doPlayerAddManaSpent(cid, mana)
	doSendAnimatedText(pos, 'HEAL', TEXTCOLOR_LIGHTGREEN)
			else doPlayerSendCancel(cid, "EXHAUSTED.")
			end
		else doPlayerSendCancel(cid, "Your vocation cannot cast this spell.")
		end
	else doPlayerSendCancel(cid, "Your level is too low or you don't have premium account.")
	end
else doPlayerSendCancel(cid, "You don't have mana for this spell")
end
end


also I added to functions.lua(trunk), global.lua(tags)

PHP:
function exhaust(cid, storevalue, exhausttime)  
-- Exhaustion function by Alreth, v1.1 2006-06-24 01:31  
-- Returns 1 if not exhausted and 0 if exhausted  
    newExhaust = os.time()  
    oldExhaust = getPlayerStorageValue(cid, storevalue)  
    if (oldExhaust == nil or oldExhaust < 0) then  
        oldExhaust = 0  
    end  
    if (exhausttime == nil or exhausttime < 0) then  
        exhausttime = 1  
    end  
    diffTime = os.difftime(newExhaust, oldExhaust)  
    if (diffTime >= exhausttime or diffTime < 0) then  
        setPlayerStorageValue(cid, storevalue, newExhaust)   
        return 1  
    else  
        return 0  
    end  
end


talkaction.lua

HTML:
<talkaction words="exura san" script="spells/divine healing.lua" />
 
Well, you can add exhaust function in your normal spell files.
 
I got global exhaution 1 sec(in config i think), and if I set exhaust function to all spells(attack spells 2sec, healing spells 1sec), if you will spamm for example sudden death(attack rune) it will shot 1 rune per 2 sec, but it takes 2 charges of rune per 2 sec(becouse of global exhausted - 1 sec, it takes charge and don't shot). If I set global exhausted to 1sec, it will ruin many of my scripts :] so I try in talkactions
 
example to use arrays and isInArray function~
Code:
function onSay(cid, words, param)
local pInfo = {
		level = getPlayerLevel(cid),
		maglevel = getPlayerMagLevel(cid),
		pos = getCreaturePosition(cid),
		voc = getPlayerVocation(cid),
		mananow = getPlayerMana(cid)
}
local formula = {
		mini = (pInfo.level * 3 + pInfo.maglevel * 3) * 2.08,
		maxi = (pInfo.level * 3 + pInfo.maglevel * 3) * 2.7
}
local spell = {
		reqlevel = 34,
		mana = 210,
		storevalue = 9995,
		exhausttime = 1,
		allow_vocs = {3, 7}
}
if pInfo.mananow >= spell.mana then
    if pInfo.level > spell.reqlevel and getPlayerPremiumDays(cid) > 0 then 
        if isInArray(spell.allow_vocs, pInfo.voc) == 1 then
            if (exhaust(cid, spell.storevalue, spell.exhausttime) == 1) then
				doCreatureAddHealth(cid, math.random(formula.mini,formula.maxi))
				doCreatureAddMana(cid, -spell.mana)
				doPlayerAddManaSpent(cid, spell.mana)
				doSendAnimatedText(pInfo.pos, 'HEAL', TEXTCOLOR_LIGHTGREEN)
            else 
				doPlayerSendCancel(cid, "EXHAUSTED.")
            end
        else 
			doPlayerSendCancel(cid, "Your vocation cannot cast this spell.")
        end
    else 
		doPlayerSendCancel(cid, "Your level is too low or you don't have premium account.")
    end
else 
	doPlayerSendCancel(cid, "You don't have mana for this spell")
end
end
 
I got a questiong, how can i make cure paralysis in talkactions? xD

@Nahruto
[10/05/2008 15:17:12] data/talkactions/scripts/spells/light healing.lua:eek:nSay

[10/05/2008 15:17:12] data/talkactions/scripts/spells/light healing.lua:10: attempt to perform arithmetic on global 'level' (a nil value)

with your version ;d
 
Last edited:
doRemoveCondition(cid, CONDITION_PARALYZE(?)) proper names can be found in global.lua

also if it is not doRemove, the it will be removeCondition.
 
You can make spells in spells with different exhaustion...
Just set exhaustion="0" in spells.xml and use exhaustion functions (functions.lua from trunk) for exhaust.
 
You can make spells in spells with different exhaustion...
Just set exhaustion="0" in spells.xml and use exhaustion functions (functions.lua from trunk) for exhaust.

I explain why I don't want to do this :

1 way: all spells with exhaust functions, exhaust in spells.xml = 0, exhausted in config 1000(betweenExActions), all works fine but, if I spam spell runes for example sd, they shot 1 sd per 1 sec(with exhaust function), but charges goes 2 charge for 2 sec(becouse 1 sec of exhausted,maybe becouse of exhausted in config 1000(betweenExActions), maybe source(I don't tested).

2 way: all spells with exhaust functions, exhaust in spells.xml = 0, exhausted in config 2000(betweenExActions). all works fine(maybe, I don't test), but I don't need 2000 sec between exActions :D

and anyway, I hate spam(when you make all with exhausted function, and try to spam (for example) exura vita, char always send exura vita exura vita exura vita, but works only 1 sec(exh. func.).
So: the best decition is talkaction, don't see minuses now;]

doRemoveCondition(cid, CONDITION_PARALYZE(?)) proper names can be found in global.lua

also if it is not doRemove, the it will be removeCondition.


getCreatureCondition(cid, condition)
createConditionObject(type)
setCombatCondition(combat, condition)
setConditionParam(condition, key, value)
addDamageCondition(condition, rounds, time, value)
setConditionFormula(combat, mina, minb, maxa, maxb)
doAreaCombatCondition(cid, pos, area, condition, effect)
doTargetCombatCondition(cid, target, condition, effect)


all lua functions with conditions ;(
 
Last edited:
Code:
function onStepOut(cid, item, pos)
	doRemoveCondition(cid, CONDITION_DROWN)
end

Originaly from drowning.lua.

Read your scripts instead of list of functions, you can learn more ^^
 
just tried it, and didnt liked it, the spells doesnt show when you cast them, no animation, tesxt, i like beter you script in spells, a bit of spam but i like it :)
 
I have question....
How i can add orange text to spells use??? I need change utani hur on normal text to utani hur orange....
 
Back
Top