What's new

Creaturescripts Lista nowych czar?w przy awansie

Status
Not open for further replies.

Forseti

Senior User
Joined
Dec 23, 2011
Messages
954
Reaction score
82
Autor: Mateusz
Opis: Skrypt wy?wietla list? nowych czar?w (dostepnych na poziom) przy awansie.

np.
Spells for Level 45
adori vita vis - Sudden Death Rune : 999


Otw?rz creaturescripts/scripts/login.lua i dodaj:
PHP:
registerCreatureEvent(cid, "spellsShowOnAdvance")
Nast?pnie otw?rz creaturescripts/creaturescripts.xml i dodaj:
PHP:
<event type="advance" name="spellsShowOnAdvance" event="script" value="advanceSpells.lua"/>
Oraz stw?rz plik creaturescripts/scripts/advanceSpells.lua i wklej:
PHP:
function onAdvance(cid, skill, oldLevel, newLevel)
 
if skill == SKILL__LEVEL and newLevel > oldLevel then
local playerLevel = getPlayerLevel(cid)
local c=0
local count = getPlayerInstantSpellCount(cid)
local text = ""
local t = {}
for i = 0, count - 1 do
local spell = getPlayerInstantSpellInfo(cid, i)
if spell.level == playerLevel then
if spell.manapercent > 0 then
spell.mana = spell.manapercent .. "%"
end
table.insert(t, spell)
c=c+1
end
end
 
if c>0 then
for i, spell in ipairs(t) do
local line = ""
 
if i ~= 1 then
line = "\n"
end
line = line .. "Spells for Level " .. spell.level .. "\n"
 
text = text .. line .. " " .. spell.words .. " - " .. spell.name .. " : " .. spell.mana .. "\n"
end
doShowTextDialog(cid, item.itemid, text)
end
 
end
 
return TRUE
end

Tyle.
 
Status
Not open for further replies.
Top