Ir para conteúdo
  • Cadastre-se

Posts Recomendados

.Qual servidor ou website você utiliza como base? 

OTServBR 12

https://github.com/opentibiabr/OTServBR-Global

Qual o motivo deste tópico? 

 

Estou tentando fazer dois amuletos funcionarem como um AOL Infinito, isso é, previne de cair loot e não desaparece ao morrer

Porém todas as minhas tentativas falharam, pois mesmo tentando copiar a forma que o aol funciona, os dois amuletos somem do inventario ao morrer e dropa loot...

 

Os ids dos amuletos são respectivamente: 36103 e 10719

Spoiler

	<item id="10719" article="a" name="Eketera Neklace">
		<attribute key="slotType" value="necklace" />
		<attribute key="quicklootcategory" value="amulet" />
		<attribute key="weight" value="400" />
		<attribute key="description" value="Have the same effect as the amulet of loss, besides being infinite." />
		<attribute key="armor" value="5" />
		<attribute key="magiclevelpoints" value="2" />
		<attribute key="absorbPercentPhysical" value="2" />
		<attribute key="absorbPercentEnergy" value="2" />
		<attribute key="absorbPercentEarth" value="2" />
		<attribute key="absorbPercentFire" value="2" />
		<attribute key="absorbPercentIce" value="2" />
		<attribute key="absorbPercentHoly" value="2" />
		<attribute key="absorbPercentDeath" value="2" />
		<attribute key="charges" value="1" />
	</item>

 

 

 

e

 

Spoiler

	<item id="36103" article="a" name="Eketera Amulet">
		<attribute key="slotType" value="necklace" />
		<attribute key="quicklootcategory" value="amulet" />
		<attribute key="weight" value="400" />
		<attribute key="description" value="Have the same effect as the amulet of loss, besides being infinite." />
		<attribute key="armor" value="5" />
		<attribute key="skillSword" value="2" />
		<attribute key="skillClub" value="2" />
		<attribute key="skillAxe" value="2" />
		<attribute key="skillDist" value="2" />
		<attribute key="absorbPercentPhysical" value="2" />
		<attribute key="absorbPercentEnergy" value="2" />
		<attribute key="absorbPercentEarth" value="2" />
		<attribute key="absorbPercentFire" value="2" />
		<attribute key="absorbPercentIce" value="2" />
		<attribute key="absorbPercentHoly" value="2" />
		<attribute key="absorbPercentDeath" value="2" />
		<attribute key="charges" value="1" />
	</item>

 

 

 

Você tem o código disponível? Se tiver publique-o aqui: 

 

 

 

 

 

 

 

creaturescripts/scripts/others/droploot.lua

Spoiler

dofile('data/modules/scripts/blessings/blessings.lua')
function onDeath(player, corpse, killer, mostDamage, unjustified, mostDamage_unjustified)
	if player:hasFlag(PlayerFlag_NotGenerateLoot) then
		return true
	end
	Blessings.DebugPrint("onDeath DROPLOOT EVENT DropLoot")
	return Blessings.PlayerDeath(player, corpse, killer)
end

 

 

 

data/modules/scripts/blessings/blessings.lua (O PROBLEMA TA AQUI)

Spoiler

Blessings = {}

Blessings.Credits = {
	Developer = "Charles (Cjaker), DudZ",
	Version = "2.0",
	lastUpdate = "08/04/2020",
	todo = {
		"Insert & Select query in blessings_history",
		"Add unfair fight reductio (convert the get killer is pvp fight with getDamageMap of dead player)",
		"Gamestore buy blessing",
		"Test ank print text",
		"Test all functions",
		"Test henricus prices/blessings",
		"Add data \\movements\\scripts\\quests\\cults of tibia\\icedeath.lua blessing information",
		"WotE data\\movements\\scripts\\quests\\wrath of the emperor\\realmTeleport.lua has line checking if player has bless 1??? wtf",
		"add blessings module support npc\\lib\\npcsystem\\modules.lua",
		"Fix store buying bless",
		"Check if store is inside lua or source..."
	}
}

Blessings.Config = {
	AdventurerBlessingLevel = 20, -- Free full bless until level
	HasToF = false, -- Enables/disables twist of fate
	InquisitonBlessPriceMultiplier = 1.1, -- Bless price multiplied by henricus
	SkulledDeathLoseStoreItem = true, -- Destroy all items on store when dying with red/blackskull
	InventoryGlowOnFiveBless = true, -- Glow in yellow inventory items when the player has 5 or more bless,
	Debug = false -- Prin debug messages in console if enabled
}

dofile('data/modules/scripts/blessings/assets.lua')

--[=====[
--
-- Table structure `blessings_history`
--

CREATE TABLE IF NOT EXISTS `blessings_history` (
  `id` int(11) NOT NULL,
  `player_id` int(11) NOT NULL,
  `blessing` tinyint(4) NOT NULL,
  `loss` tinyint(1) NOT NULL,
  `timestamp` int(11) NOT NULL,
  CONSTRAINT `blessings_history_pk` PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--]=====]

Blessings.DebugPrint = function(content,pre,pos)
	if not Blessings.Config.Debug then
		return
	end
	if pre == nil then
		pre = ""
	else
		pre = pre.. " "
	end
	if pos == nil then
		pos = ""
	else
		pos = " " .. pos
	end
	if type(content) == "boolean" then
		print("[Blessings] START BOOL - "..pre)
		print(content)
		print("[Blessings] END BOOL - "..pos)
	else
		print("[Blessings] "..pre .. content..pos)
	end
end

Blessings.C_Packet = {
	OpenWindow = 0xCF
}

Blessings.S_Packet  = {
	BlessDialog = 0x9B,
	BlessStatus = 0x9C
}

function onRecvbyte(player, msg, byte)
	if (byte == Blessings.C_Packet.OpenWindow) then
		if (player:getClient().os ~= CLIENTOS_NEW_WINDOWS and player:getClient().os ~= CLIENTOS_FLASH) then
			player:sendCancelMessage("Only work with Flash Client & 11.0")
			return false
		end

		Blessings.sendBlessDialog(player)
	end
end

Blessings.sendBlessStatus = function(player, curBless)
	local msg = NetworkMessage()
	msg:addByte(Blessings.S_Packet.BlessStatus)
	callback = function(k) return true end
	if curBless == nil then
		curBless = player:getBlessings(callback) -- ex: {1, 2, 5, 7}
	end
	Blessings.DebugPrint(#curBless, "sendBlessStatus curBless")
	if player:getClient().version >= 1120 then 
		local bitWiseCurrentBless = 0
		local blessCount = 0
		for i = 1, #curBless do
			if curBless[i].losscount then
				blessCount = blessCount + 1
			end
			if (not curBless[i].losscount and Blessings.Config.HasToF) or curBless[i].losscount then
				bitWiseCurrentBless = bit.bor(bitWiseCurrentBless, Blessings.BitWiseTable[curBless[i].id])
			end
		end
		if blessCount > 5 and Blessings.Config.InventoryGlowOnFiveBless then
			bitWiseCurrentBless = bit.bor(bitWiseCurrentBless, 1)
		end
		msg:addU16(bitWiseCurrentBless)  
		dlgBtnColour = 1
		if blessCount >= 7 then
			dlgBtnColour = 3
		elseif blessCount > 0 then
			dlgBtnColour = 2
		end
		msg:addByte(dlgBtnColour) -- Bless dialog button colour 1 = Disabled | 2 = normal | 3 = green
	elseif #curBless >= 5 then
		msg:addU16(1) -- TODO ?
	else
		msg:addU16(0)
	end

	msg:sendToPlayer(player)
end

Blessings.sendBlessDialog = function(player)
	local msg = NetworkMessage()
	msg:addByte(Blessings.S_Packet.BlessDialog)
	
	callback = function(k) return true end
	local curBless = player:getBlessings()	

	msg:addByte(Blessings.Config.HasToF and #Blessings.All or (#Blessings.All - 1)) -- total blessings
	for k = 1, #Blessings.All do
		v = Blessings.All[k]
		if v.type ~= Blessings.Types.PvP or Blessings.Config.HasToF then
			msg:addU16(Blessings.BitWiseTable[v.id])
			msg:addByte(player:getBlessingCount(v.id))
		end
	end

	local promotion = (player:isPremium() and player:isPromoted()) and 30 or 0
	local PvPminXPLoss = Blessings.LossPercent[#curBless].skill + promotion
	local PvPmaxXPLoss = PvPminXPLoss
	if Blessings.Config.HasToF then
		PvPmaxXPLoss = math.floor(PvPminXPLoss * 1.15)
	end
	local PvEXPLoss = PvPminXPLoss
	
	local playerAmulet = player:getSlotItem(CONST_SLOT_NECKLACE)
	local haveSkull = player:getSkull() >= 4
	hasAol = (playerAmulet and playerAmulet:getId() == ITEM_AMULETOFLOSS)
	
	equipLoss = Blessings.LossPercent[#curBless].item
	if haveSkull then
		equipLoss = 100
	elseif hasAol then
		equipLoss = 0
	end

	msg:addByte(2) -- BYTE PREMIUM (only work with premium days)
	msg:addByte(promotion) -- XP Loss Lower POR SER PREMIUM
	msg:addByte(PvPminXPLoss) -- XP/Skill loss min pvp death
	msg:addByte(PvPmaxXPLoss) -- XP/Skill loss max pvp death
	msg:addByte(PvEXPLoss) -- XP/Skill pve death
	msg:addByte(equipLoss) -- Equip container lose pvp death
	msg:addByte(equipLoss) -- Equip container pve death

	msg:addByte(haveSkull and 1 or 0) -- is red/black skull
	msg:addByte(hasAol and 1 or 0)


	-- History
	local historyAmount = 1
	msg:addByte(historyAmount) -- History log count
	for i = 1, historyAmount do
		msg:addU32(os.time()) -- timestamp
		msg:addByte(0) -- Color message (1 - Red | 0 = White loss)
		msg:addString("Blessing Purchased") -- History message
	end

	msg:sendToPlayer(player)
end

Blessings.getBlessingsCost = function(level)
	if level <= 30 then
		return 2000
	elseif level >= 120 then
		return 20000
	else
		return (level - 20) * 200
	end
end

Blessings.getPvpBlessingCost = function(level)
	if level <= 30 then
		return 2000
	elseif level >= 270 then
		return 50000
	else
		return (level - 20) * 200
	end
end

Blessings.useCharm = function(player, item)
	local useItem = Blessings.Charms[item.itemid]
	if not useItem then
		return true
	end

	if player:hasBlessing(useItem.blessId) then
		player:say('You already possess this blessing.', TALKTYPE_MONSTER_SAY)
		return true
	end

	player:addBlessing(useItem.blessId, 1)
	player:sendTextMessage(MESSAGE_EVENT_ADVANCE, useItem.text .. ' protects you.')
	player:getPosition():sendMagicEffect(CONST_ME_LOSEENERGY)
	item:remove(1)
	return true
end

Blessings.checkBless = function(player)
	local result, bless = 'Received blessings:'
	for k, v in pairs(Blessings.All) do
		result = player:hasBlessing(k) and result .. '\\n' .. v.name or result
	end
	player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 20 > result:len() and 'No blessings received.' or result)
	return true
end

Blessings.doAdventurerBlessing = function(player)
	if player:getLevel() > Blessings.Config.AdventurerBlessingLevel then
		return true
	end
	player:addMissingBless(true, true)

	player:sendTextMessage(MESSAGE_EVENT_ADVANCE,'You received adventurers blessings for you being level lower than ' .. Blessings.Config.AdventurerBlessingLevel .. '!')
	player:getPosition():sendMagicEffect(CONST_ME_HOLYDAMAGE)
	return true
end

Blessings.getInquisitionPrice = function(player)
	-- Find how many missing bless we have and give out the price
	inquifilter = function(b) return b.inquisition end
	donthavefilter = function(p, b) return not p:hasBlessing(b) end
	local missing = #player:getBlessings(filter, donthavefilter)
	local totalBlessPrice = Blessings.getBlessingsCost(player:getLevel()) * missing * Blessings.Config.InquisitonBlessPriceMultiplier
	return missing, totalBlessPrice
end

Blessings.DropLoot = function(player, corpse, chance, skulled)
	local multiplier = 100 -- Improve the loot randomness spectrum
	math.randomseed(os.time()) -- Improve the loot randomness spectrum
	chance = chance * multiplier
	Blessings.DebugPrint(chance, "DropLoot chance")
	for i = CONST_SLOT_HEAD, CONST_SLOT_AMMO do
		local item = player:getSlotItem(i)
		if item then
			local thisChance = chance
			local thisRandom = math.random(100*multiplier)
			if not item:isContainer() then
				thisChance = chance/10
			end
			Blessings.DebugPrint(thisChance/multiplier .. "%" .. " | thisRandom "..thisRandom/multiplier.."%", "DropLoot item "..item:getName() .. " |")
			if skulled or thisRandom <= thisChance then
				Blessings.DebugPrint("Dropped "..item:getName())
				item:moveTo(corpse)
			end
		end
	end
	if skulled and Blessings.Config.SkulledDeathLoseStoreItem then
		local inbox = self:getSlotItem(CONST_SLOT_STORE_INBOX)
		local inboxsize = inbox:getSize() - 1
		for i = 0, inboxsize do
			inbox:getItem(i):destroy()
		end
	end
end

Blessings.ClearBless = function(player, killer, currentBless)
	Blessings.DebugPrint(#currentBless, "ClearBless #currentBless")
	local hasToF = Blessings.Config.HasToF and player:hasBlessing(1) or false
	if hasToF and killer (killer:isPlayer() or (killer:getMaster() and killer:getMaster():isPlayer())) then -- TODO add better check if its pvp or pve
		player:removeBlessing(1)
		return
	end
	for i = 1, #currentBless do
		
		Blessings.DebugPrint(i, "ClearBless curBless i", " | "..currentBless[i].name)
		player:removeBlessing(currentBless[i].id, 1)
	end
end


Blessings.BuyAllBlesses = function(player)
	if not Tile(player:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) and (player:isPzLocked() or player:getCondition(CONDITION_INFIGHT, CONDITIONID_DEFAULT))  then
		player:sendCancelMessage("You can't buy bless while in battle.")
		player:getPosition():sendMagicEffect(CONST_ME_POFF)
		return
	end

	local blessCost = Blessings.getBlessingsCost(player:getLevel())
	local PvPBlessCost = Blessings.getPvpBlessingCost(player:getLevel())
	local hasToF = Blessings.Config.HasToF and player:hasBlessing(1) or true
	donthavefilter = function(p, b) return not p:hasBlessing(b) end
	local missingBless = player:getBlessings(nil,donthavefilter)
	local missingBlessAmt = #missingBless + (hasToF and 0 or 1)
	local totalCost = blessCost * #missingBless

	if missingBlessAmt == 0 then
		player:sendCancelMessage("You are already blessed.")
		player:getPosition():sendMagicEffect(CONST_ME_POFF)
		return
	end
	if not hasToF then
		totalCost = totalCost + PvPBlessCost
	end

	if player:removeMoneyNpc(totalCost) then
		for i, v in ipairs(missingBless) do
			player:addBlessing(v.id, 1)
		end
		player:sendCancelMessage("You received the remaining " .. missingBlessAmt .. " blesses for a total of " .. totalCost .." gold.")
		player:getPosition():sendMagicEffect(CONST_ME_HOLYAREA)
	else
		player:sendCancelMessage("You don't have enough money. You need " .. totalCost .. " to buy all blesses.", cid)
		player:getPosition():sendMagicEffect(CONST_ME_POFF)
	end
	
end

Blessings.PlayerDeath = function(player, corpse, killer)
	local hasToF = Blessings.Config.HasToF and player:hasBlessing(1) or false
	local hasAol = (player:getSlotItem(CONST_SLOT_NECKLACE) and player:getSlotItem(CONST_SLOT_NECKLACE):getId() == ITEM_AMULETOFLOSS)
	local haveSkull = isInArray({SKULL_RED, SKULL_BLACK}, player:getSkull())
	local curBless = player:getBlessings()

	if haveSkull then  -- lose all bless + drop all items
		Blessings.DropLoot(player, corpse, 100, true)
	elseif #curBless < 5 and not hasAol then -- lose all items 
		local equipLoss = Blessings.LossPercent[#curBless].item
		Blessings.DropLoot(player, corpse, equipLoss)
	elseif #curBless < 5 and hasAol and not hasToF then
		player:removeItem(ITEM_AMULETOFLOSS, 1, -1, false)
	end
	--Blessings.ClearBless(player, killer, curBless) IMPLEMENTED IN SOURCE BECAUSE THIS WAS HAPPENING BEFORE SKILL/EXP CALCULATIONS


	if not player:getSlotItem(CONST_SLOT_BACKPACK) then
		player:addItem(ITEM_BAG, 1, false, CONST_SLOT_BACKPACK)
	end
	
	return true
end

function Player.getBlessings(self, filter, hasblessingFilter)
	local blessings = {}
	if filter == nil then
		filter = function(b) return b.losscount end
	end
	
	if hasblessingFilter == nil then
		hasblessingFilter = function(p, b) return p:hasBlessing(b) end
	end
	for k, v in pairs(Blessings.All) do
		if filter(v) and hasblessingFilter(self, k) then
			table.insert(blessings, v)
		end
	end
	return blessings
end

function Player.addMissingBless(self, all, tof)
	if all == nil then
		all = true
	end
	if tof == nil then
		tof = false
	elseif tof then
		tof = tof and Blessings.Config.HasToF
	end
	for k, v in pairs(Blessings.All) do
		if all or (v.type == Blessings.Types.REGULAR) or (tof and v.type == Blessings.Types.PvP) then
			if not self:hasBlessing(k) then
				self:addBlessing(k, 1)
			end
		end
	end
	Blessings.sendBlessStatus(self)
end

 

 

 

EDIT ~~

 

Tentativa 1:

 

Resultado: Não acontece nenhum erro no console, porém o amuleto some (igual o aol) e dropa o loot...

 

Em blessings.lua:

Spoiler

Blessings.PlayerDeath = function(player, corpse, killer)
	local hasToF = Blessings.Config.HasToF and player:hasBlessing(1) or false
	local hasAol = (player:getSlotItem(CONST_SLOT_NECKLACE) and player:getSlotItem(CONST_SLOT_NECKLACE):getId() == AMULETOFLOSS)
	local hasVip = (player:getSlotItem(CONST_SLOT_NECKLACE) and player:getSlotItem(CONST_SLOT_NECKLACE):getId() == 36103)
	local hasVipp = (player:getSlotItem(CONST_SLOT_NECKLACE) and player:getSlotItem(CONST_SLOT_NECKLACE):getId() == 10719)
	local haveSkull = isInArray({SKULL_RED, SKULL_BLACK}, player:getSkull())
	local curBless = player:getBlessings()

	if haveSkull then  -- lose all bless + drop all items
		Blessings.DropLoot(player, corpse, 100, true)
	elseif #curBless < 5 and (not hasAol and not hasVip and not hasVipp) then -- lose all items 
		local equipLoss = Blessings.LossPercent[#curBless].item
		Blessings.DropLoot(player, corpse, equipLoss)
	elseif #curBless < 5 and hasVip and not hasToF then
	return false
	elseif #curBless < 5 and hasVipp and not hasToF then
	return false
	elseif #curBless < 5 and hasAol and not hasToF then
		player:removeItem(ITEM_AMULETOFLOSS, 1, -1, false)
	elseif #curBless < 5 and not hasAol and not hasVip and not hasVip then -- lose all items 
		local equipLoss = Blessings.LossPercent[#curBless].item
	end
	
	if not player:getSlotItem(CONST_SLOT_BACKPACK) then
		player:addItem(ITEM_BAG, 1, false, CONST_SLOT_BACKPACK)
	end
	
	return true
end
Spoiler


Blessings.sendBlessDialog = function(player)
	local msg = NetworkMessage()
	msg:addByte(Blessings.S_Packet.BlessDialog)
	
	callback = function(k) return true end
	local curBless = player:getBlessings()	

	msg:addByte(Blessings.Config.HasToF and #Blessings.All or (#Blessings.All - 1)) -- total blessings
	for k = 1, #Blessings.All do
		v = Blessings.All[k]
		if v.type ~= Blessings.Types.PvP or Blessings.Config.HasToF then
			msg:addU16(Blessings.BitWiseTable[v.id])
			msg:addByte(player:getBlessingCount(v.id))
		end
	end

	local promotion = (player:isPremium() and player:isPromoted()) and 30 or 0
	local PvPminXPLoss = Blessings.LossPercent[#curBless].skill + promotion
	local PvPmaxXPLoss = PvPminXPLoss
	if Blessings.Config.HasToF then
		PvPmaxXPLoss = math.floor(PvPminXPLoss * 1.15)
	end
	local PvEXPLoss = PvPminXPLoss
	
	local playerAmulet = player:getSlotItem(CONST_SLOT_NECKLACE)
	local haveSkull = player:getSkull() >= 4
	
	hasAol = (playerAmulet and playerAmulet:getId() == ITEM_AMULETOFLOSS)
	hasVip = (playerAmulet and playerAmulet:getId() == 36103)
	hasVipp = (playerAmulet and playerAmulet:getId() == 10719)
	equipLoss = Blessings.LossPercent[#curBless].item
	if haveSkull then
		equipLoss = 100
	elseif hasAol then
		equipLoss = 0
	elseif hasVip then
	    equipLoss = 0
	elseif hasVipp then
	    equipLoss = 0
	end

	msg:addByte(2) -- BYTE PREMIUM (only work with premium days)
	msg:addByte(promotion) -- XP Loss Lower POR SER PREMIUM
	msg:addByte(PvPminXPLoss) -- XP/Skill loss min pvp death
	msg:addByte(PvPmaxXPLoss) -- XP/Skill loss max pvp death
	msg:addByte(PvEXPLoss) -- XP/Skill pve death
	msg:addByte(equipLoss) -- Equip container lose pvp death
	msg:addByte(equipLoss) -- Equip container pve death

	msg:addByte(haveSkull and 1 or 0) -- is red/black skull
	msg:addByte(hasAol and 1 or 0)
	msg:addByte(hasVip and 1 or 0)
	msg:addByte(hasVipp and 1 or 0)


	-- History
	local historyAmount = 1
	msg:addByte(historyAmount) -- History log count
	for i = 1, historyAmount do
		msg:addU32(os.time()) -- timestamp
		msg:addByte(0) -- Color message (1 - Red | 0 = White loss)
		msg:addString("Blessing Purchased") -- History message
	end

	msg:sendToPlayer(player)
end

 

 

 

Editado por Serpente (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

Olá @Serpente, tudo bem?

 

Então, basta remover a seguinte linha:

<attribute key="charges" value="1" />

Assim ele ficará infinito :)

 

Para o Loot não dropar, adicione a seguinte linha:

<attribute key="preventDrop" value="1"/>

Assim ele irá funcionar como um AOL

Editado por 9k22 (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

image.png.0b6031c8b269a887307f1f1b02d9d5de.png

 

No TFS 1.3 infelizmente não existe essa tag =/

 

Um comportamento muito estranho que estou notando é que esses amuletos sempre desaparecem ao morrer

Mesmo que no blessings.lua eu não tenha colocado essa ação em nenhum lugar

 

Edit ~~

2° Tentiva: Mesma coisa que a 1° tentativa, sem erro no console, amuleto some e dropa loot

Spoiler

 



Blessings.PlayerDeath = function(player, corpse, killer)
	local hasToF = Blessings.Config.HasToF and player:hasBlessing(1) or false
	local hasAol = (player:getSlotItem(CONST_SLOT_NECKLACE) and (player:getSlotItem(CONST_SLOT_NECKLACE):getId() == AMULETOFLOSS or player:getSlotItem(CONST_SLOT_NECKLACE):getId() == VIPAMULET or player:getSlotItem(CONST_SLOT_NECKLACE):getId() == VIPAMULETT))
	local haveSkull = isInArray({SKULL_RED, SKULL_BLACK}, player:getSkull())
	local curBless = player:getBlessings()

	if haveSkull then  -- lose all bless + drop all items
		Blessings.DropLoot(player, corpse, 100, true)
	elseif #curBless < 5 and not hasAol then -- lose all items 
		local equipLoss = Blessings.LossPercent[#curBless].item
		Blessings.DropLoot(player, corpse, equipLoss)
	elseif #curBless < 5 and hasAol and not hasToF then
		return false
	end
	--Blessings.ClearBless(player, killer, curBless) IMPLEMENTED IN SOURCE BECAUSE THIS WAS HAPPENING BEFORE SKILL/EXP CALCULATIONS


	if not player:getSlotItem(CONST_SLOT_BACKPACK) then
		player:addItem(ITEM_BAG, 1, false, CONST_SLOT_BACKPACK)
	end
	
	return true
end

 

 

Editado por Serpente (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 cloudrun2023
      CloudRun - Sua Melhor Escolha para Hospedagem de OTServer!
      Você está procurando a solução definitiva para hospedar seu OTServer com desempenho imbatível e segurança inigualável? Não procure mais! Apresentamos a CloudRun, sua parceira confiável em serviços de hospedagem na nuvem.
       
      Recursos Exclusivos - Proteção DDoS Avançada:
      Mantenha seu OTServer online e seguro com nossa robusta proteção DDoS, garantindo uma experiência de jogo ininterrupta para seus jogadores.
       
      Servidores Ryzen 7 Poderosos: Desfrute do poder de processamento superior dos servidores Ryzen 7 para garantir um desempenho excepcional do seu OTServer. Velocidade e estabilidade garantidas!
       
      Armazenamento NVMe de Alta Velocidade:
      Reduza o tempo de carregamento do jogo com nosso armazenamento NVMe ultrarrápido. Seus jogadores vão adorar a rapidez com que podem explorar o mundo do seu OTServer.
       
      Uplink de até 1GB:
      Oferecemos uma conexão de alta velocidade com até 1GB de largura de banda, garantindo uma experiência de jogo suave e livre de lag para todos os seus jogadores, mesmo nos momentos de pico.
       
      Suporte 24 Horas:
      Estamos sempre aqui para você! Nossa equipe de suporte está disponível 24 horas por dia, 7 dias por semana, para resolver qualquer problema ou responder a qualquer pergunta que você possa ter. Sua satisfação é a nossa prioridade.
       
      Fácil e Rápido de Começar:
      Configurar seu OTServer na CloudRun é simples e rápido. Concentre-se no desenvolvimento do seu jogo enquanto cuidamos da hospedagem.
       
      Entre em Contato Agora!
      Website: https://central.cloudrun.com.br/index.php?rp=/store/cloud-ryzen-brasil
      Email: [email protected]
      Telefone: (47) 99902-5147

      Não comprometa a qualidade da hospedagem do seu OTServer. Escolha a CloudRun e ofereça aos seus jogadores a melhor experiência de jogo possível. Visite nosso site hoje mesmo para conhecer nossos planos e começar!
       
      https://central.cloudrun.com.br/index.php?rp=/store/cloud-ryzen-brasil
       
      CloudRun - Onde a Velocidade Encontra a Confiabilidade!
       

    • Por FeeTads
      SALVE rapaziada do TK, esses dias vim pensando em novos scripts pro meu OT, e em um deles eu precisava que determinada area não contasse frag pro player que matasse outros, PORÉM eu precisava que os players que morressem nessa area ainda assim tivessem as penalidades da sua morte, procurei por ai, achei alguns scripts que apenas tiravam o SKULL e não realmente o FRAG do player.

      **script atualizado 22/10/2023** - melhorado e otimizado, levei o script pra puxar as infos por .lua / creatureScripts

      vou disponibilizar o code aqui, e o que fazer pra determinada area não contar frag.

      SOURCE OTX 2 / TFS 0.x, Funciona em TFS 1.x mudando as tags e ajeitando as sintaxes.

      vá em creatureevent.cpp

      procure por:
      else if(type == "preparedeath") _type = CREATURE_EVENT_PREPAREDEATH;
      Adiciona abaixo:
      else if(type == "nocountfrag") _type = CREATURE_EVENT_NOCOUNTFRAG;

      procure por:
      case CREATURE_EVENT_PREPAREDEATH: return "onPrepareDeath";  
      Adicione abaixo: 
      case CREATURE_EVENT_NOCOUNTFRAG: return "noCountFragArea";

      procure por:
      case CREATURE_EVENT_PREPAREDEATH: return "cid, deathList";
      Adicione abaixo:
      case CREATURE_EVENT_NOCOUNTFRAG: return "cid, target";

      agora no mesmo arquivo, vá até o final do arquivo e adicione essa função:
      uint32_t CreatureEvent::executeNoCountFragArea(Creature* creature, Creature* target) { //noCountFragArea(cid, target) if(m_interface->reserveEnv()) { ScriptEnviroment* env = m_interface->getEnv(); if(m_scripted == EVENT_SCRIPT_BUFFER) { env->setRealPos(creature->getPosition()); std::ostringstream scriptstream; scriptstream << "local cid = " << env->addThing(creature) << std::endl; scriptstream << "local target = " << env->addThing(target) << std::endl; if(m_scriptData) scriptstream << *m_scriptData; bool result = true; if(m_interface->loadBuffer(scriptstream.str())) { lua_State* L = m_interface->getState(); result = m_interface->getGlobalBool(L, "_result", true); } m_interface->releaseEnv(); return result; } else { #ifdef __DEBUG_LUASCRIPTS__ std::ostringstream desc; desc << creature->getName(); env->setEvent(desc.str()); #endif env->setScriptId(m_scriptId, m_interface); env->setRealPos(creature->getPosition()); lua_State* L = m_interface->getState(); m_interface->pushFunction(m_scriptId); lua_pushnumber(L, env->addThing(creature)); lua_pushnumber(L, env->addThing(target)); bool result = m_interface->callFunction(2); m_interface->releaseEnv(); return result; } } else { std::clog << "[Error - CreatureEvent::noCountFragArea] Call stack overflow." << std::endl; return 0; } }

      agora vá em creatureevent.h

      procure por:
      CREATURE_EVENT_PREPAREDEATH
      adicione abaixo:
      CREATURE_EVENT_NOCOUNTFRAG

      procure por:
      uint32_t executePrepareDeath(Creature* creature, DeathList deathList);
      Adicione abaixo:
      uint32_t executeNoCountFragArea(Creature* creature, Creature* target);

      agora vá em player.cpp

      procure por:
      bool Player::onKilledCreature(Creature* target, DeathEntry& entry)
      abaixo de:
      War_t enemy; if(targetPlayer->getEnemy(this, enemy)) { if(entry.isLast()) IOGuild::getInstance()->updateWar(enemy); entry.setWar(enemy); }
      Adicione o seguinte código:
      if (targetPlayer){ CreatureEventList killEvents = getCreatureEvents(CREATURE_EVENT_NOCOUNTFRAG); for (const auto &event : killEvents) { if (!event->executeNoCountFragArea(this, target)) { return true; } } }

      //

      Feito isso, tudo completo na sua source, agora é necessário adicionar o creaturescript dentro do servidor

      vá até creaturescripts/scripts
      crie um arquivo chamado, "noCountFragInArea.lua"
      e dentro dele cole o código:
       
      --[[ script feito por feetads / TibiaKing ]]-- --[[ discord: feetads / FeeTads#0246 ]]-- -- Add positions here for which you do not want to count frags local areas = { [1] = {from = {x = 91, y = 122, z = 7}, to = {x = 98, y = 127, z = 7}}, -- from = area superior esquerda / to = area inferior direita (formando um quadrado) } local onlyKillerInArea = false -- only killer need to be in area? function noCountFragArea(cid, target) if not isCreature(cid) or not isCreature(target) then return true end local posKiller = getPlayerPosition(cid) local posTarget = getPlayerPosition(target) for i = 1, #areas do local area = areas[i] if isInArea(posKiller, area.from, area.to) then if onlyKillerInArea then return false elseif isInArea(posTarget, area.from, area.to) then return false end end end return true end
      agora em creaturescripts.xml
      <event type="nocountfrag" name="fragarea" event="script" value="noCountFragInArea.lua"/>
      agora em creaturescripts/scripts/login.lua
       procure por OU semelhante a esse:
      registerCreatureEvent(cid, "AdvanceSave")
      e abaixo adicione:
      registerCreatureEvent(cid, "fragarea")

      //


      Agora tudo certo, quando quiser adiciona uma area que não pega frag, vá até o script e apenas coloque a area, igual o demonstrado no script

      Exemplo:
      local areas = { [1] = {from = {x = 91, y = 122, z = 7}, to = {x = 98, y = 127, z = 7}}, [2] = {from = {x = 1000, y = 1000, z = 7}, to = {x = 1100, y = 1100, z = 7}}, }
      assim somente colocando a area no script e abrindo o server ou dando /reload, já funcionará a area como não pegar frag.
      Esse sistema pode ser bom pra areas de pvp ativo, onde você ainda quer que o player que morrer perca os atributos, como se fosse uma morte normal, porém não conta frag pra quem matar.
      Bom pra sistemas tipo castle 48h (guild war), onde há diversas mortes e risco de pegar red, atrapalhando a war.

      Façam bom proveito dos scripts, e deixem os créditos no script rsrs

      **Eu fiz as alterações e o simples código por isso vim disponibilizar, créditos meus**
    • Por Muvuka
      Abri canal a força creaturescript acho que funcione no creaturescript cria script creaturescript
       
      <channel id="9" name="HELP" logged="yes"/>
      <channel id="12" name="Report Bugs" logged="yes"/>
      <channel id="13" name="Loot" logged="yes"/>
      <channel id="14" name="Report Character Rules Tibia Rules" logged="yes"/>
      <channel id="15" name="Death Channel"/>
      <channel id="6548" name="DexSoft" level="1"/>
      <channel id="7" name="Reports" logged="yes"/>
       
      antes de 
              if(lastLogin > 0) then adicione isso:
                      doPlayerOpenChannel(cid, CHANNEL_HELP) doPlayerOpenChannel(cid, 1,  2, 3) = 1,2 ,3 Channels, entendeu? NÃO FUNCIONA EU QUERO UM MEIO DE ABRI SEM USA A SOURCE
       
      EU NÃO CONSEGUI ABRI EU NÃO TENHO SOURCE
       
       
    • Por bolachapancao
      Rapaziada seguinte preciso de um script que ao utilizar uma alavanca para até 4 jogadores.
      Os jogadores serão teleportados para hunt durante uma hora e depois de uma hora os jogadores serão teleportados de volta para o templo.
       
      Observação: caso o jogador morra ou saia da hunt o evento hunt é cancelado.

      Estou a base canary
      GitHub - opentibiabr/canary: Canary Server 13.x for OpenTibia community.
       
    • Por RAJADAO
      .Qual servidor ou website você utiliza como base? 
      Sabrehaven 8.0
      Qual o motivo deste tópico? 
      Ajuda com novos efeitos
       
      Olá amigos, gostaria de ajuda para introduzir os seguintes efeitos no meu servidor (usando o Sabrehaven 8.0 como base), adicionei algumas runas novas (avalanche, icicle, míssil sagrado, stoneshower & Thunderstorm) e alguns novos feitiços (exevo mas san, exori san, exori tera, exori frigo, exevo gran mas frigo, exevo gran mas tera, exevo tera hur, exevo frigo hur) mas nenhum dos efeitos dessas magias parece existir no servidor, alguém tem um link para um tutorial ou algo assim para que eu possa fazer isso funcionar?
      Desculpe pelo mau inglês, sou brasileiro.

      Obrigado!


      AVALANCHE RUNE id:3161 \/
      (COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
      (COMBAT_PARAM_EFFECT, CONST_ME_ICEAREA)
      (COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ICE)

      STONESHOWER RUNE id:3175 \/
      (COMBAT_PARAM_TYPE, COMBAT_EARTHDAMAGE)
      (COMBAT_PARAM_EFFECT, CONST_ME_STONES)
      (COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_EARTH)

      THUNDERSTORM RUNE id:3202 \/
      (COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
      (COMBAT_PARAM_EFFECT, CONST_ME_E NERGYHIT)
      (COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGYBALL)

      ICICLE RUNE id:3158 \/
      COMBAT_ICEDAMAGE
      CONST_ME_ICEAREA
      CONST_ANI_ICE

      SANTO MÍSSIL RUNA id:3182 \/
      (COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
      (COMBAT_PARAM_EFFECT, CONST_ME_HOLYDAMAGE)
      (COMBAT_PARAM_EFFECT, CONST_ME_HOLYAREA)
      (COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_HOLY)

      CONST_ME_PLANTATTACK (exevo gran mas tera)
      CONST_ME_ICETORNADO (exevo gran mas frigo)
      CONST_ME_SMALLPLANTS (exevo tera hur)
      CONST_ME_ICEAREA (exevo frigo hur)
      CONST_ME_ICEATTACK (exori frigo)
      CONST_ME_CARNIPHILA (exori tera)

      EXORI SAN \/
      (COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SMALLHOLY)
      CONST_ME_HOLYDAM IDADE

      EXEVO MAS SAN \/
      CONST_ME_HOLYAREA
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo