Ir para conteúdo
  • Cadastre-se

Scripting Dota liberando o nexus depois de matar so uma torre


Posts Recomendados

to usando o dota system do vodkart, devo ter feito alguma configuração errada ou sei lá, eu chequei e nao encontrei o erro

basicamente, quando maat uma unica torre do outro tibe ja libera o nexus, sendo que deveria ter q matar as 3 torres antes de liberar o nexus, ao matar qualquer torre tambem sao enviados 2 broadcasts em vez de 1, realmente contando como se tivesse matado as 3 torres. Uso tfs 0.4

data/lib/dota_system

dota_config = {
	storages = {172200, 172201, 963220, 963221, 963222, 963223, 963224}, -- count, talk, team blue, team red, tower blue, tower red, move
	players = {min = 8, max = 30}, -- min e max
	TeamBlue = {name = "Blue Assassins", town = 10},
	TeamRed = {name = "Red Barbarians", town = 11},
	rewards = {{70,9971,10}},
	timeToStartEvent = 10, -- segundos para começar o evento
	CheckTime = 5, -- tempo que o TP fica aberto para os jogadores adrentarem o evento
	teleport = {x=167, y=51, z=7}, -- position do tp onde aparece 167 51 7
	minLevel = 15000,
	room = {x=1509, y=1870, z=7}, -- 1509 1870 7 sala de espera
	block_mc = true,
	DeathDelay = 7
}


dota_days = {
	["Monday"] = {"15:40"},
	["Tuesday"] = {"15:40"},
	["Wednesday"] = {"15:40"},
	["Thursday"] = {"15:40"},
	["Friday"] = {"15:40"},
	["Saturday"] = {"15:40"},
	["Sunday"] = {"15:40"}
}

DotaTowers_Lib = {
	["Mid Tower Blue"] = {
		pos = {x=1530, y=1846, z=7}-- position towers  blue 1530 1846 7
	},
	["Bot Tower Blue"] = {
		pos = {x=1542, y=1847, z=7}-- position towers  blue 1542 1847 7
	},
	["Top Tower Blue"] = {
		pos = {x=1518, y=1847, z=7}-- position towers  blue 1518 1847 7
	},
	["Blue Nexus"] = {
		pos = {x=1542, y=1841, z=7},  -- position nexus blue 1542 1841 7
		winners = dota_config.storages[4]
	},
	["Top Tower Red"] = {
		pos = {x=1494, y=1847, z=7}-- position towers  1494 1847 7
	},
	["Bot Tower Red"] = {
		pos = {x=1470, y=1847, z=7}-- position towers  1470 1847 7
	},
	["Mid Tower Red"] = {
		pos = {x=1482, y=1846, z=7}-- position towers  1482 1846 7
	},
	["Red Nexus"] = {
		pos = {x=1470, y=1841, z=7}, -- position nexus 1470 1840 7
		winners = dota_config.storages[3]
	}
}

dota_portoes = {
	{1355,{x = 1464, y = 1845, z = 7, stackpos = 1}}, -- 1464 1845 7
	{1355,{x = 1464, y = 1846, z = 7, stackpos = 1}},
	{1355,{x = 1464, y = 1847, z = 7, stackpos = 1}},
	{1355,{x = 1464, y = 1848, z = 7, stackpos = 1}}, 
	{1355,{x = 1464, y = 1849, z = 7, stackpos = 1}}, -- fim primeiros portoes
	{1354,{x = 1548, y = 1845, z = 7, stackpos = 1}}, -- começo azul 1548 1845 7
	{1354,{x = 1548, y = 1846, z = 7, stackpos = 1}},
	{1354,{x = 1548, y = 1847, z = 7, stackpos = 1}},
	{1354,{x = 1548, y = 1848, z = 7, stackpos = 1}},
	{1354,{x = 1548, y = 1849, z = 7, stackpos = 1}} -- fim primeiro azul
}

Monsters_Dota = {
["Spider Of Jungle"] = {vocs = {2,3,6,7}, respaw = 6, pos = {x=1505, y=1857, z=7}}, -- 1505 1857 7
["Serpent Of Jungle"] = {vocs = {1,4,5,8}, respaw = 6, pos = {x=1504, y=1835, z=7}} -- 1504 1835 7
} 


---------------------> END CONFIG <--------------------------

