
Solutions
-
Wise's post in (Resolvido)vip acess was marked as the answerRefiz:
Action script:
function onUse(cid) stor = 7500 -- vip storage ccoins = 1000 -- amount of crystal coins if getPlayerStorageValue(cid, stor) < 1 then setPlayerStorageValue(cid, stor, 1) doPlayerAddItem(cid, 2160, ccoins) doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'Agora você tem acesso a VIP 1.') else doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'Você ja fez essa quest.') end return true end
Movement script:
function onStepIn(cid, item, pos, fromPos) stor = 7500 -- vip storage if getPlayerStorageValue(cid, stor) < 1 then doTeleportThing(cid, fromPos) doSendMagicEffect(fromPos, CONST_ME_POFF) doPlayerSendCancel(cid, 'Você não é VIP 1, faça a quest VIP Acess ao lado dos Teleports.') end doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE) return true end Basta adicionar o actionid ou uniqueid (qualquer que seja o que você estipulou na tag em movements.xml) ao tile.
-
Wise's post in (Resolvido)Bug Creaturescript was marked as the answerVocê está certo, é mais simples e correto assim ;]
@Thiago Virtuoso
local generator = { ["Castle Generator I"] = {brother = "Castle Generator II"}, ["Castle Generator II"] = {brother = "Castle Generator I"} } local generatorArea = { fromPos = {x = 1130, y = 1751, z = 7}, toPos = {x = 1134, y = 1813, z = 7} } local pos = { {x= 1050, y= 1813, z= 7}, {x= 1050, y= 1812, z= 7}, {x= 1050, y= 1811, z= 7}, {x= 1050, y= 1810, z= 7}, {x= 1050, y= 1809, z= 7}, {x= 1047, y= 1809, z= 7}, {x= 1048, y= 1809, z= 7}, {x= 1047, y= 1809, z= 7}, {x= 1050, y= 1752, z= 7}, {x= 1050, y= 1753, z= 7}, {x= 1050, y= 1754, z= 7}, {x= 1050, y= 1755, z= 7}, {x= 1047, y= 1755, z= 7}, {x= 1048, y= 1755, z= 7}, {x= 1049, y= 1755, z= 7}, {x= 1050, y= 1755, z= 7} } function onDeath(cid) if generator[getCreatureName(cid)] then firstm = generator[getCreatureName(cid)] secondm = getCreatureByName(firstm.brother) if isMonster(secondm) then if isInRange(getCreaturePosition(secondm), generatorArea.fromPos, generatorArea.toPos) then return true end else items = {9533, 9485} -- items list to remove for p = 1, #pos do for i = 1, #items do item = getTileItemById(pos[p], items[i]) if item.uid > 0 then doRemoveItem(item.uid) end end end doBroadcastMessage('Os geradores primários foram destruídos, acesso aos geradores reservas liberado!') end end return true end
Altere a tag do creature event para death e adicione a seguinte tag ao(s) arquivo(s) XML do(s) monster(s) que for(em) executar esse script ao morrer(em) (o(s) monster(s) configurado(s) na tabela), com o nome estipulado ao creature event na tag (creaturescripts.xml) do mesmo:
<script> <event name="EventName"/> </script> -
Wise's post in (Resolvido)Action para canivetes was marked as the answerEstá certo, fui eu quem confundi. Você quer que eles não "emperrem".
Tente: local holes = {468, 481, 483, 7932} local holeId = {294, 369, 370, 383, 392, 408, 409, 427, 428, 430, 462, 469, 470, 482, 484, 485, 489, 924, 3135, 3136} function onUse(cid, item, fromPosition, itemEx, toPosition) -- Shovel if isInArray(holes, itemEx.itemid) == true then doTransformItem(itemEx.uid, itemEx.itemid + 1) doDecayItem(itemEx.uid) return false -- Rope elseif toPosition.x == CONTAINER_POSITION or toPosition.x == 0 and toPosition.y == 0 and toPosition.z == 0 then return false end local groundTile = getThingfromPos(toPosition) if groundTile.itemid == 384 or groundTile.itemid == 418 or groundTile.itemid == 8278 then doTeleportThing(cid, {x = toPosition.x, y = toPosition.y + 1, z = toPosition.z - 1}, false) elseif isInArray(holeId, itemEx.itemid) == true then local hole = getThingfromPos({x = toPosition.x, y = toPosition.y, z = toPosition.z + 1, stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE}) if hole.itemid > 0 then doTeleportThing(hole.uid, {x = toPosition.x, y = toPosition.y + 1, z = toPosition.z}, false) else doPlayerSendCancel(cid, "Sorry, not possible.") end return false -- Pick elseif (itemEx.uid <= 65535 or itemEx.actionid > 0) and (itemEx.itemid == 354 or itemEx.itemid == 355 or itemEx.itemid == 9024 or itemEx.itemid == 9025) then doTransformItem(itemEx.uid, 392) doDecayItem(itemEx.uid) return true elseif itemEx.uid == 60001 then doTeleportThing(cid, {x=329, y=772, z=10}) doSendMagicEffect({x=329, y=772, z=10},10) return true -- Machete elseif itemEx.itemid == 2782 then doTransformItem(itemEx.uid, 2781) doDecayItem(itemEx.uid) return true elseif itemEx.itemid == 1499 then doRemoveItem(itemEx.uid) return true -- Scythe elseif itemEx.itemid == 2739 then doTransformItem(itemEx.uid, 2737) doCreateItem(2694, 1, toPosition) doDecayItem(itemEx.uid) return true end return destroyItem(cid, itemEx, toPosition) end -
Wise's post in (Resolvido)Remover mensagem para Account Manager was marked as the answerfunction onLogin(cid) OfflineTraining_initialize(cid) if(OfflineTraining_isTraining(cid)) then OfflineTraining_turnOffTraining(cid) OfflineTraining_addTrainedSkills(cid, math.min(OfflineTraining_getTime(cid), OfflineTraining_getOfflineTime(cid))) OfflineTraining_setTime(cid, math.abs(OfflineTraining_getTime(cid) - OfflineTraining_getOfflineTime(cid))) OfflineTraining_onEndTraining(cid) local left = ((OfflineTraining_getTime(cid) / 60) * 60 * 60) left = {hour = math.floor(left/3600), minutes = math.ceil((left % 3600)/60)} doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'Voce ainda tem '.. left.hour ..'h and '..left.minutes..'min de Treinamento.') else local lefts = ((OfflineTraining_getTime(cid) / 60) * 60 * 60) OfflineTraining_setTime(cid, OfflineTraining_getTime(cid) + OfflineTraining_getOfflineTime(cid)) lefts = {hour = math.floor(lefts/3600), minutes = math.ceil((lefts % 3600)/60)} doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'Voce tem '.. lefts.hour ..'h and '..lefts.minutes..'min de Treinamento.') end return true end
-
Wise's post in (Resolvido)!removefrags was marked as the answerTente:
removefrags.lua (data\talkactions\scripts):
function onSay(cid) price = 500 -- crystal coins time = 5 -- seconds to logout if getPlayerFrags(cid) > 0 then if not getCreatureCondition(cid, CONDITION_INFIGHT) or not isPlayerPzLocked(cid) then if doPlayerRemoveMoney(cid, price * 10000) then doCreatureSetNoMove(cid, true) db.executeQuery("UPDATE `killers` SET `unjustified` = 0 WHERE `id` IN (SELECT `kill_id` FROM `player_killers` WHERE `player_id` = ".. getPlayerGUID(cid) ..")") doSendMagicEffect(getThingPos(cid), CONST_ME_STUN) addEvent(doRemoveCreature, time * 1000, cid, true) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You will be logged out within '..time..' seconds to complete the removal of your frags.') else doPlayerSendCancel(cid, 'You need '..price..' crystal coins to remove your frags.') end else doPlayerSendCancel(cid, 'You can\'t remove your frags when you\'re in battle or in fight.') end else doPlayerSendCancel(cid, 'You don\'t have any frag.') end return true end
Tag - talkactions.xml (data\talkactions):
<talkaction words="!removefrags" event="script" value="removefrags.lua"/>
removefrags.lua (data\actions\scripts):
function onUse(cid, item, fromPos, toPos) time = 5 -- seconds to logout if getPlayerFrags(cid) > 0 then if not getCreatureCondition(cid, CONDITION_INFIGHT) or not isPlayerPzLocked(cid) then doCreatureSetNoMove(cid, true) db.executeQuery("UPDATE `killers` SET `unjustified` = 0 WHERE `id` IN (SELECT `kill_id` FROM `player_killers` WHERE `player_id` = ".. getPlayerGUID(cid) ..")") doSendMagicEffect(toPos, CONST_ME_STUN) addEvent(doRemoveCreature, time * 1000, cid, true) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You will be logged out within '..time..' seconds to complete the removal of your frags.') doRemoveItem(item.uid) else doPlayerSendCancel(cid, 'You can\'t remove your frags when you\'re in battle or in fight.') end else doPlayerSendCancel(cid, 'You don\'t have any frag.') end return true end
Tag - actions.xml (data\actions):
<action itemid="ITEMID" script="removefrags.lua"/>
PS: Já que há uma modificação nos dados (via database) do player, ele precisa fazer logout para atualizar. Então fiz pra que ele precise estar sem battle/pz locked para usar a talkaction/item, além de que ficará imóvel até ser "removido" do jogo.
-
Wise's post in (Resolvido)Explicação Config.lua ? was marked as the answerAs variáveis representam, respectivamente:
tempo de duração do red skull, tempo de duração do black skull, e (se não me engano) o tempo limite dos frags/kills (dia/semana/mês), ambos em segundos.
-
Wise's post in (Resolvido)[Script-Ajuda] Comando pra Abrir um Tp. was marked as the answerOk, tente:
function onSay(cid) time = 5 -- time in seconds portalid = 1387 createpos = {x=123, y=456, z=7} -- local topos = {x=123, y=456, z=7} -- destiny p = getTileItemById(createpos, portalid) if p.uid > 0 then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'There is already a portal on the local.') end doSendMagicEffect(topos, CONST_ME_TELEPORT) doCreateTeleport(portalid, topos, createpos) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'The portal was created.') doBroadcastMessage('The portal to the BOSS Event was created and it will be automatically closed in '..time..' minutes.') addEvent(doRemoveItem, time * 60000, getTileItemById(createpos, portalid).uid, 1) return true end
Não precisa alterar nada aí, basta mudar o valor da variável time com o tempo em minutos como eu expliquei no comentário dos códigos.
-
Wise's post in (Resolvido)Red Aol? was marked as the answerfunction onDeath(cid) redaol = {2173, 100} stor = 98765 slot = getPlayerSlotItem(cid, CONST_SLOT_NECKLACE) if slot.itemid == redaol[1] and getCreatureSkullType(cid) == SKULL_RED then if getPlayerStorageValue(cid, stor) < 1 then setPlayerStorageValue(cid, stor, redaol[2] - 1) elseif getPlayerStorageValue(cid, stor) == 1 then setPlayerStorageValue(cid, stor, -1) doRemoveItem(slot.uid) else setPlayerStorageValue(cid, stor, getPlayerStorageValue(cid, stor) - 1) end end return true end Não se esqueça de registrar o creature event death em login.lua
Não precisa adicionar as charges, pode retirar a tag se quiser.
Apenas certifique-se de que há a seguinte tag no seu red aol em items.xml:
<attribute key="preventDrop" value="1" /> -
Wise's post in (Resolvido)[PROBLEMA] Area of Effect was marked as the answerComo o @xWhiteWolf disse, caso seu servidor tenha o creature event statschange:
function onStatsChange(cid, attacker, type, combat, value) storage = 12345 if value > 0 and type == STATSCHANGE_HEALTHLOSS or (getCreatureCondition(cid, CONDITION_MANASHIELD) and type == STATSCHANGE_MANALOSS) then if isPlayer(attacker) and getPlayerStorageValue(attacker, storage) == getPlayerStorageValue(cid, storage) then return false end end return true end
Senão:
local storage = 12345 function onCombat(cid, target) if isPlayer(target) and getPlayerStorageValue(target, storage) == getPlayerStorageValue(cid, storage) then return false end return true end function onAttack(cid, target) if isPlayer(target) and getPlayerStorageValue(target, storage) == getPlayerStorageValue(cid, storage) then return false end return true end function onTarget(cid, target) if isPlayer(target) and getPlayerStorageValue(target, storage) == getPlayerStorageValue(cid, storage) then return false end return true end PS: não se esqueça de registrar os creature events em login.lua
-
Wise's post in (Resolvido)[PEDIDO] Modificando o Exiva was marked as the answerJá na source, em game.cpp:
Procure por:
switch(direction) { case DIR_N: ss << "north"; break; case DIR_S: ss << "south"; break; case DIR_E: ss << "east"; break; case DIR_W: ss << "west"; break; case DIR_NE: ss << "north-east"; break; case DIR_NW: ss << "north-west"; break; case DIR_SE: ss << "south-east"; break; case DIR_SW: ss << "south-west"; break; default: break; }
Substitua por:
switch(direction) { case DIR_N: ss << "north [/\]"; break; case DIR_S: ss << "south [\/]"; break; case DIR_E: ss << "east [>]"; break; case DIR_W: ss << "west [<]"; break; case DIR_NE: ss << "north-east [/\][>]"; break; case DIR_NW: ss << "north-west [/\][<]"; break; case DIR_SE: ss << "south-east [\/][>]"; break; case DIR_SW: ss << "south-west [\/][<]"; break; default: break; } -
Wise's post in (Resolvido)COmo Caulcular Frags ? was marked as the answerFrags é o que se denomina como sendo o número de jogadores mortos (kills) por um creature ID player.
Na verdade, você se referiu às flags/custom flags. Que no caso, são os privilégios e limitações aplicados à determinado group ID.
Você pode calcular os valores delas, usando o Flags Calculator.
-
Wise's post in (Resolvido)sqm com trap was marked as the answerFiz para que o player fique mudo, imóvel e receba danos de fogo por tempo indeterminado (até morrer).
Tente:
deathground.lua (data/movements/scripts):
local muted = createConditionObject(CONDITION_MUTED) setConditionParam(muted, CONDITION_PARAM_TICKS, -1) local fire = createConditionObject(CONDITION_FIRE) setConditionParam(fire, CONDITION_PARAM_PERIODICDAMAGE, -1000) setConditionParam(fire, CONDITION_PARAM_TICKS, -1) setConditionParam(fire, CONDITION_PARAM_TICKINTERVAL, 2000) function onStepIn(cid) doAddCondition(cid, muted) doAddCondition(cid, fire) doCreatureSetNoMove(cid, true) return true end
Tag - movements.xml (data/movements):
<movevent type="StepIn" actionid="ACTIONID" event="script" value="deathground.lua"/> -
Wise's post in (Resolvido)Sub nivel e Privilégios was marked as the answersubnivel.lua (data/creaturescripts/scripts):
function onKill(cid, target) local b = {'Ghazbaran', 'Morgaroth', 'Orshabaal'} -- bosses local subnivel = 98765 -- storage for i = 1, #b do if getCreatureName(target):lower() == b[i]:lower() then if getPlayerStorageValue(cid, subnivel) < 0 then return setPlayerStorageValue(cid, subnivel, 1) and true end setPlayerStorageValue(cid, subnivel, getPlayerStorageValue(cid, subnivel) + 1) end end return true end
Tag - creaturescritps.xml (data/creaturescripts):
<event type="kill" name="SubNivel" event="script" value="subnivel.lua"/>
Registre o creature event em login.lua (data/creaturescripts/scripts):
registerCreatureEvent(cid, "SubNivel")
subniveldoor.lua (data/actions/scripts):
function onUse(cid, item, fromPos, toPos) local subnivel = 3 -- nivel local stor = 98765 -- subnivel storage if getPlayerStorageValue(cid, stor) >= subnivel then doTeleportThing(cid, toPos) doSendMagicEffect(fromPos, CONST_ME_MAGIC_BLUE) else doPlayerSendCancel(cid, 'Você precisa ter SubNível '..subnivel) doSendMagicEffect(fromPos, CONST_ME_POFF) end return true end
Tag - actions.xml (data/actions):
<action actionid="ACTIONID" script="subniveldoor.lua"/> -
Wise's post in (Resolvido)Annihilator Quest was marked as the answerDetesto refazer um script a partir de códigos imensos de outra pessoa.
Então eu apenas apliquei a tabulação e algumas funções (um pouco modificadas) da New Library v. 1.2 de @xWhiteWolf.
function isOnSameFloor(fromPos, toPos) return fromPos.z == toPos.z and true or false end function isEven(arg) return arg % 2 == 0 and true or false end function getMiddlePos(fromPos, toPos) if not isOnSameFloor(fromPos, toPos) then return false end local middle = {x = 0, y = 0, z = 0} middle.x = isEven(fromPos.x + toPos.x) and (fromPos.x + toPos.x)/2 or math.floor((fromPos.x + toPos.x)/2) + 1 middle.y = isEven(fromPos.y + toPos.y) and (fromPos.y + toPos.y)/2 or math.floor((fromPos.y + toPos.y)/2) + 1 middle.z = fromPos.z or toPos.z return middle end function getDistanceRadius(fromPos, toPos) if not isOnSameFloor(fromPos, toPos) then return false end local distance = getDistanceBetween(fromPos, toPos) return isEven(distance) and (distance/2) or math.floor(distance/2) + 1 end function clearArea(middlePos, rangex, rangey) local final = {x=1126, y=1152, z=7} -- Posição onde será teleportado quando acabar o tempo for i = -rangex, rangex do for j = -rangey, rangey do pos = {x = middlePos.x + i, y = middlePos.y + j, z = middlePos.z} creature = getTopCreature(pos).uid if isMonster(creature) then doSendMagicEffect(getThingPos(creature), 14) doRemoveCreature(creature) elseif isPlayer(creature) then doSendMagicEffect(getThingPos(creature), 10) doTeleportThing(creature, final) end end end setGlobalStorageValue(sto, -1) return true end local t = { lvl = 100, entrada = { {x = 1125, y = 1152, z = 7} -- pos players }, saida = { {x = 1125, y = 1153, z = 8} -- pos para onde eles irão }, monstros = { {{x = 1121, y = 1153, z = 8}, "Demon"} -- defina pos dos montros e nomes } } function onUse(cid, item, fromPosition, itemEx, toPosition) local configure = { fromPos = {x=1121, y=1150, z=8}, -- posição superior esquerda do mapa, da area em que esta mapeado a area. toPos = {x=1129, y=1156, z=8}, -- posição inferior direita do mapa, da area em que esta mapeado a area. boss = "Demon" -- Aqui você bota o nome do monstro que você quer remover } local config = { position = {x=1126, y=1152, z=7}, -- Contagem position1 = {x=1121, y=1150, z=8}, -- Contagem position2 = {x=1121, y=1156, z=8}, -- Contagem position3 = {x=1129, y=1150, z=8}, -- Contagem position4 = {x=1129, y=1156, z=8}, -- Contagem fromPosition = {x=1121, y=1150, z=8}, toPosition = {x=1129, y=1156, z=8}, id = 1498, time = 1 -- tempo que o teleport ira sumir em minutos } local time = 60 local sto = 5973 local check = {} for _, k in ipairs(t.entrada) do local x = getTopCreature(k).uid if(x == 0 or not isPlayer(x) or getPlayerLevel(x) < t.lvl) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Não tem 5 jogadores para quest.") return true end if getGlobalStorageValue(sto) == 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Annihilaton está bloqueada. Aguarde até que seja liberada.") return true end table.insert(check, x) end for _, summon in pairs(t.monstros) do local creature = getTopCreature(summon[1]).uid doCreateMonster(summon[2], summon[1]) end for i, tid in ipairs(check) do doTeleportThing(tid, t.saida[i], false) doSendMagicEffect(t.saida[i], 10) doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945) end for i = 1,time do formula = time - 1*i addEvent(doSendAnimatedText, i*1000, config.position, formula, TEXTCOLOR_RED) addEvent(doSendAnimatedText, i*1000, config.position1, formula, TEXTCOLOR_RED) addEvent(doSendAnimatedText, i*1000, config.position2, formula, TEXTCOLOR_RED) addEvent(doSendAnimatedText, i*1000, config.position3, formula, TEXTCOLOR_RED) addEvent(doSendAnimatedText, i*1000, config.position4, formula, TEXTCOLOR_RED) end setGlobalStorageValue(sto, 1) local rx = getDistanceRadius(configure.fromPos, configure.toPos) addEvent(clearArea, config.time * 60 * 1000, getMiddlePos(configure.fromPos, configure.toPos), rx, rx) return true end -
Wise's post in (Resolvido)Pedido premium account ganha epic was marked as the answerProvavelmente essas vocações "epic" devem ter a promotion level como sendo 2.
Então..
autopromotion.lua (data/creaturescripts/scripts):
function onThink(cid) if getPlayerPremiumDays(cid) > 0 then if getPlayerPromotionLevel(cid) == 2 then return true end doPlayerSetPromotionLevel(cid, 2) else if getPlayerPromotionLevel(cid) == 1 then return true end doPlayerSetPromotionLevel(cid, 1) end return true end
Tag - creaturescripts.xml (data/creaturescripts):
<event type="think" name="AutoPromotion" event="script" value="autopromotion.lua"/>
Registre o creature evente em login.lua (data/creaturescripts/scripts):
registerCreatureEvent(cid, "AutoPromotion") -
Wise's post in (Resolvido)[Pedido] Comando !off was marked as the answeroff.lua (data/talkactions/scripts):
local stor = 54321 function ariseText(cid) local time = 2 -- seconds to repeat the function local text = 'ausente' if isPlayer(cid) then doSendAnimatedText(getCreaturePosition(cid), text, math.random(0, 255)) if getPlayerStorageValue(cid, stor) > 0 then addEvent(ariseText, time * 1000, cid) end end return true end function onSay(cid) if getPlayerStorageValue(cid, stor) < 1 then setPlayerStorageValue(cid, stor, 1) doCreatureSetNoMove(cid, true) ariseText(cid) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'O modo ausente está ativado.') else doCreatureSetNoMove(cid, false) setPlayerStorageValue(cid, stor, -1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'O modo ausente está desativado.') end return true end
Tag - talkactions.xml (data/talkactions):
<talkaction words="!off" event="script" value="off.lua"/>
offlogout.lua (data/creaturescripts/scripts):
function onLogout(cid) local stor = 54321 if getPlayerStorageValue(cid, stor) > 0 then return doPlayerSendCancel(cid, 'Você não pode fazer logout com o modo ausente ativado.') and false end return true end
Tag - creaturescripts.xml (data/creaturescripts):
<event type="logout" name="OffLogout" event="script" value="offlogout.lua"/> -
Wise's post in (Resolvido)Limpando Sala was marked as the answerTente:
function onStepIn(cid) local items = {1903, 1904, 1905} for posx = 490, 496 do for posy = 498, 503 do local pos = {x=posx, y=posy, z=5} for i = 1, #items do local limpar = getTileItemById(pos, items[i]) if limpar.uid > 0 then doRemoveItem(limpar.uid) end end end end return true end -
Wise's post in (Resolvido)[ PEDIDO ] SCRIPTS P/ QUEST de DUPLO ITEM was marked as the answerDescarte os unique IDs. Vamos usar então, action IDs.
Nesse caso, determinei como sendo os action IDs dos baús:
54001 = Sorcerer / Druid / Master Sorcerer / Elder Druid.
54002 = Paladin / Royal Paladin.
54003 = Knight / Elite Knight - Sword
54004 = Knight / Elite Knight - Club
54005 = Knight / Elite Knight - Axe
Altere como preferir.
Eu não testei
chests.lua (data/actions/scripts):
local t = { -- [actionID] = {vocs = {vocationIDs}, items = {itemIDs}} [54001] = {vocs = {1, 2, 5, 6}, items = {7424}}, -- mages [54002] = {vocs = {3, 7}, items = {8858, 2352}}, -- paladins [54003] = {vocs = {4, 8}, items = {7417}}, -- knights/sword [54004] = {vocs = {4, 8}, items = {7450}}, -- knights/club [54005] = {vocs = {4, 8}, items = {8926}} -- knights/axe } function onUse(cid, item, fromPos, toPos) local storage = 54321 local u = t[item.actionid] 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 actionid="54001-54005" event="script" value="chests.lua"/> -
Wise's post in (Resolvido)Tempo em teleport was marked as the answerAí estão os valores usados nos metamétodos da função exhaustion, sendo a storage e o tempo em segundos, respectivamente.
-
Wise's post in (Resolvido)Não Mostra Guild was marked as the answerlook.lua (data/creaturescripts/scripts):
function onLook(cid, thing, position, lookDistance) if isPlayer(thing.uid) and thing.uid ~= cid then doPlayerSetSpecialDescription(thing.uid,'[Frags: '..getPlayerFrags(thing.uid)..']') return true elseif thing.uid == cid then doPlayerSetSpecialDescription(cid,'[Frags: '..getPlayerFrags(cid)..']') local string = 'You see yourself.' if getPlayerFlagValue(cid, PLAYERFLAG_SHOWGROUPINSTEADOFVOCATION) then string = string..' You are '.. getPlayerGroupName(cid) ..'.' elseif getPlayerVocation(cid) ~= 0 then string = string..' You are '.. getPlayerVocationName(cid) ..'.' else string = string..' You have no vocation.' end string = string..getPlayerSpecialDescription(cid)..'' if getPlayerNameByGUID(getPlayerPartner(cid), false, false) ~= nil then string = string..' You are '.. (getPlayerSex(cid) == 0 and 'wife' or 'husband') ..' of '.. getPlayerNameByGUID(getPlayerPartner(cid)) ..'.' end if getPlayerGuildId(cid) > 0 then string = string..' You are ' .. (getPlayerGuildRank(cid) == '' and 'a member' or getPlayerGuildRank(cid)) ..' of the '.. getPlayerGuildName(cid) string = getPlayerGuildNick(cid) ~= '' and string..' ('.. getPlayerGuildNick(cid) ..').' or string..'.' end if getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEECREATUREDETAILS) then string = string..'nHealth: ['.. getCreatureHealth(cid) ..' / '.. getCreatureMaxHealth(cid) ..'], Mana: ['.. getCreatureMana(cid) ..' / '.. getCreatureMaxMana(cid) ..'].' string = string..'nIP: '.. doConvertIntegerToIp(getPlayerIp(cid)) ..'.' end if getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEEPOSITION) then string = string..'nPosition: [X:'.. position.x..'] [Y:'.. position.y..'] [Z:'.. position.z..'].' end doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, string) return false end return true end
Tag - creaturescripts.xml (data/creaturescripts):
<event type="look" name="Look" event="script" value="look.lua"/>
Registre o creature event em login.lua (data/creaturescripts/scripts):
registerCreatureEvent(cid, "Look") -
Wise's post in (Resolvido)Item Para Mudar de Vocação was marked as the answervocitem.lua (data/actions/scripts):
function onUse(cid, item, fromPos, toPos) local voc = 5 -- new vocationID if getPlayerVocation(cid) == voc then return doPlayerSendCancel(cid, 'You are already a '..getPlayerVocationName(cid)) end doPlayerSetVocation(cid, voc) doSendMagicEffect(toPos, CONST_ME_STUN) doRemoveItem(item.uid, 1) return true end
Tag - actions.xml (data/actions):
<action itemid="ITEMID" script="vocitem.lua"/> -
Wise's post in (Resolvido)[SIMPLES] ADICIONAR BLOCK LEVEL was marked as the answerA quebra de linha é representada por \n e não SHIFT+ENTER. Portanto, seria:
local level = 100 local pos = {x=33212, y=31671, z=13} local txt = {"Parabens! Voce tem a oportunidade de concluir a Annihilator Quest.\nLevel Recomendado: 100\nRecompensa: Sword of Valor, Stonecutter Axe, Demon Armor ou Bonebreaker Adkko", "Você não pode ser teleportado por não ter level suficiente..blablabla"} function onUse(cid, fromPos, toPos) if getPlayerLevel(cid) >= level then doTeleportThing(cid, pos) doSendMagicEffect(toPos, CONST_ME_TELEPORT) doShowTextDialog(cid, 2175, txt[1]) else doShowTextDialog(cid, 2175, txt[2]) end return true end -
Wise's post in (Resolvido)party hat was marked as the answerCerto, tente (adicione apenas a tag do movement onEquip):
local effect = {15, 3} -- {magicEffectNumber, delay in minutes} local item = {5432, 1} -- {itemID, slotNumber} function itemEffect(cid) if isPlayer(cid) then doSendMagicEffect(getCreaturePosition(cid), effect[1]) if getPlayerSlotItem(cid, item[2]).itemid == item[1] then addEvent(itemEffect, effect[2] * 1000, cid) end end return true end function onEquip(cid, item, slot) itemEffect(cid) return true end -
Wise's post in (Resolvido)[AJUDA] Boss was marked as the answerboss.lua (data/creaturescripts/scripts):
local t = {boss = 'Boss', storage = 54321} function onDeath(cid, killer) if isMonster(cid) and getCreatureName(cid) == t.boss then for i = 1, #killer do setPlayerStorageValue(killer[i], t.storage, 1) end doCreatureSay(cid, 'You defeated me..now you can open the door.', TALKTYPE_ORANGE_1) elseif isPlayer(cid) and getPlayerStorageValue(cid, t.storage) > 0 then setPlayerStorageValue(cid, t.storage, -1) end return true end function onLogout(cid) if getPlayerStorageValue(cid, t.storage) > 0 then setPlayerStorageValue(cid, t.storage, -1) end return true end
Tags - creaturescripts.xml (data/creaturescripts):
<event type="death" name="BPDeath" event="script" value="boss.lua"/> <event type="logout" name="BPLogout" event="script" value="boss.lua"/>
Registre o creature event, tanto no XML do monstro:
<script> <event name="BPDeath"/> </script>
Quanto em login.lua (data/creaturescripts/scripts):
registerCreatureEvent(cid, "BPDeath")
bossdoor.lua (data/actions/scripts):
function onUse(cid, fromPos, toPos) local storage = 54321 if getPlayerStorageValue(cid, storage) > 0 then doTeleportThing(cid, toPos) doSendMagicEffect(fromPos, CONST_ME_MAGIC_BLUE) else doSendMagicEffect(fromPos, CONST_ME_POFF) doPlayerSendCancel(cid, 'You need to kill the boss to open the door.') end return true end
Tag - actions.xml (data/actions):
<action actionid="ACTIONID" script="bossdoor.lua"/> Nesse caso, sempre que morrer/fizer logout, o player vai ter o valor da storage setado como diferente do necessário para abrir a porta.
-
Wise's post in (Resolvido)[AJUDA] GlobalEvent was marked as the answerPor ser um global event, o teleport é automaticamente criado na posição 1032, 913, 7 e leva à posição 1009, 904, 12.
Nesse caso, ele é iniciado de acordo com o tempo/horário estipulado na tag do mesmo.