Ir para conteúdo

Kydrai

Visconde
  • Total de itens

    250
  • Registro em

  • Última visita

  • Dias Ganhos

    14

Tudo que Kydrai postou

  1. No lugar de: function onCastSpell(cid, var) if doPlayerRemoveItem(cid, 2352, 1) then return doCombat(cid, combat, var) else doPlayerSendCancel(cid, "You need a crystal arrow to cast this spell") end return 0 end Coloca: function onCastSpell(cid, var) if getPlayerSlotItem(cid, CONST_SLOT_AMMO).itemid == 2352 and doPlayerRemoveItem(cid, 2352, 1) then return doCombat(cid, combat, var) end doPlayerSendCancel(cid, "You need a crystal arrow to cast this spell") return FALSE end
  2. Ainda ta tudo errado. Aconselho vc a procurar tutoriais sobre o if primeiro. Ou então escrever a lógica do funcionamento do script.
  3. A idéia é boa. Mas como isso funcionou? O script ta todo bagunçado, coisas desnecessárias e com erros. Não seria unique id? porta = 9090 -- Unic ID da porta dentro = {x=512, y=509, z=7} fora = {x=515, y=509, z=7} player1 = getThingfromPos(player1pos) Use variáveis locais. player1pos não exite. player1 desnecessário. doPlayerAddItem(cid, item2[, canDropOnMap]) O certo seria: doPlayerAddItem(cid, item2) if item.uid == porta then doPlayerSendTextMessage(cid, 21, "Você terá que arrombar a porta!") end elseif getPlayerLevel(cid) >= 90 and item.id == item1 then else doPlayerSendTextMessage(cid, 21, "Você conseguil arrombar a porta!") doSendMagicEffect(topos, 2) doTeleportThing(player1.uid,dentro) elseif player1 == dentro doTeleportThing(player1.uid,fora) end O if se usa assim: if ... then ... elseif ... then ... elseif ... then ... else ... end Tem mais alguns erros por ai ainda.
  4. <talkaction words="!buyvida" event="script" value="vida.lua"/> function onSay(cid, words, param) local money = 10 local health = 100 if doPlayerRemoveMoney(cid, money) then setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + health) else doPlayerSendCancel(cid, "Você precisa de "..money.." gp's") end return TRUE end <talkaction words="!buymana" event="script" value="mana.lua"/> function onSay(cid, words, param) local money = 10 local mana = 100 if doPlayerRemoveMoney(cid, money) then setCreatureMaxMana(cid, getCreatureMaxMana(cid) + mana) else doPlayerSendCancel(cid, "Você precisa de "..money.." gp's") end return TRUE end
  5. <talkaction words="!buyvida" event="script" value="vida.lua"/> function onSay(cid, words, param) local money = 10 local health = 100 if doPlayerRemoveMoney(cid, money) then doCreatureAddHealth(cid, health) else doPlayerSendCancel(cid, "Você precisa de "..money.." gp's") end return TRUE end <talkaction words="!buymana" event="script" value="mana.lua"/> function onSay(cid, words, param) local money = 10 local mana = 100 if doPlayerRemoveMoney(cid, money) then doCreatureAddMana(cid, mana) else doPlayerSendCancel(cid, "Você precisa de "..money.." gp's") end return TRUE end Da pra faze os 2 em 1 só tbm se preferir. Testei no TFS 0.3.6
  6. Peguei esse como exemplo: <item id="2323" article="a" name="hat of the mad"> <attribute key="description" value="You have a vague feeling that it looks somewhat silly." /> <attribute key="weight" value="700" /> <attribute key="armor" value="3" /> <attribute key="magiclevelpoints" value="1" /> <attribute key="slotType" value="head" /> </item> <movevent type="Equip" itemid="2323" slot="head" event="function" value="onEquipItem"> <vocation id="1"/> <vocation id="5" showInDescription="0"/> <vocation id="2"/> <vocation id="6" showInDescription="0"/> </movevent> <movevent type="DeEquip" itemid="2323" slot="head" event="function" value="onDeEquipItem"/> Pelo que vc disse parece que n colocou a tag: <movevent type="DeEquip" itemid="2323" slot="head" event="function" value="onDeEquipItem"/>
  7. Kydrai

    Os.time

    Pode ser assim então: <globalevent name="timer_example" time="13:00" event="script" value="my_script.lua"/> Não sei se da pra fazer time="13:00-15:00", tenta e ve se da. Se não poderia sortear o tempo entre 1h e 3h e executar a função com addEvent. Acho que seria algo assim: onTimer() local seg = math.random(7200) -- sorteia um numero entre 1s e 7200s(2h) addEvent(function, 1000*seg) return TRUE end
  8. Kydrai

    Os.time

    Tentei aqui, não deu não. Mas oq vc quer fazer exatamente?
  9. No 0.3.5+ é onDeath(cid, corpse, deathList). Acho que teria q ser assim: config = { reward = 200 --define o quanto o jogador ganhará } onDeath(cid, corpse, deathList) if isPlayer(deathList[1]) then doPlayerAddMoney(deathList[1], config.reward) doPlayerSendTextMessage(deathList[1], MESSAGE_STATUS_CONSOLE_ORANGE, "Voc\ê matou " .. getCreatureName(cid) .. " e recebeu " .. config.reward .. " GPs.") end return TRUE end
  10. Faz o teste: function onUse(cid, item, frompos, item2, topos) pos = {x=160, y=54, z=7} if item.itemid == 2363 then local time = 60 -- 60 seg local storage = 600000 local left = getPlayerStorageValue(cid, storage) - os.time(t) if left <= 0 then setPlayerStorageValue(cid, storage, os.time(t) + time) doPlayerSendCancel(cid,"Bem Vindo ao Templo!") doTeleportThing(cid,pos) doSendMagicEffect(nplayer1pos,10) doSendMagicEffect(topos,6) doSendMagicEffect(frompos,6) end doPlayerSendCancel(cid,"Você só pode usar este item depois de "..left.." segundos!") end return 1 end
  11. Kydrai

    Os.time

    Dependendo de como for usar pode ser: local hora = 3600 -- 1h em seg local time = os.time(t) + hora -- tempo atual + a hora Ai dps pra verificar: if time - os.time(t) <= 0 then passou 1 hora end Ou se quiser pegar a data e hora pode usar o os.date() Acho que seria assim: os.date('*t').hour ou em string: os.date("%H")
  12. Da um exemplo de como vc ta fazendo. Provavelmente vc ta mudando o outfit sem verificar a posição pra ql ele vai.
  13. Na pasta actions/scripts/liquids tem o arquivo de potions.lua. La tem: healthMultiplier = 1.0, manaMultiplier = 1.0 Esses são os números para multiplicar o tanto q vai recuperar. La também tem: local POTIONS = { [8704] = {empty = 7636, splash = 2, health = {50, 100}}, -- small health potion [7618] = {empty = 7636, splash = 2, health = {100, 200}}, -- health potion [7588] = {empty = 7634, splash = 2, health = {200, 400}, level = 50, vocations = {3, 4, 7, 8}, vocStr = "knights and paladins"}, -- strong health potion [7591] = {empty = 7635, splash = 2, health = {500, 700}, level = 80, vocations = {4, 8}, vocStr = "knights"}, -- great health potion [8473] = {empty = 7635, splash = 2, health = {800, 1000}, level = 130, vocations = {4, 8}, vocStr = "knights"}, -- ultimate health potion [7620] = {empty = 7636, splash = 7, mana = {70, 130}}, -- mana potion [7589] = {empty = 7634, splash = 7, mana = {110, 190}, level = 50, vocations = {1, 2, 3, 5, 6, 7}, vocStr = "sorcerers, druids and paladins"}, -- strong mana potion [7590] = {empty = 7635, splash = 7, mana = {200, 300}, level = 80, vocations = {1, 2, 5, 6}, vocStr = "sorcerers and druids"}, -- great mana potion [8472] = {empty = 7635, splash = 3, health = {200, 400}, mana = {110, 190}, level = 80, vocations = {3, 7}, vocStr = "paladins"} -- great spirit potion } Os numeros estão assim: health = {50, 100} mana = {70, 130} Esse é o minimo e maximo q a potion pode recuperar.
  14. Faz assim: local monsters = { "Water Elemental", "Rat" } Torca: create = monsters[chance][1] Por: create = monsters[chance] Troca: local numero = 2 Por: local numero = #monsters #monsters retorna quantos elementos há na tabela. chance >= 1: não tem como ser menor que um, então poderia tirar.
  15. O jeito que fiz ele faz uma sorteio de um numero entre 20 e 60, se o numero for menor ou igual ao level do player ele ganha o storage. Se vc quiser posso mudar, é só especificar como seria a porcentagem. creaturescripts\scripts\nome.lua function onAdvance(cid, skill, oldLevel, newLevel) local lvlmin, lvlmax = 20, 60 -- level minimo e maximo local storage = 500000 local vocs = {3} -- vocações -> {3,4,5} if getPlayerStorageValue(cid, storage) <= 0 and isInArray(vocs, getPlayerVocation(cid)) and skill == SKILL__LEVEL and newLevel >= lvlmin and newLevel <= lvlmax then local chance = math.random(lvlmin, lvlmax) if chance <= newLevel then doPlayerSetStorageValue(cid, storage, 1) end end return TRUE end creaturescripts\creaturescripts.xml <event type="advance" name="adv" event="script" value="nome.lua"/> creaturescripts\scripts\login.lua registerCreatureEvent(cid, "adv")
  16. Olha esse que fiz: creaturescripts/creaturescripts.xml <event type="death" name="summon" event="script" value="summon.lua"/> creaturescripts/scripts/summon.lua monsters = { --["monste name"] = {["summon name"] = {pos = {x, y, z}, delay = milisegundos}, ["troll"] = { ["bug"] = {pos = {x=93, y=126, z=7}, delay = 0}, ["rat"] = {pos = {x=95, y=126, z=7}, delay = 2000} }, ["orc"] = { ["bug"] = {pos = {x=93, y=126, z=7}, delay = 0}, ["cave rat"] = {pos = {x=95, y=126, z=7}, delay = 2000} } } function onDeath(cid, corpse, killer) local summons = monsters[string.lower(getCreatureName(cid))] if summons then for i, v in pairs(summons) do addEvent(doSummonCreature, v.delay, i, v.pos) end end return TRUE end Depois você vai nos monsters que vão sumonar e coloca: <script> <event name="summon"/> </script> Quanto ao teleport, o certo não deveria ser um movement? Ai quando pisasse no teleport tiraria a orb.
  17. No TFS tem um NPC ruby.xml, la tem uns exemplos que vc pode tentar. Ai você pode tentar algo assim (não testei): <?xml version="1.0"?> <npc name="NPC" floorchange="0" walkinterval="4000"> <health now="150" max="150"/> <look type="133" head="20" body="120" legs="75" feet="13"/> <interaction range="3" idletime="30"> <interact keywords="hi" storageId="5500" storageValue="0" storageComp="less" focus="0"> <keywords>hello</keywords> </interact> <interact keywords="hi" storageId="5500" storageValue="1" storageComp="equal" focus="1"> <keywords>hello</keywords> <response text="hello |NAME|."/> </interact> </interaction> </npc> Ai seria só mudar o storageId e testar.
  18. Baixa o notepad++ que é um ótimo editor. Isso acontece pq o bloco de notas não reconhece todos os carateres, ai não pula linha, aparece quadrados, etc.
  19. Posso até fazer, só uma dúvida. O que seria "libere a action 13540"? Não faz nenhum sentido isso. Se possível coloca o script desta action.
  20. Eu testei aqui no 0.3.5 e funfo. local config = { loginMessage = getConfigValue('loginMessage'), useFragHandler = getBooleanFromString(getConfigValue('useFragHandler')) } function onLogin(cid) if not(isPremium(cid)) and getPlayerPromotionLevel(cid) == 2 then doPlayerSetPromotionLevel(cid, 1) end local loss = getConfigValue('deathLostPercent') if(loss ~= nil) then doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10) end local accountManager = getPlayerAccountManager(cid) if(accountManager == MANAGER_NONE) then local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage if(lastLogin > 0) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str) str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "." else str = str .. " Please choose your outfit." doPlayerSendOutfitWindow(cid) end doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str) elseif(accountManager == MANAGER_NAMELOCK) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, it appears that your character has been namelocked, what would you like as your new name?") elseif(accountManager == MANAGER_ACCOUNT) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to create an account or type 'recover' to recover an account.") end if(not isPlayerGhost(cid)) then doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT) end registerCreatureEvent(cid, "Mail") registerCreatureEvent(cid, "GuildMotd") registerCreatureEvent(cid, "Idle") if(config.useFragHandler) then registerCreatureEvent(cid, "SkullCheck") end registerCreatureEvent(cid, "ReportBug") registerCreatureEvent(cid, "AdvanceSave") registerCreatureEvent(cid, "ArenaKill") registerCreatureEvent(cid, "KillingInTheNameOf") return true end
  21. Não faço idéia de como é seu sistema vip, se passasse daria pra fazer completo. Então é só alterar a parte onde muda o storage value. npcvip.xml <?xml version="1.0"?> <npc name="Nome do NPC" script="npcvip.lua" walkinterval="2000" floorchange="0"> <health now="100" max="100"/> <look type="128" head="17" body="54" legs="114" feet="0" addons="2"/> <parameters> <parameter key="message_greet" value="Ola |PLAYERNAME|. Vendo {vip}." /> </parameters> </npc> npcvip.lua 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 talkState = {} local price = 10 local coinId = 2159 local storageVip = 100000 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, 'vip') then selfSay('A VIP custa '..price..' vip coins. Deseja comprar?', cid) talkState[talkUser] = 1 elseif msgcontains(msg, 'yes') and talkState[talkUser] == 1 then if getPlayerItemCount(cid, coinId) >= price then doPlayerRemoveItem(cid, coinId, price) doPlayerSetStorageValue(cid, storageVip, getPlayerStorageValue(cid, storageVip)+10) selfSay('Sua VIP foi adicionada!', cid) else selfSay('Você não possui '..price..' vip coins.', cid) end talkState[talkUser] = 0 elseif msgcontains(msg, 'no') and talkState[talkUser] == 1 then selfSay('Ok.', cid) talkState[talkUser] = 0 end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
  22. Kydrai

    /up E /down

    function onSay(cid, words, param, channel) local lookType = 128 if getCreatureOutfit(cid).lookType == lookType then . . . end return true end getCreatureOutfit(cid).xxx:
  23. Se ja tiver o login.lua pode colocar la dentro, só vai precisar tirar a primeira e ultima linha. function onLogin(cid) if not(isPremium(cid)) and getPlayerPromotionLevel(cid) == 2 then doPlayerSetPromotionLevel(cid, 1) end end
  24. /promote player /demote player Acho que são esses, ele muda o groupId do player aumentando ou diminuindo 1.
  25. Kydrai

    2 Pedidos

    talkactions.xml <talkaction words="!alladdons" event="script" value="addons.lua"/> addons.lua local premiumDays = 5 function onSay(cid, words, param) if getPlayerPremiumDays(cid) >= premiumDays then doPlayerRemovePremiumDays(cid, premiumDays) doPlayerAddAddons(cid, 3) doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE) else doPlayerSendCancel(cid, "Você precisa de "..premiumDays.." Premium Days para executar este comando.") doSendMagicEffect(getThingPos(cid), CONST_ME_POFF) end return TRUE end talkactions.xml <talkaction words="!sdrune" event="script" value="sd.lua"/> sd.lua local premiumDays = 5 function onSay(cid, words, param) if getPlayerPremiumDays(cid) >= premiumDays then doPlayerRemovePremiumDays(cid, premiumDays) doPlayerBuyItem(cid, 2268, 1, 0, 255) doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE) else doPlayerSendCancel(cid, "Você precisa de "..premiumDays.." Premium Days para executar este comando.") doSendMagicEffect(getThingPos(cid), CONST_ME_POFF) end return TRUE end
  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...