-
Total de itens
2553 -
Registro em
-
Última visita
-
Dias Ganhos
73
Tudo que zipter98 postou
-
OK, código alterado.
-
Remova a linha: doPlayerAddExp(cid, exp) Adicione, abaixo de: function onUse(cid, item, fromPosition, itemEx, toPosition) isso: doPlayerAddLevel(cid, 3)
-
pedido Dar items para todos jogadores online
pergunta respondeu ao JonatasLucasf de zipter98 em Scripts
nvm já postaram -
Se o código acima não funcionar, use este: local shinys = { "Venusaur", "Blastoise", "Butterfree", "Beedrill", "Pidgeot", "Rattata", "Raticate", "Raichu", "Golbat", "Paras", "Parasect", "Magmar", "Typhlosion", "Xatu", "Growlithe", "Arcanine", "Tentacruel", "Farfetch'd", "Gengar", "Krabby", "Tauros", "Kingler", "Cubone", "Horsea", "Seadra", "Weezing", "Scyther", "Pinsir", "Crobat", "Zubat", "Tentacool", "Feraligatr", "Machamp", "Meganium", "Alakazam", "Tangela", "Ampharos", "Electabuzz", "Jynx", "Charizard", "Voltorb", "Electrode"} local raros = {"Dragonair", "Dratini", "Giant Magikarp", "Gyarados", "Magmortar", "Electivire", "Salamence", "Mantine"} local specialSummon = { chance = 1, --Chance, em porcentagem, do pokémon especial nascer. pokes = { {"Milotic", "Electivire", "Magmortar", "Salamence"}, --Pokémons que podem ser summonados. {"Brave Venusaur", "Ancient Kingdra", "Hard Rhydon"}, --Pokémons que, quando spawnados, há chance de summonar um dos pokémons acima. }, } local function ShinyName(cid) if isCreature(cid) then if string.find(tostring(getCreatureName(cid)), "Shiny") then local newName = tostring(getCreatureName(cid)):match("Shiny (.*)") doCreatureSetNick(cid, newName) if isMonster(cid) then doSetCreatureDropLoot(cid, false) end end end end local function doSetRandomGender(cid) if not isCreature(cid) then return true end if isSummon(cid) then return true end local gender = 0 local name = getCreatureName(cid) if not newpokedex[name] then return true end local rate = newpokedex[name].gender if rate == 0 then gender = 3 elseif rate == 500 then gender = 4 elseif rate == -1 then gender = 0 elseif math.random(1, 500) <= rate then gender = 4 else gender = 3 end doCreatureSetSkullType(cid, gender) end local function doShiny(cid) if isCreature(cid) then if isSummon(cid) then return true end if getPlayerStorageValue(cid, 74469) >= 1 then return true end if getPlayerStorageValue(cid, 22546) >= 1 then return true end if isNpcSummon(cid) then return true end if getPlayerStorageValue(cid, 637500) >= 1 then return true end --alterado v1.9 if isInArray(shinys, getCreatureName(cid)) then --alterado v1.9 \/ chance = 2.0 --1% chance elseif isInArray(raros, getCreatureName(cid)) then --n coloquem valores menores que 0.1 !! chance = 1 --1% chance else return true end if math.random(1, 500) <= chance*10 then doSendMagicEffect(getThingPos(cid), 18) local name, pos = "Shiny ".. getCreatureName(cid), getThingPos(cid) doRemoveCreature(cid) local shi = doCreateMonster(name, pos, false) setPlayerStorageValue(shi, 74469, 1) else setPlayerStorageValue(cid, 74469, 1) end --/\ else return true end end function onSpawn(cid) registerCreatureEvent(cid, "Experience") registerCreatureEvent(cid, "GeneralConfiguration") registerCreatureEvent(cid, "DirectionSystem") registerCreatureEvent(cid, "CastSystem") if isSummon(cid) then registerCreatureEvent(cid, "SummonDeath") return true end addEvent(function() if isCreature(cid) then if isInArray(specialSummon.pokes[2], getCreatureName(cid)) then if math.random(1, 100) <= specialSummon.chance then local position = getThingPos(cid) doRemoveCreature(cid) doCreateMonster(specialSummon.pokes[1][math.random(#specialSummon.pokes[1])], position) end end end end, 15) addEvent(doShiny, 10, cid) addEvent(ShinyName, 15, cid) addEvent(adjustWildPoke, 5, cid) return true end
-
^ http://www.xtibia.com/forum/topic/225014-queries-e-sql-para-otservers/
- 4 respostas
-
- talkactions
- comando
-
(e 2 mais)
Tags:
-
action Apenas tal vocation id pode usar essa talkactions
tópico respondeu ao AdilsonHacker de zipter98 em Lixeira Pública
Abaixo de: function onSay(cid, words, param) coloque: local vocations = {1, 2, 3} --Vocações que podem teleportar. if not isInArray(vocations, getPlayerVocation(cid)) then return doPlayerSendCancel(cid, "Você não é digno de ir para esse lugar.") end -
A versão que gasta menos memória é a segunda. Digo isso julgando tanto os códigos apresentados quanto as funções utilizadas.
-
pedido Adicionar limite no sistema de Apricorn
pergunta respondeu ao Elias Palermo de zipter98 em Scripts
local config = { attr = "apricorn", limit = 30, --Limite de apricorns por pokémon. returnMessage = "You already used %d apricorns in this pokemon.", } function onUse(cid, item, frompos, item2, topos) local summon = getCreatureSummons(cid)[1] local tabela_status = { [27054] = {name="offense", value = 10}, [27053] = {name="defense", value = 10}, [27052] = {name="speed", value = 10}, [27050] = {name="vitality", value = 10}, [27051] = {name="specialattack", value = 10}, } if #getCreatureSummons(cid) < 1 then doPlayerSendTextMessage((cid), 27, "[Apricorn] Solte-o Seu Pokemon Para Dar o Apricorn!.") return false else local pb = getPlayerSlotItem(cid, 8) local attr = getItemAttribute(pb.uid, config.attr) or 0 if attr < config.limit then local pokename = getItemAttribute(pb.uid, "poke") doRemoveItem(item.uid, 1) local status = tabela_status[item.itemid] local pbstat= getItemAttribute(pb.uid, status.name) local st = pbstat + tabela_status[item.itemid].value doItemSetAttribute(pb.uid, status.name , st) doSendFlareEffect(getThingPos(summon)) doSendAnimatedText(getThingPos(summon), "Apricorn!", 215) doPlayerSendTextMessage((cid), 27, "[Apricorn] Seu Pokemon "..pokename.." Ganhou "..status.value.." "..status.name.." points!") doSendFlareEffect(getThingPos(cid)) doItemSetAttribute(pb.uid, config.attr, attr + 1) else doPlayerSendCancel(cid, config.returnMessage:format(config.limit)) end end return true end -
A função em si está funcionando perfeitamente. Provavelmente você está testando-a sem um summon. Remova isso: print(getCreatureName(pid).." - "..isPlayer(pid) and "player" or isMonster(pid) and "monster" or isSummon(pid) and "summon" or "npc") e troque: local targeting = getMonstersTargetingCid(getCreatureSummons(cid)[1], 5, 5) --Área de dimensão 5x5 SQMs. por: local targeting = getMonstersTargetingCid(cid, 5, 5) --Área de dimensão 5x5 SQMs. Assim, serão verificados os monstros que estão atacando você, o jogador. Ah, e também uma pequena falta de atenção minha: Troque: print(getCreatureName(targeting).." is targeting your summon.") por: print(getCreatureName(pid).." is targeting your summon.")
-
Use este código e informe o que for imprimido no console: function getMonstersTargetingCid(cid, x, y) if not isCreature(cid) then return false end local spec, uid = getSpectators(getThingPos(cid), tonumber(x) or 1, tonumber(y) or 1), {} for _, pid in pairs(spec) do print(getCreatureName(pid).." - "..isPlayer(pid) and "player" or isMonster(pid) and "monster" or isSummon(pid) and "summon" or "npc") if pid ~= cid and not isPlayer(pid) and getCreatureTarget(pid) == cid then table.insert(uid, pid) end end return uid end
-
Alguns servidores têm problemas com o isMonster. Talvez seja o caso do seu. Tente esta versão: function getMonstersTargetingCid(cid, x, y) if not isCreature(cid) then return false end local spec, uid = getSpectators(getThingPos(cid), tonumber(x) or 1, tonumber(y) or 1), {} for _, pid in pairs(spec) do if pid ~= cid and not isPlayer(pid) and getCreatureTarget(pid) == cid then table.insert(uid, pid) end end return uid end
-
Sendo x e y as dimensões da área e cid, logicamente, a criatura sob a qual a função será executada: function getMonstersTargetingCid(cid, x, y) if not isCreature(cid) then return false end local spec, uid = getSpectators(getThingPos(cid), tonumber(x) or 1, tonumber(y) or 1), {} for _, pid in pairs(spec) do if pid ~= cid and isMonster(pid) and getCreatureTarget(pid) == cid then table.insert(uid, pid) end end return uid end Exemplo de uso: local targeting = getMonstersTargetingCid(getCreatureSummons(cid)[1], 5, 5) --Área de dimensão 5x5 SQMs. if targeting and #targeting > 0 then for _, pid in pairs(targeting) do print(getCreatureName(pid).." is targeting your summon.") end else print("There's no monsters targeting your summon.") end
-
Qual o formato que você está salvando o arquivo?
-
Qual o erro na distro? Poderia postá-lo?
-
function onUse(cid, item, fromPosition, itemEx, toPosition) local arvoresid = {2701, 2702, 2703, 2704} local madeiraid = 5901 local chance = 98 local pposition = getPlayerPosition(cid) local random = math.random(1,100) for i = 1, #arvoresid do if(itemEx.uid == arvoresid or itemEx.actionid == 3666 and random <= chance) then doCreateItem(madeiraid, 1, pposition) doSendMagicEffect(pposition, CONST_ME_CRAPS) doCreatureSay(cid, getCreatureName(cid) .. ' cortou madeira', TALKTYPE_ORANGE_1) end end return true end
-
^ O primeiro argumento da função doCreateMonster deve ser uma string ou uma variável com valor de string. Strings devem ser escritas entre aspas ("exemplo" ou 'exemplo'). E, pelo menos neste caso, o callback deve retornar verdadeiro. local pos = {x = 1087, y = 1010, z = 7} function onUse(cid, item, fromPosition, itemEx, toPosition) if itemEx.itemid == 7294 then doTeleportThing(cid, pos) doSendMagicEffect(getPlayerPosition(cid), 10) doCreateMonster("Mammoth", pos) else doPlayerSendCancel(cid, "You are using item in the wrong place.") end return true end
-
^ como os códigos são interpretados na ordem que estão, haverá erro caso o jogador deslogue. local tab = { [6] = {effect = 70}, [7] = {effect = 70}, [8] = {effect = 70}, [9] = {effect = 70}, [10] = {effect = 70}, [11] = {effect = 70},-- [vocationID] = {effect = Number} [12] = {effect = 70} } local delay = 2 -- tempo do efeito da aura em segundos function ariseAura(cid) if isPlayer(cid) then doSendMagicEffect(getThingPos(cid), tab[getPlayerVocation(cid)].effect) addEvent(ariseAura, delay * 1000, cid) end end function onLogin(cid) if tab[getPlayerVocation(cid)] then ariseAura(cid) end return true end
-
-
^ sim. @Bruno Neste loop, id assumiria o valor dos indexes da tabela e qtd, as tabelas contendo ID e quantidade. Assim, o correto seria: local quest = { items = { {2394, 1}, -- { id, quantidade } {2160, 1} }, sto = 98770 -- storage da quest. } function onUse(player, item, fromPosition, target, toPosition, isHotkey) local queststatus = player:getStorageValue(quest.sto) if queststatus ~= 1 then for _, item in pairs(quest.items) do player:addItem(item[1], item[2]) end player:sendTextMessage(MESSAGE_INFO_DESCR, "Parabens! Voce completou a quest.") player:setStorageValue(quest.sto, 1) else player:sendTextMessage(MESSAGE_INFO_DESCR, "Desculpe! Voce ja completou esta quest.") end return true end
-
Action: local config = { maxSkill = 100, --Nível máximo de critical. pointPerItem = 1, --Quantos pontos em critical irá ganhar por item. storage = 9571, } function onUse(cid, item) if getPlayerStorageValue(cid, config.storage) >= config.maxSkill then return doPlayerSendCancel(cid, "You already reached the maximum critical level. ["..config.maxSkill.."]") end setPlayerStorageValue(cid, config.storage, getPlayerStorageValue(cid, config.storage) > -1 and getPlayerStorageValue(cid, config.storage) + 1 or 1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You received: "..config.pointPerItem.." point(s) on critical skill.\nPoints: ["..getPlayerStorageValue(cid, config.storage).."/"..config.maxSkill.."]") doRemoveItem(item.uid, 1) return true end Creaturescript: local config = { chancePerLevel = 3, --Chance, por nível, de acerto crítico. extraDamage = 50, --Bônus extra, em porcentagem, de dano. storage = 9571, } function onStatsChange(cid, attacker, type, combat, value) if isPlayer(attacker) and getPlayerStorageValue(attacker, config.storage) > -1 and type == STATSCHANGE_HEALTHLOSS then if math.random(config.chancePerLevel, config.chancePerLevel * 100) <= config.chancePerLevel * getPlayerStorageValue(attacker, config.storage) then value = math.floor(value * config.extraDamage / 100) doSendAnimatedText(getThingPos(cid), "CRITICAL!", 255) end end return true end Não se esqueça de registrar o evento em login.lua.
-
action Ajuda a modificar script de porta automática
tópico respondeu ao Developer Berg de zipter98 em Lixeira Pública
Ok, troque: doTransformItem(getTileItemById(pos, i == 1 and config.door[1][n] or config.door[2]).uid, config.door[i + 1]) por: doTransformItem(getTileItemById(pos, i == 1 and config.door[1][1] or config.door[2]).uid, config.door[i + 1]) e troque: local j = i == 1 and config.door[2] or config.door[1][n] por: local j = i == 1 and config.door[2] or config.door[1][1] E 606 não é uma action, e sim o ID da porta. -
action Ajuda a modificar script de porta automática
tópico respondeu ao Developer Berg de zipter98 em Lixeira Pública
local config = { delay = 150, --Intervalo de tempo entre as "transformações" da porta, em milésimos. door = {{621, 606}, 622, 605}, --{ID da porta fechada, ID da porta aberta pela metade, ID da porta aberta}, ids = { [2701] = { {x = 1056, y = 1055, z = 7}, --Saffron-- }, }, } function onStepIn(cid, item, position) if config.ids[item.actionid] then for _, pos in pairs(config.ids[item.actionid]) do if type(config.door[1]) == "table" then for n = 1, #config.door[1] do if getTileItemById(pos, config.door[1][n]).uid > 0 then for i = 1, 2 do addEvent(function() doTransformItem(getTileItemById(pos, i == 1 and config.door[1][n] or config.door[2]).uid, config.door[i + 1]) end, i * config.delay) end end end else if getTileItemById(pos, config.door[1]).uid > 0 then for i = 1, 2 do addEvent(function() doTransformItem(getTileItemById(pos, i == 1 and config.door[1] or config.door[2]).uid, config.door[i + 1]) end, i * config.delay) end end end end end return true end function onStepOut(cid, item) if config.ids[item.actionid] then for _, pos in pairs(config.ids[item.actionid]) do local it = getTileItemById(pos, config.door[3]).uid if it > 0 then if getSpectators(pos, 1, 1) then return true end end end for _, pos in pairs(config.ids[item.actionid]) do if getTileItemById(pos, config.door[3]).uid > 0 then for i = 1, 2 do addEvent(function() if type(config.door[1]) == "table" then for n = 1, #config.door[1] do local j = i == 1 and config.door[2] or config.door[1][n] doTransformItem(getTileItemById(pos, i == 1 and config.door[3] or config.door[2]).uid, j) end else doTransformItem(getTileItemById(pos, i == 1 and config.door[3] or config.door[2]).uid, config.door[i == 1 and 2 or 1]) end end, i * config.delay) end end end end return true end -
action Ajuda a modificar script de porta automática
tópico respondeu ao Developer Berg de zipter98 em Lixeira Pública
Mesmo sendo apenas um item, você precisa colocar as posições dos cantos da porta. Segue a imagem, onde as posições circuladas são as que menciono: -
data/lib/050-function.lua, adicione as funções: function setEffect(cid, effect) setPlayerStorageValue(cid, 9671, effect) sendEffect(cid) end function sendEffect(cid) local delay = 500 --Intervalo, em milésimos de segundo, entre os efeitos. if getPlayerStorageValue(cid, 9671) > -1 then doSendMagicEffect(getThingPos(cid), getPlayerStorageValue(cid, 9671)) addEvent(function() if isPlayer(cid) then sendEffect(cid) end end, delay) end end data/creaturescripts/scripts, em login.lua: Abaixo de: function onLogin(cid) adicione: sendEffect(cid) Para adicionar um efeito ao jogador, use: setEffect(cid, efeito)
-
action Ajuda a modificar script de porta automática
tópico respondeu ao Developer Berg de zipter98 em Lixeira Pública
Vejo que você configurou apenas uma posição em ids. Bem, deve-se colocar ambas as posições da porta.
-
Quem Está Navegando 0 membros estão online
- Nenhum usuário registrado visualizando esta página.