Strack
Member
- Joined
- May 15, 2009
- Messages
- 199
- Reaction score
- 14
Well... useful? dunno... maybe some1 will find it useful, I did it 'cause some1 in another forum ask for something like that...
What it does is to cast the most "stronger" spell if have enough mana to do it
f.ex: / utevo lux -> and it will cast utevo vis lux if enough mana, if not then gran lux, if not utevo lux...
Can use words or spell name -> 'utevo lux' or 'Light'
Required-> lua function doPlayerCastSpell -> http://otland.net/f35/doplayercastspell-cid-spell-80043/
In the array 'cadena' you can add more spell chains, the most to the right is the strongest...You must put the correct Spell Name there, not words.
Hope Someone find it useful
What it does is to cast the most "stronger" spell if have enough mana to do it
f.ex: / utevo lux -> and it will cast utevo vis lux if enough mana, if not then gran lux, if not utevo lux...
Can use words or spell name -> 'utevo lux' or 'Light'
Required-> lua function doPlayerCastSpell -> http://otland.net/f35/doplayercastspell-cid-spell-80043/
Code:
<talkaction words="/" event="script" value="scriptname.lua"/>
Code:
-- Script By Strack
local cadena = {
[1] = {'Light', 'Great Light', 'Ultimate Light'},
[2] = {'Fire Wave', 'Energy Wave', 'Ice Wave', 'Terra Wave'},
[3] = {'Eternal Winter', 'Wrath of Nature', 'Rage of the Skies', 'Hells Core'}
}
local function getLastSpell(cid, param, indice, i)
if not cadena[i][indice+1] or getCreatureMana(cid) < getInstantSpellInfo(cid, cadena[i][indice+1]).mana then
return doPlayerCastSpell(cid, getInstantSpellInfo(cid, cadena[i][indice]).words)
else
getLastSpell(cid, cadena[i][indice+1], indice+1, i)
end
return true
end
function onSay(cid, words, param)
local learned = false
for i=0, getPlayerInstantSpellCount(cid)-1 do
if getPlayerInstantSpellInfo(cid, i).words == param or getPlayerInstantSpellInfo(cid, i).name == param then
learned = getPlayerInstantSpellInfo(cid, i).name
break
end
end
if not learned then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, " el param no es una spell") end
if learned then
for i=1, #cadena do
local int = table.find(cadena[i], learned)
if int then
getLastSpell(cid, learned, int, i)
break
end
end
end
return true
end
In the array 'cadena' you can add more spell chains, the most to the right is the strongest...You must put the correct Spell Name there, not words.
Hope Someone find it useful