Ir para conteúdo

Featured Replies

Postado

Olá. Preciso de ajuda criando um boss.

Pensei em um bandido, ele "sangraria" gold ao invés de sangue mesmo, deixaria montes de gold no chão sempre que levasse um ataque.

97% chance sangrar 0-20 gold coins.

03% chance de sangrar 0-2 platinum coin.

 

Preciso também que ele tenha alguma magia/evento que o teleporte de tempo em tempo na tela pra algum lugar aleatório, pra que seja extremamente difícil ou até mesmo impossível de ficar "trapado".

Muito obrigado.

 

Qual servidor ou website você utiliza como base? 

Canary, versões mais recentes.

Qual o motivo deste tópico? 

Preciso de ajudar para adicionar um boss.

 

local mType = Game.createMonsterType("Treasure Bandit")
local monster = {}

monster.description = "a treasure bandit"
monster.experience = 600
monster.outfit = {
    lookType = 129,
    lookHead = 58,
    lookBody = 40,
    lookLegs = 24,
    lookFeet = 95,
    lookAddons = 0,
    lookMount = 0
}

monster.raceId = 223
monster.Bestiary = {
    class = "Human",
    race = BESTY_RACE_HUMAN,
    toKill = 500,
    FirstUnlock = 25,
    SecondUnlock = 250,
    CharmsPoints = 5,
    Stars = 2,
    Occurrence = 0,
    Locations = "Pode ser encontrado nas redondezas de Mortland."
    }

monster.health = 1200
monster.maxHealth = 1200
monster.race = "blood"
monster.corpse = 18050
monster.speed = 180
monster.manaCost = 450

monster.changeTarget = {
    interval = 5000,
    chance = 0
}

monster.strategiesTarget = {
    nearest = 30,
    health = 10,
    damage = 10,
    random = 50,
}

monster.flags = {
    summonable = false,
    attackable = true,
    hostile = true,
    convinceable = false,
    pushable = false,
    rewardBoss = false,
    illusionable = true,
    canPushItems = true,
    canPushCreatures = true,
    staticAttackChance = 90,
    targetDistance = 4,
    runHealth = 240,
    healthHidden = false,
    isBlockable = false,
    canWalkOnEnergy = true,
    canWalkOnFire = true,
    canWalkOnPoison = true
}

monster.light = {
    level = 0,
    color = 0
}

monster.voices = {
    interval = 6000,
    chance = 10,
    {text = "Não fui eu!", yell = false},
    {text = "Tente me pegar!", yell = false}
}

monster.loot = {
    {name = "gold coin", chance = 83940, maxCount = 40}, --
    {name = "platinum coin", chance = 29900, maxCount = 2}, --
    {name = "meat", chance = 12350}, --
    {name = "rope belt", chance = 4110}
}

monster.attacks = {
    {name ="melee", interval = 2000, chance = 100, minDamage = 0, maxDamage = -68},
    {name ="combat", interval = 3000, chance = 30, type = COMBAT_PHYSICALDAMAGE, minDamage = 0, maxDamage = -80, range = 7, shootEffect = CONST_ANI_SPEAR, target = false}
}

monster.defenses = {
    defense = 25,
    armor = 20
}

monster.elements = {
    {type = COMBAT_PHYSICALDAMAGE, percent = 5},
    {type = COMBAT_ENERGYDAMAGE, percent = 10},
    {type = COMBAT_EARTHDAMAGE, percent = 10},
    {type = COMBAT_FIREDAMAGE, percent = 0},
    {type = COMBAT_LIFEDRAIN, percent = 0},
    {type = COMBAT_MANADRAIN, percent = 0},
    {type = COMBAT_DROWNDAMAGE, percent = 0},
    {type = COMBAT_ICEDAMAGE, percent = -10},
    {type = COMBAT_HOLYDAMAGE , percent = 0},
    {type = COMBAT_DEATHDAMAGE , percent = -5}
}

monster.immunities = {
    {type = "paralyze", condition = false},
    {type = "outfit", condition = false},
    {type = "invisible", condition = false},
    {type = "bleed", condition = false}
}

mType:register(monster)

 

Editado por ambrosiotibia (veja o histórico de edições)

Postado
On 1/1/2023 at 10:25 PM, ambrosiotibia said:

Olá. Preciso de ajuda criando um boss.

Pensei em um bandido, ele "sangraria" gold ao invés de sangue mesmo, deixaria montes de gold no chão sempre que levasse um ataque.

97% chance sangrar 0-20 gold coins.

03% chance de sangrar 0-2 platinum coin.

 

Preciso também que ele tenha alguma magia/evento que o teleporte de tempo em tempo na tela pra algum lugar aleatório, pra que seja extremamente difícil ou até mesmo impossível de ficar "trapado".

