
Solutions
-
Wise's post in (Resolvido)[PEDIDO] Tile Test VIP was marked as the answerEstou via mobile, só pra constar o fato de não ter disponível o {code}.
viptile.lua (data\movements\scripts)
local key = 10101 -- storage key id
function onStepIn(cid, item, pos, fromPos)
if getPlayerStorageValue(cid, key) > 0 then
doTeleportThing(cid, fromPos, true)
doSendMagicEffect(fromPos, CONST_ME_POFF)
return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Você, já testou a área vip!')
end
return setPlayerStorageValue(cid, key, 1) and doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Você, está testando uma área vip!')
end
movements.xml (data\movements)
<movevent type="StepIn" actionid="10101" event="script" value="viptile.lua"/>
-
Wise's post in (Resolvido)Como faz pra checar storage em tabela? was marked as the answerVocê não deu ouvidos ao que eu disse acima. Releia e depois observe:
local skey = 1234 -- storage key id
local t = {
[3001] = 900, -- [valueId] = HP
[3002] = 780
}
function onUse(cid, item, fromPos)
local v = t[getPlayerStorageValue(cid, skey)]
if v then
setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + v)
doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
doSendMagicEffect(fromPos, CONST_ME_TELEPORT)
doPlayerSendTextMessage(cid, 20, "Congratulations!")
end
return true
end
-
Wise's post in (Resolvido)[AJUDA]Teleport was marked as the answeroutlands.lua (data\movements\scripts)
local aid = {
[33301] = {x = 123, y = 456, z = 7}, -- [actionId] = {xyz position}
[33302] = {x = 123, y = 456, z = 7},
[33303] = {x = 123, y = 456, z = 7}
}
function onStepIn(cid, item)
local pos = aid[item.actionid]
return doTeleportThing(cid, pos) and doSendMagicEffect(pos, CONST_ME_TELEPORT)
end
movements.xml (data\movements)
<movevent type="StepIn" actionid="33301" event="script" value="outlands.lua"/> <movevent type="StepIn" actionid="33302" event="script" value="outlands.lua"/> <movevent type="StepIn" actionid="33303" event="script" value="outlands.lua"/> Basta adicionar a cada tile (via Remere's Map Editor), o actionId respectivo a posição (determinada na tabela) que irá teleportar o player. Não se esqueça de igualar os actionIds da tabela com os das tags. -
Wise's post in (Resolvido)Player sendo teleportado pra outro lugar was marked as the answerBom, o player é teleportado para a posição do templo de sua town:
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
Nesse caso, você deve alterar as coordenadas do id dessa Town no mapa do seu servidor via Remere's Map Editor. Confira a seção dos tutoriais de mapping.
-
Wise's post in (Resolvido)[AJUDA] NPC was marked as the answerAqui..
travel.lua (data\npc\scripts)
local item, pos, key = {5432, 1}, {x = 123, y = 456, z = 7}, 54321 -- {itemid, count}, {xyz position to teleport}, storage key local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end local function creatureSayCallback(cid, type, msg) if not npcHandler:isFocused(cid) then return false end local p = Player(cid) if msgcontains(msg, 'yes') and npcHandler.topic[cid] == 0 and p:getStorageValue(key) < 1 then npcHandler:say('Ok, but first you need to bring me '..item[2]..' '..ItemType(item[1]):getName()..(item[2] > 1 and 's' or '')..'. Do you have it?', cid) npcHandler.topic[cid] = 1 elseif npcHandler.topic[cid] == 1 then if msgcontains(msg, 'yes') then if p:removeItem(item[1], item[2]) then p:setStorageValue(key, 1) npcHandler:say('Sure. Do you want to go now?', cid) npcHandler.topic[cid] = 0 else npcHandler:say('You don\'t have any '..ItemType(item[1]):getName()..'. Get out of here!', cid) npcHandler:releaseFocus(cid) end end else npcHandler:say('Have a good trip!', cid) npcHandler:releaseFocus(cid) p:teleportTo(pos) pos:sendMagicEffect(CONST_ME_TELEPORT) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
Travel.xml (data\npc)
<npc name="Travel" script="travel.lua" walkinterval="3000" floorchange="0"> <health now="100" max="100" /> <look type="151" head="20" body="39" legs="45" feet="7" addons="0" /> <parameters> <parameter key="message_greet" value="Hail |PLAYERNAME|. Would you like to take a trip?"/> <parameter key="message_decline" value="Hm, okay. Get out of here!"/> <parameter key="message_walkaway" value="Sure." /> </parameters> </npc>
-
Wise's post in (Resolvido)Addon Bonus was marked as the answerNo script da spell, procure por:
return doCombat(cid, combat, var)
E substitua por (de acordo com a vocação da spell):
--Druid: local lookType = {148, 144} -- {female, male} return canPlayerWearOutfit(cid, getPlayerSex(cid) == 0 and lookType[1] or lookType[2], 3) and doCombat(cid, combat, var) or doPlayerSendCancel(cid, 'You need Druid full addons to cast this spell.') and false --Sorcerer: local lookType = {138, 130} -- {female, male} return canPlayerWearOutfit(cid, getPlayerSex(cid) == 0 and lookType[1] or lookType[2], 3) and doCombat(cid, combat, var) or doPlayerSendCancel(cid, 'You need Mage full addons to cast this spell.') and false --Knight: local lookType = {142, 134} -- {female, male} return canPlayerWearOutfit(cid, getPlayerSex(cid) == 0 and lookType[1] or lookType[2], 3) and doCombat(cid, combat, var) or doPlayerSendCancel(cid, 'You need Warrior full addons to cast this spell.') and false --Paladin: local lookType = {156, 152} -- {female, male} return canPlayerWearOutfit(cid, getPlayerSex(cid) == 0 and lookType[1] or lookType[2], 3) and doCombat(cid, combat, var) or doPlayerSendCancel(cid, 'You need Assassin full addons to cast this spell.') and false -
Wise's post in (Resolvido)Comando que mostra se o servidor está PVP ou NO-PVP was marked as the answerfunction onSay(cid) local player = Player(cid) return player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'World type is currently: '..Game.getWorldType() == 1 and 'Non-PvP' or Game.getWorldType() == 2 and 'PvP' or 'PvP-Enforced') end
-
Wise's post in (Resolvido)Ideia para uma Quest! Ajuda a Fazer? was marked as the answerCaso queira:
local chance, item = 50, {1234, 5678, 1} -- %, {item necessário, item ganho, quantidade do item ganho) local pos = {x = 5, y = 6, z = 7} -- posição a ser teleportado function onStepIn(cid) local n = math.random(100) return getPlayerItemCount(cid, item[1]) > 0 and n >= chance and doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Você teve sorte e recebeu um item!') and doPlayerAddItem(cid, item[2], item[3]) and doTeleportThing(cid, pos) and doSendMagicEffect(pos, CONST_ME_TELEPORT) or true end -
Wise's post in (Resolvido)globalevent mensagem programada was marked as the answerautomsgs.lua (data\globalevents\scripts)
local msg = { ['17:58'] = {text = 'Blablabla', type = 20}, ['17:59'] = {text = 'Blablabla', type = 21}, ['18:01'] = {text = 'Blablabla', type = 22}, ['18:02'] = {text = 'Blablabla', type = 23} } function onThink(interval, lastExecution) local h = msg[os.date('%X'):sub(1, 5)] return h and doBroadcastMessage(h.text, h.type) or true end
globalevents.xml (data\globalevents)
<globalevent name="automaticmessages" interval="60" event="script" value="automsgs.lua"/>
Message types
MESSAGE_FIRST = 18 MESSAGE_EVENT_ORANGE = 19 MESSAGE_STATUS_CONSOLE_ORANGE = 20 MESSAGE_STATUS_WARNING = 21 MESSAGE_EVENT_ADVANCE = 22 MESSAGE_EVENT_DEFAULT = 23 MESSAGE_STATUS_DEFAULT = 24 MESSAGE_INFO_DESCR = 25 MESSAGE_STATUS_SMALL = 26 MESSAGE_STATUS_CONSOLE_BLUE = 27 -
Wise's post in (Resolvido){help} Resetar apenas um skill mysql.... was marked as the answerFiz aqui:
UPDATE player_skills SET value = 10 WHERE skillid = 0; O tópico foi movido para a área correta, preste mais atenção da próxima vez!
Este tópico foi movido:
De: "OTServ→ Suporte OTServ → Suporte de Scripts"
Para: "OTServ→ Suporte OTServ → Suporte de WebSites"
-
Wise's post in (Resolvido)atacar pk ficar pz was marked as the answerattackpk.lua (data\creaturescripts\scripts):
function onAttack(cid, target) return isPlayer(cid) and getPlayerSkullType(target) > 2 and doPlayerSetPzLocked(cid, false) or true end
creaturescripts.xml (data\creaturescripts):
<event type="attack" name="AttackPK" script="attackpk.lua"/>
Registre o creature event em login.lua (data\creaturescripts\scripts):
registerCreatureEvent(cid, "AttackPK") -
Wise's post in (Resolvido)[pedido] tag se for da staff was marked as the answerFiz tão rápido que nem me dei conta dessa cagada, mas enfim..
Já que retornar removendo o player ou fazer com que retorne false ao callback nos escopos, faz com que ele não consiga executar login, acho mais simples apenas alterar o callback para que o processo ocorra quando o player estiver com/ou sem acesso e executar logout.
autotag.lua (data\creaturescripts\scripts):
function onLogout(cid) local tag = '[6S]' if getPlayerGroupId(cid) < 2 and getCreatureName(cid):find(tag) then db.query("UPDATE `players` SET `name` = '"..getCreatureName(cid):sub(tag:len() + 1).."' WHERE `id` = "..getPlayerGUID(cid)..";") elseif getPlayerGroupId(cid) > 1 and not getCreatureName(cid):find(tag) then db.query("UPDATE `players` SET `name` = '"..tag..getCreatureName(cid).."' WHERE `id` = "..getPlayerGUID(cid)..";") end return true end
creaturescripts.xml (data\creaturescripts):
<event type="logout" name="AutoTag" event="script" value="autotag.lua"/> -
Wise's post in (Resolvido)Pedido, acabou o VIP foi pro templo was marked as the answer@moviebr
Esquece, era só pra eu entender o que o estagiário estava fazendo.
Criei um método que envolve outra storage key, possibilitando assim a identificação de um player com tempo de vip ativo/inativo.
autocheckvip.lua (data\creaturescripts\scripts):
local key = {13500, 53100} -- storages local default = 1 -- default town id function onLogin(cid) if getPlayerStorageValue(cid, key[1]) < os.time() and getPlayerStorageValue(cid, key[2]) > 0 then doPlayerSetTown(cid, default) setPlayerStorageValue(cid, key[2], -1) doTeleportThing(cid, getTownTemplePosition(default)) doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Your VIP time is over.') end return true end function onLogout(cid) return getPlayerStorageValue(cid, key[1]) > os.time() and getPlayerStorageValue(cid, key[2]) < 1 and setPlayerStorageValue(cid, key[2], 1) or true end
creaturescripts.xml (data\creaturescripts):
<event type="login" name="CheckLogin" event="script" value="autocheckvip.lua"/> <event type="logout" name="CheckLogout" event="script" value="autocheckvip.lua"/> Basta o player vip fazer logout 1 vez para que o resto execute perfeitamente.
Sugiro que remova a vip de todos os players ou que faça uso de uma nova storage key para evitar possíveis falhas na identificação do player vip ativo/inativo.
-
Wise's post in (Resolvido)Monsters que Empurra was marked as the answerMe interessei pelo seu pedido, fiz aqui rapidinho..
monsterpusher.lua (data\creaturescripts\scripts):
function doPush(uid) if not isCreature(uid) then return false end local pos = getCreaturePosition(uid) local pushp = { [0] = {x = pos.x, y = pos.y + 1, z = pos.z, stackpos = 0}, [1] = {x = pos.x - 1, y = pos.y, z = pos.z, stackpos = 0}, [2] = {x = pos.x, y = pos.y - 1, z = pos.z, stackpos = 0}, [3] = {x = pos.x + 1, y = pos.y, z = pos.z, stackpos = 0}, [4] = {x = pos.x + 1, y = pos.y - 1, z = pos.z, stackpos = 0}, [5] = {x = pos.x - 1, y = pos.y - 1, z = pos.z, stackpos = 0}, [6] = {x = pos.x + 1, y = pos.y + 1, z = pos.z, stackpos = 0}, [7] = {x = pos.x - 1, y = pos.y - 1, z = pos.z, stackpos = 0} } local rn = math.random(0, 7) if getTopCreature(pushp[rn]).uid > 0 or getTileThingByPos(pushp[rn]).itemid == 0 then return doPush(uid) else doTeleportThing(uid, pushp[rn], true) end return true end function onAttack(cid, target) doPush(target) doMonsterChangeTarget(cid) return true end
creaturescripts.xml (data\creaturescripts):
<event type="attack" name="MonsterPusher" script="monsterpusher.lua"/>
Registre o creature event adicionando a seguinte tag ao arquivo XML do monstro desejado:
<script> <event name="MonsterPusher"/> </script> -
Wise's post in (Resolvido)[Ajuda] Arma com varios efeitos was marked as the answerVocê pode conferir os números dos efeitos mágicos e efeitos de distância, nesse tópico:
Lista Completa de Magic Effects e Shoot Types.
Ou, caso prefira, pode visualiza-los pelo programa ObjectBuilder.
-
Wise's post in (Resolvido)Message loot monster - Error - Help was marked as the answerEsse tipo de mensagem (29) não existe.
Escolha uma dessas e tente novamente (para o loot, normalmente seria a de número 25):
MESSAGE_FIRST = 18 MESSAGE_EVENT_ORANGE = 19 MESSAGE_STATUS_CONSOLE_ORANGE = 20 MESSAGE_STATUS_WARNING = 21 MESSAGE_EVENT_ADVANCE = 22 MESSAGE_EVENT_DEFAULT = 23 MESSAGE_STATUS_DEFAULT = 24 MESSAGE_INFO_DESCR = 25 MESSAGE_STATUS_SMALL = 26 MESSAGE_STATUS_CONSOLE_BLUE = 27 -
Wise's post in (Resolvido)Usar item só se tiver tal storage. was marked as the answerNote que o script no qual ele informou, faz uso do callback onUse e portanto, é uma action. Ele quer que essa ação aconteça ao usar o item, literalmente.
Usar é diferente de equipar, lembre-se.
local stor = {30023, 4} function onUse(cid, item, fromPos, toPos) if getPlayerStorageValue(cid, stor[1]) ~= stor[2] then return doPlayerSendCancel(cid, 'You can\'t use this item.') and false end doRemoveItem(item.uid, 2415) doPlayerSetVocation(cid, 525) doCreatureChangeOutfit(cid, {lookType = 462}) doSendMagicEffect(toPos, 32) doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'Agora voce foi promovido.') doRemoveItem(item.uid) return true end -
Wise's post in (Resolvido)Tile que heala monstro [8.60] was marked as the answerAmigo, essa função que você utilizou no segundo parâmetro, não existe. Portanto retornaria um valor nulo; seria getCreatureMaxHealth.
E o modo como ela está sendo aplicada, provavelmente iria bugar os health points do creatureid, já que você fez uma adição do HP máximo dele ao HP atual.
Você têm de subtrair os points máximos pelos points atuais, então, resultando na quantidade exata para "completar" o HP do creatureid:
function onStepIn(cid) if isMonster(cid) then doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid)) doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE) end return true end -
Wise's post in (Resolvido)[DUVIDA] Usar iten por Vocação was marked as the answerNão precisa fazer upload. Apenas clique no painel do editor de texto, onde se localizam os operadores relacionais <> e cole o script.
De qualquer forma, substitua os códigos do seu movements.xml, por estes:
-
Wise's post in (Resolvido)Spell healer com Efeito - Ajudem was marked as the answerAbra o arquivo config.lua e procure pela variável showHealingDamage ou (dependendo da versão) showHealthChange.
Basta alterar o valor para true, ex:
showHealingDamage = true -- ou showHealthChange = true Já enquanto a cor, você deve fazer alterações através da source. Veja as informações nesse tópico:
Heal com cores diferentes
-
Wise's post in (Resolvido)[PEDIDO] - Kill talk was marked as the answerEsse tipo de ação é prioridade da equipe e só poder ser feita por um membro da mesma.
Da próxima vez que você vir um tópico com um título inadequado, clique em Relatar para a equipe! abaixo do post principal do mesmo.
- Conteúdo das Regras Gerais do fórum:
• 2.19 - Moderação secundária não será tolerada:
Mensagens como "Ei, esse tópico está na área errada", "Organize seu tópico, está uma bagunça!", só podem ser usadas pelos membros de nossa equipe, caso contrário, esse tipo de ação será considerada flood, já que a correções desse nicho não cabem aos membros e, portanto, caracteriza como desvio do assunto principal do tópico.
@jNo
Tente:
textsonkill.lua (data\creaturescripts\scripts):
function onKill(cid, target) local texts = {'Dominado Full', 'Assado Full'} if isPlayer(target) then doSendAnimatedText(getCreaturePosition(cid), texts[1], math.random(0, 255)) doSendAnimatedText(getCreaturePosition(target), texts[2], math.random(0, 255)) end return true end
Tag - creaturescripts.xml (data\creaturescripts):
<event type="kill" name="TextsOnKill" event="script" value="textsonkill.lua"/>
Registre o creature event em login.lua (data\creaturescripts\scripts):
registerCreatureEvent(cid, "TextsOnKill") -
Wise's post in (Resolvido)NoDamageParty was marked as the answerCerto, tente desse modo: function onCombat(cid, target) if isPlayer(target) and isInParty(cid) and isInParty(target) then if getPlayerParty(target) == getPlayerParty(cid) or getPartyLeader(target) == cid then return false end end return true end
-
Wise's post in (Resolvido)[Pedido] Npc Teleport com Level was marked as the answerstranger.lua (data\npc\scripts):
local level = 50 local pos = {x=123, y=456, z=7} local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end 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, 'teleport')) then talkState[talkUser] = 1 selfSay('I can teleport you, but you need at least level '..level..' to go. Are you sure you\'re ready?', cid) elseif (msgcontains(msg, 'yes') and talkState[talkUser] == 1) then if (getPlayerLevel(cid) >= level) then doTeleportThing(cid, pos) doSendMagicEffect(pos, CONST_ME_TELEPORT) selfSay('Be careful!', cid) else talkState[talkUser] = 0 selfSay('I said! You need at least level '..level..' to be teleported. You\'re not ready.', cid) end elseif (msgcontains(msg, 'no') and talkState[talkUser] == 1) then talkState[talkUser] = 0 npcHandler:releaseFocus(cid) selfSay('Sure.', cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
Stranger.xml (data\npc):
<npc name="Stranger" script="data/npc/scripts/stranger.lua" access="5" lookdir="1"> <health now="1000" max="1000"/> <look type="129" head="115" body="132" legs="114" feet="95" addons="0"/> <parameters> <parameter key="message_greet" value="Hey |PLAYERNAME|, I can {teleport} some mortals." /> </parameters> </npc> -
Wise's post in (Resolvido)[PEDIDO] - Alavanca System was marked as the answerfunction onUse(cid, fromPos, toPos) pos = {x=123, y=456} -- de onde newpos = {x=1369, y=1026, z=8} -- para onde cpos = getCreaturePosition(cid) if cpos.x == pos.x and cpos.y == pos.y then doTeleportThing(cid, newpos) doSendMagicEffect(toPos, CONST_ME_TELEPORT) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have been teleported.') else doPlayerSendCancel(cid, 'You need to stay in the correct floor to be teleported.') end return true end
-
Wise's post in (Resolvido)Pedido, script de Quest was marked as the answerEu havia feito um script semelhante para outro membro há alguns dias.
uchests.lua (data\actions\scripts):
local t = { -- [uniqueID] = {vocs = {vocationIDs}, items = {itemIDs}} [55001] = {vocs = {4, 8}, items = {1234}}, -- club ~ knights [55002] = {vocs = {4, 8}, items = {1234}}, -- axe ~ knights [55003] = {vocs = {4, 8}, items = {1234}}, -- sword ~ knights [55004] = {vocs = {1, 2, 5, 6}, items = {1234}}, -- mages [55005] = {vocs = {3, 7}, items = {1234, 5678}} -- paladins } function onUse(cid, item, fromPos, toPos) storage = 54321 u = t[item.uid] if not u then return false end if isInArray(u.vocs, getPlayerVocation(cid)) then if getPlayerStorageValue(cid, storage) < 1 then setPlayerStorageValue(cid, storage, 1) for i = 1, #u.items do doPlayerAddItem(cid, u.items[i], 1) end doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You got your reward for completing the quest.') else doPlayerSendCancel(cid, 'You already have done this quest.') end else doPlayerSendCancel(cid, 'Your vocation is not allowed to do this quest.') end return true end
Tag - actions.xml (data\actions):
<action uniqueid="55001-55005" event="script" value="uchests.lua"/>
Basta adicionar aos baús, os uniqueids compatíveis com a configuração da tabela, sendo no exemplo acima:
55001 - Club (Knight, Elite Knight)
55002 - Axe (Knight, Elite Knight)
55003 - Sword (Knight, Elite Knight)
55004 - Staff (Sorcerer, Druid, Master Sorcerer, Elder Druid)
55005 - Bow / Arrow (Paladin, Royal Paladin)