Tudo que Elwyn postou
-
[Pedido] Shared Party EXP
TFS 1.x? OTX2, TFS 0.4 ou TFS 0.3.6?
- [DUVIDA] como adicionar comando de GOD 10.41
-
(Resolvido)Tile que enxe stamina
Sim, quando ele pisar no tile, um minuto depois ele vai ganhar um de stamina e assim por diante. Isso enquanto estiver no tile, se ele sair, cancela. Por exemplo, ele pisou, começou a contagem, faltando 1s pra receber a stamina ele sai. Vai cancelar e ele não vai receber stamina.
-
DOUBLE XP AUTOMATICO
TFS 1.x: events.xml <event class="Player" method="onGainExperience" enabled="1" /> player.lua function Player:onGainExperience(source, exp, rawExp) local days = { ["Sunday"] = 2, -- Double exp ["Monday"] = 3 -- Triple exp } local bonus = days[os.time("%A")] return exp * (bonus and bonus or 1) end
-
(Resolvido)Tile que enxe stamina
eventsId = {} local function rechargeStamina(cid) if not isPlayer(cid) then eventsId[cid] = nil return end doPlayerSetStamina(cid, getPlayerStamina(cid) + 1) eventsId[cid] = addEvent(rechargeStamina, 60 * 1000, cid) end function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor) if isPlayer(cid) then eventsId[cid] = addEvent(rechargeStamina, 60 * 1000, cid) end return true end function onStepOut(cid, item, position, lastPosition, fromPosition, toPosition, actor) if isPlayer(cid) then stopEvent(eventsId[cid]) eventsId[cid] = nil end return true end Agora ele só adicionará a cada minuto.
-
(Resolvido)Tile que enxe stamina
Essas mensagens são do print que deixei sem querer. Não apareceram outras mensagens? Se você fizer essa talkaction: function onSay(cid, words, param) local value = param and tonumber(param) or 1 doPlayerSetStamina(cid, value) return true end Com a seguinte tag: <talkaction access="0-4" words="!teste" event="script" value="stamina.lua" /> E mandar no tibia a seguinte mensagem: Sua stamina muda para 00:20? A propósito, o script que estou usando no OTX é exatamente este: E funciona perfeitamente. Note que é apenas o script anterior sem o print e com um delay maior no regen de stamina.
-
(Resolvido)Tile que enxe stamina
TFS 1.1: TFS 0.3.6 ~ 0.4: OTX 2: Salve como stamina_tile.lua em movements/script movements.xml: <movevent event="StepIn" itemid="407" script="stamina_tile.lua" /> <movevent event="StepOut" itemid="407" script="stamina_tile.lua" /> Mude itemid="407" para o itemid desejado, caso queira actionid é só mudar de itemid="id do item" para actionid="id da action".
-
[Dúvida] stopEvent
Nossa, desculpa. Tinha esquecido dessa dúvida. Me mande PM pra eu te adicionar skype e te ajudar melhor. Teste o script agora e me mande todos os prints que deu no console: local function Teleport(cid) doSendAnimatedText(getPlayerPosition(cid), "Aaaaah...", TEXTCOLOR_BLUE) local templo = {x = 442, y = 549, z = 7} for j = 0, 60 do starting = {x = 839 + j, y = 952, z = 7, stackpos = 253} for i = 0, 60 do checking = {x = starting.x, y = starting.y + i, z = starting.z, stackpos = starting.stackpos} creature = getThingfromPos(checking) if isPlayer(creature.uid) then doTeleportThing(creature.uid, templo) end end end for j = 0, 61 do starting = {x = 1128 + j, y = 1120, z = 6, stackpos = 253} for i = 0, 6 do checking = {x = starting.x, y = starting.y + i, z = starting.z, stackpos = starting.stackpos} creature = getThingfromPos(checking) if isPlayer(creature.uid) then doTeleportThing(creature.uid, templo) end end end for j = 0, 14 do starting = {x = 1151 + j, y = 1115, z = 6, stackpos = 253} for i = 0, 5 do checking = {x = starting.x, y = starting.y + i, z = starting.z, stackpos = starting.stackpos} creature = getThingfromPos(checking) if isPlayer(creature.uid) then doTeleportThing(creature.uid, templo) end end end for j = 0, 14 do starting = {x = 1151 + j, y = 1127, z = 6, stackpos = 253} for i = 0, 5 do checking = {x = starting.x, y = starting.y + i, z = starting.z, stackpos = starting.stackpos} creature = getThingfromPos(checking) if isPlayer(creature.uid) then doTeleportThing(creature.uid, templo) end end end for j = 0, 49 do starting = {x = 1134 + j, y = 1120, z = 5, stackpos = 253} for i = 0, 6 do checking = {x = starting.x, y = starting.y + i, z = starting.z, stackpos = starting.stackpos} creature = getThingfromPos(checking) if isPlayer(creature.uid) then doTeleportThing(creature.uid, templo) end end end for j = 0, 14 do starting = {x = 1151 + j, y = 1115, z = 5, stackpos = 253} for i = 0, 5 do checking = {x = starting.x, y = starting.y + i, z = starting.z, stackpos = starting.stackpos} creature = getThingfromPos(checking) if isPlayer(creature.uid) then doTeleportThing(creature.uid, templo) end end end for j = 0, 14 do starting = {x = 1151 + j, y = 1127, z = 5, stackpos = 253} for i = 0, 5 do checking = {x = starting.x, y = starting.y + i, z = starting.z, stackpos = starting.stackpos} creature = getThingfromPos(checking) if isPlayer(creature.uid) then doTeleportThing(creature.uid, templo) end end end return true end function onKill(cid, target, lastHit) local monstros = { "Gran Tower", "gran tower" } local nome = getCreatureTarget(cid) and getCreatureName(getCreatureTarget(cid)) or "" print("Creatuer name: " .. nome) if isInArray(monstros, nome) and isMonster(target) then if getPlayerStorageValue(cid, 13340) ~= 1 then print("Player storage ~= 1") setGlobalStorageValue(13340, getPlayerGuildId(cid)) granEffect(cid) if getPlayerStorageValue(cid, 13340) == 0 then print("Player storage == 0") stopEvent(events[cid]) print("Error? " .. events[cid]) doSendMagicEffect(getCreaturePosition(cid), 47) broadcastMessage("O player ".. getPlayerName(cid) .." conquistou o Gran Castle, e todos membros da guild ".. getPlayerGuildName(cid) .." acabam de receber a Gran Aura.") end addEvent(Teleport, 1000, cid) end end return true end
- getHighscoreString(skillId) OQUE RETORNA
- getHighscoreString(skillId) OQUE RETORNA
- getHighscoreString(skillId) OQUE RETORNA
- getHighscoreString(skillId) OQUE RETORNA
- getHighscoreString(skillId) OQUE RETORNA
-
Dúvida - Como atualizar TFS 10.41 para 10.71
Na source tem classes e métodos responsáveis pela conexão do servidor. É quem lida com a "conversa" com o cliente e traduz para ações que o servidor deve tomar. A partir da versão 10.54 a "língua" que o cliente "conversa" com o servidor mudou. Essa é a parte mais difícil de atualizar para 10.54+
- getHighscoreString(skillId) OQUE RETORNA
-
Error, ao usar.
Dê print(right_item == nil) print(left_item == nil) Logo depois da definição dessas variáveis e tente reproduzir o erro e poste o erro aqui de novo. (Incluindo o true ou false que vai aparecer em cima do erro)
- getHighscoreString(skillId) OQUE RETORNA
-
(Resolvido)Duvida Shared Exp
Veja em party.cpp na função onShareExperience
-
(Resolvido)Duvida Shared Exp
Configuração tipo?
- getHighscoreString(skillId) OQUE RETORNA
-
Error, ao usar.
getPlayerSlotItem(cid, CONST_SLOT_LEFT).itemid == 2160 and getPlayerSlotItem(cid, CONST_SLOT_LEFT).count >= 10 or getPlayerSlotItem(cid, CONST_SLOT_RIGHT).itemid == 2160 and getPlayerSlotItem(cid, CONST_SLOT_RIGHT).count >= 10 not getPlayerSlotItem(cid, CONST_SLOT_LEFT).itemid == 2160 and getPlayerSlotItem(cid, CONST_SLOT_LEFT).count >= 10 or getPlayerSlotItem(cid, CONST_SLOT_RIGHT).itemid == 2160 and getPlayerSlotItem(cid, CONST_SLOT_RIGHT).count >= 10 Quando o player não tem nada na mão esquerda ou direita dará esse erro. O que você pode fazer é garantir que existe algo na mão esquerda ou direita antes de comparar. local left_item = getPlayerSlotItem(cid, CONST_SLOT_LEFT) local right_item = getPlayerSlotItem(cid, CONST_SLOT_RIGHT) if (left_item and left_item.itemid == 2160 and left_item.count >= 10) or (right_item and right_item.itemid == 2160 and right_item.count >= 10) then doCreatureSay(cid, 'Its time to play', TALKTYPE_ORANGE_1) doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF) else doCreatureSay(cid, 'You dont have '..crystalparaapostar..' crystal coins or more in your hand', TALKTYPE_ORANGE_1) end
-
getHighscoreString(skillId) OQUE RETORNA
luascripts.cpp int32_t LuaInterface::luaGetHighscoreString(lua_State* L) { //getHighscoreString(skillId) uint16_t skillId = popNumber(L); if(skillId <= SKILL__LAST) lua_pushstring(L, g_game.getHighscoreString(skillId).c_str()); else lua_pushboolean(L, false); return 1; } game.cpp std::string Game::getHighscoreString(uint16_t skill) { Highscore hs = highscoreStorage[skill]; std::stringstream ss; ss << "Highscore for " << getSkillName(skill) << "\n\nRank Level - Player Name"; for(uint32_t i = 0; i < hs.size(); ++i) ss << "\n" << (i + 1) << ". " << hs[i].second << " - " << hs[i].first; ss << "\n\nLast updated on:\n" << std::ctime(&lastHighscoreCheck); return ss.str(); } Uma string com o seguinte formato: "Highscore for nome da skill Rank Level - Player Name 1. 100 - Player 1 2. 99 - Player 2 3. 98 - Player 3 Last update on: tempo" String acima é um exemplo.
-
(Resolvido)math.random
if getPlayerStorageValue(cid, 3509) > 0 then math.randomseed(os.time()) local rand = math.random(1,45) if rand == 1 then doPlayerAddItem(cid, 2488, 1) -- Crown Legs doSendMagicEffect(getPlayerPosition(cid), 12) end end
-
(Resolvido)math.random
Antes de usar o math.random() usa o math.randomseed(os.time()). Sobre o porquê de ser assim: Computadores não geram nada realmente aleatório. O que o math.random faz é pegar um numero para usar como base para gerar outros números. Se o número que ele pega, o chamado seed, for sempre igual, então ele vai gerar números sempre iguais.
-
[Dúvida] stopEvent
Você mudou algo a mais. Mande o script de como está agora. Ou é possível que tenha dado erro no console. Veja se tem algum erro no console.