
Solutions
-
Pedriinz's post in (Resolvido)PROBLEMAS COM O PK was marked as the answerTroque seu creature.lua por este:
function Creature:onChangeOutfit(outfit) return true end function Creature:onAreaCombat(tile, isAggressive) return RETURNVALUE_NOERROR end local function removeCombatProtection(cid) local player = Player(cid) if not player then return true end local time = 0 if player:isMage() then time = 10 elseif player:isPaladin() then time = 20 else time = 30 end player:setStorageValue(Storage.combatProtectionStorage, 2) addEvent(function(cid) local player = Player(cid) if not player then return end player:setStorageValue(Storage.combatProtectionStorage, 0) player:remove() end, time * 1000, cid) end function Creature:onTargetCombat(target) if not self then return true end if target:isPlayer() then if self:isMonster() then local protectionStorage = target:getStorageValue(Storage.combatProtectionStorage) if target:getIp() == 0 then -- If player is disconnected, monster shall ignore to attack the player if not target:isPzLocked() then if protectionStorage <= 0 then addEvent(removeCombatProtection, 30 * 1000, target.uid) target:setStorageValue(Storage.combatProtectionStorage, 1) elseif protectionStorage == 1 then self:searchTarget() return RETURNVALUE_YOUMAYNOTATTACKTHISPLAYER end end return true end if protectionStorage >= os.time() then return RETURNVALUE_YOUMAYNOTATTACKTHISPLAYER end end end if PARTY_PROTECTION ~= 0 then if self:isPlayer() and target:isPlayer() then local party = self:getParty() if party then local targetParty = target:getParty() if targetParty and targetParty == party then return RETURNVALUE_YOUMAYNOTATTACKTHISPLAYER end end end end if ADVANCED_SECURE_MODE ~= 0 then if self:isPlayer() and target:isPlayer() then if self:hasSecureMode() then return RETURNVALUE_YOUMAYNOTATTACKTHISPLAYER end end end return true end E teste. (:
-
Pedriinz's post in (Resolvido)Item por Vocação was marked as the answerfunction onUse(cid, item, fromPosition, itemEx, toPosition) local vocation = {5, 6, 7, 8} if not isInArray(vocation, getPlayerVocation(cid)) then doPlayerSendTextMessage(cid, 20, "You cant use this item.") return TRUE end if item.itemid == 10543 then doPlayerSetVocation(cid, getPlayerVocation(cid)+8) doPlayerSendTextMessage(cid, 20, "You are a ".. getPlayerVocationName(cid) ..".") end doSendMagicEffect(fromPosition, CCONST_ME_MAGIC_RED) doRemoveItem(item.uid, 1) return TRUE end try it.
-
Pedriinz's post in (Resolvido)[SCRIPT] Cast system Ajuda ! was marked as the answer@Tiago6795 Ok, o motivo de não funcionar é simples... a variavel da função que você esta utilizando é cid, enquanto no script você chama player.
function onLogout(cid) Troque o cid da primeira linha para player, assim:
function onLogout(player)
Quando for tentar fazer alterações como essa, leia e re-leia o codigo, e continue estudando os motivos e causas... logo você aprende LUA que não é difícil.
-
Pedriinz's post in (Resolvido)Sistema de Bones Rosha was marked as the answerlocal lowerRoshamuul = { [1] = "guzzlemaw", [2] = "22389" } local pos = { [1] = Position(33654, 32453, 7), [2] = Position(33658, 32462, 7), [3] = Position(33644, 32467, 7), [4] = Position(33647, 32482, 7), [5] = Position(33658, 32481, 7), [6] = Position(33637, 32485, 7), [7] = Position(33662, 32470, 7), [8] = Position(33666, 32472, 7), [9] = Position(33673, 32473, 7), [10] = Position(33677, 32476, 7), [11] = Position(33679, 32476, 7), [12] = Position(33647, 32482, 7), [13] = Position(33681, 32489, 7), [14] = Position(33688, 32488, 7), [15] = Position(33688, 32488, 7), [16] = Position(33680, 32498, 7), [17] = Position(33696, 32482, 7), [18] = Position(33705, 32481, 7), [19] = Position(33707, 32487, 7), [20] = Position(33698, 32491, 7), [21] = Position(33657, 32500, 7), [22] = Position(33670, 32499, 7) } local time = 30 -- In seconds local storage = 98119 function onUse(player, item, fromPosition, target, toPosition, isHotkey) if item.itemid == 22513 then for v=1, #pos do if item:getPosition() == pos[v] then if player:getStorageValue(storage) < os.time() then if lowerRoshamuul[math.random(1,2)] == lowerRoshamuul[1] then Game.createMonster(lowerRoshamuul[1], (player:getPosition() + Position(-1, 2, 0)), true, true) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You ransack the pile but fail to find any useful parts.") else player:addItem(tonumber(lowerRoshamuul[2]), 1) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Amidst the pile of various bones you find a large, hollow part, similar to a pipe.") end player:setStorageValue(storage, os.time() + time) else return player:sendCancelMessage(string.format("Sorry, you're exausted. You need wait %d second%s", player:getStorageValue(storage) - os.time(), (player:getStorageValue(storage) - os.time()) > 1 and "s." or ".")) end end end end return true end
Na tabela pos, você coloca a posição dos ossos que eles vão clicar.
-
Pedriinz's post in (Resolvido)Stone of Wisdom e Stone of Insight was marked as the answer@saiddias Entendi. No caso poderia ter editado uma condição que checasse se o item estivesse ou nao na bp.
Todavia se já está satisfatório o resultado ótimo. Mas delete essa variável aqui:
itemID = 2195 -- Isso será o ID da Stone of Wisdom Já que a mesma não está sendo mais utilizada, deixando esta parte do script assim:
function onUse(player, item) local exp = player:getLevel() * 200 -- Isso será a exp entregue player:remove(1) player:addExperience(exp) player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Voce acaba de ganhar "..exp.." de experiencia.") return true end
Sobre fechar o tópico, melhor deixa-lo aí, alguém pode precisar disso ou ter alguma duvida.
-
Pedriinz's post in (Resolvido)[DUVIDA] FUNÇÃO ON USE was marked as the answerVish @vankk provavelmente você está correto.
Mas deve ter alguma maneira de fazer o que ele deseja no 0.4 também...
Edit:
Coloque o parametro; allowfaruse="1", na tag do item em actions.xml
E vai poder usar de longe.
-
Pedriinz's post in (Resolvido)Ajuda a compilar OTXserver 10.98 no linux ubuntu 14.04 was marked as the answerFica difícil de ajudar sem saber o que se passa, mas com toda certeza você está manipulando isso de forma incorreta.
Realize os seguintes passos, apague tudo que você baixou sobre.
Use os comandos a seguir de forma sequenciada e ordenada e tenha certeza de USAR todos os comandos que eu listar.
# apt-get install git cmake build-essential liblua5.2-dev libgmp3-dev libmysqlclient-dev libboost-system-dev libpugixml-dev # cd /home/ # git clone https://github.com/mattyx14/otxserver.git # cd /home/otxserver/path_10_9/ # mkdir build && cd build # cmake .. # make -
Pedriinz's post in (Resolvido)[ERRO] NPCSAY was marked as the answerEntendi, substitua toda parte sobre isso, por essa:
elseif msgcontains(msg, 'promotion') then local cur, r, msg, exp, item = getPlayerStorageValue(cid, points), getPlayerStorageValue(cid, rank) if cur >= 5 and r < 1 then msg, exp = 'You have completed 5 tasks! Let me promote you to the first rank: Huntsman. Congratulations! ...', 'If you find any trophies that you don\'t need, feel free to ask me for a {trade}.', 5000 elseif cur >= 10 and r < 2 then msg, exp = 'You have completed 10 hunting tasks. It\'s time for a promotion. You advance to the rank of \'Ranger\'. Congratulations! ...', 'Oh, I made a deal with Lorek. He ships Rangers from our society - and higher ranks of course - to Banuta, Chor or near the mountain pass to Darama. Just ask him for a passage.', 8000 elseif cur >= 20 and r < 3 then msg, exp = 'Good show! You have completed 20 hunting tasks for the \'Paw and Fur - Hunting Elite. You have earned the right to join the ranks of those known as \'Big game hunter\'. Congratulations! ...', 'From now on I\'ll buy more trophies from you!', 10000 elseif cur >= 30 and r < 4 then msg, exp, item = 'Spiffing! You have done 30 hunting tasks! From now on you can call yourself a \'Trophy hunter\'. As a reward I have this special backpack for you and in addition you can sell some more rare trophies to me.', 15000, 10518 elseif cur >= 50 and r < 5 then msg, exp = 'Congratulations! You have made the highest rank: \'Elite hunter\'. If haven\'t yet done so ask me for the {special} task.', 30000 else msg = 'You dont have completed any task.' end
Me diga o resultado.
-
Pedriinz's post in (Resolvido)[AJUDA] Piso que Heala Soul was marked as the answerFácil.
Vou fazê-lo, logo edito com o mesmo.
Uma duvida, só pode passar 1x, depois não pode mais?
Teste:
function onStepIn(cid, pos) local manaRequired = 100 -- Mana que precisa pra funcionar local soulAdd = 10 -- Quantidade de soul que aumenta if getPlayerMana(cid) >= manaRequired then doCreatureAddMana(cid, -100) doPlayerAddSoul(cid, soulAdd) doPlayerSendTextMessage(cid, TALKTYPE_ORANGE, "You soul has been increase in "..soulAdd.." points.") else doPlayerSendCancel(cid, "You dont have mana for this. You need "..manaRequired.. " of mana.") end return true end
-
Pedriinz's post in (Resolvido)TFS 1.0 UPDATE BUG ADDON DOLL MOUNT DOLL was marked as the answerResolvi após a ajuda de outro cara de outro fórum.
E por mais louco que seja, eu apenas deletei o arquivo.lua do primeiro script e recriei o arquivo com os mesmo códigos e funcionou.
Tipo magica! Que louco kkk