Postado Maio 29, 2020 5 anos Este é um post popular. Testado em tfs 0.4 e otx 2! Em monsters.h procure por: Mostrar conteúdo oculto bool isSummonable, isIllusionable, isConvinceable, isAttackable, isHostile, isLureable, isWalkable, canPushItems, canPushCreatures, pushable, hideName, hideHealth; E substitua por: bool isSummonable, isIllusionable, isConvinceable, isAttackable, isHostile, isLureable, isWalkable, canPushItems, canPushCreatures, pushable, hideName, hideHealth, hideLevel; Busque por: int32_t defense, armor, health, healthMax, baseSpeed, lookCorpse, corpseUnique, corpseAction, maxSummons, targetDistance, runAwayHealth, conditionImmunities, damageImmunities, lightLevel, lightColor, changeTargetSpeed, changeTargetChance; Substitua por: int32_t defense, armor, health, healthMax, baseSpeed, lookCorpse, corpseUnique, corpseAction, maxSummons, targetDistance, runAwayHealth, conditionImmunities, damageImmunities, lightLevel, lightColor, changeTargetSpeed, changeTargetChance, levelMin, levelMax; Em monsters.cpp procure por: Mostrar conteúdo oculto canPushItems = canPushCreatures = isSummonable = isIllusionable = isConvinceable = isLureable = isWalkable = hideName = hideHealth = false; Substitua por: canPushItems = canPushCreatures = isSummonable = isIllusionable = isConvinceable = isLureable = isWalkable = hideName = hideHealth = hideLevel = false; Busque por: baseSpeed = 200; Adicione abaixo: levelMin = levelMax = 1; Busque por: bool Monsters::loadMonster Você encontrara está função: for(xmlNodePtr p = root->children; p; p = p->next) { if(p->type != XML_ELEMENT_NODE) continue; if(!xmlStrcmp(p->name, (const xmlChar*)"health")) { if(!readXMLInteger(p, "max", intValue)) { SHOW_XML_ERROR("Missing health.max"); monsterLoad = false; break; } mType->healthMax = intValue; if(!readXMLInteger(p, "now", intValue)) mType->health = mType->healthMax; else mType->health = intValue; } Adicione abaixo: else if(!xmlStrcmp(p->name, (const xmlChar*)"level")) { if(!readXMLInteger(p, "max", intValue)) mType->levelMax = 1; else mType->levelMax = intValue; if(!readXMLInteger(p, "min", intValue)) mType->levelMin = mType->levelMax; else mType->levelMin = intValue; } Busque por: if(readXMLString(tmpNode, "emblem", strValue)) mType->guildEmblem = getEmblems(strValue); Adicione abaixo: if(readXMLString(tmpNode, "hidelevel", strValue)) mType->hideLevel = booleanString(strValue); Em monster.h procure por: Mostrar conteúdo oculto class Monster : public Creature { E logo abaixo disto: public: #ifdef __ENABLE_SERVER_DIAGNOSTIC__ static uint32_t monsterCount; #endif virtual ~Monster(); Adicione: std::string name, nameDescription; int32_t level; double bonusAttack, bonusDefense; Busque por: virtual const std::string& getName() const {return mType->name;} virtual const std::string& getNameDescription() const {return mType->nameDescription;} virtual std::string getDescription(int32_t) const {return mType->nameDescription + ".";} Substitua por: virtual const std::string& getName() const {return name;} virtual const std::string& getNameDescription() const {return nameDescription;} virtual std::string getDescription(int32_t) const {return nameDescription + ".";} Em monster.cpp procure por: Mostrar conteúdo oculto Monster::Monster(MonsterType* _mType): E abaixo de: isIdle = true; Adicione: name = _mType->name; nameDescription = _mType->nameDescription; level = (int32_t)random_range(_mType->levelMin, _mType->levelMax, DISTRO_NORMAL); bonusAttack = 1.0; bonusDefense = 1.0; Busque por: Monster::onCreatureAppear Substitua toda a função por: void Monster::onCreatureAppear(const Creature* creature) { Creature::onCreatureAppear(creature); if(creature == this) { //We just spawned lets look around to see who is there. if(isSummon()) { std::string value; this->master->getStorage((std::string)"monster_level", value); uint8_t intValue = atoi(value.c_str()); if(intValue || value == "0") level = intValue; else level = 1; isMasterInRange = canSee(master->getPosition()); } if(g_config.getBool(ConfigManager::MONSTER_HAS_LEVEL)) { this->healthMax = std::floor(this->getMaxHealth() * (1. + (0.1 * (level - 1)))); this->health = this->healthMax; this->bonusAttack += (0.01 * (level - 1)); this->bonusDefense += (0.005 * (level - 1)); } updateTargetList(); updateIdleStatus(); } else onCreatureEnter(const_cast<Creature*>(creature)); } Busque por: g_config.getDouble(ConfigManager::RATE_MONSTER_DEFENSE) Substitua por: g_config.getDouble(ConfigManager::RATE_MONSTER_DEFENSE) * bonusDefense Busque por: g_config.getDouble(ConfigManager::RATE_MONSTER_ATTACK) Substitua por: g_config.getDouble(ConfigManager::RATE_MONSTER_ATTACK) * bonusAttack Em map.cpp procure por: Mostrar conteúdo oculto #include "game.h" Adicione abaixo: #include "configmanager.h" Busque por: extern Game g_game; Adicione abaixo: extern ConfigManager g_config; Busque por: bool Map::placeCreature { Adicione abaixo: Monster* monster = creature->getMonster(); if(monster && g_config.getBool(ConfigManager::MONSTER_HAS_LEVEL)) { uint8_t level; if(!monster->getMonsterType()->hideLevel) { if(monster->isSummon()) { std::string value; monster->getMaster()->getStorage((std::string)"monster_level", value); uint8_t intValue = atoi(value.c_str()); if(intValue || value == "0") level = intValue; else level = 1; } else level = monster->level; char buffer [10]; monster->name = monster->getName() + " [" + atoi(level, buffer, 10) + "]"; } } bool foundTile = false, placeInPz = false; Tile* tile = getTile(centerPos); if (tile && !extendedPos) { placeInPz = tile->hasFlag(TILESTATE_PROTECTIONZONE); uint32_t flags = FLAG_IGNOREBLOCKITEM; if (creature->isAccountManager()) flags |= FLAG_IGNOREBLOCKCREATURE; ReturnValue ret = tile->__queryAdd(0, creature, 1, flags); if (forced || ret == RET_NOERROR || ret == RET_PLAYERISNOTINVITED) foundTile = true; } size_t shufflePos = 0; PairVector relList; if (extendedPos) { shufflePos = 8; relList.push_back(PositionPair(-2, 0)); relList.push_back(PositionPair(0, -2)); relList.push_back(PositionPair(0, 2)); relList.push_back(PositionPair(2, 0)); std::random_shuffle(relList.begin(), relList.end()); } relList.push_back(PositionPair(-1, -1)); relList.push_back(PositionPair(-1, 0)); relList.push_back(PositionPair(-1, 1)); relList.push_back(PositionPair(0, -1)); relList.push_back(PositionPair(0, 1)); relList.push_back(PositionPair(1, -1)); relList.push_back(PositionPair(1, 0)); relList.push_back(PositionPair(1, 1)); std::random_shuffle(relList.begin() + shufflePos, relList.end()); uint32_t radius = 1; Position tryPos; for (uint32_t n = 1; n <= radius && !foundTile; ++n) { for (PairVector::iterator it = relList.begin(); it != relList.end() && !foundTile; ++it) { int32_t dx = it->first * n, dy = it->second * n; tryPos = centerPos; tryPos.x = tryPos.x + dx; tryPos.y = tryPos.y + dy; if (!(tile = getTile(tryPos)) || (placeInPz && !tile->hasFlag(TILESTATE_PROTECTIONZONE))) continue; if (tile->__queryAdd(0, creature, 1, 0) == RET_NOERROR) { if (!extendedPos) { foundTile = true; break; } if (isSightClear(centerPos, tryPos, false)) { foundTile = true; break; } } } } if (!foundTile) return false; int32_t index = 0; uint32_t flags = 0; Item* toItem = NULL; if (Cylinder* toCylinder = tile->__queryDestination(index, creature, &toItem, flags)) { toCylinder->__internalAddThing(creature); if (Tile* toTile = toCylinder->getTile()) toTile->qt_node->addCreature(creature); } return true; } Em configmanager.h busque por; Mostrar conteúdo oculto MONSTER_SPAWN_WALKBACK, Adicione abaixo: MONSTER_HAS_LEVEL, Em configmanager.cpp busque por: Mostrar conteúdo oculto m_loaded = true; Adicione abaixo: m_confBool[MONSTER_HAS_LEVEL] = getGlobalBool("monsterHasLevel", true); Agora no config.lua adicione: monsterHasLevel = true Como está programado, a cada nível, monstros ganham 10% de HP, 1% de dano e 0.5% de defesa. Para configurar o level minimo e máximo do monstro basta adicionar no XML do monstro a tag: <level min="1" max="10"/>
Postado Maio 29, 2020 5 anos Muito interessante esse sistema, torna o hunting mais desafiador e divertido, obrigado por compartilhar Ot Design: https://discord.gg/VgtVRNmCD7
Postado Maio 29, 2020 5 anos serve para todas a versões do TFS e OTX? Se você só testou em TFS 0.4 coloque no título TFS 0.4. STYLLER OT 2022
Postado Maio 29, 2020 5 anos @.HuRRiKaNe o bug do primeiro spawn dos monstros nascer tudo level 1 ta fixado? Compre seus Scripts Agora totalmente seguro e de forma rápida, aceitamos também encomendas. discord.gg/phJZeHa2k4 Projeto ATS (Naruto) Informações Abaixo Facebook Youtube Discord Tutoriais / Conteúdos Clique Aqui
Postado Maio 29, 2020 5 anos Em 29/05/2020 em 16:15, .HuRRiKaNe disse: Testado em tfs 0.4! Em monsters.h procure por: Mostrar conteúdo oculto Mostrar conteúdo oculto bool isSummonable, isIllusionable, isConvinceable, isAttackable, isHostile, isLureable, isWalkable, canPushItems, canPushCreatures, pushable, hideName, hideHealth; E substitua por: bool isSummonable, isIllusionable, isConvinceable, isAttackable, isHostile, isLureable, isWalkable, canPushItems, canPushCreatures, pushable, hideName, hideHealth, hideLevel; Busque por: int32_t defense, armor, health, healthMax, baseSpeed, lookCorpse, corpseUnique, corpseAction, maxSummons, targetDistance, runAwayHealth, conditionImmunities, damageImmunities, lightLevel, lightColor, changeTargetSpeed, changeTargetChance; Substitua por: int32_t defense, armor, health, healthMax, baseSpeed, lookCorpse, corpseUnique, corpseAction, maxSummons, targetDistance, runAwayHealth, conditionImmunities, damageImmunities, lightLevel, lightColor, changeTargetSpeed, changeTargetChance, levelMin, levelMax; Em monsters.cpp procure por: Mostrar conteúdo oculto Mostrar conteúdo oculto canPushItems = canPushCreatures = isSummonable = isIllusionable = isConvinceable = isLureable = isWalkable = hideName = hideHealth = false; Substitua por: canPushItems = canPushCreatures = isSummonable = isIllusionable = isConvinceable = isLureable = isWalkable = hideName = hideHealth = hideLevel = false; Busque por: baseSpeed = 200; Adicione abaixo: levelMin = levelMax = 1; Busque por: bool Monsters::loadMonster Você encontrara está função: for(xmlNodePtr p = root->children; p; p = p->next) { if(p->type != XML_ELEMENT_NODE) continue; if(!xmlStrcmp(p->name, (const xmlChar*)"health")) { if(!readXMLInteger(p, "max", intValue)) { SHOW_XML_ERROR("Missing health.max"); monsterLoad = false; break; } mType->healthMax = intValue; if(!readXMLInteger(p, "now", intValue)) mType->health = mType->healthMax; else mType->health = intValue; } Adicione abaixo: else if(!xmlStrcmp(p->name, (const xmlChar*)"level")) { if(!readXMLInteger(p, "max", intValue)) mType->levelMax = 1; else mType->levelMax = intValue; if(!readXMLInteger(p, "min", intValue)) mType->levelMin = mType->levelMax; else mType->levelMin = intValue; } Busque por: if(readXMLString(tmpNode, "emblem", strValue)) mType->guildEmblem = getEmblems(strValue); Adicione abaixo: if(readXMLString(tmpNode, "hidelevel", strValue)) mType->hideLevel = booleanString(strValue); Em monster.h procure por: Mostrar conteúdo oculto Mostrar conteúdo oculto class Monster : public Creature { E logo abaixo disto: public: #ifdef __ENABLE_SERVER_DIAGNOSTIC__ static uint32_t monsterCount; #endif virtual ~Monster(); Adicione: std::string name, nameDescription; int32_t level; double bonusAttack, bonusDefense; Busque por: virtual const std::string& getName() const {return mType->name;} virtual const std::string& getNameDescription() const {return mType->nameDescription;} virtual std::string getDescription(int32_t) const {return mType->nameDescription + ".";} Substitua por: virtual const std::string& getName() const {return name;} virtual const std::string& getNameDescription() const {return nameDescription;} virtual std::string getDescription(int32_t) const {return nameDescription + ".";} Em monster.cpp procure por: Mostrar conteúdo oculto Mostrar conteúdo oculto Monster::Monster(MonsterType* _mType): E abaixo de: isIdle = true; Adicione: name = _mType->name; nameDescription = _mType->nameDescription; level = (int32_t)random_range(_mType->levelMin, _mType->levelMax, DISTRO_NORMAL); bonusAttack = 1.0; bonusDefense = 1.0; Busque por: Monster::onCreatureAppear Substitua toda a função por: void Monster::onCreatureAppear(const Creature* creature) { Creature::onCreatureAppear(creature); if(creature == this) { //We just spawned lets look around to see who is there. if(isSummon()) { std::string value; this->master->getStorage((std::string)"monster_level", value); uint8_t intValue = atoi(value.c_str()); if(intValue || value == "0") level = intValue; else level = 1; isMasterInRange = canSee(master->getPosition()); } if(g_config.getBool(ConfigManager::MONSTER_HAS_LEVEL)) { this->healthMax = std::floor(this->getMaxHealth() * (1. + (0.1 * (level - 1)))); this->health = this->healthMax; this->bonusAttack += (0.01 * (level - 1)); this->bonusDefense += (0.005 * (level - 1)); } updateTargetList(); updateIdleStatus(); } else onCreatureEnter(const_cast<Creature*>(creature)); } Busque por: g_config.getDouble(ConfigManager::RATE_MONSTER_DEFENSE) Substitua por: g_config.getDouble(ConfigManager::RATE_MONSTER_DEFENSE) * bonusDefense Busque por: g_config.getDouble(ConfigManager::RATE_MONSTER_ATTACK) Substitua por: g_config.getDouble(ConfigManager::RATE_MONSTER_ATTACK) * bonusAttack Em map.cpp procure por: Mostrar conteúdo oculto Mostrar conteúdo oculto #include "game.h" Adicione abaixo: #include "configmanager.h" Busque por: extern Game g_game; Adicione abaixo: extern ConfigManager g_config; Busque por: bool Map::placeCreature { Adicione abaixo: Monster* monster = creature->getMonster(); if(monster && g_config.getBool(ConfigManager::MONSTER_HAS_LEVEL)) { uint8_t level; if(!monster->getMonsterType()->hideLevel) { if(monster->isSummon()) { std::string value; monster->getMaster()->getStorage((std::string)"monster_level", value); uint8_t intValue = atoi(value.c_str()); if(intValue || value == "0") level = intValue; else level = 1; } else level = monster->level; char buffer [10]; monster->name = monster->getName() + " [" + itoa(level, buffer, 10) + "]"; } } bool foundTile = false, placeInPz = false; Tile* tile = getTile(centerPos); if (tile && !extendedPos) { placeInPz = tile->hasFlag(TILESTATE_PROTECTIONZONE); uint32_t flags = FLAG_IGNOREBLOCKITEM; if (creature->isAccountManager()) flags |= FLAG_IGNOREBLOCKCREATURE; ReturnValue ret = tile->__queryAdd(0, creature, 1, flags); if (forced || ret == RET_NOERROR || ret == RET_PLAYERISNOTINVITED) foundTile = true; } size_t shufflePos = 0; PairVector relList; if (extendedPos) { shufflePos = 8; relList.push_back(PositionPair(-2, 0)); relList.push_back(PositionPair(0, -2)); relList.push_back(PositionPair(0, 2)); relList.push_back(PositionPair(2, 0)); std::random_shuffle(relList.begin(), relList.end()); } relList.push_back(PositionPair(-1, -1)); relList.push_back(PositionPair(-1, 0)); relList.push_back(PositionPair(-1, 1)); relList.push_back(PositionPair(0, -1)); relList.push_back(PositionPair(0, 1)); relList.push_back(PositionPair(1, -1)); relList.push_back(PositionPair(1, 0)); relList.push_back(PositionPair(1, 1)); std::random_shuffle(relList.begin() + shufflePos, relList.end()); uint32_t radius = 1; Position tryPos; for (uint32_t n = 1; n <= radius && !foundTile; ++n) { for (PairVector::iterator it = relList.begin(); it != relList.end() && !foundTile; ++it) { int32_t dx = it->first * n, dy = it->second * n; tryPos = centerPos; tryPos.x = tryPos.x + dx; tryPos.y = tryPos.y + dy; if (!(tile = getTile(tryPos)) || (placeInPz && !tile->hasFlag(TILESTATE_PROTECTIONZONE))) continue; if (tile->__queryAdd(0, creature, 1, 0) == RET_NOERROR) { if (!extendedPos) { foundTile = true; break; } if (isSightClear(centerPos, tryPos, false)) { foundTile = true; break; } } } } if (!foundTile) return false; int32_t index = 0; uint32_t flags = 0; Item* toItem = NULL; if (Cylinder* toCylinder = tile->__queryDestination(index, creature, &toItem, flags)) { toCylinder->__internalAddThing(creature); if (Tile* toTile = toCylinder->getTile()) toTile->qt_node->addCreature(creature); } return true; } Em configmanager.h busque por; Mostrar conteúdo oculto Mostrar conteúdo oculto MONSTER_SPAWN_WALKBACK, Adicione abaixo: MONSTER_HAS_LEVEL, Em configmanager.cpp busque por: Mostrar conteúdo oculto Mostrar conteúdo oculto m_loaded = true; Adicione abaixo: m_confBool[MONSTER_HAS_LEVEL] = getGlobalBool("monsterHasLevel", true); Agora no config.lua adicione: monsterHasLevel = true Como está programado, a cada nível, monstros ganham 10% de HP, 1% de dano e 0.5% de defesa. Para configurar o level minimo e máximo do monstro basta adicionar no XML do monstro a tag: <level min="1" max="10"/> Oque esse sistema faz? não tem nada explicando sobre poderia dizer?
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.