conditionDotaBlue = createConditionObject(CONDITION_OUTFIT)
setConditionParam(conditionDotaBlue, CONDITION_PARAM_TICKS, -1)
addOutfitCondition(conditionDotaBlue, {lookType = 128, lookHead = 88, lookBody = 88, lookLegs = 88, lookFeet = 88})
conditionDotaRed = createConditionObject(CONDITION_OUTFIT)
setConditionParam(conditionDotaRed, CONDITION_PARAM_TICKS, -1)
addOutfitCondition(conditionDotaRed, {lookType = 128, lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94})

condition_kd = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition_kd, CONDITION_PARAM_TICKS, 5*60*1000)
setConditionParam(condition_kd, CONDITION_PARAM_STAT_MAXHEALTHPERCENT, 115)
setConditionParam(condition_kd, CONDITION_PARAM_STAT_MAXMANAPERCENT, 110)
setConditionParam(condition_kd, CONDITION_PARAM_SKILL_MELEE, 10)
setConditionParam(condition_kd, CONDITION_PARAM_SKILL_FIST, 10)
setConditionParam(condition_kd, CONDITION_PARAM_SKILL_CLUB, 10)
setConditionParam(condition_kd, CONDITION_PARAM_SKILL_SWORD, 10)
setConditionParam(condition_kd, CONDITION_PARAM_SKILL_AXE, 10)
setConditionParam(condition_kd, CONDITION_PARAM_SKILL_SHIELD, 10)
setConditionParam(condition_kd, CONDITION_PARAM_STAT_MAGICLEVEL, 10)
setConditionParam(condition_kd, CONDITION_PARAM_BUFF, true)


dota_speed = createConditionObject(CONDITION_HASTE)
setConditionParam(dota_speed, CONDITION_PARAM_BUFF, true)
setConditionParam(dota_speed, CONDITION_PARAM_TICKS, 5*60*1000)
setConditionParam(dota_speed, CONDITION_PARAM_SPEED, 40)


condition_ps = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition_ps, CONDITION_PARAM_TICKS, 5*60*1000)
setConditionParam(condition_ps, CONDITION_PARAM_STAT_MAXHEALTHPERCENT, 110)
setConditionParam(condition_ps, CONDITION_PARAM_STAT_MAXMANAPERCENT, 115)
setConditionParam(condition_ps, CONDITION_PARAM_SKILL_DISTANCE, 10)
setConditionParam(condition_ps, CONDITION_PARAM_STAT_MAGICLEVEL, 10)
setConditionParam(condition_ps, CONDITION_PARAM_SKILL_SHIELD, 10)
setConditionParam(condition_ps, CONDITION_PARAM_BUFF, true)

function prepareDota()
	RemoveAllTowers()
	if getTileItemById(dota_portoes[1][2], dota_portoes[1][1]).uid == 0 then
		OpenorClosedPortoes()
	end
end
function startDota()
	OpenorClosedPortoes()
	createTower()
	sendMsgPlayersDota("The Dota Event Has Started!! Destroy the enemy towers and defend yours!", MESSAGE_STATUS_CONSOLE_RED)
end
function ZerarStorDota()
	for _, storages in pairs(dota_config.storages) do
		setGlobalStorageValue(storages, 0)
	end
