Ir para conteúdo
  • Cadastre-se

Regeneração de Mana nos Trainers


Posts Recomendados

Fala galera. 

Estou usando o TFS 1.3, mapa otservbr-global, última versão. Alguém tem script ou sabe como eu faço para adicionar regeneração de mana nos trainers? Preciso que fique regenerando sempre, para que os mages possam treinar também. 

Obrigado.

Link para o post
Compartilhar em outros sites
  • Sub-Admin

Este tópico foi movido para a seção de Suporte Otserv.

 

20230912_034613.png.cf49b650c34dd7d7b1f79bd49c70f53c.png

Eu sou um entusiasta da programação apaixonado por ajudar a comunidade open source a crescer. Sempre em busca de novos desafios e oportunidades para contribuir com meu código.  #OpenSource #Programação #Contribuição

 

Link para o post
Compartilhar em outros sites
  Em 19/09/2020 em 05:26, pergher disse:

Fala galera. 

Estou usando o TFS 1.3, mapa otservbr-global, última versão. Alguém tem script ou sabe como eu faço para adicionar regeneração de mana nos trainers? Preciso que fique regenerando sempre, para que os mages possam treinar também. 

Obrigado.

Mostrar mais  

Tu pode fazer um globalevents (mesmo sistema que foi feito na magia das estatuas da library) porem tu pode tirar o dano e add a linha de add mana

 

 

Testa esse ai, só configura o fromPosition e o toPosition para a mesma coordenada para assim soltar em 1 lugar só, ai é só repetir para todos os trainers!

local effects = {
	{fromPosition = Position(32526, 32536, 12), toPosition = Position(32526, 32539, 12), effect = CONST_ME_HOLYDAMAGE},
}

function onThink(interval, cid)
	local jolf
	for i = 1, #effects do
        local settings = effects[i]
		fromPosition = settings.fromPosition
		toPosition = settings.toPosition
		local spectators = Game.getSpectators(settings.fromPosition, false, true, 7, 7, 5, 5)
        if #spectators > 0 then
			if settings.effect then
				for y = fromPosition.y, toPosition.y do
					local newPosition = Position(fromPosition.x, y, fromPosition.z)
					newPosition:sendMagicEffect(settings.effect)

					jolf = Tile(newPosition):getTopCreature()
					if jolf and jolf:isPlayer() then
						doPlayerAddMana(cid, getPlayerMaxMana(cid))
					end
				end
				for x = fromPosition.x, toPosition.x do
					local newPosition2 = Position(x, fromPosition.y, fromPosition.z)
					newPosition2:sendMagicEffect(settings.effect)
					jolf = Tile(newPosition2):getTopCreature()
					if jolf and jolf:isPlayer() then
						doPlayerAddMana(cid, getPlayerMaxMana(cid))
					end
				end
			end
		end
	end
	return true
end

 

Editado por Faysal (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
  Em 19/09/2020 em 17:27, Zazeros disse:

@pergher Cara, se tu quiser mais simples, põe pros Trainers healar a mana do alvo, só pegar um bicho que bate na mana e trocar o valor pra positivo, ai vai curar a mana do player

Mostrar mais  

Que baita ideia haha

monster.attacks = {
    {name = "melee", attack = 130, effect = CONST_ME_DRAWBLOOD, interval = 2*1000, minDamage = -1, maxDamage = -2};
    {name= "manadrain", interval = 2*1000, chance="90", range="7", min="10", max="30"}
}

Adicionei o manadrain aqui, mas por alguma razao está dando 'unknow spell name'. Tem ideia de como pode ser o nome? Jah tentei varios haha

  Em 19/09/2020 em 16:17, Faysal disse:

Tu pode fazer um globalevents (mesmo sistema que foi feito na magia das estatuas da library) porem tu pode tirar o dano e add a linha de add mana

 

 

Testa esse ai, só configura o fromPosition e o toPosition para a mesma coordenada para assim soltar em 1 lugar só, ai é só repetir para todos os trainers!

local effects = {
	{fromPosition = Position(32526, 32536, 12), toPosition = Position(32526, 32539, 12), effect = CONST_ME_HOLYDAMAGE},
}

function onThink(interval, cid)
	local jolf
	for i = 1, #effects do
        local settings = effects[i]
		fromPosition = settings.fromPosition
		toPosition = settings.toPosition
		local spectators = Game.getSpectators(settings.fromPosition, false, true, 7, 7, 5, 5)
        if #spectators > 0 then
			if settings.effect then
				for y = fromPosition.y, toPosition.y do
					local newPosition = Position(fromPosition.x, y, fromPosition.z)
					newPosition:sendMagicEffect(settings.effect)

					jolf = Tile(newPosition):getTopCreature()
					if jolf and jolf:isPlayer() then
						doPlayerAddMana(cid, getPlayerMaxMana(cid))
					end
				end
				for x = fromPosition.x, toPosition.x do
					local newPosition2 = Position(x, fromPosition.y, fromPosition.z)
					newPosition2:sendMagicEffect(settings.effect)
					jolf = Tile(newPosition2):getTopCreature()
					if jolf and jolf:isPlayer() then
						doPlayerAddMana(cid, getPlayerMaxMana(cid))
					end
				end
			end
		end
	end
	return true
end

 

Mostrar mais  


Meu unico problema é que o char é teleportado até uma room disponível... 

 

local config = {
    -- Position of the first position (line 1 column 1)
    firstRoomPosition = {x = 1018, y = 1112, z = 7},
    -- X distance between each room (on the same line)
    distancePositionX= 12,
    -- Y distance between each room (on the same line)
    distancePositionY= 12,
    -- Number of columns
    columns= 7,
    -- Number of lines
    lines= 11
}

local function isBusyable(position)
    local player = Tile(position):getTopCreature()
    if player then
        if player:isPlayer() then
            return false
        end
    end

    local tile = Tile(position)
    if not tile then
        return false
    end

    local ground = tile:getGround()
    if not ground or ground:hasProperty(CONST_PROP_BLOCKSOLID) then
        return false
    end

    local items = tile:getItems()
    for i = 1, tile:getItemCount() do
        local item = items
        local itemType = item:getType()
        if itemType:getType() ~= ITEM_TYPE_MAGICFIELD and not itemType:isMovable() and item:hasProperty(CONST_PROP_BLOCKSOLID) then
            return false
        end
    end
    return true
end

local function calculatingRoom(uid, position, column, line)
    local player = Player(uid)
    if column >= config.columns then
        column = 0
        line = line < (config.lines -1) and line + 1 or false
    end

    if line then
        local room_pos = {x = position.x + (column * config.distancePositionX), y = position.y + (line * config.distancePositionY), z = position.z}
        if isBusyable(room_pos) then
            player:teleportTo(room_pos)
            player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
        else
            calculatingRoom(uid, position, column + 1, line)
        end
    else
        player:sendCancelMessage("Couldn't find any position for you right now.")
    end
end

local trainerEntrance = MoveEvent()
function trainerEntrance.onStepIn(creature, item, position, fromPosition)
    if not creature:isPlayer() then
        return true
    end

    calculatingRoom(creature.uid, config.firstRoomPosition, 0, 0)
    Game.createMonster("training machine", creature:getPosition(), true, false)
    Game.createMonster("training machine", creature:getPosition(), true, false)
    return true
end

trainerEntrance:position({x = 1116, y = 1092, z = 7})
trainerEntrance:register()
 

Link para o post
Compartilhar em outros sites
  Em 19/09/2020 em 23:36, pergher disse:

Que baita ideia haha

monster.attacks = {
    {name = "melee", attack = 130, effect = CONST_ME_DRAWBLOOD, interval = 2*1000, minDamage = -1, maxDamage = -2};
    {name= "manadrain", interval = 2*1000, chance="90", range="7", min="10", max="30"}
}

Adicionei o manadrain aqui, mas por alguma razao está dando 'unknow spell name'. Tem ideia de como pode ser o nome? Jah tentei varios haha


Meu unico problema é que o char é teleportado até uma room disponível... 

 

local config = {
    -- Position of the first position (line 1 column 1)
    firstRoomPosition = {x = 1018, y = 1112, z = 7},
    -- X distance between each room (on the same line)
    distancePositionX= 12,
    -- Y distance between each room (on the same line)
    distancePositionY= 12,
    -- Number of columns
    columns= 7,
    -- Number of lines
    lines= 11
}

local function isBusyable(position)
    local player = Tile(position):getTopCreature()
    if player then
        if player:isPlayer() then
            return false
        end
    end

    local tile = Tile(position)
    if not tile then
        return false
    end

    local ground = tile:getGround()
    if not ground or ground:hasProperty(CONST_PROP_BLOCKSOLID) then
        return false
    end

    local items = tile:getItems()
    for i = 1, tile:getItemCount() do
        local item = items
        local itemType = item:getType()
        if itemType:getType() ~= ITEM_TYPE_MAGICFIELD and not itemType:isMovable() and item:hasProperty(CONST_PROP_BLOCKSOLID) then
            return false
        end
    end
    return true
end

local function calculatingRoom(uid, position, column, line)
    local player = Player(uid)
    if column >= config.columns then
        column = 0
        line = line < (config.lines -1) and line + 1 or false
    end

    if line then
        local room_pos = {x = position.x + (column * config.distancePositionX), y = position.y + (line * config.distancePositionY), z = position.z}
        if isBusyable(room_pos) then
            player:teleportTo(room_pos)
            player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
        else
            calculatingRoom(uid, position, column + 1, line)
        end
    else
        player:sendCancelMessage("Couldn't find any position for you right now.")
    end
end

local trainerEntrance = MoveEvent()
function trainerEntrance.onStepIn(creature, item, position, fromPosition)
    if not creature:isPlayer() then
        return true
    end

    calculatingRoom(creature.uid, config.firstRoomPosition, 0, 0)
    Game.createMonster("training machine", creature:getPosition(), true, false)
    Game.createMonster("training machine", creature:getPosition(), true, false)
    return true
end

trainerEntrance:position({x = 1116, y = 1092, z = 7})
trainerEntrance:register()
 

Mostrar mais  

Abre o rme e vê a posição de cada piso que os players vai ficar, assim tu configura como desejar

Link para o post
Compartilhar em outros sites
  Em 19/09/2020 em 23:50, Faysal disse:

Caso não der certo posso tentar ajudar com o método do @Zazeros

Mostrar mais  

Tntei o dele mas por alguma razao ele nao esta reconhecendo o "manadrain"

monster.attacks = {
    {name = "melee", attack = 130, effect = CONST_ME_DRAWBLOOD, interval = 2*1000, minDamage = -1, maxDamage = -2};
    {name= "manadrain", interval = 2*1000, chance="90", range="7", min="10", max="30"}
}

Adicionei o manadrain aqui, mas por alguma razao está dando 'unknow spell name'. Tem ideia de como pode ser o nome? Jah tentei varios haha

Link para o post
Compartilhar em outros sites
  Em 20/09/2020 em 00:02, pergher disse:

Tntei o dele mas por alguma razao ele nao esta reconhecendo o "manadrain"

monster.attacks = {
    {name = "melee", attack = 130, effect = CONST_ME_DRAWBLOOD, interval = 2*1000, minDamage = -1, maxDamage = -2};
    {name= "manadrain", interval = 2*1000, chance="90", range="7", min="10", max="30"}
}

Adicionei o manadrain aqui, mas por alguma razao está dando 'unknow spell name'. Tem ideia de como pode ser o nome? Jah tentei varios haha

Mostrar mais  

tenta assim
 

<attack name="manadrain" interval="1000" chance="7" range="7" min="900" max="10000">

    <attribute key="shootEffect" value="energy" />

    <attribute key="areaEffect" value="poff" />

</attack>

   
   
 

 

 

Link para o post
Compartilhar em outros sites
  Em 20/09/2020 em 00:27, Faysal disse:

tenta assim
 

<attack name="manadrain" interval="1000" chance="7" range="7" min="900" max="10000">

    <attribute key="shootEffect" value="energy" />

    <attribute key="areaEffect" value="poff" />

</attack>

   
   
 

 

 

Mostrar mais  

Obrigado pela ajuda. 

Me ajudaram em outro forum, vou botar aqui como fica caso mais alguém queira:

monster.attacks = {
    {name = "melee", attack = 130, effect = CONST_ME_DRAWBLOOD, interval = 2*1000, minDamage = -1, maxDamage = -2};
    {name ="combat", interval = 3000, chance = 80, minDamage = 30, maxDamage = 50, type = COMBAT_MANADRAIN, range = 7, effect = CONST_ME_SMALLPLANTS, target = false},

}


Faysal, valeu a ajuda. Esse é customizado, aí é escrito em lua, não xml. 
Abraço.

Link para o post
Compartilhar em outros sites
  Em 20/09/2020 em 00:27, Faysal disse:

<attack name="manadrain" interval="1000" chance="7" range="7" min="900" max="10000">

    <attribute key="shootEffect" value="energy" />

    <attribute key="areaEffect" value="poff" />

</attack>

Mostrar mais  

Boa noite!
Amigo, estou tentando a mesma coisa que o amigo ai em cima. Tentei desta maneira como vc sugeriu, porém nada acontece (assim como não há log de erros).
Alguma outra sugestão ?
Desde já mto obg.

 

Meu codigo no caso ficou assim:

 

<?xml version="1.0" encoding="UTF-8"?>
<monster name="Training Monk" nameDescription="a training monk" race="blood" experience="0" speed="0" manacost="0">
	<health now="200000" max="200000"/>
	<look type="57" corpse="22567"/>
	<targetchange interval="60000" chance="0"/>
	<flags>
		<flag summonable="0"/>
		<flag attackable="1"/>
		<flag hostile="1"/>
		<flag illusionable="0"/>
		<flag convinceable="0"/>
		<flag pushable="0"/>
		<flag canpushitems="0"/>
		<flag canpushcreatures="0"/>
		<flag targetdistance="1"/>
		<flag staticattack="50"/>
		<flag runonhealth="0"/>
	</flags> 
	<attacks>
	<attack name="melee" interval="2000" skill="0" attack="-1"/>
	</attacks>
	<attack name="manadrain" interval="1000" chance="7" range="7" min="900" max="10000">
    <attribute key="shootEffect" value="energy" />
    <attribute key="areaEffect" value="poff" />
	</attack>
	<defenses armor="0" defense="0">
		<defense name="healing" interval="2000" chance="80" min="10000" max="20000">
			<attribute key="areaEffect" value="blueshimmer"/>
		</defense>
	</defenses>
	<immunities>
		<immunity invisible="1"/>
	</immunities>
</monster>

 

Link para o post
Compartilhar em outros sites
  Em 20/09/2020 em 03:15, Xablaw disse:

Boa noite!
Amigo, estou tentando a mesma coisa que o amigo ai em cima. Tentei desta maneira como vc sugeriu, porém nada acontece (assim como não há log de erros).
Alguma outra sugestão ?
Desde já mto obg.

 

Meu codigo no caso ficou assim:

 

<?xml version="1.0" encoding="UTF-8"?>
<monster name="Training Monk" nameDescription="a training monk" race="blood" experience="0" speed="0" manacost="0">
	<health now="200000" max="200000"/>
	<look type="57" corpse="22567"/>
	<targetchange interval="60000" chance="0"/>
	<flags>
		<flag summonable="0"/>
		<flag attackable="1"/>
		<flag hostile="1"/>
		<flag illusionable="0"/>
		<flag convinceable="0"/>
		<flag pushable="0"/>
		<flag canpushitems="0"/>
		<flag canpushcreatures="0"/>
		<flag targetdistance="1"/>
		<flag staticattack="50"/>
		<flag runonhealth="0"/>
	</flags> 
	<attacks>
	<attack name="melee" interval="2000" skill="0" attack="-1"/>
	</attacks>
	<attack name="manadrain" interval="1000" chance="7" range="7" min="900" max="10000">
    <attribute key="shootEffect" value="energy" />
    <attribute key="areaEffect" value="poff" />
	</attack>
	<defenses armor="0" defense="0">
		<defense name="healing" interval="2000" chance="80" min="10000" max="20000">
			<attribute key="areaEffect" value="blueshimmer"/>
		</defense>
	</defenses>
	<immunities>
		<immunity invisible="1"/>
	</immunities>
</monster>

 

Expand   Mostrar mais  

Testa esse aqui

 

<attack name="manadrain" interval="15000" chance="100" range="7" min="100" max="200">
      <attribute key="areaEffect" value="redshimmer"/>
 </attack>
Link para o post
Compartilhar em outros sites

Ficou assim, e está funcionando 100%.
Obrigado!

 

<?xml version="1.0" encoding="UTF-8"?>
<monster name="Training Monk" nameDescription="a training monk" race="blood" experience="0" speed="0" manacost="0">
	<health now="200000" max="200000"/>
	<look type="57" corpse="22567"/>
	<targetchange interval="60000" chance="0"/>
	<flags>
		<flag summonable="0"/>
		<flag attackable="1"/>
		<flag hostile="1"/>
		<flag illusionable="0"/>
		<flag convinceable="0"/>
		<flag pushable="0"/>
		<flag canpushitems="0"/>
		<flag canpushcreatures="0"/>
		<flag targetdistance="1"/>
		<flag staticattack="50"/>
		<flag runonhealth="0"/>
	</flags> 
	<attacks>
	<attack name="melee" interval="2000" skill="0" attack="-1"/>
	<attack name="manadrain" interval="1000" chance="7" range="7" min="900" max="10000">
	<attribute key="shootEffect" value="energy" />
    <attribute key="areaEffect" value="poff" />
	</attack>
	</attacks>
	<defenses armor="0" defense="0">
		<defense name="healing" interval="2000" chance="80" min="10000" max="20000">
			<attribute key="areaEffect" value="blueshimmer"/>
		</defense>
	</defenses>
	<immunities>
		<immunity invisible="1"/>
	</immunities>
</monster>

 

Link para o post
Compartilhar em outros sites

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

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

  • Estatísticas dos Fóruns

    96823
    Tópicos
    519566
    Posts
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo