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

Physical Increase Spell

Laron25

New Member
Joined
Mar 28, 2010
Messages
127
Reaction score
2
Hello.
Anyone can make for me spell, who increase your physical damage by 15% (not skills),
with Turn On and Turn Off option.

If player say SPELLNAME, then he launch spell and his mana going down 5 points/sec.
If player say SPELLNAME while it launch, he turn off the spell.
The spell is going down when player mana is 0.
And if its possible, add Condition mark to this spell (like RL tibia buffs)

Anyone can help me with this ?
Thanks.
 
Możesz mi powiedzieć jak zacząć ? NIe jestem najlepszy w te klocki :(
//
Can you help me, what i must script to begin? Im not super at scripting...
 
Last edited:
creaturescripts.xml
XML:
-
	<event type="statschange" name="stat" event="script" value="stat.lua"/>
login.lua
Lua:
--
	registerCreatureEvent(cid, 'stat')
stat.lua
Lua:
function onStatsChange(cid, attacker, type, combat, value)
	if type == STATSCHANGE_HEALTHLOSS and combat == COMBAT_PHYSICALDAMAGE and isPlayer(attacker) and getCreatureStorage(cid, 5) == -1 and hasCondition(attacker, CONDITION_ATTRIBUTES, 5) then
		doCreatureSetStorage(cid, 5, 1)
		local v = -(value * 1.15) * (isPlayer(cid) and 2 or 1)
		doTargetCombatHealth(attacker, cid, COMBAT_PHYSICALDAMAGE, v, v, CONST_ME_NONE)
		doCreatureSetStorage(cid, 5)
		return false
	end
	return true
end
the spell
Lua:
local a = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(a, CONDITION_PARAM_SUBID, 5)
setConditionParam(a, CONDITION_PARAM_BUFF, true)
setConditionParam(a, CONDITION_PARAM_TICKS, -1)

local t, e = {}, 0
function f()
	for i = 1, #t do
		local c, f = t[i]
		if isPlayer(c) then
			if getCreatureMana(c) >= 5 then
				doCreatureAddMana(c, -5, false)
				f = true
			else
				doRemoveCondition(c, CONDITION_ATTRIBUTES, 5)
				doSendMagicEffect(getThingPos(c), CONST_ME_MAGIC_RED)
			end
		end
		if not f then
			table.remove(t, i)
		end
	end
	e = addEvent(f, 1000)
end

function onCastSpell(cid, var)
	if hasCondition(cid, CONDITION_ATTRIBUTES, 5) then
		doRemoveCondition(cid, CONDITION_ATTRIBUTES, 5)
		for i = 1, #t do
			if t[i] == cid then
				table.remove(t, i)
				break
			end
		end
		if #t == 0 then
			stopEvent(e)
			e = 0
		end
		doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_RED)
	else
		doAddCondition(cid, a)
		table.insert(t, cid)
		if e == 0 then
			e = addEvent(f, 1000)
		end
		doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_GREEN)
	end
	return true
end
all monster files
XML:
-
	<script>
		<event name="stat"/>
	</script>
(you can use notepad++ to insert the last thing quickly)
 
Back
Top