Ir para conteúdo
  • Cadastre-se

Posts Recomendados

Nome do Script: Sistema de Pet com Evolução

Tipo do Script: Lib

Versão Utilizada:9.44

Servidor Utilizado:Crystal Server 2.3

Nível de Experiência:Intermediário

Informações Extras: Desejo modificar esse script. Adicionar sistema de evolução.

Ex:"Orc - LvL 10 - Orc Spearman - LVL 30 - Orc Warlord

"Uma Semana De Rep+ Pra Quem Resolver"

Hidden Content

    Give reaction to this post to see the hidden content.

--Circles

AREA_CIRCLE2X2 =

{

	{0, 1, 1, 1, 0},

	{1, 1, 1, 1, 1},

	{1, 1, 3, 1, 1},

	{1, 1, 1, 1, 1},

	{0, 1, 1, 1, 0}

}


AREA_CIRCLE3X3 =

{

	{0, 0, 1, 1, 1, 0, 0},

	{0, 1, 1, 1, 1, 1, 0},

	{1, 1, 1, 1, 1, 1, 1},

	{1, 1, 1, 3, 1, 1, 1},

	{1, 1, 1, 1, 1, 1, 1},

	{0, 1, 1, 1, 1, 1, 0},

	{0, 0, 1, 1, 1, 0, 0}

}


-- Crosses

AREA_CROSS1X1 =

{

	{0, 1, 0},

	{1, 3, 1},

	{0, 1, 0}

}


AREA_CROSS5X5 =

{

	{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},

	{0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},

	{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},

	{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},

	{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},

	{1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1},

	{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},

	{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},

	{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},

	{0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},

	{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}

}


AREA_CROSS6X6 =

{

	{0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0},

	{0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0},

	{0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0},

	{0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0},

	{0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0},

	{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},

	{1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1},

	{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},

	{0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0},

	{0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0},

	{0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0},

	{0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0},

	{0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0}

}


--Squares

AREA_SQUARE1X1 =

{

	{1, 1, 1},

	{1, 3, 1},

	{1, 1, 1}

}


-- Walls

AREA_WALLFIELD = {

	{1, 1, 3, 1, 1}

}


AREADIAGONAL_WALLFIELD =

{

	{0, 0, 0, 0, 1},

	{0, 0, 0, 1, 1},

	{0, 1, 3, 1, 0},

	{1, 1, 0, 0, 0},

	{1, 0, 0, 0, 0},

}


emoteAttack = true

petEmoteAttack = true

refillStatsAtLevel = true


TYPE_NEAR = 1

TYPE_DISTANCE = 2


petExhaust = 3 --in seconds

petSayExhaust = 3 --in seconds


petGainTicks =

{

	health = {func = doCreatureAddHealth, time = 3000, count = 1},

	mana = {func = doCreatureAddMana, time = 3000, count = 2}

}


petGainHealth = 30

petGainMana = 30

petExpRate = 1.3


carryItems = 10


petItemsBase = 1250

petItems = {}

blockedItems = {6132, 2195}


for i = 1, carryItems do

	table.insert(petItems, petItemsBase + i)

end


petBase = 6120

petStorages =

{

	pet = petBase + 1000,

	level = petBase + 2000,

	exp = petBase + 3000,

	items = petBase + 4000,

	isPet = petBase + 5000,

	isDead = petBase + 6000,

	exhaust = petBase + 7000,

	sayExhaust = petBase + 8000,

	moveExhaust = petBase + 9000,

	health = petBase + 10000,

	mana = petBase + 11000,

	buyed = petBase + 12000

}


tables =

{

	pet = {},

	level = {},

	exp = {},

	items = {},

	isDead = {},

	exhaust = {},

	health = {},

	mana = {},

	buyed = {}

}


reviveCost = 1000


pets =

