Guitar Freak
_LüA_n☺b_
As title says, I just made a simple spell that buffs you adding 20% HP for 20 seconds, but you can ONLY use it if you have 15 "whatever Items" on you (in this case, I used "talons").
So after you say the words for the spell, it checks if you have the 15 talons on you and if you do, it removes them and buffs you.
If you dont, it sends a cancel message telling you that you need 15 talons and it wont buff you nor waste your mana.
Here's the spell, I know its simple but Im just starting on lua scripting so bare with me. I also added comment lines (--) after important lines of the script in case you're learning like me and want to know what's going on or what everything means.
You may aswell use it in your server if you desire or modify it as you wish.
In spells.xml (dont mind about the name or words lol, they're just a reference):
Change the name/words/mana/lvl/vocation/etc. to anything you want.
And in itembuff.lua:
And thats it. Tested and working on TFS 0.3.2 but should work with any other 0.3+ I think.
<----->
As requested by Jixx~, in the following link is this same spell but instead of adding 20% HP, it adds 20% Mana:
http://otland.net/f132/buff-spell-item-simple-script-33781/#post366552
Cheers~
So after you say the words for the spell, it checks if you have the 15 talons on you and if you do, it removes them and buffs you.
If you dont, it sends a cancel message telling you that you need 15 talons and it wont buff you nor waste your mana.
Here's the spell, I know its simple but Im just starting on lua scripting so bare with me. I also added comment lines (--) after important lines of the script in case you're learning like me and want to know what's going on or what everything means.
You may aswell use it in your server if you desire or modify it as you wish.
In spells.xml (dont mind about the name or words lol, they're just a reference):
Lua:
<instant name="Item HP Buff" words="hpbuff" lvl="1" mana="10" aggressive="0" selftarget="1" params="1" exhaustion="2000" needlearn="0" event="script" value="itembuff.lua">
<vocation name="Druid"/>
</instant>
Change the name/words/mana/lvl/vocation/etc. to anything you want.
And in itembuff.lua:
Lua:
-- Simple "HP Buff from Item" spell by Guitar Freak.
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, 39) -- You can change to any effect you desire.
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, FALSE)
local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_TICKS, 20000) -- Amount of time the buff lasts in miliseconds, so 20000 = 20 seconds.
setConditionParam(condition, CONDITION_PARAM_STAT_MAXHEALTHPERCENT, 120) -- Amount of HP % added, 100% = Total HP so if you put 120% it adds 20% to the total HP. Putting like 50% cuts your HP to half, etc.
setConditionParam(condition, CONDITION_PARAM_BUFF, TRUE)
setCombatCondition(combat, condition)
function onCastSpell(cid, var)
if getPlayerItemCount(cid,2151) >= 15 then -- This line checks if the player has the 15 talons. (2151 is the ItemID of the "talon", but you can change it to whatever you want. The "15" is the amount of talons you need for the buff to work)
doPlayerRemoveItem(cid, 2151, 15) -- If he does, it removes the 15 talons and:
return doCombat(cid, combat, var) -- Adds the buff, sends the magic effect, etc.
else -- Otherwise if he doesnt have 15 talons:
doPlayerSendCancel(cid, "You do not have enough talons, you need 15 talons to execute this spell.") -- It sends him this cancel message,
doSendMagicEffect(getCreaturePos(cid), 2) -- Also shows this magic effect on the player which is a "puff" to tell the spell didnt work.
return LUA_ERROR -- And finally cancels everything so the spell doesnt work, the mana is not spent nor any talons taken, and the player is not buffed.
end
end
And thats it. Tested and working on TFS 0.3.2 but should work with any other 0.3+ I think.
<----->
As requested by Jixx~, in the following link is this same spell but instead of adding 20% HP, it adds 20% Mana:
http://otland.net/f132/buff-spell-item-simple-script-33781/#post366552
Cheers~
Last edited: