Ir para conteúdo

jhon992

Conde
  • Total de itens

    631
  • Registro em

  • Última visita

  • Dias Ganhos

    13

Tudo que jhon992 postou

  1. Hoje vim trazer uma spell que criei a pedido de um membro e achei bem legal. É uma spell que você controla para criar uma muralha em volta de seus inimigos, ela é otima para wars e servers derivados como de avatar, naruto. Então primeiro vou posta o script dela e depois um video para melhor entendimento. Vai em data/spells/scripts, duplica um arquivo e nomeia para "crystal wall" sem as aspas e nele cole: --<Script by Jhon992>-- local stonesId = {8633,8634,8635,8636} -- ids dos diferente tipos de stones. local timeRemove = 60 -- tempo para dumir as pedras em segundos. function createObject(cid, position, stonesPosition) if (isPlayer(cid)) then if getPlayerLookDir(cid) == 0 then positions = {x=position.x, y=position.y-1, z=position.z} elseif getPlayerLookDir(cid) == 1 then positions = {x=position.x+1, y=position.y, z=position.z} elseif getPlayerLookDir(cid) == 2 then positions = {x=position.x, y=position.y+1, z=position.z} elseif getPlayerLookDir(cid) == 3 then positions = {x=position.x-1, y=position.y, z=position.z} end if isWalkable(positions) then createStone(stonesPosition, positions, stonesId[math.random(1,#stonesId)], cid) addEvent(createObject, 500, cid, positions, stonesPosition) else addEvent(removeStones, timeRemove*1000, stonesPosition) end end end function createStone(stonesPosition, positions, stone, cid) doCreateItem(stone, 1, positions) stonesPosition[(#stonesPosition)+1] = {x=positions.x, y=positions.y, z=positions.z, stackpos=1} end function removeStones(stonesPosition) for i=1, #stonesPosition do for o=1, 2 do stonesPosition[i] = {x=stonesPosition[i].x, y=stonesPosition[i].y, z=stonesPosition[i].z, stackpos=o} if isInArray(stonesId, getThingfromPos(stonesPosition[i]).itemid) then doRemoveItem(getThingfromPos(stonesPosition[i]).uid) end end end end function isWalkable(pos, creature, pz, proj) -- nord if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end local creature = getTopCreature(pos) if creature.type > 0 then return false end if getTilePzInfo(pos) and not pz then return false end local n = not proj and 3 or 2 for i = 0, 255 do pos.stackpos = i local tile = getTileThingByPos(pos) if tile.itemid ~= 0 and not isCreature(tile.uid) then if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then return false end end end return true end function onCastSpell(cid, var) local stonesPosition = {} local position = getPlayerPosition(cid) createObject(cid, position, stonesPosition) return true end E em data/spells/spells.xml a tag: Obs: As tags serão diferentes dependendo da versão de seu ot. Tire como base de alguma outra tag e coloque as vocações de sua escolha. <instant name="Crystal Wall" words="exevo crystal" lvl="45" mana="800" prem="1" blockwalls="1" exhaustion="2000" groups="3,2000" icon="127" needlearn="0" event="script" value="crystal wall.lua"> <vocation id="1"/> <vocation id="2"/> <vocation id="5"/> <vocation id="6"/> </instant> Prontinho. Você pode escolher o tempo que demorara para sumir os crystais e pode modificar os crystais por outros ids, apenas modificando as duas primeiras linhas do arquivo "crystal wall.lua". Ela vai funcionar da seguinte maneira, quando você usa-sa ela ira criar crystais para a direção em que você esta virado e conforme você for modificando a direção os crystais vão saindo, até que encontre alguma barreira como players e itens que não se pode andar por cima. Video:
  2. fiz a última aqui rapidinho pra vc tirar como exemplo. --<Script by Jhon992>-- local stonesId = {8633,8634,8635,8636} -- ids dos diferente tipos de stones. local timeRemove = 30 -- tempo para dumir as pedras em segundos. local stonesPosition = {} -- não mexa. function createObject(cid, position) if (isPlayer(cid)) then if getPlayerLookDir(cid) == 0 then positions = {x=position.x, y=position.y-1, z=position.z} elseif getPlayerLookDir(cid) == 1 then positions = {x=position.x+1, y=position.y, z=position.z} elseif getPlayerLookDir(cid) == 2 then positions = {x=position.x, y=position.y+1, z=position.z} elseif getPlayerLookDir(cid) == 3 then positions = {x=position.x-1, y=position.y, z=position.z} end if isWalkable(positions) then createStone(positions, stonesId[math.random(1,#stonesId)], cid) addEvent(createObject, 500, cid, positions) else addEvent(removeStones, timeRemove*1000) end end end function createStone(positions, stone, cid) doCreateItem(stone, 1, positions) stonesPosition[(#stonesPosition)+1] = {x=positions.x, y=positions.y, z=positions.z, stackpos=1} end function removeStones() for i=1, #stonesPosition do for o=1, 2 do stonesPosition[i] = {x=stonesPosition[i].x, y=stonesPosition[i].y, z=stonesPosition[i].z, stackpos=o} if isInArray(stonesId, getThingfromPos(stonesPosition[i]).itemid) then doRemoveItem(getThingfromPos(stonesPosition[i]).uid) end end end end function isWalkable(pos, creature, pz, proj) -- nord if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end if getTopCreature(pos).uid > 0 and creature then return false end if getTileInfo(pos).protection and not pz then return false end local n = not proj and 3 or 2 for i = 0, 255 do pos.stackpos = i local tile = getTileThingByPos(pos) if tile.itemid ~= 0 and not isCreature(tile.uid) then if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then return false end end end return true end function onCastSpell(cid, var) local position = getPlayerPosition(cid) createObject(cid, position) end
  3. não sei, fiquei meio assim tbm. mais fiz pra escolher um numero msm. asijda aqui ele disse que era sóh 1 nm: o player chega fala hi e escolhe um numero de 1 a 10 acho que o exemplo da mega sena foi sóh pra dizer que mais de uma pessoa pode ganhar.
  4. Primeiro você vai ter que criar um npc para o player poder escolher um número. nomeio e crie como quiser. o script do npc sera esse: function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end local numberMax = 10 -- numero maximo que o player pode escolher function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid if msgcontains(msg, 'sim') then selfSay('Você pode escolher um número de {1 à '..numberMax..'.}', cid) talkState[talkUser] = 2 elseif talkState[talkUser] == 2 then if tonumber(msg) <= numberMax and tonumber(msg) > 0 then if getPlayerStorageValue(cid, 439412) == -1 then setPlayerStorageValue(cid, 439412, tonumber(msg)+1) selfSay('Parabéns, você escolheu o número '..tonumber(msg)..', aguarde o sortei.', cid) selfSay('Caso deslogue, seu numero não será valido.', cid) else selfSay('Você ja escolheu um número, espere até o sortei ocorrer.', cid) end else selfSay('Esso não é um numero valido.', cid) end end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) o teu globalevent vai mudar pra esse: local config = { lottery_hora = "2 horas", reward_count = 1, website = 0, numberMax = 10 -- numero maximo que o player pode escolher } function onThink(interval, lastExecution) local players = getPlayersOnline() local list = {} for i, tid in ipairs(players) do list[i] = tid end local sorteio = math.random(1,config.numberMax) local cont = 0 for o=1, #list do if getPlayerStorageValue(list[o], 439412) == sorteio then local winner = list[o] cont = cont + 1 if(config.website == 1) then db.executeQuery("INSERT INTO `lottery` (`name`) VALUES ('".. getCreatureName(winner) .."');") end doBroadcastMessage('[Loteria Erondino Serve] Ganhador['.. cont ..']: '.. getCreatureName(winner) ..', Recompensa: '.. config.reward_count ..'moedas! - Parabens ! (Proxima em: '.. config.lottery_hora ..')') doPlayerAddItem(winner, 2160,config.reward_count) end end return TRUE end e no teu arquivo login.lua, que fica na pasta data/creaturescripts/scripts. abra-o e antes do último return true cole: setPlayerStorageValue(cid, 439412, -1) prontinho!
  5. Creio que isso de aparecer Status e clicar em Points e abrir aquela janelinha, só fazendo pelas Sources programando c++. Então se precisa arrumar um programador c++ pra fazer isso pra ti, provavelmente tem que editar o cliente tbm. Ja o resto pode ser feito em programação .lua. Mesmo assim, vai ser bem complicado fazer esse sistema completo aew.
  6. jhon992

    Addevent Item

    tenta assim oh: function onUse(cid, item, fromPosition, itemEx, toPosition) if(item.itemid == 7585) and getPlayerStorageValue(cid, 123468) < 6 then doSummonCreature('Giant Spider', {x=33181, y=31867, z=12}) setPlayerStorageValue(cid, 123468,getPlayerStorageValue(cid, 123468)+1) doTransformItem(item.uid, 7586) addEvent(TransformItem, 3000, toPosition, itemEx.itemid) end return TRUE end function TransformItem(position, itemid) doRemoveItem(getThingfromPos(position).uid, 1) doCreateItem(itemid, 1, position) end
  7. e um slot n ia servir para nada? se colocase duas espadas ia atacar sóh com uma, então não ia adiantar nada. fiz com intuito de ser assim msm por isso "two weapons system", n ia deixar o slot vazio pra nada.
  8. faiz um sistema de forja igual ao desse video e posta pra galera aqui do xtibia. claro que não precisa do som, sóh o sistema de forja msm. e faiz se quiser neh, é sóh uma ideia. é bom pra testar suas abilidades
  9. como assim? não entendi oque você quis dizer. o objetivo não foi aumentar o ataque e sim tirar o shield do otserv, para não deixar 1 slot vazia tive que disabilitar para poder usar duas weapons e depois apliquei a formula para somar sua damage na hra de atacar o monstro.
  10. Fly que vai para varios lugares tbm jah tem, tem scripts de teleports de rolo, tem fly system do mock. tem fly system de pokemon...
  11. Se todos jah existem em otservers, pq você cria? Pq n cria algo novo que não tem em nenhum otserv?
  12. @Snokiuthu, isso é um tutorial de creaturescripts, não de storage e variaveis locais, expliquei só o mais basico mesmo de creaturescripts. Obs: Aquele script ali fiz sóh como exemplo e creio que não sera usado em server algum.
  13. #Reportado, pedidos atendidos.
  14. jhon992

    [Duvida]Premium

    #Reportado, para moverem.
  15. Era sóh aplicar o doPlayerSave(cid) como voce tentou, bastava por no local correto. local config = { costPremiumDays = 45 } function onSay(cid, words, param, channel) if(getPlayerPremiumDays(cid) < config.costPremiumDays) then doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Desculpe, você não tem " .. config.costPremiumDays .. " dias premium para obter isso.") doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF) return TRUE end if(getPlayerPremiumDays(cid) < 65535) then doPlayerAddPremiumDays(cid, -config.costPremiumDays) local bp = doPlayerAddItem(cid, 12327, 1) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você gastou " .. config.costPremiumDays .. " dias de sua premium account.") doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_RED) doPlayerSave(cid) return TRUE end end
  16. o erro é em algum arquivo do tipo onLogin, mais n esta nesse script n. voce deve entrar no seu creaturescripts.xml e verifica quais são os scripts do tipo onLogin, depois abra a pasta scripts e vai no arquivo correspondente abra-o e procure por ENTREI!, é sóh excluir a linha completa e salvar. caso tenha duvida, poste seu creaturescripts.xml aqui.
  17. acho que sóh implementando essa função nas suas sources ou na sua lib, mais nem sei fazer isso. tbm acho que a compilação do teu tfs deve estar com problema se essa função não funciona, tenta substituir seu executavel por um outro.
  18. jhon992

    Action Com Erro

    Não observase as mudanças que eu fiz? Uma foi tirar as speels de dentro da função onUse, pois as spells são incializadas antes. Então para funcionar você deve como o script que postei, colocando a inicialização dessa spells antes da linha: function onUse(cid, item, fromPosition, itemEx, toPosition)
  19. Aqui funcionou perfeitamente. Esse erro que acusa ta dizendo que não existe a função getCreatureHealth no seu otserv.
  20. no proprio tfs jah possui esse script: em talkactions/script/playerinfo.lua function onSay(cid, words, param, channel) if(param == '') then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.") return true end local pid = getPlayerByNameWildcard(param) if(not pid or (isPlayerGhost(pid) and getPlayerGhostAccess(pid) > getPlayerGhostAccess(cid))) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. param .. " not found.") return true end local tmp = {accountId = getPlayerAccountId(pid), ip = getPlayerIp(pid)} local pos = getCreaturePosition(pid) doPlayerPopupFYI(cid, "Information about player" .. "\nName: " .. getCreatureName(pid) .. "\nGUID: " .. getPlayerGUID(pid) .. "\nGroup: " .. getPlayerGroupName(pid) .. "\nAccess: " .. getPlayerAccess(pid) .. "\nVocation: " .. getVocationInfo(getPlayerVocation(pid)).name .. "\nStatus:" .. "\nLevel - " .. getPlayerLevel(pid) .. ", Magic Level - " .. getPlayerMagLevel(pid) .. ", Speed - " .. getCreatureSpeed(pid) .. "\nHealth - " .. getCreatureHealth(pid) .. " / " .. getCreatureMaxHealth(pid) .. ", Mana - " .. getCreatureMana(pid) .. " / " .. getCreatureMaxMana(pid) .. "\nSkills:" .. "\nFist - " .. getPlayerSkillLevel(pid, SKILL_FIST) .. ", Club - " .. getPlayerSkillLevel(pid, SKILL_CLUB) .. ", Sword - " .. getPlayerSkillLevel(pid, SKILL_SWORD) .. ", Axe - " .. getPlayerSkillLevel(pid, SKILL_AXE) .. "\nDistance - " .. getPlayerSkillLevel(pid, SKILL_DISTANCE) .. ", Shielding - " .. getPlayerSkillLevel(pid, SKILL_SHIELD) .. ", Fishing - " .. getPlayerSkillLevel(pid, SKILL_FISHING) .. "\nCash:" .. "\nCrystal - " .. getPlayerItemCount(pid, 2160) .. ", Platinum - " .. getPlayerItemCount(pid, 2152) .. ", Gold - " .. getPlayerItemCount(pid, 2148) .. "\nBalance: " .. getPlayerBalance(pid) .. "\nPosition: [X - " .. pos.x .. " | Y - " .. pos.y .. " | Z - " .. pos.z .. "]" .. "\n\nInformation about account" .. "\nName: " .. getPlayerAccount(pid) .. "\nID: " .. tmp.accountId .. "\nNotations: " .. getNotationsCount(tmp.accountId) .. "\nIP: " .. doConvertIntegerToIp(tmp.ip) .. " (" .. tmp.ip .. ")") return true end e no talkactions.xml jah deve ter essa tag: <talkaction log="yes" words="/info" access="2" event="script" value="playerinfo.lua"/> é sóh você mudar para: <talkaction log="yes" words="!status" event="script" value="playerinfo.lua"/>
  21. Pra funcionar certinho essa essa talk de promotion aqui: function onSay(cid, words, param, channel) local configs = { cost = 20000, level = 20 } if isVip(cid) then if getPlayerLevel(cid) >= configs.level then if getPlayerPromotionLevel(cid) == 1 then if configs.cost <= 0 or doPlayerRemoveMoney(cid, configs.cost) then setPlayerPromotionLevel(cid, 2) else doPlayerSendCancel(cid, "Voce nao tem o dinheiro suficiente que é " .. configs.cost .. " gold coins.") end else doPlayerSendCancel(cid, "Voce ja é promoted.") end else doPlayerSendCancel(cid, "Voce precisa ser level " .. configs.level .. " ou maior para adiquirir a promotion.") end else doPlayerSendCancel(cid, "Voce precisa ser vip para adiquirir a promotion.") end return TRUE end Para funcionar o player tem que estar com a primeira promotion jah, e nos vocations.xml os fromvoc="idvocação" devem estar corretos.
  22. tenta assim: obs: nem testei, qualquer erro avisa! function onUse(cid, item, frompos, item2, topos) local stonepos = {x=posx, y=posy, z=posz, stackpos=1} -- posição da pedra local getstone = getThingfromPos(stonepos) local timecreate = 1 -- minutos para criar a pedra novamente if item.uid == 1000 and getstone.itemid == 1304 then -- unique da alavanca, id da stone if doRemoveItem(getstone.uid,1) then doSendMagicEffect(stonepos,2) addEvent(doCreateItem, timecreate*1000*60, 1304, 1, stonepos) if item.itemid == 1945 then doTransformItem(item.uid,item.itemid+1) else doTransformItem(item.uid,item.itemid-1) end end else doPlayerSendCancel(cid,"Sorry, not possible.") end return true end Fiz com base no primeiro script, tão nem olhei o outro e essa linha uqe você perguntou > for i = 1, 255 do é uma estrutura de repetição, serve para atribuir valores de 1 á 255 á variavel i, ou seja, ele repetira tuda essa estrutura do "for" até seu respectivo "end" 255 vezes.
  23. jhon992

    [Duvida]Premium

    Se não funcionar dos geitos anteriormente ditos, tente assim: function onSay(cid, words, param) local t = string.explode(param, ",") local player = getPlayerByNameWildcard(t[1]) local premiumdays = tonumber(t[2]) if (not t[1]) then doPlayerSendCancel(cid, "You must fill with a player name.") elseif (premiumdays < 0) then doPlayerAddPremiumDays(player, premiumdays) doPlayerSendTextMessage(cid,22,"You have removed " .. t[2] .. " premium days from " .. player .. ".") doPlayerSendTextMessage(player,25,"You have lost " .. t[2] .. " premium days.") elseif (premiumdays >= 1 and premiumdays < 150) then doPlayerAddPremiumDays(player, premiumdays) if getPlayerPromotionLevel(cid) < 1 then setPlayerPromotionLevel(cid, 1) doPlayerSendTextMessage(player,25,"You are promoted.") end doPlayerSendTextMessage(cid,22,"You have added " .. premiumdays .. " premium days from " .. getCreatureName(player) .. ".") doPlayerSendTextMessage(player,25,"You received " .. premiumdays .. " premium days.") end return TRUE end
  24. jhon992

    Action Com Erro

    local combat1 = createCombatObject() setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) setCombatParam(combat1, COMBAT_PARAM_EFFECT, 111) setCombatFormula(combat1, COMBAT_FORMULA_LEVELMAGIC, -1, -10, -1, -20, 5, 5, 1.4, 2.1) function onUse(cid, item, fromPosition, itemEx, toPosition) local c = { ["Demon"] = {name="Demon", m1 = combat1, spell = "Quick Attack", minLv = 20, distance = 1} } local summ = getCreatureSummons(cid) if #summ == 0 then return doPlayerSendCancel(cid, "Sorry, but you need a pokemon.") end local sumonName = getCreatureName(summ[1]) if c[sumonName] then if getPlayerLevel(cid) < c[sumonName].minLv then return doPlayerSendCancel(cid, "Sorry, but you must be level " .. c[sumonName].minLv .. " or higher to cast.") and doSendMagicEffect(getThingPos(cid), 2) end if not isCreature(getCreatureTarget(cid)) or getCreatureTarget(cid) == sumonName then return doPlayerSendCancel(cid, "Invalid target.") and doSendMagicEffect(getThingPos(cid), 2) end if getDistanceBetween(getThingPos(summ[1]), getThingPos(getCreatureTarget(cid))) > c[sumonName].distance then return doPlayerSendCancel(cid, "Sorry, your pokemon is too far away.") and doSendMagicEffect(getThingPos(cid), 2) end if getPlayerStorageValue(cid, 23000) <= os.time() then doPlayerSetStorageValue(cid, 23000, os.time()+5) doCombat(summ[1], c[sumonName].m1, numberToVariant(getCreatureTarget(cid))) doCreatureSay(cid, sumonName .. ", " .. c[sumonName].spell .. ".") end doPlayerSendCancel(cid, "Cooldown: ["..(getPlayerStorageValue(cid, 23000)-os.time()).."] seconds.") doSendMagicEffect(getThingPos(cid), 2) else return doPlayerSendCancel(cid, "Sorry, your pokemon don't have this spell.") end end
  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...