{

	[1] =

	{

		monster = "orc spearman",

		vocations = {1, 2, 3, 4},

		level = 30,

		attacks =

		{

			[1] = {name = "", level = 30, petLevel = 30, mana = 50, type = TYPE_DISTANCE, range = 10, combat = COMBAT_PHYSICALDAMAGE, effect = CONST_ME_NONE, distEffect = CONST_ANI_SPEAR, damageMin = 0.7, damageMax = 1.0}

		}

	},

	[2] =

	{

		monster = "fire devil",

		vocations = {1, 2},

		level = 60,

		attacks =

		{

			[1] = {name = "Fire Strike", level = 60, petLevel = 60, mana = 100, type = TYPE_DISTANCE, combat = COMBAT_FIREDAMAGE, effect = CONST_ME_FIREDAMAGE, distEffect = CONST_ANI_FIRE, damageMin = 1.5, damageMax = 2.0}

		}

	},

	[3] =

	{

		monster = "minotaur guard",

		vocations = {3, 4},

		level = 60,

		cost = 50,

		attacks =

		{

			[1] = {name = "Punch", level = 60, petLevel = 60, mana = 55, type = TYPE_NEAR, combat = COMBAT_PHYSICALDAMAGE, effect = CONST_ME_BLOOD, distEffect = CONST_ANI_NONE, damageMin = 1.5, damageMax = 2.0}

		}

	},

	[4] =

	{

		monster = "water elemental",

		vocations = {2},

		level = 95,

		cost = 15000,

		attacks =

		{

			[1] = {name = "Ice Bomb", level = 100, petLevel = 100, mana = 250, type = TYPE_DISTANCE, range = 3, combat = COMBAT_ICEDAMAGE, effect = CONST_ME_ICEAREA, distEffect = CONST_ANI_ICE, damageMin = 1.5, damageMax = 2.0, area = AREA_CROSS1X1},

			[2] = {name = "Poison Strike", level = 95, petLevel = 95, mana = 80, type = TYPE_DISTANCE, range = 8, combat = COMBAT_POISONDAMAGE, effect = CONST_ME_GREENRINGS, distEffect = CONST_ANI_POISON, damageMin = 1.2, damageMax = 1.8}	

		}

	},

	[5] =

	{

		monster = "fire elemental",

		vocations = {1},

		level = 95,

		attacks =

		{

			[1] = {name = "Fire Bomb", level = 100, petLevel = 100, mana = 250, type = TYPE_DISTANCE, range = 3, combat = COMBAT_FIREDAMAGE, effect = CONST_ME_FIRE, distEffect = CONST_ANI_FIRE, damageMin = 1.5, damageMax = 2.0, area = AREA_CROSS1X1},

			[2] = {name = "Fire Strike", level = 95, petLevel = 95, mana = 80, type = TYPE_DISTANCE, range = 3, combat = COMBAT_FIREDAMAGE, effect = CONST_ME_FIREDAMAGE, distEffect = CONST_ANI_FIRE, damageMin = 1.2, damageMax = 1.8}	

		}

	},

	[6] =

	{

		monster = "orc warlord",

		vocations = {4},

		level = 95,

		attacks =

		{

			[1] = {name = "Throw Knife", level = 95, petLevel = 95, mana = 80, type = TYPE_DISTANCE, combat = COMBAT_PHYSICALDAMAGE, effect = CONST_ME_BLOOD, distEffect = CONST_ANI_THROWINGKNIFE, damageMin = 1.5, damageMax = 2.0}

		}

	},

	[7] =

	{

		monster = "golem",

		vocations = {3},

		level = 95,

		attacks =

		{

			[1] = {name = "Throw Stone", level = 95, petLevel = 95, mana = 80, type = TYPE_DISTANCE, combat = COMBAT_PHYSICALDAMAGE, effect = CONST_ME_BLOOD, distEffect = CONST_ANI_LARGEROCK, damageMin = 1.5, damageMax = 2.0}

		}

	},

	[8] =

	{

		monster = "wyrm",

		vocations = {1, 2, 3, 4},

		level = 135

	},

	[9] =

	{

		monster = "dragon lord",

		vocations = {1, 2, 3, 4},

		level = 200,

		attacks =

		{

			[1] = {name = "Fire Bomb", level = 200, petLevel = 200, mana = 300, type = TYPE_DISTANCE, range = 3, combat = COMBAT_FIREDAMAGE, effect = CONST_ME_FIREAREA, distEffect = CONST_ANI_FIRE, damageMin = 1.5, damageMax = 2.0, area = AREA_CROSS1X1},

			[2] = {name = "Fire Storm", level = 205, petLevel = 220, mana = 700, type = TYPE_NEAR, range = 8, combat = COMBAT_FIREDAMAGE, effect = CONST_ME_FIREAREA, distEffect = CONST_ANI_FIRE, damageMin = 1.8, damageMax = 2.5, area = AREA_CROSS5X5},

			[3] = {name = "Fire Explosion", level = 203, petLevel = 210, mana = 450, type = TYPE_DISTANCE, range = 6, combat = COMBAT_FIREDAMAGE, effect = CONST_ME_EXPLOSIONHIT, distEffect = CONST_ANI_FIRE, damageMin = 1.5, damageMax = 2.1, area = AREA_CIRCLE2X2},

			[4] = {name = "Scratch", level = 201, petLevel = 205, mana = 150, type = TYPE_NEAR, range = 1, combat = COMBAT_PHYSICALDAMAGE, effect = CONST_ME_HITAREA, distEffect = CONST_ANI_FIRE, damageMin = 1.3, damageMax = 1.8},

			[5] = {name = "Fire Strike", level = 203, petLevel = 210, mana = 100, type = TYPE_DISTANCE, range = 3, combat = COMBAT_FIREDAMAGE, effect = CONST_ME_EXPLOSIONAREA, distEffect = CONST_ANI_FIRE, damageMin = 1.8, damageMax = 1.9}	

		}

	}

}


for i = 1, #pets do

	table.insert(tables.pet, petStorages.pet + i)

	table.insert(tables.level, petStorages.level + i)

	table.insert(tables.exp, petStorages.exp + i)

	table.insert(tables.items, petStorages.items + i)

	table.insert(tables.isDead, petStorages.isDead + i)

	table.insert(tables.exhaust, petStorages.exhaust + i)

	table.insert(tables.health, petStorages.health + i)

	table.insert(tables.mana, petStorages.mana + i)

	table.insert(tables.buyed, petStorages.buyed + i)

end


function gainStat(pid, stat)


	if pid and pid > 0 and isMonster(pid) then

		stat.func(pid, stat.count)

	end

	addEvent(gainStat, stat.time, pid, stat)

end


function getLevelByExp(exp)

	return math.floor((math.sqrt(3) * math.sqrt(243*(exp+1)^2-48600*(exp+1)+3680000)+27 * (exp+1)-2700)^(1/3)/30^(2/3)-(5*10^(2/3))/(3^(1/3)*(math.sqrt(3)*math.sqrt(243*(exp+1)^2-48600*(exp+1)+3680000)+27*(exp+1)-2700)^(1/3))+2)

end


function getPetInfo(pet)

	if isNumber(pet) then

		return pets[pet] or false

	else

		for _, v in pairs(pets) do

			if pet:lower() == v.monster then

				return v

			end

		end

	end

	return false

end


function getPetByLevel(cid)

	local level = getPlayerLevel(cid)

	local pet

	for i = 1, #pets do

		v = pets[i]

		if level >= v.level and isInArray(v.vocations, getPlayerVocation(cid)) then

			pet = v

		end

	end

	return (pet ~= nil and pet or false)

end


function getAttackFormula(pid, attack)

	return {

			min = ((getPetLevel(pid) * 2) * (1 + attack.damageMin) + getPetLevel(pid)) / 2.5,

			max = ((getPetLevel(pid) * 3) * (1 + attack.damageMax) + getPetLevel(pid)) / 2.5

		   }

end


function doAttack(pid, target, param)


	local pet = getPetInfo(getCreatureName(pid))

	if pet then

		if pet.attacks and pet.attacks[param] then

			local attack = pet.attacks[param]

			if target > 0 and pid ~= getCreatureTarget(getCreatureMaster(pid)) then

				if attack.type and attack.type == TYPE_DISTANCE and getDistanceBetween(getCreaturePosition(pid), getCreaturePosition(target)) > (attack.range or 3) or attack.type == TYPE_NEAR and getDistanceBetween(getCreaturePosition(pid), getCreaturePosition(target)) > (attack.range or 1) then

					return doPlayerSendCancel(getCreatureMaster(pid), "Target is too far.") and doSendMagicEffect(getCreaturePosition(pid), CONST_ME_POFF)

				end

				if not isSightClear(getCreaturePosition(pid), getCreaturePosition(target), true) then

					return doPlayerSendCancel(getCreatureMaster(pid), "There is not enough room.") and doSendMagicEffect(getCreaturePosition(pid), CONST_ME_POFF)

				end

			else

				return doPlayerSendCancel(getCreatureMaster(pid), "Please select a target first.") and doSendMagicEffect(getCreaturePosition(pid), CONST_ME_POFF)

			end

			if getPlayerLevel(getCreatureMaster(pid)) < attack.level then

				return doPlayerSendCancel(getCreatureMaster(pid), "You need level " .. attack.level .. " or higher to use this attack.") and doSendMagicEffect(getCreaturePosition(pid), CONST_ME_POFF)

			end

			if getPetLevel(pid) < attack.petLevel then

				return doPlayerSendCancel(getCreatureMaster(pid), "Your pet needs level " .. attack.petLevel .. " or higher to use this attack.") and doSendMagicEffect(getCreaturePosition(pid), CONST_ME_POFF)

			end

			if attack.mana and getCreatureMana(pid) < attack.mana then

				return doPlayerSendCancel(getCreatureMaster(pid), "Your pet does not have enough mana.") and doSendMagicEffect(getCreaturePosition(pid), CONST_ME_POFF)

			end

			if attack.area then

				doCastAreaAttack(pid, target, attack.area, attack)

			else

				doTargetCombatHealth(pid, target, attack.combat, -getAttackFormula(pid, attack).min, -getAttackFormula(pid, attack).max, attack.effect)

			end

			doCreatureAddMana(pid, -attack.mana)

			if attack.name ~= "" then

				 if emoteAttack then

					doCreatureSay(getCreatureMaster(pid), getCreatureName(pid) .. ", use " .. attack.name .. "!", TALKTYPE_SAY)

				end

				if petEmoteAttack then

					doCreatureSay(pid, attack.name, TALKTYPE_MONSTER)

				end

			end

			return doSendDistanceShoot(getCreaturePosition(pid), (attack.type == TYPE_DISTANCE and getCreaturePosition(target) or getCreaturePosition(pid)), attack.distEffect)

		else

			return doSendMagicEffect(getCreaturePosition(pid), CONST_ME_POFF)

		end

	else

		return doSendMagicEffect(getCreaturePosition(pid), CONST_ME_POFF) and doPlayerSendCancel(getCreatureMaster(pid), "There is a tecnical problem, please contact a gamemaster.")

	end

end


function callPet(cid, petId)


	for i = 1, #tables do

		for y = 1, #tables[i] do

			if getCreatureStorage(cid, tables[i][y]) < 0 then

				doCreatureSetStorage(cid, tables[i][y], 0)

			end

		end

	end


	local pet = getPetInfoById(petId)

	if not pet then

		return doPlayerSendCancel(cid, "Something is wrong.")

	end


	if getPlayerLevel(cid) < pet.level then

		return doPlayerSendCancel(cid, "You need level " .. pet.level .. " or higher to call this pet.")

	end

	if pet.cost and pet.cost > 0 then

		if getCreatureStorage(cid, tables.buyed[petId]) < 1 then

			return doPlayerSendCancel(cid, "You need to buy this pet first.") and doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)

		end

	end


	local ret = doCreateMonster(pet.monster, getCreaturePosition(cid))


	if getCreatureStorage(cid, tables.level[petId]) < 1 then

		doCreatureSetStorage(cid, tables.level[petId], pet.level)

	end


	if getCreatureStorage(cid, tables.exp[petId]) < 1 then

		doCreatureSetStorage(cid, tables.exp[petId], getExperienceForLevel(pet.level))

	end


	if getCreatureStorage(cid, tables.level[petId]) < pet.level then

		doCreatureSetStorage(cid, tables.level[petId], pet.level)

	elseif getPlayerLevel(cid) * 3 < getCreatureStorage(cid, tables.level[petId]) then

		doCreatureSetStorage(cid, tables.level[petId], pet.level)

		doCreatureSetStorage(cid, tables.exp[petId], getExperienceForLevel(pet.level))

	end


	if getLevelByExp(getCreatureStorage(cid, tables.exp[petId])) < getCreatureStorage(cid, tables.level[petId]) then

		doCreatureSetStorage(cid, tables.exp[petId], getExperienceForLevel(getCreatureStorage(cid, tables.level[petId])))

	end


	if getCreatureStorage(cid, tables.health[petId]) < 1 then

		doCreatureSetStorage(cid, tables.health[petId], getCreatureStorage(cid, tables.level[petId]) * petGainHealth)

	end


	if getCreatureStorage(cid, tables.mana[petId]) < 1 then

		doCreatureSetStorage(cid, tables.mana[petId], getCreatureStorage(cid, tables.level[petId]) * petGainMana)

	end


	doCreatureSetStorage(ret, tables.level[petId], getCreatureStorage(cid, tables.level[petId]))

	doCreatureSetStorage(ret, tables.exp[petId], getCreatureStorage(cid, tables.exp[petId]))


	doConvinceCreature(cid, ret)

	doCreatureSetStorage(ret, petStorages.isPet, 1)

	doSendMagicEffect(getCreaturePosition(ret), CONST_ME_TELEPORT)

	setCreatureMaxHealth(ret, getPetLevel(ret) * petGainHealth)

	doCreatureAddHealth(ret, -getCreatureHealth(ret) + getCreatureStorage(cid, tables.health[petId]))

	setCreatureMaxMana(ret, getPetLevel(ret) * petGainMana)

	doCreatureAddMana(ret, -getCreatureMana(ret) + getCreatureStorage(cid, tables.mana[petId]))

	for _, v in pairs(petGainTicks) do

		gainStat(ret, v)

	end

	return doCreatureSay(cid, "Go pet!", TALKTYPE_SAY)

end


function doCastAreaAttack(pid, target, area, attack)

	local center = {}

	local areaxx = {}

	center.y = math.floor(#area/2)+1

	for y = 1, #area do

		for x = 1, #area[y] do

			local number = area[y][x]

			if number > 0 then

				center.x = math.floor(table.getn(area[y])/2)+1

				if attack.type == TYPE_DISTANCE then

					table.insert(areaxx, {x = getCreaturePosition(target).x + x - center.x, y = getCreaturePosition(target).y + y - center.y, z = getCreaturePosition(target).z})

				else

					table.insert(areaxx, {x = getCreaturePosition(pid).x + x - center.x, y = getCreaturePosition(pid).y + y - center.y, z = getCreaturePosition(pid).z})

				end				

			end

		end

	end

	for i = 1, #areaxx do

		doAreaCombatHealth(pid, attack.combat, areaxx[i], 0, -getAttackFormula(pid, attack).min, -getAttackFormula(pid, attack).max, attack.effect)

	end

end


function isPet(pid)

	local id = getPetIdByName(getCreatureName(pid))

	return getCreatureStorage(pid, petStorages.isPet) > 0 and true or false

end


function doPetAddExperience(pid, exp)


	local id = getPetIdByName(getCreatureName(pid))

	exp = math.ceil(exp)

	doCreatureSetStorage(getCreatureMaster(pid), tables.exp[id], getPetExperience(pid) + exp)

	doSendAnimatedText(getCreaturePosition(pid), exp, getConfigValue("gainExperienceColor"))

	return true

end


function getPetExperience(pid)

	local id = getPetIdByName(getCreatureName(pid))

	return getCreatureStorage(getCreatureMaster(pid), tables.exp[id])

end


function getPetLevel(pid)

	local id = getPetIdByName(getCreatureName(pid))

	return getCreatureStorage(getCreatureMaster(pid), tables.level[id])

end


function doPetSetLevel(pid, level)


	local id = getPetIdByName(getCreatureName(pid))

	doCreatureSetStorage(getCreatureMaster(pid), tables.level[id], level)

	setCreatureMaxHealth(pid, getPetLevel(pid) * petGainHealth)

	setCreatureMaxMana(pid, getPetLevel(pid) * petGainMana)

	return true

end


function getPlayerPet(cid)

	local pet

	if #getCreatureSummons(cid) < 1 then

		pet = false

	end


	for _, it in ipairs(getCreatureSummons(cid)) do

		if isPet(it) then

			pet = it

			break

		end

	end

	return pet

end


function getPetIdByName(name)


	local id = 0

	for k, it in pairs(pets) do

		if it.monster:lower() == name:lower() then

			id = k

			break

		end

	end

	return (id > 0 and id or false)

end


function getTopItem(p)

	p.stackpos = 0

	local v = getThingFromPos(p)

	repeat

		p.stackpos = p.stackpos + 1

		v = getThingFromPos(p)

	until v.itemid == 0

	p.stackpos = p.stackpos - 1

	return getThingFromPos(p)

end


function getPetInfoById(pet)

	for k, v in pairs(pets) do

		if k == pet then

			return v

		end

	end

	return false

end


if not getCreatureStorage then

	getCreatureStorage = getPlayerStorageValue

	doCreatureSetStorage = doPlayerSetStorageValue

end

Editado por Light.Tenshimaru (veja o histórico de edições)
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.

  • Conteúdo Similar

    • Por KotZletY
      Salve geral, recentemente fiz um Task System para meu servidor, então gostaria de compartilha ele com vocês, assim como outros scripts que fiz e gostaria de compartilhar. Bom, vamos ao que interessa.
                        
       
                                                                                                               Informações!!
      Task Normal - Você 1x por vez, quantas vezes quiser, repetindo a task se também quiser.
      Task Diaria -  Você faz uma vez por dia, não podendo repeti em quanto as 24 horas não terminar.
      Task Rank - É mostrado na descrição do player qual rank task ele possui.
      Task Rank Quest - Um extra desse task system é o piso task, será explicado na parte do script, leiam com atenção.
      Task Comandos - Comandos task, 1 para ver o progresso das suas task e outro para mostrar informações do seu personagem, como uma consulta, os comandos são: !task que mostra quais task você ta fazendo, tanto diaria quanto normal e !task me que mostrar informações do seu personagem, como rank, quantidade de pontos task e quantidade de pontos task rank.
      Well, o resto é surpresa, cabe você descobrir! xD
       
       
      Para não ficar só nas palavras, mostrarei algumas imagens, várias no caso: Removida, colocarei novas!
       
                                                                                                               Instalação!!
      Muito bem, chega de conversa, como instalar logo essa bagaça. Primeiramente vá em data/lib e abra o arquivo lib.lua e adicione:
      dofile('data/lib/task system.lua') Ainda na pasta lib crie um arquivo.lua chamado task system.lua e adicione esse code dentro:
       
      No final do tópico, ensinarei a configurar a lib. Agora vai em, data/npc e crie um arquivo.xml chamado  task.xml e coloque esse code dentro:
      <?xml version="1.0" encoding="UTF-8"?> <npc name="NPC Task" script="task system.lua" walkinterval="0" floorchange="0"> <health now="150" max="150"/> <look type="430"/> <parameters> <parameter key="message_greet" value="Hello |PLAYERNAME|. I'm in charge of delivering missions to the players. Would you like to do a {normal} task, {daily} task, {receive} your reward from a task or {abandon} a task ? You can also see the {normal task list} and the {daily task list}."/> <parameter key="message_farewell" value="See you later." /> <parameter key="message_walkaway" value="See you later." /> </parameters> </npc> Ainda na pasta npc, entre na pasta scripts e crie um arquivo.lua chamado task system.lua e adicione esse code dentro:
       
      Agora vá em data/talkactions e abra o arquivo talkactions.xml e adicione a seguinte tag:
      <talkaction words="!task" separator=" " script="task system.lua" /> Ainda na pasta talkactions entre na pasta scripts e crie um arquivo.lua chamado task system.lua e adicione esse code dentro dele:
       
      Agora vá em data/creaturescripts e abra o arquivo creaturescripts.xl e adicione a seguinte tag:
      <event type="kill" name="tasksystem" script="task system.lua"/> Ainda na pasta creaturescripts entre na pasta scripts e crie um arquivo.lua chamado task system.lua e adicione esse code dentro dele:
      Ainda na pasta script  abra o login.lua e adicione dentro:
      player:registerEvent("tasksystem") Agora vá em data/events/scripts e abra o arquivo player.lua, depois de aberto, antes de:
      self:sendTextMessage(MESSAGE_INFO_DESCR, description) adicione:
      if thing:isCreature() then if thing:isPlayer() then description = string.format("%s\nTask Rank: "..getRankTask(thing), description) end end  
                                                                                              Extra(Opcional)!!
       
      Extra,  vá em data/movements/scripts e crie um  arquivo chamado tile task.lua, depois de aberto, antes de:
            
      Vá em data/movements/movements.xml adicione: 
      <movevent event="StepIn" actionid="XXXX" script="tile task.lua"/>  
      Explicação: Com esse movements acima, você só poderá passar por o piso caso tenha pontos task necessário para passar, se ativar a opção, removePoints então a mesma quantidade de pontos necessária para passar, será removida, ao passar, caso esteja desativada, então
      apenas será necessário ter os pontos task para passar. Em XXXX coloque o actionid, e o actionid coloque no piso desejado!
       
      New Extra: Vá em data/movements/scripts e crie um arquivo chamado tile task2.lua e adicione o seguinte scripts:
       
      Vá em data/movements/movements.xml adicione:  
      <movevent event="StepIn" actionid="XXXX" script="tile task2.lua"/> Explicação: Ao adicionar esse movements acima, você só poderá passar pelo piso caso seu rank task seja igual ou superior ao rank definido na variável, caso não seja igual e nem superior, não será possível passar.
      Configure na lib, a sequência de ranks de acordo com a sequência de rank da tabela de pontos, assim:
       
      A sequência precisa está igual e numeradas.
                                                                                               Configurando!!
      task_monsters = { [1] = {name = "monster1", mons_list = {"monster_t2", "monster_t3"}, storage = 30000, amount = 20, exp = 5000, pointsTask = {1, 1}, items = {{id = 2157, count = 1}, {id = 2160, count = 3}}}, [2] = {name = "monster2", mons_list = {"", ""}, storage = 30001, amount = 10, exp = 10000, pointsTask = {1, 1}, items = {{id = 10521, count = 1}, {id = 2160, count = 5}}}, [3] = {name = "monster3", mons_list = {"", ""}, storage = 30002, amount = 10, exp = 18000, pointsTask = {1, 1}, items = {{id = 2195, count = 1}, {id = 2160, count = 8}}}, [4] = {name = "monster4", mons_list = {"", ""}, storage = 30003, amount = 10, exp = 20000, pointsTask = {1, 1}, items = {{id = 2520, count = 1}, {id = 2160, count = 10}}} } task_daily = { [1] = {name = "monsterDay1", mons_list = {"monsterDay1_t2", "monsterDay1_t3"}, storage = 40000, amount = 10, exp = 5000, pointsTask = {1, 1}, items = {{id = 2157, count = 1}, {id = 2160, count = 3}}}, [2] = {name = "monsterDay2", mons_list = {"", ""}, storage = 40001, amount = 10, exp = 10000, pointsTask = {1, 1}, items = {{id = 10521, count = 1}, {id = 2160, count = 5}}}, [3] = {name = "monsterDay3", mons_list = {"", ""}, storage = 40002, amount = 10, exp = 18000, pointsTask = {1, 1}, items = {{id = 2195, count = 1}, {id = 2160, count = 8}}}, [4] = {name = "monsterDay4", mons_list = {"", ""}, storage = 40003, amount = 10, exp = 20000, pointsTask = {1, 1}, items = {{id = 2520, count = 1}, {id = 2160, count = 10}}} }                                        
                                                    
      nome - Nome do monstro.
      mons_list - Nome dos monstro que são semelhantes e que matando eles também contará.
      Exemplo:
      name = "troll", mons_list = {"troll","frost troll","island troll"} e assim matando,  troll, frost troll e island troll contará na task também.
      storage - É a storage que salva a quantidade de monstros já matados.
      amount - É a quantidade necessária de monstros matados para finalizar a task.
      exp - É a quantidade de Experiência que vai ganhar ao finalizar a task, caso não queira dar experiência, basta deixar em 0.
      pointsTask = {Task Points Que vai ganhar(Pontos usado no piso e etc..), Pontos Rank, que irá ganhar e aumentar seu rank.}
      items - Itens que o player vai ganhar, devem está tabelados, dentro da tabela item, adicione das tabelas contendo o id do item e count, quantidade de items que irá ganhar.
      Ex: items = {{id = 2157, count = 1}, {id = 2160, count = 3}} -- Aqui contém 2x tipos de itens, o 2157 e o 2160, e suas devidas quantidades que irá ganhar.
      items = {{id = 2157, count = 1}} -- Aqui só tem 1 tipo de item e a quantidade que vai ganhar.
      Adicione quantos itens quiser. O mesmo vale para as task diarias!
       
       
       
      Bom, é isso ae, qualquer duvida, crítica, sugestões, deixem ae, se precisa de suporte na instalação ou está com erro em algo estarei dando suporte, abraços e bom uso do sistema.
      É totalmente proibido leva meu sistema para outro site, blog ou fórum!
    • Por Under
      Apresentando o Tibia-IA: A IA para Desenvolvimento de Servidores Tibia! 
       O que é o Tibia-IA?
      Um modelo de IA especializado para Tibia! Ele está atualmente em teste gratuito, e eu adoraria que vocês o experimentassem. Basta acessar https://ai.tibiaking.com, criar uma conta e começar a usar totalmente de graça! 
       Versão Experimental Fechada
      Atualmente, algumas funcionalidades ainda estão em desenvolvimento. No momento, apenas a geração de scripts está disponível para o público.
      Se encontrarem qualquer problema nos scripts gerados, me avisem! Vamos juntos construir a IA mais poderosa para ajudar no desenvolvimento de servidores Tibia!  
      Contato direto discord : underewar
       Acesse agora: https://ai.tibiaking.com
       Como funciona?
       Geração automática de scripts LUA para TFS  Suporte a diferentes eventos, criaturas, NPCs, magias, etc.  Ferramenta em constante evolução para aprimorar o desenvolvimento Novidades em breve confira no site. O acesso ao Tibia-IA está disponível para testes GRATUITOS! 
      Basta criar uma conta em: https://ai.tibiaking.com
      Utilize a IA para gerar seus scripts de forma simples e rápida
      Envie feedbacks para ajudarmos a tornar a ferramenta ainda melhor!

      Problemas relatar diretamente no meu discord pessoal : underewar
       
       
    • Por Bagon
      Bom, hoje venho trazer á vocês um sistema de Pet System DIFERENCIADO de alguns presentes no fórum. Este sistema tem diversos comandos diferenciados, como: 
       
      !pet nomedopet este comando irá sumonar o pet. 
      !remove irá remover o pet.
      !fale eu sou lindo o pet falará "eu sou lindo"
      !conversar o pet irá conversar com vc. 
       
      Então sem mais delongas vamos ao script.
       
      OBS: SCRIPT TESTADO SOMENTE EM TFS 0.4/0.3, e este script foi feito com a intenção de ser vendido no site do ot ou em poderá usar como quest usando o item selecionado como premio. fique ao seu critério.
       
      Primeiro vá até a pasta talkaction/script e crie um arquivo chamado petsystem.lua, depois coloque o seguinte script:
       
       
      Agora em talkactions/talkactions.xml adicione a seguinte tag:
       
      <talkaction words="!pet;!remove;!fale;!conversar" event="script" value="petsystem.lua" />  
      EXPLICAÇÂO:
      As partes em Negrito, são os pets. Você pode alterar ou criar monstros para fazer eles como pets. (Recomendo criar um monstro para que seja somente pet.)
       
      Exemplo: ["dog"]= {stor=78552},      
       
       
      Lembrando que é necessário mudar esta parte no script do monstro colocado a cima.
       
      <flag attackable="1" /> para :
       
      <flag attackable="0" />  
      agora vá em action/script e crie um arquivo chamado pet com o seguinte script:
       
       
      e vá em action.xml e adiciona a seguinte tag:
       
      <action itemid="10063" script="pet.lua"/> Explicação: Na tag da action o itemid é o item que deverá ser usado para ganhar a storage 78552, e assim podera sumonar o monstro com esta storage.
       
                                              
                                                         CRIE UMA ACTION COM A TAG A CIMA PARA CADA MONSTRO COLOCADO NA TALKACTION,
                                                         BASTA VC ALTERAR A STORAGE DO SCRIPT DA ACTION
                                                         EXEMPLO: em action altere as storage que estão em vermelho, como mostra abaixo
       
                                                              if getPlayerStorageValue(cid, 78552) < 1 then
                                                              setPlayerStorageValue(cid, 78552, 1)
       
                                                         aonde tem 78552 altere para 78553 que no caso é a storage do cyclops escolhido lá no script da talkaction
                                                         e assim susecivelmente.
       
       
       
      CREDITOS:
      Mulizeu
      Smartbox
      Bagon 
       
    • Por Imperius
      Olá, pessoal! Acabei encontrando um script que tinha feito a um tempo atrás. Estou compartilhando aqui para quem quiser usar ou melhorar.
       
      É bem parecido com os outros sistemas de roleta, igual deste tópico: https://tibiaking.com/forums/topic/101557-action-cassino-roleta-de-items/
       
      Como funciona?
       
      O "Treasure Chest" é um item custom, onde o jogador têm a possibilidade de ganhar itens raros ou bem meia boca. Tudo dependerá da sorte.
       
      O jogador precisa tacar o treasure chest na bancada e acionar a alavanca. O treasure chest irá se transformar em vários itens de forma randômica no qual o jogador poderá ou não ganhar. No final, apenas um item é entregue ao jogador.
       
      Para entender melhor o seu funcionamento, segue o GIF abaixo:
       

       
       
      em data > actions > actions.xml
       
       
      em data > actions > scripts > crie um arquivo chamado leverTreasureChest.lua
       
       
      no banco de dados do servidor, adicione o seguinte código em "SQL":
       
       
       

      Também estou disponibilizando uma página PHP, para quem quiser usar no site do servidor. Na página tem informações sobre o funcionamento, quais são os possíveis prêmios e a lista de jogadores que ganharam os itens raros.
       

       
       
      Espero ter ajudado de alguma forma! : )
       
      treasure_chest.php
    • Por Maniaco
      Salve TibiaKing!!! TFS 0.4 . 8.60
       
      Estou implementando o Sistema do @WooX de Cave Exlusiva

      Link:
       
      Porem estou com um problema seguindo o tutorial completo dele acabo tendo um retorno de erro na Distro! E ja que o mesmo nao entra no forum deis de 14/01! Venho solicitar ajuda de vocês!
      Caso alguem tenha o Discord Dele Favor me Passe  
      Vamos lá!
      Erro:
       
      Script :
       
      Lib
       
       
      Print Rme:
       
       
      Lembrando que nao esta funcionando em geral, Acrédito que eu tenha pulado algo ou deixado passar despercebido!
      Espero que alguem consiga me ajudar vlw!
  • Estatísticas dos Fóruns

    96843
    Tópicos
    519612
    Posts
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo