Bom vamos começar como criar mana rune para ot XML!
Primeiro passo:
Entrar na pasta de /data/action/scripts depois copiar qualquer script.lua e colar na mesma pasta, entam renomear o script copiado para mfrune.lua depois abrir e apaguar tudo o que esta escrito e coloque isto:
-- New MF rune******-- function onUse(cid, item, frompos, item2, topos) playerpos = {x=topos.x, y=topos.y, z=topos.z, stackpos=253}************ player = getThingfromPos(playerpos) ml = getPlayerMagLevel(cid) lvl = getPlayerLevel(cid) formula = math.random(((lvl+ml)*2)-(lvl-ml)) if item2.itemid == 1 and ml >= 2 then doSendMagicEffect(playerpos,1) doPlayerAddMana(player.uid,formula) doPlayerSay(player.uid,"Ahhhhhh",2) if item.type > 1 then doChangeTypeItem(item.uid,item.type-1) else doRemoveItem(item.uid,1) end end if item2.itemid == 1 and ml <= 1 then doSendMagicEffect(frompos,2) doPlayerSendCancel(cid,"You dont Have Magic Level to use this rune.") end if item2.itemid >= 2 then doPlayerSendCancel(cid,"You can only use this rune in you or in players.") doSendMAgicEffect(frompos,2) end return 1 end
Segundo Passo:
Após o primeiro passo vem o segundo , agora voltar para a pasta /data/actions e abrir o arquivo actions.xml e colar:
<action itemid="2281" script="mfrune.lua" />
PS: O action itemid é o id do item a ser utilizado você pode modificalo o 2281 vou usar como exemplo.
Terceiro Passo:
Abrir a pasta /data/spells/scripts copiar qualquer script.lua e renomear para mana rune.lua depois abrir o arquivo mana rune.lua , apagar tudo oque esta escrito nele e escrever:
local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1) setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0) function onCastSpell(cid, var) doPlayerAddMana(cid, 1000) return doCombat(cid, combat, var) end
PS: no local doPlayerAddMana onde esta 1000 é a quantidade de mana que você deseja que adicione ao jogador, eu recomendo por 1000 dai você consequentemente vende esta runa por um preço digamos que alto.
Quarto Passo:
Voltar para a pasta /data/spells abrir o arquivo spells.xml e colocar:
<rune name="Mana Rune" id="2281" charges="1" maglv="5" mana="0" enabled="1" script="mana rune.lua"></rune>
PS: Você pode modificar o magic level que pode utilizar a runa e tambem no id se você modicifou ele no segundo passo tera de modificar aqui tambem.
Primeiro Passo B:
Agora tua mana rune ja esta criada, só que o npc não a vende entao vou mostrar como fazer o npc vende-la.
Abrir a pasta /data/npc/scripts abrir o arquivo runes.lua.
Procure um lugar que esteja escrito isto
if msgcontains(msg, 'runes') then selfSay('I sell hmms (10gps cada), uhs (30gps cada), gfbs (20gps cada), explosions (30gps cada), sds (40gps cada) and blank runes (5gps cada).')
então adicione antes do blank rune a mana rune. ficara assim:
if msgcontains(msg, 'runes') thenselfSay('I sell hmms (10gps cada), uhs (30gps cada), gfbs (20gps cada), explosions (30gps cada), sds (40gps cada), mana rune (2k cada) and blank runes (5gps cada).')
PS: Você pode modificar opreço onde esta 2k pode colocar o preço que queira.
Segundo Passo B:
No mesmo arquivo ''runes.lua" procure o local onde esta as runas e entre elas coloque:
Citação:
elseif msgcontains(msg, 'mana rune') then
count = getCount(msg)
if count == 0 then
selfSay('Im Not Sell 0 Mana Rune!, Continue buying ')
talk_start = os.clock()
else
buy(cid,2281,count, 2000)
end
PS: Se você tiver modificado o id do item no Segundo e no Quarto Passo tera que modificar agora tambem, e se modificou o preço dela no Primeiro Passo B tera que modificar ali onde esta 2000, Cuidado: O preço neste segundo passo esta em gps isto é 1k = 1000gps
Agora vamos criar uma Mana Rune para OT SQL
Primeiro passo:
Entrar na pasta de /data/action/scripts depois copiar qualquer script.lua e colar na mesma pasta, entam renomear o script copiado para mfrune.lua depois abrir e apaguar tudo o que esta escrito e coloque isto:
-- New MF rune******-- function onUse(cid, item, frompos, item2, topos) playerpos = {x=topos.x, y=topos.y, z=topos.z, stackpos=253}************ player = getThingfromPos(playerpos) ml = getPlayerMagLevel(cid) lvl = getPlayerLevel(cid) formula = math.random(((lvl+ml)*2)-(lvl-ml)) if item2.itemid == 1 and ml >= 2 then doSendMagicEffect(playerpos,1) doPlayerAddMana(player.uid,formula) doPlayerSay(player.uid,"Ahhhhhh",2) if item.type > 1 then doChangeTypeItem(item.uid,item.type-1) else doRemoveItem(item.uid,1) end end if item2.itemid == 1 and ml <= 1 then doSendMagicEffect(frompos,2) doPlayerSendCancel(cid,"You dont Have Magic Level to use this rune.") end if item2.itemid >= 2 then doPlayerSendCancel(cid,"You can only use this rune in you or in players.") doSendMAgicEffect(frompos,2) end return 1 end
Segundo Passo:
Após o primeiro passo vem o segundo , agora voltar para a pasta /data/actions e abrir o arquivo actions.xml e colar:
<action itemid="2281" script="mfrune.lua" />
PS: O action itemid é o id do item a ser utilizado você pode modificalo o 2281 vou usar como exemplo.
Terceiro Passo:
Abrir a pasta /data/spells/scripts copiar qualquer script.lua e renomear para mana rune.lua depois abrir o arquivo mana rune.lua , apagar tudo oque esta escrito nele e escrever:
local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1) setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0) function onCastSpell(cid, var) doPlayerAddMana(cid, 1000) return doCombat(cid, combat, var) end
PS: no local doPlayerAddMana onde esta 1000 é a quantidade de mana que você deseja que adicione ao jogador, eu recomendo por 1000 dai você consequentemente vende esta runa por um preço digamos que alto.
Quarto Passo:
Voltar para a pasta /data/spells abrir o arquivo spells.xml e colocar:
<rune name="Mana Rune" id="2281" charges="1" maglv="5" mana="0" enabled="1" script="mana rune.lua"></rune>
PS: Você pode modificar o magic level que pode utilizar a runa e tambem no id se você modificou ele no segundo passo tera de modificar aqui tambem.
Primeiro Passo B:
Agora tua mana rune ja esta criada, só que o npc não a vende entao vou mostrar como fazer o npc vende-la.
Abrir a pasta /data/npc/scripts abrir o arquivo runes.lua.
E digite a parte que está em negrito
-- Made by Delton // Coltain --
-- If you use or edit, please give credit to me --
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)
-- These have to be here so they won't mess up the keywords
shopModule:addBuyableItem({'energy field', 'ef'}, 2277, 115, 3, 'energy field rune')
shopModule:addBuyableItem({'fire field', 'ff'}, 2301, 85, 3, 'fire field rune')
shopModule:addBuyableItem({'poison field', 'pf'}, 2285, 65, 3, 'poison field rune')
local node1 = keywordHandler:addKeyword({'runes'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell Healing, Support, Attack, Summon, and Field Runes.'})
shopModule:addBuyableItem({'mana', 'rune'}, 2281, 10, 'mana rune')
shopModule:addBuyableItem({'blank', 'rune'}, 2260, 10, 'blank rune')
local node2 = keywordHandler:addKeyword({'healing'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can sell you Antidote, Intense Healing, and Ultimate Healing Runes.'})
shopModule:addBuyableItem({'antidote', 'antidote'}, 2266, 65, 1, 'antidote rune')
shopModule:addBuyableItem({'intense healing', 'ih'}, 2265, 95, 1, 'intense healing rune')
shopModule:addBuyableItem({'ultimate healing', 'uh'}, 2273, 175, 1, 'ultimate healing rune')
local node3 = keywordHandler:addKeyword({'support'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can sell you Chameleon, Desintegrate, Destroy Field, Magic Wall, and Paralyze Runes.'})
shopModule:addBuyableItem({'chameleon', 'chameleon'}, 2291, 210, 1, 'chameleon rune')
shopModule:addBuyableItem({'desintegrate', 'desintegrate'}, 2310, 80, 3, 'desintegrate rune')
shopModule:addBuyableItem({'destroy field', 'destroy field'}, 2261, 45, 3, 'destroy field rune')
shopModule:addBuyableItem({'magic wall', 'mw'}, 2293, 350, 3, 'magic wall rune')
shopModule:addBuyableItem({'paralyze', 'paralyze'}, 2278, 700, 1, 'paralyze rune')
local node4 = keywordHandler:addKeyword({'attack'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can sell you Avalanche, Explosion, Fireball, Great Fireball, Heavy Magic Missile, Icicle, Light Magic Missile, Soulfire, Stalagmite, Stone Shower, Sudden Death, Thunderstorm Runes.'})
shopModule:addBuyableItem({'avalanche', 'avalanche'}, 2274, 180, 4, 'avalanche rune')
shopModule:addBuyableItem({'explosion', 'explo'}, 2274, 190, 6, 'explosion rune')
shopModule:addBuyableItem({'great fireball', 'gfb'}, 2304, 180, 4, 'great fireball rune')
shopModule:addBuyableItem({'fireball', 'fb'}, 2302, 150, 5, 'fireball rune')
shopModule:addBuyableItem({'heavy magic missile', 'hmm'}, 2311, 120, 10, 'heavy magic missile rune')
shopModule:addBuyableItem({'icicle', 'icicle'}, 2271, 150, 5, 'icicle rune')
shopModule:addBuyableItem({'light magic missile', 'lmm'}, 2287, 40, 10, 'light magic missile rune')
shopModule:addBuyableItem({'soulfire', 'sf'}, 2308, 140, 3, 'soulfire rune')
shopModule:addBuyableItem({'stalagmite', 'stalagmite'}, 2292, 120, 10, 'stalagmite rune')
shopModule:addBuyableItem({'stone shower', 'ss'}, 2288, 150, 4, 'stone shower rune')
shopModule:addBuyableItem({'sudden death', 'sd'}, 2268, 325, 3, 'sudden death rune')
shopModule:addBuyableItem({'thunderstorm', 'thunderstorm'}, 2315, 150, 4, 'thunderstorm rune')
local node5 = keywordHandler:addKeyword({'summon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can sell you Animate Dead and Convince Creature Runes.'})
shopModule:addBuyableItem({'animate dead', 'animate dead'}, 2316, 375, 1, 'animate dead rune')
shopModule:addBuyableItem({'convince creature', 'cc'}, 2302, 80, 1, 'convince creature rune')
local node6 = keywordHandler:addKeyword({'field'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can sell you Energy Bomb, Energy Field, Energy Wall, Fire Bomb, Fire Field, Fire Wall, Poison Bomb, Poison Field, and Poison Wall Runes.'})
shopModule:addBuyableItem({'energy bomb', 'energybomb'}, 2262, 325, 2, 'energy bomb rune')
shopModule:addBuyableItem({'energy wall', 'ew'}, 2279, 340, 4, 'energy wall rune')
shopModule:addBuyableItem({'fire bomb', 'firebomb'}, 2305, 235, 2, 'fire bomb rune')
shopModule:addBuyableItem({'fire wall', 'fw'}, 2303, 245, 4, 'fire wall rune')
shopModule:addBuyableItem({'poison bomb', 'pb'}, 2286, 170, 2, 'poison bomb rune')
shopModule:addBuyableItem({'poison wall', 'pw'}, 2289, 210, 4, 'poison wall rune')
local node7 = keywordHandler:addKeyword({'potions'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell Health, Mana, Strong Health, Strong Mana, Great Health, Great Mana, Ultimate Health, and Great Spirit Potions.'})
shopModule:addBuyableItem({'great spirit potion', 'gsp'}, 8376, 190, 'great spirit potion')
shopModule:addBuyableItem({'ultimate health potion', 'uhp'}, 8377, 310, 'ultimate health potion')
shopModule:addBuyableItem({'great mana potion', 'gmp'}, 7590, 120, 'great mana potion')
shopModule:addBuyableItem({'great health potion', 'ghp'}, 7591, 190, 'great health potion')
shopModule:addBuyableItem({'strong health potion', 'shp'}, 7588, 100, 'strong health potion')
shopModule:addBuyableItem({'strong mana potion', 'smp'}, 7589, 80, 'strong mana potion')
shopModule:addBuyableItem({'health potion', 'hp'}, 7618, 45, 'health potion')
shopModule:addBuyableItem({'mana potion', 'mp'}, 7620, 50, 'mana potion')
local node8 = keywordHandler:addKeyword({'wands'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell Wand of Vortex, Wand of Dragonbreath, Wand of Decay, Wand of Cosmic Energy, and Wand of Inferno.'})
shopModule:addBuyableItem({'wand of vortex', 'wov'}, 2190, 100, 'wand of vortex')
shopModule:addBuyableItem({'wand of dragonbreath', 'wodb'}, 2191, 1000, 'wand of dragonbreath')
shopModule:addBuyableItem({'wand of decay', 'wod'}, 2188, 5000, 'wand of decay')
shopModule:addBuyableItem({'wand of cosmic energy', 'woce'}, 2189, 10000, 'wand of cosmic energy')
shopModule:addBuyableItem({'wand of inferno', 'woi'}, 2187, 15000, 'wand of inferno')
local node10 = keywordHandler:addKeyword({'rods'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell Snakebite Rod, Moonlight Rod, Necrotic Rod, Terra Rod, and Hailstorm Rod.'})
shopModule:addBuyableItem({'snakebite rod', 'sbr'}, 2182, 100, 'snakebite rod')
shopModule:addBuyableItem({'moonlight rod', 'mlr'}, 2186, 1000, 'moonlight rod')
shopModule:addBuyableItem({'necrotic rod', 'nr'}, 2185, 5000, 'necrotic rod')
shopModule:addBuyableItem({'terra rod', 'tr'}, 2181, 10000, 'terra rod')
shopModule:addBuyableItem({'hailstorm rod', 'hsr'}, 2183, 15000, 'hailstorm rod')
PS: Você pode modificar opreço onde esta 10 gps pode colocar o preço que queira.
É isso ai pessoal xD
Espero que tenham aprovado
Flwss