Guitar Freak
_LüA_n☺b_
Hello.
Today I have been playing around with the stuff I have been learning from my Lua Questions thread and other sites aswell, and I decided to test my knowledge on a single script, that ended in this spell.
After hours of work and plenty of silly (very silly) mistakes, I finally got it working correctly.
It might be a silly and not-so-useful spell, but could lead to something better from others, but as I said it was mostly to test myself
· Credits:
~ kokokoko, Syntax and all the people that has helped me on the thread or on PMs, thanks guys.
~ Guitar Freak (me) for the scripting, made from scratch! Havent made many like that so Im proud of it ^_^
· Compatibility:
Tested and working with TFS 0.3.5 and 0.3.5pl1.
Untested on others but probably works with any 0.3+.
· Description:
This is some sort of an "evolving spell". It consists in a spell with 2 stages (or more), where you can reach the best stage of it only after meeting certain conditions.
For this Im using an exana-type of spell as an example, but maybe you guys can get it for an idea for something better.
· How it works:
Basically it is an "exana pox" spell that, when you say the words (in this case Exana), it dispels Poison, Drunk and Paralyze conditions on it's first stage, but then when the player gets his promotion (and only if player is from the vocations you allow in the spell's config), the spell will "evolve" to second stage for him, so when he does "Exana", the spell will now dispel some extra conditions which in this case are Fire and Energy. Meaning that at the second and final stage, the spell will dispel Poison, Drunk, Paralyze, Fire and Energy conditions, for those who met the requirements.
So leaving the default configuration, means that any player from any vocation can use the first stage of the spell, even knights can use Exana to dispel Poison, Drunk and Paralyze conditions, but when knights get promoted they wont be able to use the second stage, the spell will remain in first stage for them. But for the other vocations, after promoting the spell will go to second stage.
It might be a little confusing but test it yourself and you'll get the hang of it!
· Script:
First, add this to your /data/spells.xml folder:
Configure to however you desire, of course.
Then create exana.lua in your /data/spells/scripts folder and add this:
I was having fun with the stuff Im learning so bare with me if it is still n0b scripted. You can also remove the random animations, I just like it that way
As I said it might be useless for some, but maybe with a similar "system" you could make more useful evolving spells
Since you can configure almost everything on the script, or also make a different one yourself with stages depending on the lvl of the player, or using storagevalues so after doing "x" quest the spell evolves (or so it evolves for VIPs, etc).
I think it can be useful for some stuff like that, I hope you like it
If you find any bugs, tell me!
Cheerz.
Today I have been playing around with the stuff I have been learning from my Lua Questions thread and other sites aswell, and I decided to test my knowledge on a single script, that ended in this spell.
After hours of work and plenty of silly (very silly) mistakes, I finally got it working correctly.
It might be a silly and not-so-useful spell, but could lead to something better from others, but as I said it was mostly to test myself
· Credits:
~ kokokoko, Syntax and all the people that has helped me on the thread or on PMs, thanks guys.
~ Guitar Freak (me) for the scripting, made from scratch! Havent made many like that so Im proud of it ^_^
· Compatibility:
Tested and working with TFS 0.3.5 and 0.3.5pl1.
Untested on others but probably works with any 0.3+.
· Description:
This is some sort of an "evolving spell". It consists in a spell with 2 stages (or more), where you can reach the best stage of it only after meeting certain conditions.
For this Im using an exana-type of spell as an example, but maybe you guys can get it for an idea for something better.
· How it works:
Basically it is an "exana pox" spell that, when you say the words (in this case Exana), it dispels Poison, Drunk and Paralyze conditions on it's first stage, but then when the player gets his promotion (and only if player is from the vocations you allow in the spell's config), the spell will "evolve" to second stage for him, so when he does "Exana", the spell will now dispel some extra conditions which in this case are Fire and Energy. Meaning that at the second and final stage, the spell will dispel Poison, Drunk, Paralyze, Fire and Energy conditions, for those who met the requirements.
So leaving the default configuration, means that any player from any vocation can use the first stage of the spell, even knights can use Exana to dispel Poison, Drunk and Paralyze conditions, but when knights get promoted they wont be able to use the second stage, the spell will remain in first stage for them. But for the other vocations, after promoting the spell will go to second stage.
It might be a little confusing but test it yourself and you'll get the hang of it!
· Script:
First, add this to your /data/spells.xml folder:
PHP:
<instant name="Exana" words="exana" lvl="10" mana="20" exhaustion="2000" needlearn="0" event="script" value="exana.lua"/>
Configure to however you desire, of course.
Then create exana.lua in your /data/spells/scripts folder and add this:
Lua:
-- Evolving Spell scripted by Guitar Freak.
-- More info on: [url]http://otland.net/f82/0-3-5-advanced-evolving-spell-exana-type-example-47933/[/url]
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)
local pos = getCreaturePosition(cid)
local PromotionLevel = 1 -- Default PromotionLevel is 1, but if you have a second promotion and want the spell to evolve at that point, put 2.
local config = { -- Go to your /data/lib/constant.lua for better information on conditions in case you want to modify something, etc.
vocations = { -- Vocations that will be able to use the EVOLVED spell (NOT the normal spell, this is configured in spells.xml).
1, -- Sorcerer
2, -- Druid
3, -- Paladin
5, -- Master Sorcerer
6, -- Elder Druid
7 -- Royal Paladin
},
conditions = { -- Initial conditions it removes, before it evolves.
CONDITION_POISON,
CONDITION_DRUNK,
CONDITION_PARALYZE
},
extras = { -- Extra conditions it removes after it evolves.
CONDITION_FIRE,
CONDITION_ENERGY
},
effects = { -- Animations to be randomized.
CONST_ME_MAGIC_BLUE,
CONST_ME_MAGIC_RED,
CONST_ME_MAGIC_GREEN
},
}
------------------------------------
-- Dont modify anything from here: --
function ConditionRemove()
for _, c in pairs(config.conditions) do
doRemoveCondition(cid, c)
end
end
function AddExtras()
for _, e in pairs(config.extras) do
table.insert(config.conditions,e)
ConditionRemove()
end
end
-- To here. --
--------------
function onCastSpell(cid, var)
if getPlayerPromotionLevel(cid) >= PromotionLevel and isInArray(config.vocations, getPlayerVocation(cid)) then
AddExtras()
else
ConditionRemove()
end
doSendMagicEffect(pos, config.effects[math.random(1,#config.effects)])
return doCombat(cid, combat, var)
end
I was having fun with the stuff Im learning so bare with me if it is still n0b scripted. You can also remove the random animations, I just like it that way
As I said it might be useless for some, but maybe with a similar "system" you could make more useful evolving spells
Since you can configure almost everything on the script, or also make a different one yourself with stages depending on the lvl of the player, or using storagevalues so after doing "x" quest the spell evolves (or so it evolves for VIPs, etc).
I think it can be useful for some stuff like that, I hope you like it
If you find any bugs, tell me!
Cheerz.
Last edited: