Ir para conteúdo

Imperius

Membro
  • Registro em

  • Última visita

Solutions

  1. Imperius's post in Error script boss was marked as the answer   
    data > creaturescripts > creaturescripts.xml
     
    <event type="kill" name="killTheBoss" event="script" value="killTheBoss.lua"/> <event type="login" name="killTheBossLogin" event="script" value="killTheBoss.lua"/>  
    data > creaturescripts > scripts > killTheBoss.lua
     
    local config = { monsters = {"Boss Hits"}, rewards = { {itemID = 8300, chanceToGainInPercent = 10, quantity = 1}, {itemID = 8301, chanceToGainInPercent = 20, quantity = 1}, {itemID = 8302, chanceToGainInPercent = 30, quantity = 1}, {itemID = 8303, chanceToGainInPercent = 40, quantity = 1}, }, effect = 27, } -- Função para selecionar um item com base na porcentagem function selectRandomItem() local totalChance = 0 for _, reward in pairs(config.rewards) do totalChance = totalChance + reward.chanceToGainInPercent end local randomValue = math.random(1, totalChance) local cumulativeChance = 0 for _, reward in pairs(config.rewards) do cumulativeChance = cumulativeChance + reward.chanceToGainInPercent if randomValue <= cumulativeChance then return reward end end end function onKill(cid, target, lastHit) if isPlayer(cid) and isMonster(target) then if getCreatureMaster(target) ~= nil then return true end local monsterNameKilled = getCreatureName(target) if isInArray(config.monsters, monsterNameKilled) then local selectedItem = selectRandomItem() doPlayerAddItem(cid, selectedItem.itemID, selectedItem.quantity) doSendMagicEffect(getCreaturePosition(cid), config.effect) end end return true end function onLogin(cid) registerCreatureEvent(cid, "killTheBoss") return true end  
  2. Imperius's post in [SQLite] -=[TFS]=- 0.4 8.60 ERRO NO SCRIPT --[MultipleExp System]-- [CREATURESCRIPT] was marked as the answer   
    qual versão / servidor vc tá usando? Testei aqui sem erro na distro.
     
    única coisa que falta é colocar "return true" no final da function para os players conseguir logar no servidor
  3. Imperius's post in (Resolvido)Script boss + teleport (Adaptação) was marked as the answer   
    seria tipo isso? Não entendi mt bem como será feito p/ nascer boss, então fiz uma talkaction, aí é só vc adapta da maneira que quiser.
     
    data > lib > spawnBoss.lua
     
    BOSS_SPAWN_CONFIG = { bosses = { ["Boss Thdagger"] = { -- Nome do Boss. position = { spawnBoss = {x = 263, y = 349, z = 7 }, -- Onde o boss nascerá. openTP = {x = 0, y = 0, z = 0}, -- Onde o TP aparecerá. locationTP = {x = 0, y = 0, z = 0} -- Onde o TP levará o jogador. }, timeInSeconds = { closeTP = 60 -- segundos p/ fechar o TP após o boss ter nascido. } } -- Adicione outros bosses aqui se quiser ... } } -- Mostrará a contagem regressiva em cima do TP -- function spawnBossCountdownOnTeleport(bossCreature, teleport, timeToCloseTP) local bossName = getCreatureName(bossCreature); if not bossName then doRemoveItem(getTileItemById(teleport, 1387).uid) doSendMagicEffect(teleport, CONST_ME_POFF) return true end local timeToCloseTP = tonumber(timeToCloseTP) - 1; if timeToCloseTP == 0 then doRemoveItem(getTileItemById(teleport, 1387).uid) doSendMagicEffect(teleport, CONST_ME_POFF) return true end doSendAnimatedText(teleport, timeToCloseTP, 725) addEvent(spawnBossCountdownOnTeleport, 1000, bossCreature, teleport, timeToCloseTP); return true end  
     
    data > talkactions > scripts > spawnBoss.lua
     
    function onSay(cid, words, param, channel) local bossName = param; if not BOSS_SPAWN_CONFIG.bosses[bossName] then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Boss nao encontrado! Escreva o nome corretamente, incluindo letras maiuscula/minuscula.") return true end local bossCreature = doCreateMonster(bossName, BOSS_SPAWN_CONFIG.bosses[bossName].position.spawnBoss) doCreateTeleport(1387, BOSS_SPAWN_CONFIG.bosses[bossName].position.locationTP, BOSS_SPAWN_CONFIG.bosses[bossName].position.openTP) spawnBossCountdownOnTeleport(bossCreature, BOSS_SPAWN_CONFIG.bosses[bossName].position.openTP, BOSS_SPAWN_CONFIG.bosses[bossName].timeInSeconds.closeTP); doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "BOSS: "..bossName.." foi criado!") return true end  
    data > talkactions > talkactions.xml
     
    <!-- Spawn Boss --> <talkaction access="5" words="/boss" script="spawnBoss.lua"/>  
    /boss nome do boss
  4. data > talkactions > scripts > online.lua
     
    function onSay(cid, words, param, channel) local quantityOnline = 0 for _, pid in ipairs(getPlayersOnline()) do if getPlayerAccess(pid) < 4 then quantityOnline = quantityOnline + 1 local playerReset = getPlayerStorageValue(pid, 54676) playerReset = (playerReset > 0) and playerReset or 0 doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, ""..getCreatureName(pid).." ["..getPlayerLevel(pid).."] - "..getPlayerVocationName(pid).." | Resets: "..playerReset.."") end end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, quantityOnline.." Player(s) online") return true end  
  5. aqui funcionou de boa
     
    Só que tem um porém: o NPC só vai liberar a opção de "buy" se você tiver a mesma quantidade de gold na backpack em relação ao preço do item em moeda vip.
  6. Imperius's post in Monstro X nascer depois que 10 monstros Y forem mortos. was marked as the answer   
    data > creaturescripts > creaturescripts.xml:
     
    <event type="kill" name="killMonster" script="killMonster.lua"/>  
    creaturescripts  > scripts > killMonster.lua:
     
    Contabilizar a morte do monstro para todos os jogadores.
    Ex: se um jogador matar 7 wolfs e algum outro jogador matar 3
    O boss vai aparecer.
     
     
    Contabilizar de forma individual
    ex: o jogador precisará matar os 10 para nascer o boss.
     
     
     
     
    creaturescripts > scripts > login.lua > adicione isso antes do último return true:
     
    registerCreatureEvent(cid, "killMonster")  
     
  7. Imperius's post in (Resolvido)Skin was marked as the answer   
    Dessa forma?
     
    local storage = {1234567, 1234568} -- Armazena o outfit que o player estava usando / Armazena o Cooldown. local cooldown = 1 -- tempo em minutos. local remover = true -- Remover o item ao usar? false = não remove, true = remove. local outfitID = 1397 -- id da outfit que o player se transformará. function onUse(cid, item) if getPlayerVocation(cid) < 26 or getPlayerVocation(cid) > 37 then doPlayerSendTextMessage(cid, 22, "Sua vocacao nao pode usar este item!") return true end if getPlayerStorageValue(cid, storage[2]) - os.time() >= 1 then doPlayerSendCancel(cid, "Voce precisa aguardar " ..(getPlayerStorageValue(cid, storage[2]) - os.time()).. " segundos para usar este item novamente.") return true end if getCreatureOutfit(cid).lookType ~= outfitID then setPlayerStorageValue(cid, storage[1], getCreatureOutfit(cid).lookType) doCreatureChangeOutfit(cid, {lookType = outfitID}) doPlayerSendTextMessage(cid, 24, "Skin Akatsuki Ativada!") else doCreatureChangeOutfit(cid, {lookType = getPlayerStorageValue(cid, storage[1])}) doPlayerSendTextMessage(cid, 24, "Skin Akatsuki Desativada!") end setPlayerStorageValue(cid, storage[2], os.time() + (cooldown*60)) -- Seta o Cooldown. if remover then doRemoveItem(item.uid, 1) end return true end  
  8. Imperius's post in (Resolvido)Item que troca de vocação. was marked as the answer   
    data > actions > actions.xml:
     
    <!-- Trocar de vocação --> <action itemid="14175" script="changeVocation.lua" />  
    data > actions  > scripts > changeVocation.lua:
     
    function onUse(cid, item) local itemID = 14175 -- ID DO ITEM local vocationsID = {1, 2, 3} -- Coloque as ID's das vocações que poderão utilizar o item para trocar de vocação. local changeVocationTo = 20 -- Coloque a ID da vocação que o player irá virar após usar o item. if item.itemid == itemID and isInArray(vocationsID, getPlayerVocation(cid)) then doRemoveItem(item.uid, 1) doPlayerSetVocation(cid, changeVocationTo) doSendMagicEffect(getThingPos(cid), math.random(140,147)) doPlayerSendTextMessage(cid, 22, "You are now a "..getPlayerVocationName(cid).."!") else doPlayerSendTextMessage(cid, 22, "You can't be promoted since you're already a "..getPlayerVocationName(cid).."!") end return true end  
     
    aviso: Pode ser que o seu servidor não suporte efeitos a partir do 69. Isso fará que você leve um debug ao utilizar o item (foi o que aconteceu comigo quando testei). Se for o caso, é só trocar o math.random(140,147) para algum efeito que o seu servidor suporte.
     
  9. Imperius's post in Npc que anuncia Quem Morreu! was marked as the answer   
    Ideia interessante! Fiz uma adaptação no script do Death System 2016 do chaitosoft, para funcionar conforme o seu pedido.
     

     
    aviso: eu testei somente na versão TFS 0.4 caso a sua versão for superior, não tenho certeza se irá ou não funcionar.
     
    Segue abaixo o passo a passo de como configurar em seu servidor:
     
    Em data > npc, crie um arquivo NomeDoNPC.xml e adicione o código abaixo:
     
     
    <?xml version="1.0" encoding="UTF-8"?> <npc name="NomeDoNPC" script="data/npc/scripts/NomeDoNPC.lua" walkinterval="2000" floorchange="0"> <health now="100" max="100"/> <look type="268" head="76" body="38" legs="76" feet="95" addons="2"/> </npc>  
    em seguida, na pasta data > npc > scripts, crie um arquivo NomeDoNPC.lua e adicione o código a seguir:
     
    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 npcHandler:addModule(FocusModule:new())  
     
    Logo após, vá em data > creaturescripts, abra o arquivo creaturescripts.xml e cole a tag:
     
    <!-- NPC Anuncia Morte --> <event type="death" name="npcDeath" event="script" value="npcDeath.lua"/>  
     
    agora em data > creaturescripts > scripts, crie um arquivo chamado npcDeath.lua e cole o código de acordo com a sua preferência:
     
     
     
     
    Por fim, vá até em data > creaturescripts > scripts, abra o arquivo login.lua e adicione esta linha antes do último return true
     
    registerCreatureEvent(cid, "npcDeath")  
    e pronto!
     

Informação Importante

Confirmação de Termo