Histórico de Curtidas
-
Ina Kion recebeu reputação de Marjer em item de skill :Dfunction doPlayerAddMagicLevel(cid, amount) return doPlayerAddSpentMana(cid, getPlayerRequiredMana(cid, getPlayerMagLevel(cid, true) + amount) - getPlayerSpentMana(cid)) end local STORAGE = 20 function onUse(cid, item, fromPosition, itemEx, toPosition) if getPlayerStorageValue(cid, STORAGE)>= 1 then return true end local voc = getPlayerVocation(cid) if voc == 1 or voc == 2 or voc == 5 or voc == 6 or voc == 15 or voc == 16 then doPlayerAddMagicLevel(cid, 5) doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Você abriu um baú e ganhou 15 de skill em magic level, parabéns.") elseif voc == 3 or voc == 7 then doPlayerAddSkill(cid, SKILL_DISTANCE, 15) doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Você abriu um baú e ganhou 15 de skill em distance fighting, parabéns.") elseif voc == 4 or voc == 8 then local club = getPlayerSkillLevel(cid, 1) local sword = getPlayerSkillLevel(cid,2) local axe = getPlayerSkillLevel(cid, 3) local skill_add = "" if club > sword and club > axe then doPlayerAddSkill(cid, 1, 15) skill_add = "club" elseif axe > club and axe > sword then doPlayerAddSkill(cid, 2, 15) skill_add = "axe" else doPlayerAddSkill(cid, 3, 15) skill_add = "sword" end doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Você abriu um baú e ganhou 15 de skill em ".. skill_add .. " fighting, parabéns.") elseif voc == 13 or voc == 14 then doPlayerAddSkill(cid, 1, 15) doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Você abriu um baú e ganhou 15 de skill em club, parabéns.") end setPlayerStorageValue(cid, STORAGE, 1) return true end Não encontrei a função que adiciona magic level ao player, por isso pode ser que não funcione bem no seu servidor. Testa aí.
-
Ina Kion recebeu reputação de JhonathanSouza em item de skill :Dfunction doPlayerAddMagicLevel(cid, amount) return doPlayerAddSpentMana(cid, getPlayerRequiredMana(cid, getPlayerMagLevel(cid, true) + amount) - getPlayerSpentMana(cid)) end local STORAGE = 20 function onUse(cid, item, fromPosition, itemEx, toPosition) if getPlayerStorageValue(cid, STORAGE)>= 1 then return true end local voc = getPlayerVocation(cid) if voc == 1 or voc == 2 or voc == 5 or voc == 6 or voc == 15 or voc == 16 then doPlayerAddMagicLevel(cid, 5) doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Você abriu um baú e ganhou 15 de skill em magic level, parabéns.") elseif voc == 3 or voc == 7 then doPlayerAddSkill(cid, SKILL_DISTANCE, 15) doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Você abriu um baú e ganhou 15 de skill em distance fighting, parabéns.") elseif voc == 4 or voc == 8 then local club = getPlayerSkillLevel(cid, 1) local sword = getPlayerSkillLevel(cid,2) local axe = getPlayerSkillLevel(cid, 3) local skill_add = "" if club > sword and club > axe then doPlayerAddSkill(cid, 1, 15) skill_add = "club" elseif axe > club and axe > sword then doPlayerAddSkill(cid, 2, 15) skill_add = "axe" else doPlayerAddSkill(cid, 3, 15) skill_add = "sword" end doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Você abriu um baú e ganhou 15 de skill em ".. skill_add .. " fighting, parabéns.") elseif voc == 13 or voc == 14 then doPlayerAddSkill(cid, 1, 15) doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Você abriu um baú e ganhou 15 de skill em club, parabéns.") end setPlayerStorageValue(cid, STORAGE, 1) return true end Não encontrei a função que adiciona magic level ao player, por isso pode ser que não funcione bem no seu servidor. Testa aí.
-
Ina Kion recebeu reputação de Anuudek em (Resolvido)Oque são sources?Só pra complementar, source é o código fonte do servidor, que faz a comunicação entre o client e os jogadores~
-
Ina Kion recebeu reputação de MaXwEllDeN em item de skill :Dfunction doPlayerAddMagicLevel(cid, amount) return doPlayerAddSpentMana(cid, getPlayerRequiredMana(cid, getPlayerMagLevel(cid, true) + amount) - getPlayerSpentMana(cid)) end local STORAGE = 20 function onUse(cid, item, fromPosition, itemEx, toPosition) if getPlayerStorageValue(cid, STORAGE)>= 1 then return true end local voc = getPlayerVocation(cid) if voc == 1 or voc == 2 or voc == 5 or voc == 6 or voc == 15 or voc == 16 then doPlayerAddMagicLevel(cid, 5) doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Você abriu um baú e ganhou 15 de skill em magic level, parabéns.") elseif voc == 3 or voc == 7 then doPlayerAddSkill(cid, SKILL_DISTANCE, 15) doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Você abriu um baú e ganhou 15 de skill em distance fighting, parabéns.") elseif voc == 4 or voc == 8 then local club = getPlayerSkillLevel(cid, 1) local sword = getPlayerSkillLevel(cid,2) local axe = getPlayerSkillLevel(cid, 3) local skill_add = "" if club > sword and club > axe then doPlayerAddSkill(cid, 1, 15) skill_add = "club" elseif axe > club and axe > sword then doPlayerAddSkill(cid, 2, 15) skill_add = "axe" else doPlayerAddSkill(cid, 3, 15) skill_add = "sword" end doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Você abriu um baú e ganhou 15 de skill em ".. skill_add .. " fighting, parabéns.") elseif voc == 13 or voc == 14 then doPlayerAddSkill(cid, 1, 15) doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Você abriu um baú e ganhou 15 de skill em club, parabéns.") end setPlayerStorageValue(cid, STORAGE, 1) return true end Não encontrei a função que adiciona magic level ao player, por isso pode ser que não funcione bem no seu servidor. Testa aí.
-
Ina Kion deu reputação a MaXwEllDeN em {Simple} Level Points#Introdução
Este é um sistema muito simples e básico que eu fiz baseando-me no jogo Mu Online, no qual ao avançar de nível você ganha pontos que podem ser distribuídos para aumentar seus "stats".
#Instalação
Faça o download do sistema e cole na pasta do seu servidor.
@Creaturescripts
Depois abra a pasta creaturescripts/scripts que fica dentro da pasta data do seu servidor, abra o arquivo login.lua, com algum editor de texto, e lá no final antes do último return true cole a seguinte linha:
registerCreatureEvent(cid, "PointSystem") #Configuração No arquivo PointsSystem.lua da pasta lib L_LvlPoints = { vocPoints = { -- [Skill] = Pontos que ganha, [1] = 3, [2] = 3, [3] = 3, [4] = 5, [5] = 5, [6] = 5, [7] = 5, [8] = 8, }, entre Colchetes fica o id da vocation, e depois do sinal de igualdade a quantidade de pontos que ele ganhará por level que for upado. attributes = { ["vitalidade"] = {np = 2, vl = 5, nm = "Hit Points"}, -- Precisa usar 2 points para adicionar 10 de hp ["energy"] = {np = 4, vl = 2, nm = "Mana Points"}, ["magic"] = {np = 30, vl = 1, nm = "Magic Level"}, ["shielding"] = {np = 40, vl = 1, nm = "Shielding Skill"}, ["sword"] = {np = 20, vl = 1, nm = "Sword Skill"}, ["axe"] = {np = 20, vl = 1, nm = "Axe Skill"}, ["club"] = {np = 20, vl = 1, nm = "Club Skill"}, ["distance"] = {np = 20, vl = 1, nm = "Distance Skill"}, } np - quantidade de pontos para adicionar o stat vl - quanto vai adicioanar pelo np. Exemplo: ["vitalidade"] = {np = 2, vl = 5, nm = "Hit Points"}
Com 2 pontos eu compro 5 de HP
É isso ai galera, bye bye
-
Ina Kion deu reputação a MaXwEllDeN em Werewolf System#Introdução
#Instalação
Primeiro faça o download do sistema e cole na sua pasta data[ANEXO].
#Configuração
Como na maioria dos meus códigos: as configurações ficam na lib, então:
WEREWOLF_CONFIG = { onlyMale = true, -- Somente players male poderão se transformar? tf_time = 5, -- Tempo transformado ( em minutos) mana_remove = 750,-- Mana que vai remover hp_percent = 10, -- Quantos % de HP o player vai voltar depois da transformação nhp_x = 2, -- O HP do Player aumenta 2x nmp_percent = 50 -- Perde 50% da mana } Pô, tá tudo comentado né! Para configurar o horário em que ele será transformado, você abre o globalevents.xml e modifica onde tem time = <!-- Werewolf --> <globalevent name="Werewolf" time="20:30" event="script" value = "Werewolf.lua"/>
Werewolf by MaXwEllDeN and Vittu.rar
-
Ina Kion deu reputação a MaXwEllDeN em Como funcionam os Scripts?Obrigado. Tô com vontade de fazer mais tutoriais, se alguém tiver alguma dúvida aí!
-
Ina Kion deu reputação a MaXwEllDeN em Como funcionam os Scripts?Como funcionam os Scripts?
Você já deve ter se perguntado como os scripts funcionam ou não. Por exemplo: Como o servidor sabe que quando eu apertar com o botão direito em um Health Potion ele terá que healar o player alvo?
Em primeiro lugar devemos entender o que são callbacks. Do modo mais simples callback é algo que acontece devido a uma reação, é como a Terceira Lei de Newton que diz que toda ação gera uma reação, esse callback é a nossa reção, é uma função que vai ser executada assim que algo acontecer, no caso do Health Potion assim que ele for usado.
Quando um item é usado ele provoca a chamada de um callback dessa função:
function onUse(cid, item, fromPosition, itemEx, toPosition) end – Max, que parâmetros são esses? – É simples. O Script do Health Potion ficaria +/- assim: local config = { min_heal = 100, -- Minimo que vai healar max_heal = 200, -- Máximo que vai healar empty = 7636, -- Id do Potion vazio } function onUse(cid, item, fromPosition, itemEx, toPosition) if isCreature(itemEx.uid) then doCreatureSay(cid, "Aaaah...", 19) doSendMagicEffect(toPosition, 12) doCreatureAddHealth(itemEx.uid, math.random(config.min_heal, config.max_heal)) doTransformItem(item.uid, config.empty) else doPlayerSendCancel(cid, "You cannot use this object.") end return true end Bem, esse aí é o script, agora só é você salvar, colocar na sua pasta actions/scripts e pronto! – Max, se existem vários scripts na pasta actions/scripts, como meu OT sabe qual usar? – Por causa das chamadas TAGs. – TAGs? – Sim, é uma linha que é colocada no .xml para dizer ao seu servido que o Callback para um item x será a função daquele script. As Tags das actions seguem esse modelo: <action itemid = "7618" event = "script" value = "HealthPotion.lua" /> Exercício: Crie uma Action que quando eu usar uma Warlord Sword em alguém essa pessoa diga "Aí, isso doi". Poste a TAG também! Resposta SÓ ABRA DEPOIS DE RESOLVER:
É isso aí pessoal, essa foi a primeira aula de Scriptwriting que eu escreví, espero que gostem :3