Muito obrigado.

 

Qual servidor ou website você utiliza como base? 

Canary, versões mais recentes.

Qual o motivo deste tópico? 

Preciso de ajudar para adicionar um boss.

 


local mType = Game.createMonsterType("Treasure Bandit")
local monster = {}

monster.description = "a treasure bandit"
monster.experience = 600
monster.outfit = {
    lookType = 129,
    lookHead = 58,
    lookBody = 40,
    lookLegs = 24,
    lookFeet = 95,
    lookAddons = 0,
    lookMount = 0
}

monster.raceId = 223
monster.Bestiary = {
    class = "Human",
    race = BESTY_RACE_HUMAN,
    toKill = 500,
    FirstUnlock = 25,
    SecondUnlock = 250,
    CharmsPoints = 5,
    Stars = 2,
    Occurrence = 0,
    Locations = "Pode ser encontrado nas redondezas de Mortland."
    }

monster.health = 1200
monster.maxHealth = 1200
monster.race = "blood"
monster.corpse = 18050
monster.speed = 180
monster.manaCost = 450

monster.changeTarget = {
    interval = 5000,
    chance = 0
}

monster.strategiesTarget = {
    nearest = 30,
    health = 10,
    damage = 10,
    random = 50,
}

monster.flags = {
    summonable = false,
    attackable = true,
    hostile = true,
    convinceable = false,
    pushable = false,
    rewardBoss = false,
    illusionable = true,
    canPushItems = true,
    canPushCreatures = true,
    staticAttackChance = 90,
    targetDistance = 4,
    runHealth = 240,
    healthHidden = false,
    isBlockable = false,
    canWalkOnEnergy = true,
    canWalkOnFire = true,
    canWalkOnPoison = true
}

monster.light = {
    level = 0,
    color = 0
}

monster.voices = {
    interval = 6000,
    chance = 10,
    {text = "Não fui eu!", yell = false},
    {text = "Tente me pegar!", yell = false}
}

monster.loot = {
    {name = "gold coin", chance = 83940, maxCount = 40}, --
    {name = "platinum coin", chance = 29900, maxCount = 2}, --
    {name = "meat", chance = 12350}, --
    {name = "rope belt", chance = 4110}
}

monster.attacks = {
    {name ="melee", interval = 2000, chance = 100, minDamage = 0, maxDamage = -68},
    {name ="combat", interval = 3000, chance = 30, type = COMBAT_PHYSICALDAMAGE, minDamage = 0, maxDamage = -80, range = 7, shootEffect = CONST_ANI_SPEAR, target = false}
}

monster.defenses = {
    defense = 25,
    armor = 20
}

monster.elements = {
    {type = COMBAT_PHYSICALDAMAGE, percent = 5},
    {type = COMBAT_ENERGYDAMAGE, percent = 10},
    {type = COMBAT_EARTHDAMAGE, percent = 10},
    {type = COMBAT_FIREDAMAGE, percent = 0},
    {type = COMBAT_LIFEDRAIN, percent = 0},
    {type = COMBAT_MANADRAIN, percent = 0},
    {type = COMBAT_DROWNDAMAGE, percent = 0},
    {type = COMBAT_ICEDAMAGE, percent = -10},
    {type = COMBAT_HOLYDAMAGE , percent = 0},
    {type = COMBAT_DEATHDAMAGE , percent = -5}
}

monster.immunities = {
    {type = "paralyze", condition = false},
    {type = "outfit", condition = false},
    {type = "invisible", condition = false},
    {type = "bleed", condition = false}
}

mType:register(monster)

 

Para que o monstro "sangre" ouro e platinum quando atacado, basta adicionar um evento de ataque similar 
ao que eu te apresentei na resposta anterior. 
Por exemplo:
 

-- Cria a função do evento de ataque do monstro
function onAttack(creature, target)
  if creature:getName() == "Treasure Bandit" then
    -- Gera um número aleatório entre 1 e 100
    local chance = randomNumber(1, 100)
    -- Se a chance for 97 ou menor, o monstro "sangra" ouro
    if chance <= 97 then
      local goldAmount = randomNumber(0, 20)
      creature:doSendTextMessage(MESSAGE_EVENT_ADVANCE, "O Treasure Bandit perdeu " .. goldAmount .. " ouro.")
      -- Remove o ouro do monstro e adiciona ao jogador
      creature:removeMoney(goldAmount)
      target:addMoney(goldAmount)
    -- Se a chance for 3 ou maior, o monstro "sangra" platinum
    elseif chance >= 3 then
      local platinumAmount = randomNumber(0, 2)
      creature:doSendTextMessage(MESSAGE_EVENT_ADVANCE, "O Treasure Bandit perdeu " .. platinumAmount .. " platinum.")
      -- Remove o platinum do monstro e adiciona ao jogador
      creature:removeMoney(platinumAmount * 100)
      target:addMoney(platinumAmount * 100)
    end
  end
end


Para registrar os eventos de ataque e tempo em tempo do monstro, basta adicionar a seguinte linha de código 
no final do arquivo de configuração do monstro:
 

function onLogin(creature)
  creature:registerEvent("TreasureBanditAttack")
  creature:registerEvent("TreasureBanditThink")
end

Espero que isso ajude.

Postado

Da maneira a cima não funcionará, pois é um creaturescript com algoritmo de onAttack, ou seja, se a pessoa atacar o monstro, mesmo não dando hit, o monstro sangrará o gold.

A maneira correta é um script dentro do monstro. Eu fiz na função onThink, então ele vai verificar de tempo em tempo o algoritmo.

Eu alterei o script do teu monstro, desta maneira:

local mType = Game.createMonsterType("Treasure Bandit")
local monster = {}

monster.description = "a treasure bandit"
monster.experience = 600
monster.outfit = {
    lookType = 129,
    lookHead = 58,
    lookBody = 40,
    lookLegs = 24,
    lookFeet = 95,
    lookAddons = 0,
    lookMount = 0
}

monster.raceId = 223
monster.Bestiary = {
    class = "Human",
    race = BESTY_RACE_HUMAN,
    toKill = 500,
    FirstUnlock = 25,
    SecondUnlock = 250,
    CharmsPoints = 5,
    Stars = 2,
    Occurrence = 0,
    Locations = "Pode ser encontrado nas redondezas de Mortland."
}

monster.health = 1200
monster.maxHealth = 1200
monster.race = "blood"
monster.corpse = 18050
monster.speed = 180
monster.manaCost = 450

monster.changeTarget = {
    interval = 5000,
    chance = 0
}

monster.strategiesTarget = {
    nearest = 30,
    health = 10,
    damage = 10,
    random = 50,
}

monster.flags = {
    summonable = false,
    attackable = true,
    hostile = true,
    convinceable = false,
    pushable = false,
    rewardBoss = false,
    illusionable = true,
    canPushItems = true,
    canPushCreatures = true,
    staticAttackChance = 90,
    targetDistance = 4,
    runHealth = 240,
    healthHidden = false,
    isBlockable = false,
    canWalkOnEnergy = true,
    canWalkOnFire = true,
    canWalkOnPoison = true
}

monster.light = {
    level = 0,
    color = 0
}

monster.voices = {
    interval = 6000,
    chance = 10,
    { text = "Não fui eu!", yell = false },
    { text = "Tente me pegar!", yell = false }
}

monster.loot = {
    { name = "gold coin", chance = 83940, maxCount = 40 }, --
    { name = "platinum coin", chance = 29900, maxCount = 2 }, --
    { name = "meat", chance = 12350 }, --
    { name = "rope belt", chance = 4110 }
}

monster.attacks = {
    { name = "melee", interval = 2000, chance = 100, minDamage = 0, maxDamage = -68 },
    { name = "combat", interval = 3000, chance = 30, type = COMBAT_PHYSICALDAMAGE, minDamage = 0, maxDamage = -80,
        range = 7, shootEffect = CONST_ANI_SPEAR, target = false }
}

monster.defenses = {
    defense = 25,
    armor = 20
}

monster.elements = {
    { type = COMBAT_PHYSICALDAMAGE, percent = 5 },
    { type = COMBAT_ENERGYDAMAGE, percent = 10 },
    { type = COMBAT_EARTHDAMAGE, percent = 10 },
    { type = COMBAT_FIREDAMAGE, percent = 0 },
    { type = COMBAT_LIFEDRAIN, percent = 0 },
    { type = COMBAT_MANADRAIN, percent = 0 },
    { type = COMBAT_DROWNDAMAGE, percent = 0 },
    { type = COMBAT_ICEDAMAGE, percent = -10 },
    { type = COMBAT_HOLYDAMAGE, percent = 0 },
    { type = COMBAT_DEATHDAMAGE, percent = -5 }
}

monster.immunities = {
    { type = "paralyze", condition = false },
    { type = "outfit", condition = false },
    { type = "invisible", condition = false },
    { type = "bleed", condition = false }
}

local maxHealth = monster.maxHealth
local aux = maxHealth
mType.onThink = function(monster, interval)
    local health = monster:getHealth()
    if aux > health then
        Game.createItem(2448, (maxHealth - health), monster:getPosition())
        aux = health
    end
end

mType:register(monster)

Não testei, mas provavelmente funcionará

Editado por Anderson Sacani (veja o histórico de edições)

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.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo