-
Total de itens
2553 -
Registro em
-
Última visita
-
Dias Ganhos
72
Tudo que zipter98 postou
-
pedido Sistema de dominar cidades - Vodkart
tópico respondeu ao warriorfrog de zipter98 em Lixeira Pública
Lib: cityMonsters = { --["monster_name"] = recomendo número anterior + 1, ["Monster I"] = 1, ["Monster II"] = 2, ["Monster III"] = 3, --etc } DEFAULT_STORAGE = 49198 function setGuildExperience(guildId, exp) for _, pid in pairs(getPlayersOnline()) do if getPlayerGuildId(pid) == guildId then doPlayerSetExperienceRate(cid, exp) end end end function getGuildExpRate(guildId) for _, pid in pairs(getPlayersOnline()) do local playerRate = getPlayerRates(pid)[8] if getPlayerGuildId(pid) == guildId and playerRate > 1 then return playerRate end end return 1.0 end Creaturescript: function onTarget(cid, target) local m, playerGuild = cityMonsters[getCreatureName(target)], getPlayerGuildId(cid) if isPlayer(cid) and isMonster(target) and m and playerGuild > 0 then return getGlobalStorageValue(DEFAULT_STORAGE + m) ~= playerGuild end return true end function onStatsChange(cid, attacker, type, combat, value) if isPlayer(attacker) and isMonster(cid) and type == STATSCHANGE_HEALTHLOSS then local m, playerGuild = cityMonsters[getCreatureName(cid)], getPlayerGuildId(attacker) if m and playerGuild > 0 then return getGlobalStorageValue(DEFAULT_STORAGE + m) ~= playerGuild end end return true end function onLogin(cid) local guildId = getPlayerGuildId(cid) if guildId > 0 and getGuildExpRate(guildId) > 1 then doPlayerSetExperienceRate(cid, getGuildExpRate(guildId)) end registerCreatureEvent(cid, "mTarget") registerCreatureEvent(cid, "mStatsChange") return true end function onDeath(cid, corpse, deathList) local killer, m = deathList[1], cityMonsters[getCreatureName(cid)] if killer and isPlayer(killer) and m then local atualGuild, playerGuild = getPlayerStorageValue(cid, 98471), getPlayerGuildId(killer) if atualGuild > 0 and playerGuild > 0 and atualGuild ~= playerGuild then setGuildExperience(atualGuild, getGuildExpRate(atualGuild) - 0.05) setGuildExperience(playerGuild, getGuildExpRate(playerGuild) + 0.05) setGlobalStorageValue(DEFAULT_STORAGE + m, playerGuild) end end return true end Tags: <event type="death" name="mDeath" event="script" value="nome_do_arquivo.lua"/> <event type="statschange" name="mStatsChange" event="script" value="nome_do_arquivo.lua"/> <event type="target" name="mTarget" event="script" value="nome_do_arquivo.lua"/> <event type="login" name="mLogin" event="script" value="nome_do_arquivo.lua"/> No arquivo .XML do monstro: <script> <event name="mDeath"/> </script> -
action: --[[ Slot system 100% by mock \o ]] ---Config local conf = { maxSlotCount=2, ignoredIds={}, items = { --[itemid] = {attr = "hp"/"mp"/"ml"/"cas"/"shield"/"dist", percent = x%}, [4918] = {attr = "hp", percent = 5}, [4920] = {attr = "dist", percent = 15}, [4925] = {attr = "ml", percent = 5}, --etc }, } --End function choose(...) --- Function by mock. local arg = {...} return arg[math.random(1, #arg)] end if not getItemAttack then function getItemAttack(uid) return getItemAttribute(uid,'attack') end function getItemDefense(uid) return getItemAttribute(uid,'defense') end end local function isArmor(uid) -- Function by Mock the bear. if (getItemInfo(uid.itemid).armor ~= 0) and (getItemWeaponType(uid.uid) == 0) then return true end return false end local function isWeapon(uid) -- Function by Mock the bear. uid = uid or 0 local f = getItemWeaponType(uid) if f == 1 or f == 2 or f == 3 then return true end return false end local function isShield(uid) -- Function by Mock the bear. uid = uid or 0 if getItemWeaponType(uid) == 4 then return true end return false end local function isBow(uid) -- Function by Mock the bear. uid = uid or 0 if getItemWeaponType(uid) == 5 and not isItemStackable(uid) then return true end return false end function onUse(cid, item, fromPosition, itemEx, toPosition) -- Script by mock the bear (MTB) if item.uid == 0 or item.itemid == 0 then return false end local itemTable = conf.items[item.itemid] if not itemTable then return doPlayerSendCancel(cid, "You cannot use this item.") end toPosition.stackpos = 255 if item.uid == 0 or item.itemid == 0 then return false end toPosition.stackpos = 255 if isInArray(conf.ignoredIds, itemEx.itemid) or (not getItemWeaponType(itemEx.uid) or getItemWeaponType(itemEx.uid) > 5) or (getItemWeaponType(itemEx.uid) == 0 and not isArmor(itemEx)) or itemEx.itemid == 0 or itemEx.type > 1 or isItemStackable(itemEx.uid) then doPlayerSendTextMessage(cid, 24,"You cant open a slot on this item.") return true end if isCreature(itemEx.uid) then return false end local nam = getItemName(itemEx.uid) function getSlotCount(nam) local c = 0 for _ in nam:gmatch('%[(.-)%]') do c = c+1 end return c end if getSlotCount(nam) < conf.maxSlotCount then local l = itemTable.attr local p = itemTable.percent doSendMagicEffect(toPosition,30) nam = nam..' ['..l..'.+'..p..'%]' doSendAnimatedText(toPosition,l..' '..p..'%',120) doItemSetAttribute(itemEx.uid,'name',nam) doRemoveItem(item.uid,1) else doPlayerSendTextMessage(cid, 24,"You cant open a slot on this item.") end return true end
-
pedido Sistema de dominar cidades - Vodkart
tópico respondeu ao warriorfrog de zipter98 em Lixeira Pública
E os monstros, seriam os mesmos para todas as cidades? Ou seria, por exemplo, monstro x na cidade 1, monstro y na cidade 2, etc? -
pedido Sistema de dominar cidades - Vodkart
tópico respondeu ao warriorfrog de zipter98 em Lixeira Pública
Assim que mortos, esses monstros spawnarão automaticamente ou terão um tempo para tal? -
--- Xtibia --- Xtibia. local vocations = {1, 2, 4, 5, 6, 7, 8} -- Vocações que podem refinar itens local ids_bloqueados = {2160, 5706, 2463} -- Itens que não podem ser refinados local controle = { {level = 0, quantOre = 1, chance = 100}, -- Level do item, quantidade de Iron Ore necessaria, chance de sucesso {level = 1, quantOre = 2, chance = 90}, {level = 2, quantOre = 3, chance = 80}, {level = 3, quantOre = 4, chance = 70}, {level = 4, quantOre = 5, chance = 60}, {level = 5, quantOre = 6, chance = 50}, {level = 6, quantOre = 7, chance = 40}, {level = 7, quantOre = 8, chance = 30}, {level = 8, quantOre = 9, chance = 20}, {level = 9, quantOre = 10, chance = 10} } function getItemLevel(uid) if uid > 0 then return getItemAttribute(uid, "lvl") or 0 end return false end function doItemAddLevel(uid, count) if uid > 0 and tonumber(count) then return doItemSetAttribute(uid, "lvl", getItemLevel(uid) + count) end return false end function onUse(cid, item, fromPosition, itemEx, toPosition) if not isInArray(vocations, getPlayerVocation(cid)) then return doPlayerSendCancel(cid, "Sua vocacao nao pode refinar.") elseif isInArray(ids_bloqueados, itemEx.uid) then return doPlayerSendCancel(cid, "Este item nao pode ser refinado.") end if getItemInfo(itemEx.itemid).attack > 0 or getItemInfo(itemEx.itemid).defense > 0 or getItemInfo(itemEx.itemid).armor > 0 then for _, upgrade in pairs(controle) do local atk = getItemAttribute(itemEx.uid, "attack") or getItemInfo(itemEx.itemid).attack local def = getItemAttribute(itemEx.uid, "defense") or getItemInfo(itemEx.itemid).defense local arm = getItemAttribute(itemEx.uid, "armor") or getItemInfo(itemEx.itemid).armor local chance = math.random(1, 100) if getItemLevel(itemEx.uid) == upgrade.level then if doPlayerRemoveItem(cid, 5880, upgrade.quantOre) then doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_CRAPS) if chance <= upgrade.chance then if getItemLevel(itemEx.uid) == 0 then doItemSetAttribute(itemEx.uid, "description", "Esse item foi refinado por" ..getCreatureName(cid)) end doItemAddLevel(itemEx.uid, 1) doItemSetAttribute(itemEx.uid, "name", getItemNameById(itemEx.itemid).. " + " ..getItemLevel(itemEx.uid)) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce refinou com sucesso! Agora seu "..getItemNameById(itemEx.itemid).." eh level " ..getItemLevel(itemEx.uid)) if getItemInfo(itemEx.itemid).attack > 0 then doItemSetAttribute(itemEx.uid, "attack", atk + 1) return true elseif getItemInfo(itemEx.itemid).armor > 0 then doItemSetAttribute(itemEx.uid, "armor", arm + 1) return true elseif getItemInfo(itemEx.itemid).defense > 0 and getItemInfo(itemEx.itemid).attack <= 0 then doItemSetAttribute(itemEx.uid, "defense", def + 1) return true end else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce falhou.") if getItemLevel(itemEx.uid) > 0 then doItemAddLevel(itemEx.uid, -1) doItemSetAttribute(itemEx.uid, "name", getItemNameById(itemEx.itemid).. " + " ..getItemLevel(itemEx.uid)) if getItemInfo(itemEx.itemid).attack > 0 then doItemSetAttribute(itemEx.uid, "attack", atk - 1) return true elseif getItemInfo(itemEx.itemid).armor > 0 then doItemSetAttribute(itemEx.uid, "armor", arm - 1) return true elseif getItemInfo(itemEx.itemid).defense > 0 and getItemInfo(itemEx.itemid).attack <= 0 then doItemSetAttribute(itemEx.uid, "defense", def - 1) return true end end return true end else doPlayerSendCancel(cid, "Voce nao tem iron ores o suficiente. Voce precisa de "..upgrade.quantOre.." iron ores.") end end end else doPlayerSendCancel(cid, "Esse item nao pode ser refinado.") end return true end
-
anúncio Novo sistema de Cargos e Novas pips!
tópico respondeu ao Administrador de zipter98 em Noticias
Como esperado da nova staff, um ótimo trabalho.- 51 respostas
-
- novos cargos
- pips
-
(e 2 mais)
Tags:
-
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
-
Quem Está Navegando 0 membros estão online
- Nenhum usuário registrado visualizando esta página.