end
function getPlayerInDota()
	local t = {}
	for _, cid in pairs(getPlayersOnline()) do
		if getPlayerStorageValue(cid, dota_config.storages[1]) > 0 then
			t[#t+1] = cid
		end
	end
	return t
end
function sendMsgPlayersDota(msg, type)
	for _, pid in pairs(getPlayerInDota()) do
		doPlayerSendTextMessage(pid, type, msg)
	end
end
function getMcEvent(cid)
	local t = {}
	for _, pid in pairs(getPlayerInDota()) do
		if getPlayerIp(cid) == getPlayerIp(pid) then
			t[#t+1] = pid
		end
	end
	return t
end
function OpenorClosedPortoes()
	for i = 1, #dota_portoes do
		if getTileItemById(dota_portoes[i][2], dota_portoes[i][1]).uid == 0 then
			doCreateItem(dota_portoes[i][1], 1, dota_portoes[i][2])
		else
			doRemoveItem(getThingfromPos(dota_portoes[i][2]).uid,1)
			doSendMagicEffect(dota_portoes[i][2], CONST_ME_POFF)
		end
	end
end
function RemoveAllTowers()
	for n, _ in pairs(DotaTowers_Lib) do -- towers and nexus
		local creature = getCreatureByName(n)
		if creature ~= nil and not isPlayer(creature) then
			doRemoveCreature(getTopCreature(getCreaturePosition(creature)).uid)
		end
	end
	for m, _ in pairs(Monsters_Dota) do -- jungle mobs
		local jungle = getCreatureByName(m)
		if jungle ~= nil and not isPlayer(jungle) then
			doRemoveCreature(getTopCreature(getCreaturePosition(jungle)).uid)
		end
	end
end
function createTower()
	for n, t in pairs(DotaTowers_Lib) do
		    if not isInArray({"Blue Nexus","Red Nexus"}, n) then 
            		doSummonCreature(n, t.pos)
			end
	end
	for v, k in pairs(Monsters_Dota) do
        doSummonCreature(v, k.pos)
	end	
end
function createNexus(name)
	return doSummonCreature(name, DotaTowers_Lib[name].pos)
end
function getDotaRewards(cid, items)
	local backpack = doPlayerAddItem(cid, 11115, 1) -- backpackID {1,8981,1},{1,8299,1},{1,8310,1},{1,10138,1}
	for _, i_i in ipairs(items) do
		local chance, item, amount = i_i[1],i_i[2],i_i[3]
		if chance >= math.random(1, 100) then
			if isItemStackable(item) or amount == 1 then
				doAddContainerItem(backpack, item, amount)
				doPlayerAddItem(cid, 8981, 1) -- 10558
				doPlayerAddItem(cid, 8299, 1)
				doPlayerAddItem(cid, 8310, 1)
				doPlayerAddItem(cid, 10558, 80)
				doPlayerAddItem(cid, 10138, 1)
			else
				for i = 1, amount do
					doAddContainerItem(backpack, item, 1)
					doPlayerAddItem(cid, 8981, 1)
					doPlayerAddItem(cid, 8299, 1)
					doPlayerAddItem(cid, 8310, 1)
					doPlayerAddItem(cid, 10138, 1)
				end
			end
		end
	end
end
function noMoveAfterDeath(cid, delay)
	if not isCreature(cid) or getPlayerStorageValue(cid, dota_config.storages[1]) <= 0 then return LUA_ERROR end
	if delay > 0 then
		doPlayerSendTextMessage(cid, 26, delay)
		addEvent(noMoveAfterDeath, 1000, cid, delay-1)
	elseif delay == 0 then
		doPlayerSendTextMessage(cid,26, "GO GO GO")
		doCreatureSetNoMove(cid, false)
		setPlayerStorageValue(cid, dota_config.storages[6], 0) 
	end
end
function getDotaWinners(storage)
	for _, cid in pairs(getPlayerInDota()) do
		if getPlayerStorageValue(cid, storage) > 0 then
			getDotaRewards(cid, dota_config.rewards)
		end
	end
end
function doBuffPlayer(buffs, team, vocations)
	for _, cid in pairs(getPlayerInDota()) do
		if getPlayerStorageValue(cid, team) > 0 and isInArray(vocations, getPlayerVocation(cid))  then
			for i = 1, #buffs do
			 doAddCondition(cid, buffs[i])
			end
			 doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "[Dota Event] You just received a 5 minuts buff by killing jungle monsters!")
			doSendMagicEffect(getPlayerPosition(cid), 28)
		end
	end
end
function randomTeam()
	for _, cid in pairs(getPlayerInDota()) do
			local getMyTeam = getGlobalStorageValue(dota_config.storages[3]) < getGlobalStorageValue(dota_config.storages[4]) and {dota_config.storages[3],dota_config.TeamBlue.town,dota_config.TeamBlue.name,conditionDotaBlue} or {dota_config.storages[4],dota_config.TeamRed.town,dota_config.TeamRed.name,conditionDotaRed} 
			doAddCondition(cid, getMyTeam[4])
			setPlayerStorageValue(cid, getMyTeam[1], 1)
			setGlobalStorageValue(getMyTeam[1], getGlobalStorageValue(getMyTeam[1])+1)
			doPlayerSetTown(cid, getMyTeam[2])
			doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
			doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You will join the team " .. getMyTeam[3] .. "!")
	end
end
function dotaBroadSpecialKills(cid, target)
	local storages,type = {878756,878757},{"","Double Kill","Triple Kill","Quadra Kill","Penta Kill"}
	if getPlayerStorageValue(cid, storages[1]) - os.time() <= 0 then
		setPlayerStorageValue(cid, storages[1], os.time()+120)
		setPlayerStorageValue(cid, storages[2], 1)
	else
		setPlayerStorageValue(cid, storages[2], getPlayerStorageValue(cid, storages[2])+1)
		if getPlayerStorageValue(cid, storages[2]) < 6 then
			sendMsgPlayersDota(getPlayerName(cid) .. " fez " .. type[getPlayerStorageValue(cid, storages[2])] .. " em ".. getPlayerName(target) .. "!", MESSAGE_STATUS_CONSOLE_RED)
			elseif getPlayerStorageValue(cid, storages[2]) > 5 then
				sendMsgPlayersDota(getPlayerName(cid) .. " is Legendary!!", MESSAGE_STATUS_CONSOLE_RED)
			end
		end
end
function removeDotaConditions()
	for _, cid in pairs(getPlayerInDota()) do
			doRemoveConditions(cid, false)
			doPlayerSetTown(cid, 1)
			doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
			doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
			doCreatureSetNoMove(cid, false)
			setPlayerStorageValue(cid, dota_config.storages[3], 0)
			setPlayerStorageValue(cid, dota_config.storages[4], 0)
			setPlayerStorageValue(cid, dota_config.storages[1], 0)
			setPlayerStorageValue(cid, dota_config.storages[6], 0)
	end
end
function removeDotaTp()
	local t = getTileItemById(dota_config.teleport, 1387).uid
	return t > 0 and doRemoveItem(t) and doSendMagicEffect(dota_config.teleport, CONST_ME_POFF)
end
function CheckDotaEvent(delay)
	if getGlobalStorageValue(dota_config.storages[1]) ~= (dota_config.players.max+1) then
		if delay > 0 and getGlobalStorageValue(dota_config.storages[1]) < dota_config.players.max then
			doBroadcastMessage("[Dota Event] Starting in " .. delay .. " minutes! The teleport will be closed once the event start!", MESSAGE_STATUS_WARNING)
		elseif delay == 0 and getGlobalStorageValue(dota_config.storages[1]) < dota_config.players.min then
			removeDotaConditions()
			removeDotaTp()
			doBroadcastMessage("The Dota Event could not start because not enough players were participating.\n At least " .. dota_config.players.min .. " players are needed!", MESSAGE_STATUS_WARNING)
			ZerarStorDota()
		elseif delay == 0 and getGlobalStorageValue(dota_config.storages[1]) >= dota_config.players.min then
			removeDotaTp()
			randomTeam()
			doBroadcastMessage("Good Lucky! The event will start in "..dota_config.timeToStartEvent.." seconds. get ready!")
			addEvent(startDota, dota_config.timeToStartEvent*1000)
		end
		addEvent(CheckDotaEvent, 60000, delay-1)
	end
end
function doSpawnJungleMobs(name, pos)
	if getGlobalStorageValue(dota_config.storages[1]) > 0 then
		doSummonCreature(name, pos)
		sendMsgPlayersDota("[Dota] ".. name .. " Has Spawned", MESSAGE_STATUS_CONSOLE_RED)
	end
end

 

Link para o post
Compartilhar em outros sites

@Vodkart acredito só ter mudado algumas mensagens e os premios, segue o script e as tags

tags:

	<event type="kill" name="KillGerador" event="script" value="dota_system.lua"/>
	<event type="login" name="DotaLogin" event="script" value="dota_system.lua"/>
	<event type="PrepareDeath" name="DeathDota" event="script" value="dota_system.lua"/>
	<event type="combat" name="DotaAttack" event="script" value="dota_system.lua"/>
	<event type="statschange" name="TowerStats" event="script" value="dota_system.lua"/>
	<event type="death" name="JungleDeath" event="script" value="dota_system.lua"/>

dota_system.lua:

function onPrepareDeath(cid, deathList)
	if isPlayer(cid) and getPlayerStorageValue(cid, dota_config.storages[1]) > 0 then
		local strings = {""}
		local j, position, corpse = 1, 1, 0
		for _, pid in ipairs(deathList) do
			if isCreature(pid) == true then
				strings[position] = j == 1 and "" or strings[position] .. ", "
				strings[position] = strings[position] .. getCreatureName(pid) .. ""
				j = j + 1
			else
				strings[position] = j == 1 and "" or strings[position] .. ", "
				strings[position] = strings[position] .."a field item"
				j = j + 1
			end
		end
		for i, str in ipairs(strings) do
			if(str:sub(str:len()) ~= ",") then
				str = str .. "."
			end
			desc = "You recognize "
			desc = desc .. "" .. getCreatureName(cid) .. ". He was killed by " .. str
		end
		if(getPlayerSex(cid) == 1) then
			corpse = doCreateItem(3058, getCreaturePosition(cid))
		else
			corpse = doCreateItem(3065, getCreaturePosition(cid))
		end
		doItemSetAttribute(corpse, "description", desc)
		doCreatureSetNoMove(cid, true)
		setPlayerStorageValue(cid, dota_config.storages[6], 1) 
		noMoveAfterDeath(cid, dota_config.DeathDelay)
		setPlayerStorageValue(cid, 878756, 0) -- special kill
		doRemoveConditions(cid, false)
		doAddCondition(cid, getPlayerStorageValue(cid, dota_config.storages[3]) > 0 and conditionDotaBlue or conditionDotaRed)
		if isPlayer(deathList[1]) then
			dotaBroadSpecialKills(deathList[1], cid)
		end
	end
	return true
end
function onKill(cid, target, lastHit)
	if isPlayer(cid) and isMonster(target) then
		local var, jungle = DotaTowers_Lib[getCreatureName(target)],Monsters_Dota[getCreatureName(target)] 
		if var then -- towers and nexus
			if var.winners == nil then
				local storage = isInArray({"Mid Tower Blue","Bot Tower Blue","Top Tower Blue"}, getCreatureName(target)) and dota_config.storages[5] or dota_config.storages[6]
				setGlobalStorageValue(storage, getGlobalStorageValue(storage)+1)
				if getGlobalStorageValue(storage) <= 2 then
					broadcastMessage("[Evento Dota] A "..getCreatureName(target).." Foi Destruida! ["..getGlobalStorageValue(storage).."/3]", MESSAGE_EVENT_ADVANCE)
				elseif getGlobalStorageValue(storage) == 3 then
					local ret = isInArray({"Mid Tower Blue","Bot Tower Blue","Top Tower Blue"}, getCreatureName(target)) and "Blue Nexus" or "Red Nexus"
					broadcastMessage("[Evento Dota] A última Torre "..getCreatureName(target).." Foi Destruido! O "..ret.." Surgiu!", MESSAGE_EVENT_ADVANCE)
					createNexus(ret)
				end 
			else
				broadcastMessage("[Evento Dota] "..getCreatureName(target).." Foi Destruido! Time "..(getCreatureName(target) == "Blue Nexus" and "Vermelho" or "Azul").." foi o Vencedor desta Rodada do Evento Dota!", MESSAGE_EVENT_ADVANCE) 
				getDotaWinners(var.winners)
				OpenorClosedPortoes()
				RemoveAllTowers()
				removeDotaConditions()
				ZerarStorDota()
			end
		end
	end
	return true 
end
function onLogin(cid)
	registerCreatureEvent(cid, "DotaAttack")
	registerCreatureEvent(cid, "KillGerador")
	registerCreatureEvent(cid, "DeathDota")
	registerCreatureEvent(cid, "TowerStats")
	if getPlayerStorageValue(cid, dota_config.storages[1]) > 0 or getPlayerStorageValue(cid, dota_config.storages[4]) > 0 or getPlayerStorageValue(cid, dota_config.storages[4]) > 0 then
		doPlayerSetTown(cid, 1)
		doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
    end
    	setPlayerStorageValue(cid, dota_config.storages[3], 0)
	setPlayerStorageValue(cid, dota_config.storages[4], 0)
 	setPlayerStorageValue(cid, dota_config.storages[1], 0)
 	setPlayerStorageValue(cid, dota_config.storages[6], 0)
	return true
end
function onStatsChange(cid, attacker, type, combat, value)
if isPlayer(attacker) and isMonster(cid) then
	local tower = DotaTowers_Lib[getCreatureName(cid)]
	if type == STATSCHANGE_HEALTHLOSS  and tower then
		local TowerPercent = 100/(getCreatureMaxHealth(cid)/getCreatureHealth(cid))
		if TowerPercent <= 75 and TowerPercent >= 74 then
			sendMsgPlayersDota(getCreatureName(cid) .. " está com 75% de Vida, Corra para proteger!!", MESSAGE_STATUS_CONSOLE_RED)
		elseif TowerPercent <= 50 and TowerPercent >= 49 then
			sendMsgPlayersDota(getCreatureName(cid) .. " está com 50% de Vida!! Corra para proteger!!", MESSAGE_STATUS_CONSOLE_RED)
		elseif TowerPercent <= 25 and TowerPercent >= 24 then
			sendMsgPlayersDota(getCreatureName(cid) .. " está com 25% de Vida!! Corra para proteger!!", MESSAGE_STATUS_CONSOLE_RED)
		end
	end
end
return true
end
function onCombat(cid, target)
	if isPlayer(cid) and isPlayer(target) and getPlayerStorageValue(cid, dota_config.storages[3]) > 0 and getPlayerStorageValue(target, dota_config.storages[3]) > 0 or getPlayerStorageValue(cid, dota_config.storages[4]) > 0 and getPlayerStorageValue(target, dota_config.storages[4]) > 0  or getPlayerStorageValue(cid, dota_config.storages[6]) > 0 or getPlayerStorageValue(target, dota_config.storages[6]) > 0 then
		doPlayerSendCancel(cid, "You may not attack this player.") return false	
	elseif isPlayer(cid) and isMonster(target) and getPlayerStorageValue(cid, dota_config.storages[3]) > 0 and isInArray({"Mid Tower Blue","Bot Tower Blue","Top Tower Blue","Blue Nexus"}, getCreatureName(target)) or getPlayerStorageValue(cid, dota_config.storages[4]) > 0 and isInArray({"Top Tower Red","Bot Tower Red","Mid Tower Red","Red Nexus"}, getCreatureName(target)) then
		doPlayerSendCancel(cid, "You may not attack this.") return false
	end
	return true
end
function onDeath(cid, corpse, deathList)
	if isPlayer(cid) or not Monsters_Dota[getCreatureName(cid)] then return true end
	local killer, jungle = deathList[1], Monsters_Dota[getCreatureName(cid)]
	if isPlayer(killer) and jungle then
		local conditions = getCreatureName(cid) == "Spider Of Jungle" and {condition_ps,dota_speed} or {condition_kd, dota_speed}
		local storage = getPlayerStorageValue(killer, dota_config.storages[3]) > 0 and dota_config.storages[3] or dota_config.storages[4]
		for _, pid in ipairs(deathList) do
			if isPlayer(pid) then
				doRemoveConditions(pid, CONDITION_PARALYZE)
			end
		end
		doBuffPlayer(conditions, storage, jungle.vocs)
		addEvent(doSpawnJungleMobs, jungle.respaw*1000*60, getCreatureName(cid), jungle.pos)  
	end
	return true
end

 

Link para o post
Compartilhar em outros sites

@Gabrieldsadaxas estranho, esta td certo, vou colocar um timer de 2 segundos, pode estar executando 2x seguidos.

 

tenta assim:

 

 

function onPrepareDeath(cid, deathList)
	if isPlayer(cid) and getPlayerStorageValue(cid, dota_config.storages[1]) > 0 then
		local strings = {""}
		local j, position, corpse = 1, 1, 0
		for _, pid in ipairs(deathList) do
			if isCreature(pid) == true then
				strings[position] = j == 1 and "" or strings[position] .. ", "
				strings[position] = strings[position] .. getCreatureName(pid) .. ""
				j = j + 1
			else
				strings[position] = j == 1 and "" or strings[position] .. ", "
				strings[position] = strings[position] .."a field item"
				j = j + 1
			end
		end
		for i, str in ipairs(strings) do
			if(str:sub(str:len()) ~= ",") then
				str = str .. "."
			end
			desc = "You recognize "
			desc = desc .. "" .. getCreatureName(cid) .. ". He was killed by " .. str
		end
		if(getPlayerSex(cid) == 1) then
			corpse = doCreateItem(3058, getCreaturePosition(cid))
		else
			corpse = doCreateItem(3065, getCreaturePosition(cid))
		end
		doItemSetAttribute(corpse, "description", desc)
		doCreatureSetNoMove(cid, true)
		setPlayerStorageValue(cid, dota_config.storages[6], 1) 
		noMoveAfterDeath(cid, dota_config.DeathDelay)
		setPlayerStorageValue(cid, 878756, 0) -- special kill
		doRemoveConditions(cid, false)
		doAddCondition(cid, getPlayerStorageValue(cid, dota_config.storages[3]) > 0 and conditionDotaBlue or conditionDotaRed)
		if isPlayer(deathList[1]) then
			dotaBroadSpecialKills(deathList[1], cid)
		end
	end
	return true
end
function onKill(cid, target, lastHit)
local exausted = 2
	if isPlayer(cid) and isMonster(target) then
		local var, jungle = DotaTowers_Lib[getCreatureName(target)],Monsters_Dota[getCreatureName(target)] 
		if var then -- towers and nexus
			if var.winners == nil then
				local storage = isInArray({"Mid Tower Blue","Bot Tower Blue","Top Tower Blue"}, getCreatureName(target)) and dota_config.storages[5] or dota_config.storages[6]
			if getGlobalStorageValue((storage+1000)) - os.time() <= 0 then	
				setGlobalStorageValue(storage, getGlobalStorageValue(storage)+1)
				if getGlobalStorageValue(storage) <= 2 then
					broadcastMessage("[Evento Dota] A "..getCreatureName(target).." Foi Destruida! ["..getGlobalStorageValue(storage).."/3]", MESSAGE_EVENT_ADVANCE)
				elseif getGlobalStorageValue(storage) == 3 then
					local ret = isInArray({"Mid Tower Blue","Bot Tower Blue","Top Tower Blue"}, getCreatureName(target)) and "Blue Nexus" or "Red Nexus"
					broadcastMessage("[Evento Dota] A última Torre "..getCreatureName(target).." Foi Destruido! O "..ret.." Surgiu!", MESSAGE_EVENT_ADVANCE)
					createNexus(ret)
				end
				setGlobalStorageValue((storage+1000), os.time()+exausted)
			end
			else
				broadcastMessage("[Evento Dota] "..getCreatureName(target).." Foi Destruido! Time "..(getCreatureName(target) == "Blue Nexus" and "Vermelho" or "Azul").." foi o Vencedor desta Rodada do Evento Dota!", MESSAGE_EVENT_ADVANCE) 
				getDotaWinners(var.winners)
				OpenorClosedPortoes()
				RemoveAllTowers()
				removeDotaConditions()
				ZerarStorDota()
			end
		end
	end
	return true 
end
function onLogin(cid)
	registerCreatureEvent(cid, "DotaAttack")
	registerCreatureEvent(cid, "KillGerador")
	registerCreatureEvent(cid, "DeathDota")
	registerCreatureEvent(cid, "TowerStats")
	if getPlayerStorageValue(cid, dota_config.storages[1]) > 0 or getPlayerStorageValue(cid, dota_config.storages[4]) > 0 or getPlayerStorageValue(cid, dota_config.storages[4]) > 0 then
		doPlayerSetTown(cid, 1)
		doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
    end
    	setPlayerStorageValue(cid, dota_config.storages[3], 0)
	setPlayerStorageValue(cid, dota_config.storages[4], 0)
 	setPlayerStorageValue(cid, dota_config.storages[1], 0)
 	setPlayerStorageValue(cid, dota_config.storages[6], 0)
	return true
end
function onStatsChange(cid, attacker, type, combat, value)
if isPlayer(attacker) and isMonster(cid) then
	local tower = DotaTowers_Lib[getCreatureName(cid)]
	if type == STATSCHANGE_HEALTHLOSS  and tower then
		local TowerPercent = 100/(getCreatureMaxHealth(cid)/getCreatureHealth(cid))
		if TowerPercent <= 75 and TowerPercent >= 74 then
			sendMsgPlayersDota(getCreatureName(cid) .. " está com 75% de Vida, Corra para proteger!!", MESSAGE_STATUS_CONSOLE_RED)
		elseif TowerPercent <= 50 and TowerPercent >= 49 then
			sendMsgPlayersDota(getCreatureName(cid) .. " está com 50% de Vida!! Corra para proteger!!", MESSAGE_STATUS_CONSOLE_RED)
		elseif TowerPercent <= 25 and TowerPercent >= 24 then
			sendMsgPlayersDota(getCreatureName(cid) .. " está com 25% de Vida!! Corra para proteger!!", MESSAGE_STATUS_CONSOLE_RED)
		end
	end
end
return true
end
function onCombat(cid, target)
	if isPlayer(cid) and isPlayer(target) and getPlayerStorageValue(cid, dota_config.storages[3]) > 0 and getPlayerStorageValue(target, dota_config.storages[3]) > 0 or getPlayerStorageValue(cid, dota_config.storages[4]) > 0 and getPlayerStorageValue(target, dota_config.storages[4]) > 0  or getPlayerStorageValue(cid, dota_config.storages[6]) > 0 or getPlayerStorageValue(target, dota_config.storages[6]) > 0 then
		doPlayerSendCancel(cid, "You may not attack this player.") return false	
	elseif isPlayer(cid) and isMonster(target) and getPlayerStorageValue(cid, dota_config.storages[3]) > 0 and isInArray({"Mid Tower Blue","Bot Tower Blue","Top Tower Blue","Blue Nexus"}, getCreatureName(target)) or getPlayerStorageValue(cid, dota_config.storages[4]) > 0 and isInArray({"Top Tower Red","Bot Tower Red","Mid Tower Red","Red Nexus"}, getCreatureName(target)) then
		doPlayerSendCancel(cid, "You may not attack this.") return false
	end
	return true
end
function onDeath(cid, corpse, deathList)
	if isPlayer(cid) or not Monsters_Dota[getCreatureName(cid)] then return true end
	local killer, jungle = deathList[1], Monsters_Dota[getCreatureName(cid)]
	if isPlayer(killer) and jungle then
		local conditions = getCreatureName(cid) == "Spider Of Jungle" and {condition_ps,dota_speed} or {condition_kd, dota_speed}
		local storage = getPlayerStorageValue(killer, dota_config.storages[3]) > 0 and dota_config.storages[3] or dota_config.storages[4]
		for _, pid in ipairs(deathList) do
			if isPlayer(pid) then
				doRemoveConditions(pid, CONDITION_PARALYZE)
			end
		end
		doBuffPlayer(conditions, storage, jungle.vocs)
		addEvent(doSpawnJungleMobs, jungle.respaw*1000*60, getCreatureName(cid), jungle.pos)  
	end
	return true
end

 

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

Link para o post
Compartilhar em outros sites

assim que eu testar aviso aqui, vlw man

 

@Vodkart se liga o que acontece quando uma torre chega a 75% de hp

Citar

21:13 Top Tower Red está com 75% de Vida, Corra para proteger!!
21:13 Top Tower Red está com 75% de Vida, Corra para proteger!!
21:13 Top Tower Red está com 75% de Vida, Corra para proteger!!
21:13 Top Tower Red está com 75% de Vida, Corra para proteger!!
21:13 Top Tower Red está com 75% de Vida, Corra para proteger!!
21:13 Top Tower Red está com 75% de Vida, Corra para proteger!!
21:13 Top Tower Red está com 75% de Vida, Corra para proteger!!
21:13 Top Tower Red está com 75% de Vida, Corra para proteger!!
21:13 Top Tower Red está com 75% de Vida, Corra para proteger!!

e aqui 50

Citar

21:13 Top Tower Red está com 50% de Vida!! Corra para proteger!!
21:13 Top Tower Red está com 50% de Vida!! Corra para proteger!!
21:13 Top Tower Red está com 50% de Vida!! Corra para proteger!!
21:13 Top Tower Red está com 50% de Vida!! Corra para proteger!!
21:13 Top Tower Red está com 50% de Vida!! Corra para proteger!!
21:13 Top Tower Red está com 50% de Vida!! Corra para proteger!!
21:13 Top Tower Red está com 50% de Vida!! Corra para proteger!!
21:13 Top Tower Red está com 50% de Vida!! Corra para proteger!!

o mesmo com 25

o que vc fez solucionou, agora tem que matar as 3 torres :) o problema é que, realmente, esta sendo executado varias vezes a mesma função/linha 

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

@Vodkart @Gabrieldsadaxas Tem algum vídeo demonstrando esse script em ação? Fiquei curioso hihi

Meu Curso sobre Programação para OTServer

Programando OTServer

 

Peça o seu script! Entre agora mesmo no grupo

Developing

 

Conteúdos:

 

Discord: Belmont#7352

Não esqueça do REP+ :)     

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