Ir para conteúdo

Líderes

Conteúdo Popular

Exibindo conteúdo com a maior reputação em 12/09/15 em todas áreas

  1. Tente esse: function loseOnZombieArena(cid) kickPlayerFromZombiesArea(cid) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce perdeu.") local players = getZombiesEventPlayers() if(#players <= 1) then local winner = players[1] if(winner) then doPlayerAddItem(winner, 2157, 5, true) doPlayerAddItem(winner, 6119, 1, true) doPlayerSendTextMessage(winner, MESSAGE_STATUS_CONSOLE_BLUE, "Voce ganhou o Zombie Event.") doBroadcastMessage("Depois de " .. os.time() - getPlayerZombiesEventStatus(winner) .. " segundos, o jogador " .. getCreatureName(winner) .. " ganhou o Zombie Arena Event com " .. getStorage(ZE_ZOMBIES_SPAWNED) .. " zumbis!") kickPlayerFromZombiesArea(winner) else doBroadcastMessage("O evento acabou, infelizmente ninguém ganhou!") end doSetStorage(ZE_STATUS, 0) doSetStorage(ZE_PLAYERS_NUMBER, ZE_DEFAULT_NUMBER_OF_PLAYERS) doSetStorage(ZE_ZOMBIES_TO_SPAWN, 0) doSetStorage(ZE_ZOMBIES_SPAWNED, 0) local width = (math.max(ZE_spawnFromPosition.x, ZE_spawnToPosition.x) - math.min(ZE_spawnFromPosition.x, ZE_spawnToPosition.x)) / 2 + 1 local height = (math.max(ZE_spawnFromPosition.y, ZE_spawnToPosition.y) - math.min(ZE_spawnFromPosition.y, ZE_spawnToPosition.y)) / 2 + 1 local centerPos = {x=math.min(ZE_spawnFromPosition.x, ZE_spawnToPosition.x)+width,y=math.min(ZE_spawnFromPosition.y, ZE_spawnToPosition.y)+height,z=ZE_spawnFromPosition.z} for z = math.min(ZE_spawnFromPosition.z, ZE_spawnToPosition.z), math.max(ZE_spawnFromPosition.z, ZE_spawnToPosition.z) do centerPos.z = z for i, uid in pairs(getSpectators(centerPos, width, height, false)) do if(isMonster(uid)) then doRemoveCreature(uid) end end end end end function onStatsChange(target, cid, changetype, combat, value) if((cid and isMonster(cid) and getCreatureName(cid) == "Zombie Event") or (isInRange(getThingPosition(target), ZE_spawnFromPosition, ZE_spawnToPosition) and changetype == STATSCHANGE_HEALTHLOSS and math.abs(value) >= getCreatureHealth(target))) then doCreatureAddHealth(target, getCreatureMaxHealth(target)) loseOnZombieArena(target) return false end return true end
    3 pontos
  2. Uma pena não funcionar para descer escadas... mas nada que um teleportThing não resolva...
    2 pontos
  3. vai em creaturescripts\scripts\zombie\onattack e substitua tudo por isso: function loseOnZombieArena(cid) kickPlayerFromZombiesArea(cid) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce perdeu.") local players = getZombiesEventPlayers() if(#players <= 1) then local winner = players[1] if(winner) then doPlayerAddItem(winner, 2157, 5, true) doPlayerAddItem(winner, 6119, 1, true) doPlayerSendTextMessage(winner, MESSAGE_STATUS_CONSOLE_BLUE, "Voce ganhou o Zombie Event.") doBroadcastMessage("Depois de " .. os.time() - getPlayerZombiesEventStatus(winner) .. " segundos, o jogador " .. getCreatureName(winner) .. " ganhou o Zombie Arena Event com " .. getStorage(ZE_ZOMBIES_SPAWNED) .. " zumbis!") kickPlayerFromZombiesArea(winner) else doBroadcastMessage("O evento acabou, infelizmente ninguém ganhou!") end doSetStorage(ZE_STATUS, 0) doSetStorage(ZE_PLAYERS_NUMBER, ZE_DEFAULT_NUMBER_OF_PLAYERS) doSetStorage(ZE_ZOMBIES_TO_SPAWN, 0) doSetStorage(ZE_ZOMBIES_SPAWNED, 0) local width = (math.max(ZE_spawnFromPosition.x, ZE_spawnToPosition.x) - math.min(ZE_spawnFromPosition.x, ZE_spawnToPosition.x)) / 2 + 1 local height = (math.max(ZE_spawnFromPosition.y, ZE_spawnToPosition.y) - math.min(ZE_spawnFromPosition.y, ZE_spawnToPosition.y)) / 2 + 1 local centerPos = {x=math.min(ZE_spawnFromPosition.x, ZE_spawnToPosition.x)+width,y=math.min(ZE_spawnFromPosition.y, ZE_spawnToPosition.y)+height,z=ZE_spawnFromPosition.z} for z = math.min(ZE_spawnFromPosition.z, ZE_spawnToPosition.z), math.max(ZE_spawnFromPosition.z, ZE_spawnToPosition.z) do centerPos.z = z for i, uid in pairs(getSpectators(centerPos, width, height, false)) do if(isMonster(uid)) then doRemoveCreature(uid) end end end end end function onStatsChange(target, cid, changetype, combat, value) if((cid and isMonster(cid) and getCreatureName(cid) == "Zombie Event") or (isInRange(getThingPosition(target), ZE_spawnFromPosition, ZE_spawnToPosition) and changetype == STATSCHANGE_HEALTHLOSS and math.abs(value) >= getCreatureHealth(target))) then doCreatureAddHealth(target, getCreatureMaxHealth(target)) loseOnZombieArena(target) return false end return true end Depois vai em lib\032-position.lua e substitue por: function isInRange(position, fromPosition, toPosition) return (position.x >= fromPosition.x and position.y >= fromPosition.y and position.z >= fromPosition.z and position.x <= toPosition.x and position.y <= toPosition.y and position.z <= toPosition.z) end function getDistanceBetween(fromPosition, toPosition) local x, y = math.abs(fromPosition.x - toPosition.x), math.abs(fromPosition.y - toPosition.y) local diff = math.max(x, y) if(fromPosition.z ~= toPosition.z) then diff = diff + 9 + 6 end return diff end function getDirectionTo(pos1, pos2) local dir = NORTH if(pos1.x > pos2.x) then dir = WEST if(pos1.y > pos2.y) then dir = NORTHWEST elseif(pos1.y < pos2.y) then dir = SOUTHWEST end elseif(pos1.x < pos2.x) then dir = EAST if(pos1.y > pos2.y) then dir = NORTHEAST elseif(pos1.y < pos2.y) then dir = SOUTHEAST end else if(pos1.y > pos2.y) then dir = NORTH elseif(pos1.y < pos2.y) then dir = SOUTH end end return dir end function getCreatureLookPosition(cid) return getPosByDir(getThingPos(cid), getCreatureLookDirection(cid)) end function getPositionByDirection(position, direction, size) local n = size or 1 if(direction == NORTH) then position.y = position.y - n elseif(direction == SOUTH) then position.y = position.y + n elseif(direction == WEST) then position.x = position.x - n elseif(direction == EAST) then position.x = position.x + n elseif(direction == NORTHWEST) then position.y = position.y - n position.x = position.x - n elseif(direction == NORTHEAST) then position.y = position.y - n position.x = position.x + n elseif(direction == SOUTHWEST) then position.y = position.y + n position.x = position.x - n elseif(direction == SOUTHEAST) then position.y = position.y + n position.x = position.x + n end return position end function doComparePositions(position, positionEx) return position.x == positionEx.x and position.y == positionEx.y and position.z == positionEx.z end function getArea(position, x, y) local t = {} for i = (position.x - x), (position.x + x) do for j = (position.y - y), (position.y + y) do table.insert(t, {x = i, y = j, z = position.z}) end end return t end
    2 pontos
  4. Yan Liima

    Newstory Dbo+Nto+Bleach misturado!

    Fala galera do xtibia beleza? Hoje estou trazendo aqui um servidor que eu e o Matheus Pacheco fez é um dbo misturado com nto e bleach bom não é um servidor perfeito pois se fosse não estaria compartilhando com vocês, mais o servidor é bacana pra caramba pra quem curte misturas de servidores. Bom galera não entrarei muito em detalhes pois estou meio compresa, mais dentro da pasta do servidor tera um arquivo LEIAME!!!.txt vocês pode ler as informações la... Imagens: Templo TELEPORTES: SITE: Proibido postar esse servidor em outros fórum/sites sem minha permissão. DOWNLOAD DO SERVIDOR: DOWNLOAD SCAN --------------------------------------------------------- DOWNLOAD DO SITE: DOWNLOAD SCAN --------------------------------------------------------- DOWNLOAD DO CLIENT DOWNLOAD SCAN Créditos: Yan Liima Matheus Pacheco
    1 ponto
  5. caotic

    doCreateMonsterNick(monster, nick, pos)

    Tudo bem galera xtibiana? Resolvi trazer a vocês um sistema de nick que permite mudar o nome do monstro in-game. A função e simples de se usar e não tem nenhum tipo de limitação ela foi desenvolvida na versão 8.6 com a tfs 0.3.6. Lets go: Vá em monster.h e procure isto: typedef std::list<Creature*> CreatureList; class Monster : public Creature { private: Monster(MonsterType* _mType); public: #ifdef __ENABLE_SERVER_DIAGNOSTIC__ static uint32_t monsterCount; #endif virtual ~Monster(); E coloque este codigo em baixo: std::string nick,realname; Continue em monster.h e procure: static Monster* createMonster(const std::string& name); E coloque embaixo: static Monster* createMonsterNick(const std::string& name, std::string nick); Procure também: virtual const std::string& getName() const {return mType->name;} E substitua por isto: virtual const std::string& getName() const {return nick;} Depois vá em monster.cpp e procure: Monster* Monster::createMonster(const std::string& name) { MonsterType* mType = g_monsters.getMonsterType(name); if(!mType) return NULL; return createMonster(mType); } Substitua por: Monster* Monster::createMonster(const std::string& name) { MonsterType* mType = g_monsters.getMonsterType(name); if(!mType) return NULL; mType->name = name; return createMonster(mType); } Monster* Monster::createMonsterNick(const std::string& name, std::string nick) { MonsterType* mType = g_monsters.getMonsterType(name); if(!mType) return NULL; if (!(nick == "")) { mType->name = nick; } return createMonster(mType); } Continuando em monster.cpp procure: currentOutfit = mType->outfit; Adicionar embaixo: nick = mType->name; Vá em luascript.h e procure isto static int32_t luaDoCreateNpc(lua_State* L); Embaixo coloque: static int32_t luaDoCreateMonsterNick(lua_State* L); static int32_t luaGetCreatureNickRealName(lua_State* L); Em luascript.cpp procure: //doPlayerSetIdleTime(cid, amount) lua_register(m_luaState, "doPlayerSetIdleTime", LuaScriptInterface::luaDoPlayerSetIdleTime); Coloque embaixo: //doCreateMonster(monster, nick, pos) lua_register(m_luaState, "doCreateMonsterNick", LuaScriptInterface::luaDoCreateMonsterNick); Continue em luascript.cpp e procure isto: int32_t LuaScriptInterface::luaGetCreatureName(lua_State* L) { //getCreatureName(cid) ScriptEnviroment* env = getEnv(); if(Creature* creature = env->getCreatureByUID(popNumber(L))) lua_pushstring(L, creature->getName().c_str()); else { errorEx(getError(LUA_ERROR_CREATURE_NOT_FOUND)); lua_pushboolean(L, false); } return 1; } Coloque isto: int32_t LuaScriptInterface::luaGetCreatureNickRealName(lua_State* L) { //getCreatureNickRealName(cid) ScriptEnviroment* env = getEnv(); if(Monster* monster = env->getCreatureByUID(popNumber(L))->getMonster()) lua_pushstring(L, monster->realname.c_str()); else { errorEx(getError(LUA_ERROR_CREATURE_NOT_FOUND)); lua_pushboolean(L, false); } return 1; } int32_t LuaScriptInterface::luaDoCreateMonsterNick(lua_State* L) { //doCreateMonsterNick(monster, nick, pos) ScriptEnviroment* env = getEnv(); PositionEx pos; popPosition(L, pos); std::string nick = popString(L); const std::string name = popString(L).c_str(); Monster* monster = Monster::createMonsterNick(name, nick); if(!monster) { errorEx(getError(LUA_ERROR_CREATURE_NOT_FOUND)); lua_pushboolean(L, false); return 1; } if(!g_game.placeCreature(monster, pos)) { delete monster; errorEx("Cannot create monster: " + name); lua_pushboolean(L, false); return 1; } monster->realname = name; lua_pushnumber(L, env->addThing((Thing*)monster)); return 1; } -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Exemplo de uso: function onSay(cid, words, param, channel) local t = string.explode(param, ",") doCreateMonsterNick(t[1], t[2], getThingPos(cid)) return true end
    1 ponto
  6. caotic

    TV System by caotic

    Eae galeerrra xtibiana. Venho disponibilizar o famoso sistema de televisão poketibiano completo o sistema foi feito para ambos os clients tibianos. O sistema permite você assistir outro players jogando assim você fica sem usar itens,falar(so pm), se movimentar e etc... Vamos la: Vá em luascript.cpp e procure: int32_t LuaScriptInterface::luaGetTopCreature(lua_State* L) { //getTopCreature(pos) PositionEx pos; popPosition(L, pos); ScriptEnviroment* env = getEnv(); Tile* tile = g_game.getTile(pos); if(!tile) { pushThing(L, NULL, 0); return 1; } Thing* thing = tile->getTopCreature(); if(!thing || !thing->getCreature()) { pushThing(L, NULL, 0); return 1; } pushThing(L, thing, env->addThing(thing)); return 1; } E coloque embaixo: int32_t LuaScriptInterface::luaGetAllsTvs(lua_State* L) { //getAllsTvs(cid) ScriptEnviroment* env = getEnv(); Player* player = env->getPlayerByUID(popNumber(L)); if (!player) { errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND)); lua_pushboolean(L, false); return 1; } Tvlist::iterator it; it = player->tv.begin(); lua_newtable(L); uint32_t tableplayers = 1; for(uint32_t i = 1; it != player->tv.end(); ++it, ++i) { Player* players = env->getPlayerByUID(*it); if (players) { lua_pushnumber(L, tableplayers); lua_pushnumber(L, env->addThing(players)); pushTable(L); tableplayers = tableplayers+1; } } return 1; } int32_t LuaScriptInterface::luaSetPlayerTv(lua_State* L) { ScriptEnviroment* env = getEnv(); Player* player_tv = env->getPlayerByUID(popNumber(L)); Creature* creature = env->getCreatureByUID(popNumber(L)); if (!creature) { errorEx(getError(LUA_ERROR_CREATURE_NOT_FOUND)); lua_pushboolean(L, false); } Player* player = creature->getPlayer(); if (!player) { errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND)); lua_pushboolean(L, false); return 1; } if (!player_tv) { errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND)); lua_pushboolean(L, false); return 1; } player_tv->tv.push_back(player->getID()); SpectatorVec::iterator it; SpectatorVec list = g_game.getSpectators(player->getPosition()); Player* tmpPlayer = NULL; Condition* condition = NULL; if((condition = Condition::createCondition(CONDITIONID_DEFAULT, CONDITION_GAMEMASTER, -1, 0, false, GAMEMASTER_INVISIBLE))) { creature->setHideName(false); player->addCondition(condition); g_game.internalCreatureChangeVisible(creature, VISIBLE_GHOST_DISAPPEAR); for(it = list.begin(); it != list.end(); ++it) { if((tmpPlayer = (*it)->getPlayer()) && !tmpPlayer->canSeeCreature(player)) tmpPlayer->sendMagicEffect(player->getPosition(), MAGIC_EFFECT_POFF); } for(AutoList<Player>::iterator pit = Player::autoList.begin(); pit != Player::autoList.end(); ++pit) { if(!pit->second->canSeeCreature(player)) pit->second->notifyLogOut(player); } IOLoginData::getInstance()->updateOnlineStatus(player->getGUID(), false); if(player->isTrading()) g_game.internalCloseTrade(player); player->clearPartyInvitations(); if(player->getParty()) player->getParty()->leave(player); g_game.internalTeleport(player, player_tv->getPosition(), true); } lua_pushboolean(L, true); } int32_t LuaScriptInterface::luaDoSendChannelsTv(lua_State* L) { ScriptEnviroment* env = getEnv(); Player* player = env->getPlayerByUID(popNumber(L)); if (!player) { errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND)); lua_pushboolean(L, false); return 1; } player->sendChannelsDialog(true); lua_pushboolean(L, true); return 1; } int32_t LuaScriptInterface::luaDoRemovePlayerTv(lua_State* L) { ScriptEnviroment* env = getEnv(); Player* player = env->getPlayerByUID(popNumber(L)); Player* creature = env->getPlayerByUID(popNumber(L)); if (!player) { errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND)); lua_pushboolean(L, false); return 1; } for(std::list<uint32_t>::iterator it = player->tv.begin(); it != player->tv.end(); ++it) { if ((*it) == creature->getID()) { Tvlist tv = player->tv; if (!creature) { errorEx(getError(LUA_ERROR_CREATURE_NOT_FOUND)); lua_pushboolean(L, false); return 1; } Player* player_tv = creature->getPlayer(); if (!player) { return 1; } SpectatorVec::iterator its; SpectatorVec list = g_game.getSpectators(player_tv->getPosition()); Player* tmpPlayer = NULL; Condition* condition = NULL; creature->setHideName(false); if((condition = player_tv->getCondition(CONDITION_GAMEMASTER, CONDITIONID_DEFAULT, GAMEMASTER_INVISIBLE))) { IOLoginData::getInstance()->updateOnlineStatus(player_tv->getGUID(), true); for(AutoList<Player>::iterator pit = Player::autoList.begin(); pit != Player::autoList.end(); ++pit) { if(!pit->second->canSeeCreature(player_tv)) pit->second->notifyLogIn(player_tv); } for(its = list.begin(); its != list.end(); ++its) { if((tmpPlayer = (*its)->getPlayer()) && !tmpPlayer->canSeeCreature(player_tv)) tmpPlayer->sendMagicEffect(player_tv->getPosition(), MAGIC_EFFECT_TELEPORT); } player_tv->removeCondition(condition); g_game.internalCreatureChangeVisible(creature, VISIBLE_GHOST_APPEAR); *it = NULL; } } } lua_pushboolean(L, true); } Continuando em luascript.cpp procure: //doCreatureSay(uid, text[, type = SPEAK_SAY[, ghost = false[, cid = 0[, pos]]]]) lua_register(m_luaState, "doCreatureSay", LuaScriptInterface::luaDoCreatureSay); Coloque embaixo: //doRemovePlayerTv(cid, id) lua_register(m_luaState, "removePlayerTv", LuaScriptInterface::luaDoRemovePlayerTv); //getAllsTv() lua_register(m_luaState, "getTvs", LuaScriptInterface::luaGetAllsTvs); //setPlayerTv(cid, player) lua_register(m_luaState, "setPlayerTv", LuaScriptInterface::luaSetPlayerTv); //doSendChannelstTv(cid) lua_register(m_luaState, "doSendChannelsTv", LuaScriptInterface::luaDoSendChannelsTv); Em luascript.h procure: static int32_t luaGetPlayerParty(lua_State* L); Coloque embaixo: static int32_t luaGetAllsTvs(lua_State* L); static int32_t luaSetPlayerTv(lua_State* L); static int32_t luaDoSendChannelsTv(lua_State* L); static int32_t luaDoRemovePlayerTv(lua_State* L); Vamos agora em game.cpp: Procure: bool Game::playerSay(uint32_t playerId, uint16_t channelId, SpeakClasses type, const std::string& receiver, const std::string& text) E substitua função por esta nova função: bool Game::playerSay(uint32_t playerId, uint16_t channelId, SpeakClasses type, const std::string& receiver, const std::string& text) { Player* player = getPlayerByID(playerId); if(!player || player->isRemoved()) return false; std::string str; if (player->getStorage(34421, str) && str == "true") { if (type == SPEAK_SAY) { player->getStorage(292924, str); player->sendTextMessage(MSG_STATUS_SMALL, str.c_str()); return false; } switch(type) { case SPEAK_WHISPER: return playerWhisper(player, text); case SPEAK_YELL: return playerYell(player, text); case SPEAK_PRIVATE: case SPEAK_PRIVATE_RED: case SPEAK_RVR_ANSWER: return playerSpeakTo(player, type, receiver, text); case SPEAK_CHANNEL_O: case SPEAK_CHANNEL_Y: case SPEAK_CHANNEL_RN: case SPEAK_CHANNEL_RA: case SPEAK_CHANNEL_W: { if(playerTalkToChannel(player, type, text, channelId)) return true; return playerSay(playerId, 0, SPEAK_SAY, receiver, text); } case SPEAK_BROADCAST: return playerBroadcastMessage(player, SPEAK_BROADCAST, text); case SPEAK_RVR_CHANNEL: return playerReportRuleViolation(player, text); case SPEAK_RVR_CONTINUE: return playerContinueReport(player, text); default: break; } internalCreatureSay(player, SPEAK_SAY, text, false); return false; } uint32_t muteTime = 0; bool muted = player->isMuted(channelId, type, muteTime); if(muted) { char buffer[75]; sprintf(buffer, "You are still muted for %d seconds.", muteTime); player->sendTextMessage(MSG_STATUS_SMALL, buffer); return false; } if(player->isAccountManager()) { player->removeMessageBuffer(); return internalCreatureSay(player, SPEAK_SAY, text, false); } if(g_talkActions->onPlayerSay(player, type == SPEAK_SAY ? CHANNEL_DEFAULT : channelId, text, false)) return true; if(!muted) { ReturnValue ret = RET_NOERROR; if(!muteTime) { ret = g_spells->onPlayerSay(player, text); if(ret == RET_NOERROR || (ret == RET_NEEDEXCHANGE && !g_config.getBool(ConfigManager::BUFFER_SPELL_FAILURE))) return true; } player->removeMessageBuffer(); if(ret == RET_NEEDEXCHANGE) return true; } switch(type) { case SPEAK_SAY: return internalCreatureSay(player, SPEAK_SAY, text, false); case SPEAK_WHISPER: return playerWhisper(player, text); case SPEAK_YELL: return playerYell(player, text); case SPEAK_PRIVATE: case SPEAK_PRIVATE_RED: case SPEAK_RVR_ANSWER: return playerSpeakTo(player, type, receiver, text); case SPEAK_CHANNEL_O: case SPEAK_CHANNEL_Y: case SPEAK_CHANNEL_RN: case SPEAK_CHANNEL_RA: case SPEAK_CHANNEL_W: { if(playerTalkToChannel(player, type, text, channelId)) return true; return playerSay(playerId, 0, SPEAK_SAY, receiver, text); } case SPEAK_PRIVATE_PN: return playerSpeakToNpc(player, text); case SPEAK_BROADCAST: return playerBroadcastMessage(player, SPEAK_BROADCAST, text); case SPEAK_RVR_CHANNEL: return playerReportRuleViolation(player, text); case SPEAK_RVR_CONTINUE: return playerContinueReport(player, text); default: break; } return false; } Continuando em game.cpp procure a função: ReturnValue Game::internalMoveCreature(Creature* creature, Direction direction, uint32_t flags/* = 0*/) E substitua por esta função: ReturnValue Game::internalMoveCreature(Creature* creature, Direction direction, uint32_t flags/* = 0*/) { const Position& currentPos = creature->getPosition(); Cylinder* fromTile = creature->getTile(); Cylinder* toTile = NULL; Position destPos = getNextPosition(direction, currentPos); if(direction < SOUTHWEST && creature->getPlayer()) { Tile* tmpTile = NULL; if(currentPos.z != 8 && creature->getTile()->hasHeight(3)) //try go up { if((!(tmpTile = map->getTile(Position(currentPos.x, currentPos.y, currentPos.z - 1))) || (!tmpTile->ground && !tmpTile->hasProperty(BLOCKSOLID))) && (tmpTile = map->getTile(Position(destPos.x, destPos.y, destPos.z - 1))) && tmpTile->ground && !tmpTile->hasProperty(BLOCKSOLID)) { flags = flags | FLAG_IGNOREBLOCKITEM | FLAG_IGNOREBLOCKCREATURE; destPos.z--; } } else if(currentPos.z != 7 && (!(tmpTile = map->getTile(destPos)) || (!tmpTile->ground && !tmpTile->hasProperty(BLOCKSOLID))) && (tmpTile = map->getTile(Position( destPos.x, destPos.y, destPos.z + 1))) && tmpTile->hasHeight(3)) //try go down { flags = flags | FLAG_IGNOREBLOCKITEM | FLAG_IGNOREBLOCKCREATURE; destPos.z++; } } ReturnValue ret = RET_NOTPOSSIBLE; if((toTile = map->getTile(destPos))) ret = internalMoveCreature(NULL, creature, fromTile, toTile, flags); if(ret != RET_NOERROR) { if(Player* player = creature->getPlayer()) { player->sendCancelMessage(ret); player->sendCancelWalk(); } } Player* player = creature->getPlayer(); if (player) { Tvlist::iterator it; it = player->tv.begin(); for(uint32_t i = 1; it != player->tv.end(); ++it, ++i) { Player* players = getPlayerByID(*it); if (players) { internalTeleport(players, player->getPosition(), true, 0); } } } return ret; } Procure a função: bool Game::playerRequestChannels(uint32_t playerId) Substitua a função por: bool Game::playerRequestChannels(uint32_t playerId) { Player* player = getPlayerByID(playerId); if(!player || player->isRemoved()) return false; player->sendChannelsDialog(false); return true; } Agora vamos a protocolgame.cpp e procure a função; void ProtocolGame::sendChannelsDialog(bool tv) E substitua por esta função: void ProtocolGame::sendChannelsDialog(bool tv) { NetworkMessage_ptr msg = getOutputBuffer(); std::string str; if(msg) { if (tv) { uint16_t bytes = 0; for(AutoList<Player>::iterator it = Player::autoList.begin(); it != Player::autoList.end(); ++it) { it->second->getStorage(22120, str); if (str == "true") { bytes = bytes+1; } } if (bytes < 1) { player->sendCancel("Não há nenhuma tv online"); return; } TRACK_MESSAGE(msg); msg->AddByte(0xAB); msg->AddByte(bytes); uint16_t id = 200; for(AutoList<Player>::iterator it = Player::autoList.begin(); it != Player::autoList.end(); ++it) { it->second->getStorage(22120, str); if (str == "true") { id = id+1; it->second->getStorage(12121, str); msg->AddU16(id); msg->AddString(str); } } return; } TRACK_MESSAGE(msg); msg->AddByte(0xAB); ChannelList list = g_chat.getChannelList(player); msg->AddByte(list.size()); for(ChannelList::iterator it = list.begin(); it != list.end(); ++it) { if(ChatChannel* channel = (*it)) { msg->AddU16(channel->getId()); msg->AddString(channel->getName()); } } } } Procure em protocolgame.h a seguinta declaração: void sendChannelsDialog(); Substitua por: void sendChannelsDialog(bool tv); Agora vamos em player.h e procure: void sendChannelsDialog() {if(client) client->sendChannelsDialog();} E substitua por: void sendChannelsDialog(bool tv) {if(client) client->sendChannelsDialog(tv);} Procure denovo em player.h: typedef std::list<Party*> PartyList; E adicione embaixo: typedef std::list<uint32_t> Tvlist; Continuando em player.h procure: AttackedSet attackedSet; Coloque embaixo: Tvlist tv; Vamos denovo a protocolgame.cpp e procure: if(player->isAccountManager()) { switch(recvbyte) { case 0x14: parseLogout(msg); break; case 0x96: parseSay(msg); break; default: sendCancelWalk(); break; } } Coloque embaixo: std::string str; if (player->getStorage(34421, str) && str == "true") { player->getStorage(292924, str); switch(recvbyte) { case 0x14: parseLogout(msg); break; case 0x96: parseSay(msg); break; case 0x97: // request channels parseGetChannels(msg); break; case 0x98: // open channel parseOpenChannel(msg); break; case 0x99: // close channel parseCloseChannel(msg); break; case 0x9A: // open priv parseOpenPriv(msg); break; case 0x1E: // keep alive / ping response parseReceivePing(msg); break; default: player->sendTextMessage(MSG_INFO_DESCR, str); break; } Seguidamente vá em creatureevent.cpp e procure: else if(tmpStr == "preparedeath") m_type = CREATURE_EVENT_PREPAREDEATH; Coloque embaixo: else if(tmpStr == "selecttv") m_type = CREATURE_EVENT_SELECTTV; Procure depois: case CREATURE_EVENT_PREPAREDEATH: return "onPrepareDeath"; Coloque embaixo: case CREATURE_EVENT_SELECTTV: return "onSelectTv"; Procure: case CREATURE_EVENT_PREPAREDEATH: return "cid, deathList"; Coloque embaixo: case CREATURE_EVENT_SELECTTV: return "cid, id"; Procure: uint32_t CreatureEvent::executeChannelJoin(Player* player, uint16_t channelId, UsersMap usersMap) { //onJoinChannel(cid, channel, users) if(m_interface->reserveEnv()) { ScriptEnviroment* env = m_interface->getEnv(); if(m_scripted == EVENT_SCRIPT_BUFFER) { std::stringstream scriptstream; scriptstream << "local cid = " << env->addThing(player) << std::endl; scriptstream << "local channel = " << channelId << std::endl; scriptstream << "local users = {}" << std::endl; for(UsersMap::iterator it = usersMap.begin(); it != usersMap.end(); ++it) scriptstream << "users:insert(" << env->addThing(it->second) << ")" << std::endl; scriptstream << m_scriptData; bool result = true; if(m_interface->loadBuffer(scriptstream.str())) { lua_State* L = m_interface->getState(); result = m_interface->getGlobalBool(L, "_result", true); } m_interface->releaseEnv(); return result; } else { #ifdef __DEBUG_LUASCRIPTS__ char desc[35]; sprintf(desc, "%s", player->getName().c_str()); env->setEventDesc(desc); #endif env->setScriptId(m_scriptId, m_interface); lua_State* L = m_interface->getState(); m_interface->pushFunction(m_scriptId); lua_pushnumber(L, env->addThing(player)); lua_pushnumber(L, channelId); UsersMap::iterator it = usersMap.begin(); lua_newtable(L); for(int32_t i = 1; it != usersMap.end(); ++it, ++i) { lua_pushnumber(L, i); lua_pushnumber(L, env->addThing(it->second)); lua_settable(L, -3); } bool result = m_interface->callFunction(3); m_interface->releaseEnv(); return result; } } else { std::cout << "[Error - CreatureEvent::executeChannelJoin] Call stack overflow." << std::endl; return 0; } } Coloque embaixo: uint32_t CreatureEvent::executeSelectTv(Player* player, uint16_t id) { //onSelectTv(cid, id) if(m_interface->reserveEnv()) { ScriptEnviroment* env = m_interface->getEnv(); if(m_scripted == EVENT_SCRIPT_BUFFER) { std::stringstream scriptstream; scriptstream << "local cid = " << env->addThing(player) << std::endl; scriptstream << "local id = " << id << std::endl; scriptstream << m_scriptData; bool result = true; if(m_interface->loadBuffer(scriptstream.str())) { lua_State* L = m_interface->getState(); result = m_interface->getGlobalBool(L, "_result", true); } m_interface->releaseEnv(); return result; } else { #ifdef __DEBUG_LUASCRIPTS__ char desc[35]; sprintf(desc, "%s", player->getName().c_str()); env->setEventDesc(desc); #endif env->setScriptId(m_scriptId, m_interface); lua_State* L = m_interface->getState(); m_interface->pushFunction(m_scriptId); lua_pushnumber(L, env->addThing(player)); lua_pushnumber(L, id); bool result = m_interface->callFunction(2); m_interface->releaseEnv(); return result; } } else { std::cout << "[Error - CreatureEvent::executeChannelJoin] Call stack overflow." << std::endl; return 0; } } Vá em creatureevent.h e procure: CREATURE_EVENT_ATTACK, Coloque embaixo: CREATURE_EVENT_SELECTTV Procure continuando em creatureevent.h: uint32_t executeCombat(Creature* creature, Creature* target); Coloque embaixo: uint32_t executeSelectTv(Player* player, uint16_t id); Vá agora em game.cpp denovo e procure a função: bool Game::playerOpenChannel(uint32_t playerId, uint16_t channelId) Substitua a função por: bool Game::playerOpenChannel(uint32_t playerId, uint16_t channelId) { Player* player = getPlayerByID(playerId); if(!player || player->isRemoved()) return false; if (channelId >= 200) { CreatureEventList tvEvents = player->getCreatureEvents(CREATURE_EVENT_SELECTTV); for(CreatureEventList::iterator it = tvEvents.begin(); it != tvEvents.end(); ++it) (*it)->executeSelectTv(player, channelId); return true; } ChatChannel* channel = g_chat.addUserToChannel(player, channelId); if(!channel) { #ifdef __DEBUG_CHAT__ std::cout << "Game::playerOpenChannel - failed adding user to channel." << std::endl; #endif return false; } if(channel->getId() != CHANNEL_RVR) player->sendChannel(channel->getId(), channel->getName()); else player->sendRuleViolationsChannel(channel->getId()); return true; } Vá em data/lib e crie um novo arquivo lua chamado tv system: names = {} storage_hastv = 22120 storage_watchtv = 34421 storage_nametv = 12121 storage_idwatchtv = 21213 storage_msgwatch = 292924 storage_namewatchtv = 21923 storage_save_group_id = 63732 smallerros = false ERROR_ID_NOT_FOUND = "ERROR\nPLAYER NOT FOUND\nSet Storage FALSE ON LOGIN" MSG_TV_SYSTEM = "Esta ação não e possivel você esta assistindo" MSG_CREATE_TV = "Parabéns, você criou sua TV " MSG_LOGOUT_TV = "Você saiu da tv " MSG_LOGOUT_TV_TOWN = "Você retornou a sua cidade " ID_ITEM_TV = 1949 ---- IMPORTANTE ID DA SUA CAM(CAMERA) MSG_WATCH_TV = "Você esta assitindo a uma tv" MSG_HAS_TV = "Você ja tem tv" MSG_NO_HAS_TV = "Você não tem tv" MSG_ENTER_PLAYER = "Um novo player entrou - " MININUM_STRING_CARACTER = 4 HAS_TV = "Você ja tem uma tv" MSG_DELETE_TV = "Você deletou sua channel com sucesso" MSG_WATCH_TV_ENTER_TV = "Você entrou na channel " NAME_WRONG = "Nome incorreto" MSG_HAS_NAME_TV = "Desculpe, ja existe uma tv com este nome escolha outro por favor" function setBooleanStorage(cid, storage, bool) if not bool then setPlayerStorageValue(cid, storage, -1) return true end setPlayerStorageValue(cid, storage, "true") return true end function checkFindStrings(str, array) for i=1, #array do if string.find(str, array[i]) then return true end end return false end function playerHasTv(cid) return getPlayerStorageValue(cid, storage_hastv) == "true" and true end function playerWatchTv(cid) return getPlayerStorageValue(cid, storage_watchtv) == "true" and true end function getTvOnlines() local t = {} local online = getPlayersOnline() for i=1, #online do if playerHasTv(online[i]) then table.insert(t, online[i]) end end return t end function getNamesTv(sep) local tvs = getTvOnlines() str = "" for i=1, #tvs do str = str..sep..getTvName(tvs[i]) end return str end function getIdByTvName(name) local tvs = getTvOnlines() for i=1, #tvs do if tvs[i] == name then return name end end return false end function stopWatchAllsPlayerTv(id) local onlines = getTvs(id) for i=1, #onlines do playerStopWatchTv(onlines[i]) end return true end function getNameTv(id) if not isPlayer(id) then print(ERROR_ID_NOT_FOUND) return false end local storage = getPlayerStorageValue(id, storage_nametv) if storage ~= -1 then return storage end return "" end function createNewTv(cid, name) if #name < MININUM_STRING_CARACTER or checkFindStrings(name, names) then doPlayerSendCancel(cid, NAME_WRONG) return false end local tvs = getTvOnlines() for i=1, #tvs do if getNameTv(tvs[i]) == name then doPlayerSendCancel(cid, MSG_HAS_NAME_TV) return false end end if playerHasTv(cid) then doPlayerSendCancel(cid, MSG_HAS_TV) return false end if playerWatchTv(cid) then doPlayerSendCancel(cid, MSG_WATCH_TV) return false end setBooleanStorage(cid, storage_hastv, true) setPlayerStorageValue(cid, storage_nametv, name) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, MSG_CREATE_TV..name) return true end function getTvNameById(id) if not isPlayer(id) then print(ERROR_ID_NOT_FOUND) return false end return getPlayerStorageValue(id, storage_nametv) end function playerWatchTv(cid, id) if not isPlayer(id) then if smallerros then print(ERROR_ID_NOT_FOUND) end return false end if playerHasTv(cid) then doPlayerSendCancel(cid, MSG_HAS_TV) return false end if playerWatchTv(cid) then doPlayerSendCancel(cid, MSG_WATCH_TV) return false end local name = getTvNameById(id) setBooleanStorage(cid, storage_watchtv, true) setPlayerStorageValue(cid, storage_msgwatch, MSG_TV_SYSTEM) setPlayerStorageValue(cid, storage_idwatchtv, id) setPlayerStorageValue(cid, storage_namewatchtv, name) setPlayerStorageValue(cid, storage_save_group_id, getPlayerGroupId(cid)) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, MSG_WATCH_TV_ENTER_TV) doPlayerSendTextMessage(id, MESSAGE_STATUS_CONSOLE_BLUE, MSG_ENTER_PLAYER..getCreatureName(cid)) setPlayerTv(cid, id) return true end function playerStopWatchTv(cid) local id = getPlayerStorageValue(cid, storage_idwatchtv) local name = getPlayerStorageValue(cid, storage_namewatchtv) local town = getPlayerTown(cid) local namet = getTownName(town) local post = getTownTemplePosition(town) if getPlayerStorageValue(cid, storage_watchtv) ~= "true" then return true end removePlayerTv(cid, id) setBooleanStorage(cid, storage_watchtv, false) setPlayerStorageValue(cid, storage_idwatchtv, -1) setPlayerStorageValue(cid, storage_namewatchtv, -1) setPlayerGroupId(cid, getPlayerStorageValue(cid, storage_save_group_id)) doTeleportThing(cid, post) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, MSG_LOGOUT_TV..name) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, MSG_LOGOUT_TV_TOWN..namet) return true end function deleteTv(cid) if getPlayerStorageValue(cid, 22120) ~= "true" then return false end stopWatchAllsPlayerTv(cid) setBooleanStorage(cid, storage_hastv) setPlayerStorageValue(cid, storage_nametv, -1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, MSG_DELETE_TV) return true end Agora vamos em actions e crie um arquivo lua chamado tv e coloque: function onUse(cid, item, fromPosition, itemEx, toPosition) doSendChannelsTv(cid) end Vá em actions.xml e coloque a seguinte configurando com o id da sua tv: Agora vamos em talkactions e crie um novo arquivo lua chamado delete e coloque isto: function onSay(cid, words, param, channel) deleteTv(cid) return true end Agora vamos em talkactions.xml e coloque a seguinte tag: <talkaction words="/delete" event="script" value="delete.lua"/> Agora vamos a creaturescripts e crie um arquivo lua chamado createTv e coloque: function onTextEdit(cid, it:em, newText) if item.itemid == ID_ITEM_TV then createNewTv(cid, newText) return true end return true end Crie outro chamado de tv e coloque: function onSelectTv(cid, id) local tv = getTvOnlines() local idstarter = 200 for i=1, #tv do local tv = tv[i] local sub_id = i+idstarter if sub_id == id then playerWatchTv(cid, tv) end end return true end Crie outro chamado de tvlogout : function onLogout(cid) if isPlayer(cid) then deleteTv(cid) playerStopWatchTv(cid) end return true end Vá em creaturescripts.xml e coloque as seguintes as tags: <event type="textedit" name="newTv" event="script" value="createTv.lua"/> <event type="selecttv" name="selecttv" event="script" value="tv.lua"/> <event type="logout" name="tvlogout" event="script" value="tvlogout.lua"/> Vá em data/xml/group.xml e abra o arquivo e coloque o novo group: <group id="8" name="Tv" flags="3845069447162" customFlags="2097151" access="1" violationReasons="4" nameViolationFlags="2"/> Video do sistema em execução: E recomendavel NUNCA modificar as storages porques estão ligados aos codigos. Para mudar o id da camera e so mudar a variavel ID_ITEM_TV Para deletar uma tv diga o comand /delete
    1 ponto
  7. Administrador

    Mudanças Dezembro

    Hail xTibianos trago um pacote de novidades bem interessantes para a comunidade, e tenho expectativas de que todos gostarão. A um tempo atrás iniciamos a mudança das PIPS do fórum, que são essas plaquinhas que estão em baixo da sua imagem e, hoje, estamos lançando as PIPS oficiais do xTibia. As placas atuais foram produzidas por mim e estou de ouvidos abertos à criticas e mudanças são possíveis. Confiram também outras novidades que você pode não estar por dentro: • • • • Portal Novo Após as reclamações constantes do Portal antigo, em relação ao uso do xTibia nos aparelhos celulares, decidimos reformular o portal e manter um padrão agradável e prático. Esperamos, todos nós, que tenham gostado do visual. • Menu Rápido Seguindo o mesmo conceito do Menu Alternativo, restirado à uns meses atrás devido a problemas. O Menu Rápido foi adicionado ao portal para facilitar a busca pelo conteúdo do fórum. Não há previsões para adição de novas seções no Menu. • Like System O nosso querido Like System foi desativado e agora compartilhamos todos de um lindo botão (que todos conhecemos): Bom, pelo menos agora o ranking reputação faz sentido, . Staff Novas PIPS Veja abaixo todas as novas placas para membros. (Ou, clique aqui) Elas mudam conforme a sua quantidade de posts, sendo: 0; 50; 100; 250; 500; 700; 1000; 1500; 2000; 3000 e 5000. •
    1 ponto
  8. zorddella

    Daniel Spriting

    Cara você é monstro '-' Muito bela sua art, você é cheio de talentos parabéns. Isso que é força de vontade, mesmo quem não te conhece(como eu por exemplo) pelo pouco que ver já sente inspiração vindo de ti xD Também não curto o estilo realista, estou praticando mais animado tbm, espero encontrar meu estilo e ser mestre igual você ahaha =D
    1 ponto
  9. cola isso entre function onUse e o primeiro if if isInArray({413, 414, 415, 416, 417, 418}, getPlayerVocation(cid)) then return doPlayerSendCancel(cid, "Sua vocação não pode usar este scroll.") end
    1 ponto
  10. Stigal

    [Download] Addons Pokemons [151]

    Ola Xtibianos, Venho trazer os Addons Pokemons (*Outifits Dos Pokemons) para todos que estao pedindo a tempos... Eles Sairao Completos e com Sistema Todo Prontos No "Pokemon Centurion [v4] - Cacaiu" Mas estou disponibilisando aki somente as Sprites... • Menu: ├ Script Dos Addon; ├ Download; ├ Scan; └ Creditos. • Script Dos Addon - Creditos RicardoSohnn • • Download's • Pokemon Addons (4shared) http://www.4shared.com/rar/xRKlSsAq/Pokemon_Addons_-_Stigal.html? • Scan • Pokemon Addons (Scan) https://www.virustotal.com/file/a1f0559b8a103a518fe7305060e679e929812fd90debb7189cd9fef3a56c60ad/analysis/1347480518/ • Creditos • Cacaiu - 50% {Deu Elas} Stigal - 50% {Arrumou e Deixou todas na versao compativel}
    1 ponto
  11. Gwix

    Show Off (Gwix)

    Eu sinceramente amei o resultado de Zanknore, espero que quando lançada você mude de ideia. Mas obrigado Obrigado!!
    1 ponto
  12. Abaixo de: function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor) coloque: if not isPlayer(cid) then return true end if not HaveCharaterAcess(cid) then doPlayerSendCancel(cid, "Você não é vip, portanto o manapool não irá healar sua mana.") doTeleportThing(cid, fromPosition) return true end
    1 ponto
  13. Duuhzinhow

    Ajuda com npc

    tenta mudar essa parte npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) coloca npcHandler:setCallback(CALLBACK_ONTHINK, thinkCallback) npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
    1 ponto
  14. Caronte

    Problema com Zombie Event

    Mude a última função (spawnNewZombie) sua da linha 98 para baixo. Coloque isto: function spawnNewZombie() local posx = {} local posy = {} local posz = {} local pir = {} for i=1, 5 do local posx_tmp = math.random(ZE_spawnFromPosition.x ,ZE_spawnToPosition.x) local posy_tmp = math.random(ZE_spawnFromPosition.y ,ZE_spawnToPosition.y) local posz_tmp = math.random(ZE_spawnFromPosition.z ,ZE_spawnToPosition.z) local pir_tmp = 0 local spec = getSpectators({x=posx_tmp, y=posy_tmp, z=posz_tmp}, 3, 3, false) if(spec and #spec > 0) then for z, pid in pairs(spec) do if(isPlayer(pid)) then pir_tmp = pir_tmp + 1 end end end posx[i] = posx_tmp posy[i] = posy_tmp posz[i] = posz_tmp pir[i] = pir_tmp end local lowest_i = 1 for i=2, 5 do if(pir[i] < pir[lowest_i]) then lowest_i = i end end local ret = (type(doCreateMonster("Zombie Event", {x=posx[lowest_i], y=posy[lowest_i], z=posz[lowest_i]}, false, false, false)) == 'number') if(ret) then addZombiesCount() end return ret end Já tenho uns 7 anos de tibia, e nunca deu isso em um otserver meu. verifique se você tá colocando o nome certo.
    1 ponto
  15. 1 ponto
  16. Oneshot

    Oneshot Spell Lib

    Oneshot Spell Lib Boa tarde, meus queridos. Como eu disse no último post do tópico do Spell Forge, sim, ele estava ficando funcional o bastante, mas uma coisa não me agradava, o nível de dificuldade de configuração do sistema estava aumentando, e uma hora, não teria como OT-admins usarem meu sistema, pois não saberiam configurar. Então resolvi parar o desenvolvimento dele por enquanto, mas segue minha biblioteca que estava usando para desenvolvimento do sistema. Uma biblioteca completa para desenvolvimento de magias, orientada a objetos, torna a coisa bem mais interessante. Para utilizar minha biblioteca, basta criar arquivo com qualquer nome na pasta data/lib do seu servidor e colar o seguinte conteúdo abaixo: -- This library is part of Oneshot Spell System -- Copyright (C) 2013 Oneshot -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. -- constant CONST_SPELL_AREA = 0 -- area spells, like exevo gran mas vis CONST_SPELL_DIRECTION = 1 -- wave spells, like exevo flam hur CONST_SPELL_TARGETORDIRECTION = 2 -- mix between area and wave spells WEAPON_SKILLS = { [WEAPON_SWORD] = SKILL_SWORD, [WEAPON_CLUB] = SKILL_CLUB, [WEAPON_AXE] = SKILL_AXE, } -- class for combats (spell instances) Combat = { type = 0, me = 0, ani = 0, formula = { type = 0, values = {}, }, condition = nil, delay = 0, id = 0, } function Combat:New(_type, me, ani, delay, id) local new_spellinstance = { type = _type or COMBAT_NONE, me = me or CONST_ME_NONE, ani = ani or CONST_ANI_NONE, formula = { type = COMBAT_FORMULA_UNDEFINED, values = {0, 0, 0, 0, 0, 0, 0, 0}, }, condition = nil, delay = delay or -1, id = id or 1, } return setmetatable(new_spellinstance, {__index = self}) end function Combat:SetType(_type) self.type = (tonumber(_type) and _type or COMBAT_NONE) end function Combat:SetEffect(me) self.me = (tonumber(me) and me or CONST_ME_NONE) end function Combat:SetDistanceEffect(ani) self.ani = (tonumber(ani) and ani or CONST_ANI_NONE) end function Combat:SetFormula(_type, ...) local args = select("#", ...) self.formula.type = (tonumber(_type and _type or COMBAT_FORMULA_UNDEFINED)) local minc, maxc if args > 8 then minc, maxc = select(9, ...) end local minm, maxm = getConfigValue("formulaMagic") or 1 maxm = minm local minl, maxl = getConfigValue("formulaLevel") or 5 maxl = minl if args > 6 then minm, maxm = select(7, ...) end if args > 4 then minl, maxl = select(5, ...) end local mina, minb, maxa, maxb = select(1, ...) self.formula.values = {mina, minb, maxa, maxb, minl, maxl, minm, maxm, minc, maxc} end function Combat:SetCondition(condition) -- condition needs to be a createConditionObject(), e.g -- local condition = createConditionObject(CONDITION_FIRE) -- setConditionParam(condition, CONDITION_PARAM_TICKS, 1 * 1000) self.condition = condition end function Combat:GetDelay() return self.delay end function Combat:SetDelay(delay) self.delay = (tonumber(delay) and delay or -1) end function Combat:GetId() return self.id end function Combat:SetId(id) self.id = (tonumber(id) and id or 1) end function Combat:getMinMaxValues(cid, ex) local min, max = 0, 0 local n = self.formula.values if not isCreature(cid) then return false end if not isPlayer(cid) then self.formula.type = COMBAT_FORMULA_DAMAGE end if self.formula.type == COMBAT_FORMULA_LEVELMAGIC then min = (getPlayerLevel(cid) / n[5] + getPlayerMagLevel(cid) * n[7]) * n[1] + n[2] max = (getPlayerLevel(cid) / n[6] + getPlayerMagLevel(cid) * n[8]) * n[3] + n[4] if n[9] then min = math.max(n[9], min) end if n[10] then max = math.max(n[10], max) end elseif self.formula.type == COMBAT_FORMULA_SKILL then local weapon = getPlayerWeapon(cid) if weapon.uid > 0 then max = getPlayerWeaponDamage(cid, weapon) * n[3] + n[4] else max = n[4] end if n[10] then max = math.max(n[10], max) end elseif self.formula.type == COMBAT_FORMULA_DAMAGE then min = n[2] max = n[4] end return min, max end function Combat:Callback(position, cid, ex) if not isCreature(cid) then return false end local min, max = self:getMinMaxValues(cid, ex) doCombatAreaHealth(cid, self.type, position, 0, min, max, self.me) if self.condition then doCombatAreaCondition(cid, position, 0, self.condition, CONST_ME_NONE) end return true end -- class for spells Spell = { type = 0, level = 0, maglevel = 0, mana = 0, needtarget = false, target_or_direction = false, range = 0, needweapon = false, selftarget = false, vocations = {}, combats = {}, } function Spell:New(_type, level, maglevel, mana, needtarget, range, needweapon, selftarget, ...) local new_spell = { type = _type or CONST_SPELL_AREA, level = level or 1, maglevel = maglevel or 0, mana = mana or 0, needtarget = needtarget or false, range = range or 1, needweapon = needweapon or false, selftarget = selftarget or false, vocations = {...}, combat = {}, area = {{3}}, } return setmetatable(new_spell, {__index = self}) end function Spell:SetType(_type) self.type = (tonumber(_type) and _type or CONST_SPELLarea) end function Spell:SetLevel(level) self.level = (tonumber(level) and level or 1) end function Spell:SetMagLevel(maglevel) self.maglevel = (tonumber(maglevel) and maglevel or 0) end function Spell:SetMana(mana) self.mana = (tonumber(mana) and mana or 0) end function Spell:SetNeedTarget(needtarget) self.needtarget = (type(needtarget) == "boolean" and needtarget or false) end function Spell:SetRange(range) self.range = (tonumber(range) and range or 1) end function Spell:SetNeedWeapon(needweapon) self.needweapon = (type(needweapon) == "boolean" and needweapon or false) end function Spell:SetSelfTarget(selftarget) self.selftarget = (type(selftarget) == "boolean" and selftarget or false) end function Spell:SetVocations(...) self.vocations = {...} end function Spell:Append(...) local t = {...} for i = 1, #t do self.combat[t[i]:GetId()] = t[i] end end function Spell:SetArea(area) self.area = area end function Spell:Cast(cid) if not isCreature(cid) then return false end if #self.combat == 0 then doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF) return false end if isPlayer(cid) then if not getPlayerFlagValue(cid, PLAYERFLAG_IGNORESPELLCHECK) then if getPlayerLevel(cid) < self.level then doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF) doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTENOUGHLEVEL) return false end if getCreatureMana(cid) < self.mana then doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF) doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTENOUGHMANA) return false end if getPlayerMagLevel(cid) < self.maglevel then doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF) doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTENOUGHMAGICLEVEL) return false end if self.needweapon and (getPlayerWeapon(cid).uid == 0) then doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF) doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUNEEDAWEAPONTOUSETHISSPELL) return false end local vocation = getPlayerVocation(cid) if #self.vocations > 0 and not (table.find(self.vocations, vocation) or table.find(self.vocations, getVocationInfo(vocation).fromVocation)) then doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF) doPlayerSendDefaultCancel(cid, RETURNVALUE_YOURVOCATIONCANNOTUSETHISSPELL) return false end end end local target = getCreatureTarget(cid) if self.needtarget == true then if self.type == CONST_SPELL_DIRECTION then self.type = CONST_SPELL_TARGETORDIRECTION elseif self.type == CONST_SPELL_AREA and not isCreature(target) then doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF) doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUCANONLYUSEITONCREATURES) return false end end if self.range and isCreature(target) then if getDistanceBetween(getCreaturePosition(cid), getCreaturePosition(target)) > self.range then doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF) doPlayerSendDefaultCancel(cid, RETURNVALUE_TOOFARAWAY) return false end end local area = self.area if self.type == CONST_SPELL_DIRECTION or (self.type == CONST_SPELL_TARGETORDIRECTION and not isCreature(target)) then area = getAreaByDir(area, getCreatureLookDirection(cid)) end local centre = getCreaturePosition(cid) local target = getCreatureTarget(cid) if self.type == CONST_SPELL_DIRECTION then centre = getPosByDir(getCreaturePosition(cid), getCreatureLookDirection(cid), 1) elseif self.type == CONST_SPELL_TARGETORDIRECTION then centre = (isCreature(target) and getCreaturePosition(target) or getPosByDir(getCreaturePosition(cid), getCreatureLookDirection(cid), 1)) elseif self.type == CONST_SPELL_AREA then if self.needtarget and isCreature(target) then centre = getCreaturePosition(target) end end local positions = getAreaPositions(area, centre) for i = 1, #area do for j = 1, #area[i] do local tmp = area[i][j] if tmp == 3 then for k = 1, #self.combat do local combat = self.combat[k] if combat then addEvent(function() if self.selftarget then combat:Callback(positions[i][j], 0) else combat:Callback(positions[i][j], cid) end doSendDistanceShoot(getCreaturePosition(cid), centre, combat.ani) end, combat:GetDelay()) end end elseif type(tmp) == "number" and self.combat[tmp] then local combat = self.combat[tmp] if combat then addEvent(function() if self.selftarget then combat:Callback(positions[i][j], 0) else combat:Callback(positions[i][j], cid) end doSendDistanceShoot(getCreaturePosition(cid), centre, combat.ani) end, combat:GetDelay()) end elseif type(tmp) == "table" then for k = 1, #tmp do local tile = tmp[k] local combat = self.combat[tile] if combat then addEvent(function() if self.selftarget then combat:Callback(positions[i][j], 0) else combat:Callback(positions[i][j], cid) end doSendDistanceShoot(getCreaturePosition(cid), centre, combat.ani) end, combat:GetDelay()) end end end end end if self.mana > 0 then doCreatureAddMana(cid, -self.mana, 0) end return true end function rotate(area) local ret = {} for i = 1, #area do for j = 1, #area[i] do if not ret[#area[i]-j+1] then ret[#area[i]-j+1] = {} end ret[#area[i]-j+1][i] = area[i][j] end end return ret end function getAreaByDir(area, direction) local ret = area if direction > NORTH then local n = (4 - direction) repeat ret = rotate(ret) n = n - 1 until n == 0 end return ret end function getAreaCentre(area) local x, y = 0, 0 for i = 1, #area do for j = 1, #area[i] do if area[i][j] == 3 then x = j y = i break end end end return x, y end function getAreaPositions(area, centre) local ret = {} local x, y = getAreaCentre(area) for i = 1, #area do for j = 1, #area[i] do if not ret[i] then ret[i] = {} end ret[i][j] = {x = centre.x + (j - x), y = centre.y + (i - y), z = centre.z} end end return ret end function getPlayerMeleeDamage(cid, item) local skill, attack if item.uid > 0 then local info = getItemInfo(item.itemid) skill = getPlayerSkillLevel(cid, WEAPON_SKILLS[getItemWeaponType(item.uid)]) attack = ((getItemAttribute(item.uid, "attack") or info.attack) + (getItemAttribute(item.uid, "extraAttack") or info.extraAttack) - info.abilities.elementDamage) else skill = getPlayerSkillLevel(cid, SKILL_FIST) attack = 0 end local damage = math.ceil((2 * (attack * (skill + 5.8) / 25 + (getPlayerLevel(cid) - 1) / 10.)) / getPlayerAttackFactor(cid)) return -math.random(0, damage) end function getPlayerAttackFactor(cid) local switch = { 1.0, 1.2, 2.0, } return switch[(getPlayerModes(cid).fight + 1)] end dofile(getDataDir() .."/spells/lib/spells.lua") É uma biblioteca orientada a objetos que facilita o desenvolvimento de magias. Comparando a forma dos scripts de magias, com a minha biblioteca e sem, podemos ver a diferença. Sem a biblioteca: local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE) setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_ENERGYAREA) setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY) setAttackFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 5, 5, 4.5, 9) local area = createCombatArea(AREA_SQUAREWAVE5, AREADIAGONAL_SQUAREWAVE5) setCombatArea(combat, area) function onCastSpell(cid, var) return doCombat(cid, combat, var) end Com a biblioteca: local combat = Combat:New(COMBAT_ENERGYDAMAGE, CONST_ME_ENERGYAREA, CONST_ANI_ENERGY) combat:SetFormula(COMBAT_FORMULA_LEVELMAGIC, -1, 0, -1, 0, 5, 5, 4.5, 9) local spell = Spell:New(CONST_SPELL_DIRECTION) spell:Append(combat) spell:SetArea(AREA_WAVE4) function onCastSpell(cid, var) return spell:Cast(cid) end Mas o melhor mesmo é notado quando você quer desenvolver as magias com mais de uma variável combat. Aquelas magias de múltiplos hits e efeitos. Vou pegar uma magia de 3 efeitos e danos diferentes. local combat1 = createCombatObject() setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE) setCombatParam(combat1, COMBAT_PARAM_EFFECT, CONST_ME_ENERGYAREA) setCombatParam(combat1, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY) setAttackFormula(combat1, COMBAT_FORMULA_LEVELMAGIC, 5, 5, 4.5, 9) local combat2 = createCombatObject() setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE) setCombatParam(combat2, COMBAT_PARAM_EFFECT, CONST_ME_ICEAREA) setCombatParam(combat2, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ICE) setAttackFormula(combat2, COMBAT_FORMULA_LEVELMAGIC, 5, 5, 1, 2) local combat3 = createCombatObject() setCombatParam(combat3, COMBAT_PARAM_TYPE, COMBAT_EARTHDAMAGE) setCombatParam(combat3, COMBAT_PARAM_EFFECT, CONST_ME_SMALLPLANTS) setCombatParam(combat3, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_EARTH) setAttackFormula(combat3, COMBAT_FORMULA_LEVELMAGIC, 5, 5, 3.5, 7) local area = createCombatArea(AREA_SQUAREWAVE5, AREADIAGONAL_SQUAREWAVE5) setCombatArea(combat1, area) setCombatArea(combat2, area) setCombatArea(combat3, area) function onCastSpell1(cid, var) doCombat(cid, combat1, var) end function onCastSpell2(cid, var) doCombat(cid, combat2, var) end function onCastSpell3(cid, var) doCombat(cid, combat3, var) end function onCastSpell(cid, var) onCastSpell1(cid, var) addEvent(onCastSpell2, 300, cid, var) addEvent(onCastSpell3, 600, cid, var) return true end Com o uso da minha biblioteca, podemos notar a redução de linhas, e a limpeza do código: local combat1 = Combat:New(COMBAT_ENERGYDAMAGE, CONST_ME_ENERGYAREA, CONST_ANI_ENERGY) combat1:SetFormula(COMBAT_FORMULA_LEVELMAGIC, -1, 0, -1, 0, 5, 5, 4.5, 9) local combat2 = Combat:New(COMBAT_ICEDAMAGE, CONST_ME_ICEAREA, CONST_ANI_ICE) combat2:SetFormula(COMBAT_FORMULA_LEVELMAGIC, -1, 0, -1, 0, 5, 5, 1, 2) combat2:SetId(2) combat2:SetDelay(300) local combat3 = Combat:New(COMBAT_EARTHDAMAGE, CONST_ME_SMALLPLANTS, CONST_ANI_EARTH) combat3:SetFormula(COMBAT_FORMULA_LEVELMAGIC, -1, 0, -1, 0, 5, 5, 3.5, 7) combat3:SetId(4) combat3:SetDelay(600) local T = {1, 2, 4} local area = { {T, T, T}, {T, T, T}, {T, T, T}, {0, T, 0}, {0, 3, 0}, } local spell = Spell:New(CONST_SPELL_DIRECTION) spell:SetArea(area) spell:Append(combat1, combat2, combat3) function onCastSpell(cid, var) return spell:Cast(cid) end Qualquer dúvida quanto ao uso da biblioteca no desenvolvimento de magias, basta postar neste tópico que estarei esclarecendo. Grande Abraço, Oneshot.
    1 ponto
  17. Jardeson

    [Download] Addons Pokemons [151]

    e pra por fly, ride e surf? como faço para por o sprite com addon?
    1 ponto
  18. LuckOake

    Aprendendo A Scriptear

    Olá galera. Muitos de vocês que são iniciantes em scripting tem certa dificuldade para criar scripts, uns por falta de ideias, outros por realmente não conseguirem montar nada. Por isso, resolvi fazer esse tutorial simples e claro. Aprendendo a Scriptear Introdução: Bom, primeiramente, você já se perguntou "por quê quero scriptear"? Se sim, legal, mas chegou à uma resposta? Se não, pense nisso. Tente chegar à algo que te inspire, seja observando trabalhos de scripters mais conhecidos e habilidosos ou simplesmente querendo criar novas coisas para ter seu nome conhecido. Sem uma inspiração você não vai avançar, acredite em mim. Começando no mundo dos scripts: Quando você tentou aprender a scriptear pela primeira vez, o que você fez? 95% das pessoas responderiam: "Eu li tutoriais". Tudo bem, mas será que isso é certo? Posso te assegurar que não. É claro, ler um tutorial abre sua mente para a parte teórica de scriptear, mas nada muito grande, de pouco adianta a teoria se você não entende a prática. Como praticar: Vou compartilhar com vocês uma experiência de vida. Eu tenho um server que está atualmente fechado para reformas, mas antigamente, eu necessitava sempre de inovar para agradar os players, só que os scripts que eu queria nem sempre estavam disponíveis na net. O que eu fazia? Simples, procurava scripts que possuiam as funções que eu precisava e ia juntando os pedaços até formar o que eu queria. Não, nunca funcionava de primeira, tinha vez que eu levava umas 2 horas para montar um script não muito avançado. Resultados da prática: Com a prática dita acima, você aprende as funções (como elas funcionam, o que significam, etc), aprende a estrutura de um script (if, else, end, etc), e o principal, aprende a criar. Moral: Não leia tutoriais apenas, pratique à partir do que você já conhece. Exemplo disso: Você conhece as cores azul e vermelho. Se você juntar as duas, você conhecerá uma nova cor, a cor roxa. Ou seja, juntando seus conhecimentos você obtêm mais sabedoria. Aprendendo a Imaginar Introdução: Bom, o maior problema de todo scripter é a falta de idéias, mas nem todos sabem resolver isso e encalham, alguns até desistem. Como resolver? Mas antes de tudo, vamos ao por quê. Por quê não tenho ideias? Você provavelmente já se perguntou isso. Se não, SE PERGUNTE. É importante. Parte das pessoas diriam que é porquê tudo já foi inventado, mas acredite, isso tá errado. Eu mesmo tinha essa visão, mas aprendi a imaginar, mesmo que às vezes seja difícil. Você não tem ideias bem provavelmente porquê você não tentou ter. Ou se tentou, fez da maneira errada. Então como ter ideias? Cara, você mora num universo que provavelmente está dentro de outras imensidões que seres humanos como nós são incapazes de compreender, mas fiquemos na Terra mesmo. O que tem na Terra? Muitas coisas, e a cada dia são criadas mais e mais coisas. Observe o mundo ao seu redor, se você prestar atenção em cada detalhe, verá que existem objetos, pessoas e até ambientes que você nunca imaginava que existisse. Você, tendo um pingo de criatividade, pode criar na sua mente um paraíso inteiro à partir de um simples campo de futebol. Moral: Você aprende a imaginar à partir do que já existe, isso é fato, mas com isso, você pode muito bem tirar uma base da sua imaginação ou até mesmo da realidade e criar um sistema que não existe, afinal, muitas coisas ainda não existem. Conclusão Final Você aprende praticando, e com a prática você evolui, mas para praticar você precisa de uma inspiração, e a partir da inspiração você tem ideias, e a partir das ideias você pratica, e com a prática você evolui, e fica nesse ciclo infinito. --------------------------------------------------------------------------------------------- Obrigado galera, espero que vocês tenham entendido o que eu quis dizer. Att. Luck Oake
    1 ponto
  19. tibiaa4e

    Pasta Data - Funções Em Lua

    Pasta Enciclopedia com todos os links de outros tutoriais ! http://www.xtibia.com/forum/Pasta-Data-Enc...r-E-t99746.html Parte II – Funções Lua Nessa segunda parte irei mostrar como usar e quase todas as funções em lua existentes no otserver, lembrando que esse tutorial foi baseado no The Forgotten Server 0.3.0 Alpha 3. Portanto poderá haver funções aqui que não terá em outros otservers ou será diferente o nome. Lembrando que todas as funções existentes aqui poderão ser usadas tanto em actions,npcs,movements,talk actions e spells. Dividi as funções em três grandes grupos e subgrupos, os três grandes são funções get(receba), set (insira) e do (faça). Use Forgotten Server 3.0 pelo amor de deus, se você não saber usar sql aprende a usar SqlLite nesse link... Se você Aries você não tem honra para mexer aqui Funções Get São as funções que retornam valores, ou seja, elas fazem checagens. São muitos usadas e uteis. Ela é usada em condicionais (If, while, for) ou inseridas em variaveis. O modo de usa-la depende do tipo de script ou do jeito que você preferir. Dividi elas em dois grupos, a get simples e a get com parametros. Funções get simples São funções simples mesmo basta coloca-las e elas retornarão um valor, pode coloca-las em condicionais ou em variaveis. E todas elas buscam valores em players. Os que há creature pode ser usados em monstros (a maioria). São elas : getPlayerFood(cid) – Verifica quanto de tempo de comida o player possui. getCreatureHealth(cid) – Verifica a health atual do player. getCreatureMaxHealth(cid) – Verifica a health maxima do player. getCreatureMana(cid) – Verifica a mana atual do player. getCreatureMaxMana(cid) – Verifica a mana maxima do player. getPlayerLevel(cid) – Verifica o level do player. getPlayerExperience(cid) – Verifica a experiencia. getPlayerMagLevel(cid) – Verifica o magic level. getPlayerAccess(cid) – Verifica o nivel de acesso (player,gm,tutor...) getPlayerTown(cid) - Verifica o id da cidade natal do player. getPlayerVocation(cid) – Verifica a vocação dele. getPlayerSoul(cid) – Verifica o soul points. getPlayerFreeCap(cid) – Verifica quanto de capacidade atual existe. getPlayerLight(cid) - Verifica o tamanho da luz do player. getPlayerGuildId(cid) – Verifica o id atual da guild do player. getPlayerGuildName(cid) – Verifica o nome da guild. getPlayerGuildRank(cid) - Verifica o posto dele na guild. getPlayerGuildNick(cid) – Verifica o nick dele na guild. (aquilo escrito no final entre parenteeses). getPlayerGuildLevel(cid) – Verifica o nivel da guild. getPlayerSex(cid) – Verifica o sexo do player(0-mulher, 1 – homem). getPlayerLookDir(cid) – Verifica a direção na qual ele está olhando. (0-norte, 1-leste, 2-sul, 3 -oeste). getPlayerGUID(cid) – Verifica o id dele na database. getPlayerPromotionLevel(cid) – Verifica o nivel da promoção do player. getPlayerGroupId(cid) – Verifica o nivel dele. (igual acesso). getPlayerInstantSpellCount(cid) - Verifica quantas spells o player sabe. getMonsterTargetList(cid) – Verifica os montros na qual você está atacando. getMonsterFriendList(cid) – Verifica os monstros amigo (provavelmente summons). getCreatureOutfit(cid) – Verifica o id da roupa do player. getCreaturePosition(cid) – Verifica a posição x,y,z do player. getCreatureSpeed(cid) – Verifica a velocidade atual do player. getCreatureBaseSpeed(cid) – Verifica a velocidade base do player. getCreatureName(cid) – Verifica o nome do player. getCreatureTarget(cid) – Verifica quem o player está atacando. getPlayerPremiumDays(cid) – Verifica quantos dias de premmium account o player possui. getPlayerSkullType(cid) – Verifica qual skull o player possui. getPlayerBalance(cid) – Verifica o saldo bancario do player. getPlayerStamina(cid) – Verifica o tempo de stamina. getPlayerNoMove(cid) – Verifica se ele pode se mover. getPlayerExtraExpRate(cid) – Verifica a taxa de experiencia extra (a confirmar). getPlayerPartner(cid) – Se o player está em parte ou não. getPlayerParty(cid) – Verifica informações da party do player. getPartyMembers(lid) – Verifica os membros da party segundo o id da função acima. getCreatureMaster(cid) – Verifica a criatura mestre (a que sumona). getCreatureSummons(cid) – Verifica os summons da criatura. A sintaxe dessas funções é essa : Exemplo : if getCreatureMana(cid) == 20 then Ou mana = getCreatureMana(cid) if mana == 20 then Funções get com parametros. Essas funções fazem o mesmo papel da outra get simples, porém elas tem certos parametros pois normalmente elas checam coisas a mais, e algumas checam objetos e não só valores do player. Lembrando que se for comparar itens que são com nomes (exemplo : getItemNameById(2195) == 'boots of haste' then) deve se colocar entre aspas pois é uma função string. Numeros não prescisam estar dentro de aspas. São elas : getPlayerSkill(cid, skillid) - checa o skill especificado do player (0- fist,1-club, 2-sword, 3-axe, 4-distance, 5 -shield, 6 – fishing). getPlayerItemCount(cid,itemid) - checa a quantidade de item agrupaveis. getPlayerSlotItem(cid, slot) - Checa que item tem no slot do player (1-cabeca, 2- amuleto, 3- backpack, 4-armadura, 5-mao direita, 6-mao esquerda, 7-pernas, 8- botas, 9-anel, 10 slot da torcha). getPlayerWeapon(cid, <optional> ignoreAmmo) - Checa que arma o player esta usando. (o outro paramentro ainda n usei). getPlayerItemById(cid, deepSearch, itemId, <optional> subType) - Procura o item especifica no item, pode colocar o subtipo (viais por exemplo). getPlayerDepotItems(cid, depotid) - Ve quantos itens tem no depot da cidade (Por id de cidade). getPlayerFlagValue(cid, flag) - Ve as flag dos players (Apenas em TFS e nunca usei). getPlayerCustomFlagValue(cid, flag) - Verifica o valor da flag. getPlayerLearnedInstantSpell(cid, name) - Verifica se o player sabe a magia. getPlayerInstantSpellInfo(cid, index) - Desconheço getInstantSpellInfoByName(cid, name) - Verifica valores da magia getInstantSpellWords(name) - Retorna a palavra magica da magia. getPlayerStorageValue(uid, valueid) - Verifica o valor do storage do player getCreatureByName(name) - Retorna o nome da criatura. getPlayerGUIDByName(name) - Verifica o numero da tabela sql do player. getPlayerNameByGUID(guid) - Verifica o nome do jogador pelo numero da tabela sql getContainerSize(uid) - Verifica quantos slots tem o container. getContainerCap(uid) - Verifica quanto pesa o container. getContainerItem(uid, slot) - Verifica se há um container no slot especificado. getDepotId(uid) - - Verifica o id da cidade do depot. getItemDescriptionsById(itemid) - Pega a descrição do item pelo id. getItemNameById(itemid) - - Pega o nome do item pelo id. getItemPluralNameById(itemid) - Pega o nome em plural do item pelo id.(apenas itens agrupaveis). getItemIdArticleById(itemid) - Retorna um valor pelo id. Desconheço essa função getItemWeightById(itemid, count, <optional: default: 1> precise) - -Pega o peso do item por id. getItemDescriptions(uid) - - Pega a descrição do item por uid. (por exemplo se ele é item ou item2 em actions). getItemName(uid) - - Pega a descrição do item por uid. getItemAttack(uid) - Pega o ataque do item por uid. getItemPluralName(uid) - Pega o nome em plural por uid. getItemExtraAttack(uid) - Modifica o ataque extra da arma (Acho que deve ser ataque elemental ou defesa de armor). getItemIdArticle(uid) - - Desconheço. getItemDefense(uid) - - Pega a defesa do item por uid. getItemExtraDefense(uid) - - Pega a defesa extra (armor) por uid. getItemArmor(uid) - - Pega o valor de armour por uid. getItemAttackSpeed(uid) - - Pega a velocidade de ataque por uid. getItemHitChance(uid) - - Pega a chanche de dano do item por uid. getItemIdByName(name) - - Retorna o id do item pelo nome. getPromotedVocation(vocation) - - Verifica qual o nome da vocação promocional da vocação(Sorcerer = Master Sorcerer). getPlayerBlessing(cid, blessing) - - Verifica qual nivel de benção o player tem (1 = 1, 2 =2...). getTemplePositionByName(townName) - - Verifica as coordenadas do templo pelo nome da cidade. getTemplePositionById(townId) - - Verifica as coordenadas do templo pelo id da cidade. Funções Set São poucas funções. Elas inserem valores ou seja inserem novos valores, inutilizando os antigos. Deve se usa-las dentro de condicionais. Exemplo : No caso se o item se chamar boots of haste, o script coloca arm 5 nela. São elas : setItemAttack(uid, attack) - Modifica o ataque da arma setPlayerStamina(cid, minutes) - Adicione tempo em stamina. setPlayerExtraExpRate(cid, value) - Modifica mais taxa de experiencia setPlayerPartner(cid, guid) - Desconheço setItemPluralName(uid) - Modifica ou adiciona o nome do item no plural. setItemName(uid) - Muda o nome do item. setItemIdArticle(uid) - Modifica o article no item (sei la q merda é essa) setItemExtraAttack(uid, extraattack) - Adiciona ataque extra na arma. setItemDefense(uid, defense) - Modifica defesa no item setItemExtraDefense(uid, extradefense) - Modifica aquela defesa extra na arma setItemArmor(uid, armor) - Modifica a armor do item setItemAttackSpeed(uid, attackspeed) - Muda a velocidade de ataque do item setItemHitChance(uid, hitChance) - Modifica a taxa de dano do item setGlobalStorageValue(valueid, newvalue) - Adiciona um valor global (Muito util para scripts avançados) setHouseOwner(houseid, ownerGUID) - Muda o dono da casa setWorldType(type) - Muda o estilo do mundo para PvP, Non Pvp e Pvp Enforced Funções do Funções que fazer algo, normalmente modificam , porem ao contrario do set algumas apenas adiciona valores. São usadas dentro de condicionais. A sintaxe dela é : if item.itemid == 2195 then doCreatureAddHealth(cid, -1000) end No caso se o item usado no script for 2195, ele remove 1000 de hp. São elas : doPlayerLearnInstantSpell(cid, name) - Faz o player aprende a magia pelo nome dela. doRemoveItem(uid, quantidade) - Remove o item do player. doPlayerFeed(cid, food) - Adiciona "comida" ao player. doPlayerSendCancel(cid, text) - Manda aquela mensagem branca no rodape da tela. doPlayerSendDefaultCancel(cid, ReturnValue) - Inutil pelo que saiba , pq nunca vi um script com isso e por isso n sei pra q serve. doTeleportThing(cid, newpos, <optional> pushmove) - Teleporta o player para uma nova posição. doTransformItem(uid, toitemid, <optional> count/subtype) - Transforma o item em outro. doCreatureSay(cid, text, type) - - Faz o player falar algo. doSendMagicEffect(pos, type[, player]) - Faz algum efeito magico doSendDistanceShoot(frompos, topos, type) - Faz algum efeito de distancia doChangeTypeItem(uid, newtype) - Muda o tipo dele ou a quantidade de itens agrupaveis. doSetItemActionId(uid, actionid) - Adiciona uma nova actionid por uid. doSetItemText(uid, text) - - Adiciona um texto ao item. doSetItemSpecialDescription(uid, desc) - Coloca a descrição especial no item. (Esse item foi feito especialmente para sei la kem). doSendAnimatedText(pos, text, color) - Manda um texto animado (Se vc joga servidor Pvp Enforced sabe qual é). doPlayerAddSkillTry(cid, skillid, n) - Adiciona uma tentativa em um skill (Se vc colocar 9999999 ele aumenta apenas 1 skill). doCreatureAddHealth(cid, health) - Adiciona life ao player. doCreatureAddMana(cid, mana) - Adiciona mana ao player. doPlayerSetTown(cid, townid) - Muda a cidade do player. doPlayerSetVocation(cid,voc) - Muda a vocação do player ( Não coloque vocação promocional em TFS pq dará erros). doPlayerRemoveItem(cid, itemid, count, <optional> subtype) - Remove um item do player. doPlayerAddExp(cid, exp) - Adiciona experiencia ao player. doPlayerAddOutfit(cid,looktype,addons) - Adiciona addons do outfit ao player. doPlayerRemoveOutfit(cid,looktype,addons) - Remove addons do outfit do player. doAddContainerItem(uid, itemid, <optional> count/subtype) - Adiciona um container por uid. doBroadcastMessage(message, type) - Manda uma mensagem global ao servidor. doPlayerBroadcastMessage(cid, message, <optional> type) - doPlayerSetSex(cid, newSex) - - Muda o sexo do Player (0- mulher, 1 homem) doCreatureChangeOutfit(cid, outfit) - Muda a roupa do player. doSetMonsterOutfit(cid, name, time) - Muda a roupa para de um monstro. doSetItemOutfit(cid, item, time) - Muda a roupa do player para de um item. doSetCreatureOutfit(cid, outfit, time) - Adiciona uma roupa por tempo. doPlayerAddMapMark(cid, pos, type, <optional> description) - Adiciona aquelas marcações no mapa do jogador. doPlayerAddPremiumDays(cid, days) - Adiciona dias de premmium no jogador doPlayerAddManaSpent(cid, mana) - Adiciona % de magic level (Se vc colcoar 99999999 ele aumentará muitos mls...) doPlayerAddSoul(cid, soul) - Adiciona soul points ao jogador doPlayerAddItem(uid, itemid, <optional> count/subtype, <optional: default: 1> canDropOnMap) - Adiciona itens no player. doPlayerAddItemEx(cid, uid, <optional: default: 0> canDropOnMap) - Adiciona um item2 no player (Estranho). doPlayerSendTextMessage(cid, MessageClasses, message) - Manda um texto pro player. doPlayerAddMoney(cid, money) - Adiciona dinheiro ao player doPlayerRemoveMoney(cid, money) - Remove dinheiro do player. doPlayerWithdrawMoney(cid, money) - Remove dinheiro do banco doPlayerDepositMoney(cid, money) - Adiciona dinheiro ao banco. doPlayerTransferMoneyTo(cid, target, money) - Transfere dinheiro do banco. doShowTextDialog(cid, itemid, text) - Mostra o texto do item doDecayItem(uid) - Decai o item (aprodecer) doCreateItem(itemid, type/count, pos) - doCreateItemEx(itemid, <optional> count/subtype) - Cria um item2. doTileAddItemEx(pos, uid) - Cria um item2 em um tile doAddContainerItemEx(uid, virtuid) - Adiciona um item2 no container doCreateTeleport(itemid, topos, createpos) - Cria um teleport doSummonCreature(name, pos) - Sumona um monstro Existem mais comandos porém são rarissimos de ser usados. Por que os cara do TFS criam comandos em Luas para o Gesior e Jiddo se lascarem criando tranqueiras em Lua. Stackpos Sem duvidas, umas das partes mais chatas de explicar, porém ao aprender é dificil esquecer. O stackpos é usado para se mexer em itens empilhados, infelizmente ele se modifica muito então essa tabela mostra os stackpos que não mudam. Agora tirando isso os de 2 a 252 sempre mudam (Eu acho que não esqueci os outros que mudam), então vou tentar explicar do jeito que entendi antigamente... Se você tem empilhado o chão, uma mesa, e um bag. Os stackpos ficam assim Agora se você tem os mesmo itens e em cima da bag uma backpack e um scarab coin. Confundiu ? Sim é normal, se houver três ou mais itens acima do chão, o chão e o objeto acima dele continuam com o mesmo stackpos. Porém depois é contado de cima para baixo. Veja esse exemplo : stackpos: Nesse caso a ordem dos itens de baixo para cima é : Areia, mesa, dead human, machete, shovel, rope, gold coin.bag e backpack. Entenderam agora ? Se não tente fazer uns testes que com certeza entenderá. E depois pelo seu bem, tente não esquecer isso. Pois em movements é importantissimo. Bem esse tutorial foi leve e servirá de base para os proximos, pois esses comandos podem ser usados em tudo que há lua. Peço desculpas se ele fico confuso Pois não estou vagal quanto antes e tenho pouco tempo... Esperem que virão mais tutoriais. Comentarios é o combustivel. Então deem sugestões, reclamações ou me ofendam sei la.
    1 ponto
Líderes está configurado para São Paulo/GMT-03:00
×
×
  • Criar Novo...