• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

[Support] Need help with buffing script

kyono

New Member
Joined
Jul 5, 2009
Messages
2
Reaction score
0
Ok so heres the concept:

Spell functions the same way "heal friend" would except its buff based so picture a buff that applies to a single player. The buff's strength varies from level to level and it has a cap. The mana usage varies also. The buff itself is a maximum HP buff ( It increases your maximum health ). Heres what I have so far.

Code:
local Level = getPlayerLevel(cid)
if Level >= 15 then
              Level =  15
end
local ManaCost = (100 * .3) * (Level - 11) + 100

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_RED)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, FALSE)

local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_SUBID, 1)
setConditionParam(condition, CONDITION_PARAM_BUFF, TRUE)
setConditionParam(condition, CONDITION_PARAM_TICKS, 5 * 60 * 1000)

function onCastSpell(cid, var)
	if (Level == 11) then
		setConditionParam(condition, CONDITION_PARAM_STAT_MAXHEALTH, 30)
		setConditionParam(condition, CONDITION_PARAM_HEALTHGAIN, 30)
	end
	if (Level == 12) then
		setConditionParam(condition, CONDITION_PARAM_STAT_MAXHEALTH, 60)
		setConditionParam(condition, CONDITION_PARAM_HEALTHGAIN, 60)
	end
	if (Level == 13) then
		setConditionParam(condition, CONDITION_PARAM_STAT_MAXHEALTH, 90)
		setConditionParam(condition, CONDITION_PARAM_HEALTHGAIN, 90)
	end
	if (Level == 14) then
		setConditionParam(condition, CONDITION_PARAM_STAT_MAXHEALTH, 120)
		setConditionParam(condition, CONDITION_PARAM_HEALTHGAIN, 120)
	end
	if (Level >= 15) then
		setConditionParam(condition, CONDITION_PARAM_STAT_MAXHEALTH, 150)
		setConditionParam(condition, CONDITION_PARAM_HEALTHGAIN, 150)
	end

	if ( getCreatureMana(cid) < ManaCost ) then
		doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTENOUGHMANA)
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
		return LUA_ERROR
	end
	
	doCreatureAddMana(cid, -ManaCost, FALSE)
	doPlayerAddSpentMana(cid, ManaCost)
	doAddCondition(cid, condition)
	return doCombat(cid, combat, var)
end


I'm unsure as to why this code doesn't work o_o. Any help would be greatly appreciated.


Quick notes -
Tibia 8.42
The Forgotten Server 0.3b3

And here is how my spells.xml looks for it
Code:
<instant name="Minor Health Increase" words="acuta health" lvl="11" mana="0" prem="0" needtarget="1" params="1" exhaustion="2000" needlearn="0" script="Instant_Priest/minor_health_buff.lua">
 
Back
Top