W data/actions/scripts/ tworzymy manarune.lua
Kod:
function onUse(cid, item, frompos, item2, topos)
local MagicLevelToUse = 2
local MaxManaToAdd = 200 local MinManaToAdd = 100
local mLvl = getPlayerMagLevel(cid) local ManaToAdd = math.random(MinManaToAdd, MaxManaToAdd)
if item2.itemid == 1 and mLvl >= MagicLevelToUse then if item.type > 1 then doSendMagicEffect(frompos,1) doPlayerAddMana(cid,ManaToAdd) doPlayerSay(cid,"Ahhh...",17) --doCreatureSay()-- doChangeTypeItem(item.uid,item.type-1) else doRemoveItem(item.uid,1) end elseif item2.itemid >= 2 then doPlayerSendCancel(cid,"You can only use this rune on you/on other players.") doSendMAgicEffect(frompos,2) elseif item2.itemid == 1 and mLvl < MagicLevelToUse then doSendMagicEffect(frompos,2) doPlayerSendCancel(cid,"You don't have enough magic level to use this rune.") end return true end
local MagicLevelToUse = 2 - magic level do użycia runki local MaxManaToAdd = 200 - max mana dodawana local MinManaToAdd = 100 - min mana dodawana
data/actions/actions.xml
dodajemy linijkę:
Kod:
<action itemid="2270" script="manarune.lua" />
2270 - ID (wygląd) runy. Można zastosowac każde, dosłownie każde! Może to byc lód truskawkowy czy nawet miś z annihilatora (Spis ID mamy w pliku items.xml (data/items/))
No i jeszcze obiecany NPC.
W data/npc/scripts/ znajdujemy runes.lua
tam pod
Kod:
elseif msgcontains(msg, 'explosion') then buy(cid,2313,5,90)
elseif msgcontains(msg, 'sd') then buy(cid,2268,5,100)
elseif msgcontains(msg, 'blank') then buy(cid,2260,1,5)
doklejamy:
Kod:
elseif msgcontains(msg, 'manarune') then buy(cid,2270,5,55)
manarune - nazwa jaką trzeba powiedziec aby kupić rune 2270 - id jaki podaliście musi byc taki sam 5 - liczba strzal w runie 55 - cena
|