Ir para conteúdo

bamb00

Membro
  • Registro em

  • Última visita

Histórico de Curtidas

  1. Gostei
    bamb00 deu reputação a ManoTobira em [action] Edo Tensei   
    primeiro crie os monstros de edo tensei
     
    em actions copie um arquivo e renomeie para edocatch
     
    apague tudo oq tem nele e cole isso
     
    primeiro crie os monstros de edo tensei
     
    em actions copie um arquivo e renomeie para edocatch
     
    apague tudo oq tem nele e cole isso
     
    local mtrs = {                   ["[Edo Tensei] Madara] = {hp = 50000, maxhp = 50000, corpse = 2936, chance = 100},                 ["[Edo Tensei] Sasuke] = {hp = 50000, maxhp = 50000, corpse = 2806, chance = 100},                 ["[Edo Tensei] Deidara] = {hp = 50000, maxhp = 50000, corpse = 2879, chance = 100}, } local vocs = {300, 649} local corpos = {2936, 2806, 2879}   function onUse(cid, item, frompos, item2, topos) if(not(isInArray(vocs, getPlayerVocation(cid)))) then return doPlayerSendTextMessage(cid, 26, "You cannot use this object.") end if(not(isInArray(corpos, item2.itemid))) then doPlayerPopupFYI(cid, "Para usar o Edo Tensei você deve usar o pergaminho em algum corpo de um jogador.") return true end                 for pet_name, v in pairs(mtrs) do                                 if item2.itemid == v.corpse then                                         if math.random(0,100) <= v.chance then doSendMagicEffect(topos, 2)                                                 doPlayerSendTextMessage(cid, 27, "".. pet_name .. " foi selado nesse pergaminho.")                                                 doRemoveItem(item2.uid, 1)                                                 doRemoveItem(item.uid, 1)                                                 local itemcatch = doPlayerAddItem(cid, 11390, 1)                                                 doItemSetAttribute(itemcatch, "namepet", pet_name)                                                 doItemSetAttribute(itemcatch, "description", "Neste pergaminho foi selado um ".. pet_name ..".")                                                 doItemSetAttribute(itemcatch, "lifepet", v.hp)                                                 doItemSetAttribute(itemcatch, "maxlifepet", v.maxhp)                                         else                                                 doPlayerSendTextMessage(cid, 27, "Falhou.")                                         end                                 end                 end                 return true end  
         Configuração
    azul=nome do monster
    verde=hp que o monster vai nasce
    azul fraco=id do monster morto
    rosa=chance de selar o corpo
    amarelo=vocaçoes para usar o edo tensei
    vermelho=id do item que solta o edo tensei
     
    agora copie outro arquivo e renomeie para edogo
     
    apague tudo oq tem dentro e cole isso
     
    local config = { percent = 15, --- porcentagem do chakra que perde }   function onUse(cid, item, frompos, item2, topos)     local health = tonumber(getItemAttribute(item.uid, "lifepet"))     local mhp = tonumber(getItemAttribute(item.uid, "maxlifepet")) local lifedraw = math.ceil(getCreatureMaxHealth(cid) * (config.percent)/100) local vocs = {300, 649} local msg0 = [[ Você ssó pode ter 0 summon(s), A seguinte tabela mostra os leveis e o respectivo número de summons que um player terá ao estar nele   Level <~> [summons]   ~->50[1] ~->150[2] ~->200[2] ~->350[3] ~->450[4] ]]   local msg1 = [[ Você ssó pode ter 1 summon(s), A seguinte tabela mostra os leveis e o respectivo número de summons que um player terá ao estar nele   Level <~> [summons]   ~->50[1] ~->150[2] ~->200[2] ~->350[3] ~->450[4] ]]   local msg2 = [[ Você ssó pode ter 2 summon(s), A seguinte tabela mostra os leveis e o respectivo número de summons que um player terá ao estar nele   Level <~> [summons]   ~->50[1] ~->150[2] ~->200[2] ~->350[3] ~->450[4] ]]   local msg3 = [[ Você ssó pode ter 3 summon(s), A seguinte tabela mostra os leveis e o respectivo número de summons que um player terá ao estar nele   Level <~> [summons]   ~->50[1] ~->150[2] ~->200[2] ~->350[3] ~->450[4] ]]   local msg4 = [[ Você ssó pode ter 4 summon(s), A seguinte tabela mostra os leveis e o respectivo número de summons que um player terá ao estar nele   Level <~> [summons]   ~->50[1] ~->150[2] ~->200[2] ~->350[3] ~->450[4] ]]   if(not(isInArray(vocs, getPlayerVocation(cid)))) then return doPlayerSendTextMessage(cid, 26, "You cannot use this object.") end   if health <= 0 then return doPlayerSendCancel(cid, "Esse pet esta morto.") end     if #getCreatureSummons(cid) == 0 and getPlayerLevel(cid) <= 49 then doPlayerPopupFYI(cid, msg0)     return true end   if #getCreatureSummons(cid) == 1 and getPlayerLevel(cid) <= 149 then doPlayerPopupFYI(cid, msg1)     return true end   if #getCreatureSummons(cid) == 1 and getPlayerLevel(cid) <= 199 then doPlayerPopupFYI(cid, msg1)     return true end   if #getCreatureSummons(cid) == 2 and getPlayerLevel(cid) <= 349 then doPlayerPopupFYI(cid, msg2)     return true end   if #getCreatureSummons(cid) == 3 and getPlayerLevel(cid) <= 449 then doPlayerPopupFYI(cid, msg3)     return true end   if #getCreatureSummons(cid) == 4 and getPlayerLevel(cid) >= 450 then doPlayerPopupFYI(cid, msg4)     return true end       local pet_name = getItemAttribute(item.uid, "namepet")   if item.itemid == 11390 then if not getTilePzInfo(getPlayerPosition(cid)) then if #getCreatureSummons(cid) < 1 and getPlayerLevel(cid) > 49 or #getCreatureSummons(cid) < 2 and getPlayerLevel(cid) > 149 or #getCreatureSummons(cid) < 2 and getPlayerLevel(cid) > 199 or #getCreatureSummons(cid) < 3 and getPlayerLevel(cid) > 349 or #getCreatureSummons(cid) < 4 and getPlayerLevel(cid) > 449 then if isCreature(cid) then if getCreatureMaxHealth(cid) then   local summon = doSummonCreature(pet_name, topos) doRemoveItem(item.uid, 1)                 doConvinceCreature(cid, summon)                 setCreatureMaxHealth(summon, mhp)                 doCreatureAddHealth(summon, mhp)                 doCreatureAddHealth(summon, health - mhp) doCreatureAddHealth(cid, -5000) doCreatureAddMana(cid, -5103)                 doSendMagicEffect(getCreaturePosition(summon), 2)                 doCreatureSay(cid, "EDO TENSEI!", 19) end else doPlayerSendCancel(cid,'Você não pode invocar uma criatura de uma zona protegida.') end     end end end     return true end        Configuração
    local msg=tabela do edo tensei e nessa parte getCreatureSummons(cid) < 1 é a quantidade de summon e nessa getPlayerLevel(cid) > 49 é o level pra usa no caso é 50 porque tem que colocar 1 a menos
     
    agora abra actions.xml e adicione
     
    <!-- Edo Tensei --> <action itemid="11389" event="script" value="edocatch.lua"/> <action itemid="11390" event="script" value="edogo.lua"/>        Configuração azul=id do item que captura o edo tensei vermelho=id do item que solta o edo tensei     Créditos   BananaFight LuckOake MaXwElldEn Gears PsyMcKenzie   por terem criado o pet system que usei de base
  2. Curtir
    bamb00 deu reputação a Yota em [C ]Level System in monster [0.3.6]   
    Boa noite, venho compartilhar o código feito por @Oneshot/ @Garou, com adaptação para tfs 0.3.6 (854) por mim. Bem, ele postou para atfs 0.4 (860), dai eu só mexi em umas linhas parar funcionar no tfs 0.3.6(854), dai vou compartilhar com vocês.
    Com o monster level system, o monstro passa a ter level e ganha mais HP, dá mais dano, tem mais defesa, dependendo dele. monsters.h
    procure por:
    bool isSummonable, isIllusionable, isConvinceable, isAttackable, isHostile, isLureable, isWalkable, canPushItems, canPushCreatures, pushable, hideName, hideHealth; Substitua por:
    bool isSummonable, isIllusionable, isConvinceable, isAttackable, isHostile, isLureable, isWalkable, canPushItems, canPushCreatures, pushable, hideName, hideHealth, hideLevel; Procure 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; monsters.cpp
     
    Procure por:
    canPushItems = canPushCreatures = isSummonable = isIllusionable = isConvinceable = isLureable = isWalkable = hideName = hideHealth = false; Substitua por:
    canPushItems = canPushCreatures = isSummonable = isIllusionable = isConvinceable = isLureable = isWalkable = hideName = hideHealth = hideLevel = false; Procure por:
    baseSpeed = 200; Logo abaixo, adicione:
    levelMin = levelMax = 1; Localize:
    if(readXMLInteger(p, "max", intValue)) mType->healthMax = intValue; else { SHOW_XML_ERROR("Missing health.max"); monsterLoad = false; } } abaixo adicione:
    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; } procure por:
    if(readXMLString(tmpNode, "shield", strValue)) mType->partyShield = getPartyShield(strValue); logo baixo adicione:
    if(readXMLString(tmpNode, "hidelevel", strValue)) mType->hideLevel = booleanString(strValue); Monster.h
    Procure:
    virtual ~Monster(); std::string name, nameDescription; abaixo adicione:
    std::string name, nameDescription; int32_t level; double bonusAttack, bonusDefense; Procure:
    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 + ".";} Monster.cpp
     
    Logo 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; Procure por está função:
    Monster::onCreatureAppear Apague e coloque está função:
    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((uint32_t)"1996", value); this->master->getStorage((uint32_t)"1996", 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)); } Substitua todos:
    g_config.getDouble(ConfigManager::RATE_MONSTER_DEFENSE) Por:
    g_config.getDouble(ConfigManager::RATE_MONSTER_DEFENSE) * bonusDefense Substitua todos:
    g_config.getDouble(ConfigManager::RATE_MONSTER_ATTACK) Por:
    g_config.getDouble(ConfigManager::RATE_MONSTER_ATTACK) * bonusAttack Map.cpp
     
    Procure por:
    #include "game.h" Adicione em baixo:
    #include "configmanager.h"  Procure por:
    extern Game g_game; Adicione em baixo:
    extern ConfigManager g_config; Procure por está função:
    bool Map::placeCreature(const Position& centerPos, Creature* creature, bool extendedPos /*= false*/, bool forced /*= false*/) { Abaixo do " { " adicione:
    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((uint32_t)"1996", value); monster->getMaster()->getStorage((uint32_t)"1996", 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) + "]"; } } configmanager.h
     
    Procure por:
    ADDONS_PREMIUM, e abaixo adicione logo em baixo:
    MONSTER_HAS_LEVEL, configmanager.cpp
    procure por:
    m_confBool[ADDONS_PREMIUM] = getGlobalBool("addonsOnlyPremium", true); e logo em baixo adicione:
    m_confBool[MONSTER_HAS_LEVEL] = getGlobalBool("monsterHasLevel", true); no Config.lua adicione:
    monsterHasLevel = true -- true para monstros nascerem com level, false para não nascerem com level São muitas modificações para fazer, mas o resultado é garantido e é uma funcionalidade a mais para seu servidor.
    Como está programado, a cada level, monstros ganham 10% de HP, 1% de dano e 0.5% de defesa.
     
    Para configurar level mínimo e máximo, é só adicionar no XML do monstro:
    <level min="1" max="10"/> -- level minimo, level maximo E alterar a seu gosto.
    Se você fizer certo irá ficar assim:

     
    Créditos:
    @Oneshot

Informação Importante

Confirmação de Termo