Ir para conteúdo
  • Cadastre-se

Posts Recomendados

Ai está um MOD CTF , como nos velhos tempos ;)

Se já exister no forum , peço desculpas ;(


<?xml version="1.0" encoding="utf-8"?>

<mod name="CTF" version="1.0" author="Doggynub" contact="otland.net" enabled="yes">

  <config name="toto"><![CDATA[


--[[ Storage Settings]]--



Owner = 1900 -- put empty storage


FLAG2_INn = 4000 -- put empty storage


FLAG_IN = 4001 -- put empty storage


TEAM1_FLAGS = 3030 -- put empty storage


TEAM2_FLAGS = 3031 -- put empty storage


Event_Start = 3032 -- put empty storage


Event_timeend = 3033 -- put empty storage


Event_Tile_Close = 3039 -- put empty storage


joined = 2023 --put empty storage


Timer = 1010 --put empty storage


--------------------------------------



--[[ Places setting ]]--



BLUE_FLAG = {x=3536,y=3537,z=7} -- Blue flag Place


RED_FLAG = {x=3536,y=3537,z=7} --red flag Place


Tp_Place = {x=1007,y=991,z=15} -- Place where the event teleport will be created.


Wait_Place = {x=3551,y=3554,z=7} -- Positions Players will  be sent when the enter event's teleport


frompos = {x=3553, y=3559, z=7} --start sqm in the waiting room(1 floor)


topos = {x=3556,y=3566,z=7} -- end sqm in the waiting room(1 floor)


Red_Position = {x=3615,y=3602,z=7} -- Red team temple pos


Blue_Position = {x=3546,y=3536,z=7} -- Blue team temple pos




---------------------------------------



--[[Event setting ]]--



Event_WaitTime = 5 -- time for the collection of player then event will start (in minutes)


Event_MaxTime = 10 --- in minutes ( this is the max time for an event to bb running )


Players_Speed = 20000 -- put the level of base speed in event ( like if you want the speed of lvl 300 then wright 300)


  Flag_Holder_Speed = 20000 -- [Old-Styled feature] speed for the player when he hold a flag better not to increase.


TEAM2_NAME = "Red" -- team 2 name


TEAM1_NAME = "Green" -- team 1 name


FLAG_SCORE = 5 -- score when team gets he wins


Teleport_On_Score = false -- this teleport all players to their team main position when some one score a flag , make false to disable.


Players_Least_Number = 2 -- this means if there is less than 2 players joined the event will be cancelled


Min_Join_Level = 100 -- min lvl for a player to join event


rewards_random = {

						[60] = { -- Rewards of 60% , if it is then it will randomly give one of the items in the items verible if there you put more than one item there

									items = {9971,9971,9971}

								},


						[30] = { -- Rewards of 30%

									items = {9971,9971,9971}

								},



						[10] = { -- Rewards of 10%

									items = {9971,9971,9971}

								}

					}



]]></config>

  <lib name="CTF-lib"><![CDATA[

function isTeamTwo(cid)

	return (isPlayer(cid) and getPlayerStorageValue(cid,5054) > -1)

end

function isTeamOne(cid)

	return (isPlayer(cid) and getPlayerStorageValue(cid,5055) > -1)

end

function resetTheTeams(cid)

	return (isPlayer(cid) and setPlayerStorageValue(cid,5054,-1) and setPlayerStorageValue(cid,5055,-1))

end

function setflagOwner(cid)

	return setPlayerStorageValue(cid,Owner,1)

end

function flagOwner(cid)

	return (isPlayer(cid) and getPlayerStorageValue(cid,Owner) > 0)

end

function releaseBF(cid)

	setGlobalStorageValue(FLAG_IN,-1)

	setPlayerStorageValue(cid,103, 0)

	setPlayerStorageValue(cid,Owner,-1)

return true

end

function releaseRF(cid)

	setGlobalStorageValue(FLAG2_INn,-1)

	setPlayerStorageValue(cid,103, 0)

	setPlayerStorageValue(cid,Owner,-1)

return true

end

function setFirstTeam(cid)

	return setPlayerStorageValue(cid,5055,1)

end

function setSecondTeam(cid)

	return setPlayerStorageValue(cid,5054,2)

end

function addToRed()

	return setGlobalStorageValue(TEAM2_FLAGS,getGlobalStorageValue(TEAM2_FLAGS)+1)

end

function addToBlue()

	return setGlobalStorageValue(TEAM1_FLAGS,getGlobalStorageValue(TEAM1_FLAGS)+1)

end

function getBlueScore()

	return getGlobalStorageValue(TEAM1_FLAGS)

end

function getRedScore()

	return getGlobalStorageValue(TEAM2_FLAGS)

end

function getTheSpeed(level)

	value = (220 +(2 *(level -1)))

	return value

end


function resetTheStorage()

	setGlobalStorageValue(Event_Start,-1)

	setGlobalStorageValue(Event_timeend,-1)

	setGlobalStorageValue(TEAM1_FLAGS,0)

	setGlobalStorageValue(FLAG2_INn,-1)

	setGlobalStorageValue(FLAG_IN,-1)

	setGlobalStorageValue(TEAM2_FLAGS,0)

return true

end

function blueStolen()

	return getGlobalStorageValue(FLAG_IN)

end

function redStolen()

	return getGlobalStorageValue(FLAG2_INn)

end

function giveReward(cid)

	local t = math.random(1,100)

	if t <= 10 then

		local rare = rewards_random[10].items[math.random(1,#rewards_random[10].items)]

		doPlayerAddItem(cid,rare,1)

		doPlayerSendTextMessage(cid,25,"Rare rate Reward : you won "..getItemNameById(rare)..".")


	elseif t > 10 and t <= 40 then

		local semi = rewards_random[30].items[math.random(1,#rewards_random[30].items)]

		doPlayerAddItem(cid,semi,1)

		doPlayerSendTextMessage(cid,25,"Semi rate Reward : you won "..getItemNameById(semi)..".")



	elseif t > 40 then

		local aver = rewards_random[60].items[math.random(1,#rewards_random[60].items)]

		doPlayerAddItem(cid,aver,1)

		doPlayerSendTextMessage(cid,25,"Averege rate Reward : you won "..getItemNameById(aver)..".")

	end

	return true

end

]]></lib>

  <event type="login" name="Tutorial Login" event="script"><![CDATA[

domodlib('toto')

domodlib('CTF-lib')

function onLogin(cid)

	if getGlobalStorageValue(Event_Start) < 1 then

		if isTeamOne(cid) or isTeamTwo(cid) then

			resetTheTeams(cid)

		end

	end

	registerCreatureEvent(cid, "Attk")

	registerCreatureEvent(cid, "ctff")

	registerCreatureEvent(cid, "prepare")

return true

end

]]></event>

  <event type="combat" name="Attk" event="script"><![CDATA[

domodlib('toto')

domodlib('CTF-lib')


function onCombat(cid, target)

	if isTeamOne(cid) and isTeamOne(target) then

		return false

	end

	if isTeamTwo(cid) and isTeamTwo(target) then

		return false

	end

	return true

end

]]></event>

  <event type="statschange" name="prepare" event="script"><![CDATA[

domodlib('toto')

domodlib('CTF-lib')


local corpse_ids = {

		[0] = 3065, -- female

		[1] = 3058 -- male

}

function onStatsChange(cid, attacker, type, combat, value)

		if combat == COMBAT_HEALING then

			return true

		end

		if getCreatureHealth(cid) > value then

			return true

		end

		if getGlobalStorageValue(Event_Start) > 0 then

			if flagOwner(cid) then

				if isTeamOne(cid) then

					doItemSetAttribute(doCreateItem(corpse_ids[getPlayerSex(cid)], 1, getThingPos(cid)), "description", "You recognize "..getCreatureName(cid)..". He was killed by "..(isMonster(attacker) and "a "..string.lower(getCreatureName(attacker)) or isCreature(attacker) and getCreatureName(attacker) or "a field item").."[Flag Holder].")

					doTeleportThing(cid,Blue_Position,false)

					doSendMagicEffect(Blue_Position,10)

					doCreatureAddHealth(cid,getCreatureMaxHealth(cid))

					doCreatureAddMana(cid,getCreatureMaxMana(cid))

					releaseRF(cid)

							for _,cid in ipairs(getPlayersOnline()) do

								if isTeamOne(cid) or isTeamTwo(cid) then

									doPlayerSendTextMessage(cid,22,getCreatureName(cid) .. " has died with the "..TEAM2_NAME.." team flag. The flag is returned back to the "..TEAM1_NAME.." team.")

								end

							end

					return false

				elseif isTeamTwo(cid) then

					doItemSetAttribute(doCreateItem(corpse_ids[getPlayerSex(cid)], 1, getThingPos(cid)), "description", "You recognize "..getCreatureName(cid)..". He was killed by "..(isMonster(attacker) and "a "..string.lower(getCreatureName(attacker)) or isCreature(attacker) and getCreatureName(attacker) or "a field item").."[Flag Holder].")

					doTeleportThing(cid,Red_Position,false)

					doSendMagicEffect(Red_Position,10)

					doCreatureAddHealth(cid,getCreatureMaxHealth(cid))

					doCreatureAddMana(cid,getCreatureMaxMana(cid))

					releaseBF(cid)

							for _,cid in ipairs(getPlayersOnline()) do

								if isTeamOne(cid) or isTeamTwo(cid) then

									doPlayerSendTextMessage(cid,22,getCreatureName(cid) .. " has died with the "..TEAM1_NAME.." team flag. The flag is returned back to the "..TEAM1_NAME.." team.")

								end

							end

				return false

				end


			else

				if isTeamOne(cid) or isTeamTwo(cid) then

					doItemSetAttribute(doCreateItem(corpse_ids[getPlayerSex(cid)], 1, getThingPos(cid)), "description", "You recognize "..getCreatureName(cid)..". He was killed by "..(isMonster(attacker) and "a "..string.lower(getCreatureName(attacker)) or isCreature(attacker) and getCreatureName(attacker) or "a field item").."[Normal kill].")

					doTeleportThing(cid,( isTeamTwo(cid) and Red_Position or Blue_Position ),false)

					doSendMagicEffect(Red_Position,10)

					doCreatureAddHealth(cid,getCreatureMaxHealth(cid))

					doCreatureAddMana(cid,getCreatureMaxMana(cid))

					return false

				end

			end


		end

return true

end


]]></event>

  <movevent type="StepIn" actionid="6000" event="script"><![CDATA[

domodlib('toto')

domodlib('CTF-lib')


function eventEnds()

	doBroadcastMessage('CTF-Event : The '..TEAM2_NAME..' team won and reciaved their reward.')

		for _,cid in ipairs(getPlayersOnline()) do

			if isTeamTwo(cid) then

				doTeleportThing(cid,getTownTemplePosition(getPlayerTown(cid)),false)

				doSendMagicEffect(getTownTemplePosition(getPlayerTown(cid)),10)

				doRemoveConditions(cid,false)

				resetTheTeams(cid)

				doChangeSpeed(cid, getTheSpeed(getPlayerLevel(cid)) - getCreatureSpeed(cid))

				giveReward(cid)


			elseif isTeamOne(cid) then

				doTeleportThing(cid,getTownTemplePosition(getPlayerTown(cid)),false)

				doSendMagicEffect(getTownTemplePosition(getPlayerTown(cid)),10)

				doRemoveConditions(cid,false)

				doPlayerSendTextMessage(cid,22,'Your team have lost.')

				resetTheTeams(cid)

				doChangeSpeed(cid, getTheSpeed(getPlayerLevel(cid)) - getCreatureSpeed(cid))

			end

		end

	addEvent(resetTheStorage,5)

end

function onStepIn(cid, item, position, fromPosition)

	if getGlobalStorageValue(Event_Start) > 0 and getGlobalStorageValue(Event_timeend) > 0 then

		if isTeamTwo(cid) and redStolen() < 0 then

			if not flagOwner(cid) then

				doTeleportThing(cid, fromPosition,TRUE)

				doSendMagicEffect(getThingPos(cid),2)

				doPlayerSendTextMessage(cid, 27, "This is your team flag, you cant take it!")

			end

		elseif isTeamTwo(cid) and redStolen() > 0 and blueStolen() < 0 then

			doPlayerSendTextMessage(cid, 27, "Your team's Flag has been stolen, go get it back!")

			doTeleportThing(cid, fromPosition,TRUE)

			doSendMagicEffect(getThingPos(cid),2)

		  return true

		end

		if isTeamTwo(cid) and flagOwner(cid) and blueStolen() > 0 and redStolen() < 0 then

			if getRedScore() == FLAG_SCORE -1 then

				addEvent(eventEnds,1000)

				addToRed()

				doTeleportThing(cid, fromPosition,TRUE)

				doChangeSpeed(cid, getTheSpeed(Players_Speed) - getCreatureSpeed(cid) )

				releaseBF(cid)

					for _,tid in ipairs(getPlayersOnline()) do

						if isTeamOne(tid) or isTeamTwo(tid) then

							doPlayerSendTextMessage(tid,22,getCreatureName(cid) .. " have captured the last flag and earned match win to the ".. TEAM2_NAME.." team!")

						end

					end

			else

				releaseBF(cid)

				addToRed()

				doTeleportThing(cid, fromPosition,TRUE)

				doChangeSpeed(cid, getTheSpeed(Players_Speed) - getCreatureSpeed(cid) )

					for _,tid in ipairs(getPlayersOnline()) do

						if isTeamOne(tid) or isTeamTwo(tid) then

							doPlayerSendTextMessage(tid,22,getCreatureName(cid) .. " have captured the flag and earned 1 point to the ".. TEAM2_NAME.." team!")

								if Teleport_On_Score == true then

									doTeleportThing(tid,( isTeamTwo(tid) and Red_Position or Blue_Position ), false)

									doSendMagicEffect(getThingPos(tid),10)

								end

						end

					end

			end

		end

		if isTeamOne(cid) then

			if blueStolen() < 0 and redStolen() > 0 then

				if flagOwner(cid) then

					doPlayerSendTextMessage(cid, 27, "You already holding the flag!")

					doTeleportThing(cid, fromPosition,TRUE)

					doSendMagicEffect(getThingPos(cid),2)

				elseif (not flagOwner(cid)) then

					doPlayerSendTextMessage(cid, 27, "Your Team mates already stole the oponent flag, defend him!")

					doTeleportThing(cid, fromPosition,TRUE)

					doSendMagicEffect(getThingPos(cid),2)

				end

			elseif blueStolen() > 0 and redStolen() < 0 then

				doPlayerSendTextMessage(cid, 27, "Your team's flag is taken you can't capture or steel a flag!")

				doTeleportThing(cid, fromPosition,TRUE)

				doSendMagicEffect(getThingPos(cid),2)

			end

			if redStolen() < 0 and blueStolen() < 0 then

				setGlobalStorageValue(FLAG2_INn,1)

				setflagOwner(cid)

				setPlayerStorageValue(cid,103, os.time()+300)

				doTeleportThing(cid, fromPosition,TRUE)

				doChangeSpeed(cid, getTheSpeed(Flag_Holder_Speed)- getCreatureSpeed(cid) )

					for _,tid in ipairs(getPlayersOnline()) do

						if isTeamOne(tid) or isTeamTwo(tid) then

							doPlayerSendTextMessage(tid,22,getCreatureName(cid) .. " stolen the "..TEAM2_NAME.." team flag!")

						end

					end

			end

		end

	end

return true

end

]]></movevent>

  <movevent type="StepIn" actionid="3435" event="script"><![CDATA[

domodlib('toto')

domodlib('CTF-lib')

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)

	if getStorage(Event_Tile_Close) > 0 then

		if getPlayerLevel(cid) < Min_Join_Level then

		   doTeleportThing(cid,fromPosition,false)

			doSendMagicEffect(fromPosition,10)

			doPlayerSendTextMessage(cid,21,"Only players of level "..Min_Join_Level.." are allowed to pass.")

		else

			doTeleportThing(cid,Wait_Place,false)

			doSendMagicEffect(Wait_Place,10)

		end

	else

		doTeleportThing(cid,fromPosition,false)

		doSendMagicEffect(fromPosition,10)

		doPlayerSendTextMessage(cid,21,"Come back later, event is closed now.")

	end

return true

end


]]></movevent>

  <movevent type="StepIn" actionid="6001" event="script"><![CDATA[

domodlib('toto')

domodlib('CTF-lib')


function eventEnded()

	if getGlobalStorageValue(Event_Start) > 0 and getGlobalStorageValue(Event_timeend) > 0 then

		doBroadcastMessage('CTF-Event : The '.. TEAM1_NAME..' team won and reciaved their reward.')

			for _,cid in ipairs(getPlayersOnline()) do

				if isTeamOne(cid) then

					doTeleportThing(cid,getTownTemplePosition(getPlayerTown(cid)),false)

					doSendMagicEffect(getTownTemplePosition(getPlayerTown(cid)),10)

					doRemoveConditions(cid,false)

					resetTheTeams(cid)

					doChangeSpeed(cid, getTheSpeed(getPlayerLevel(cid)) - getCreatureSpeed(cid))

					giveReward(cid)

				elseif isTeamTwo(cid) then

					doTeleportThing(cid,getTownTemplePosition(getPlayerTown(cid)),false)

					doSendMagicEffect(getTownTemplePosition(getPlayerTown(cid)),10)

					doRemoveConditions(cid,false)

					doPlayerSendTextMessage(cid,22,'Your team have lost.')

					resetTheTeams(cid)

					doChangeSpeed(cid, getTheSpeed(getPlayerLevel(cid)) - getCreatureSpeed(cid))

				end

			end

	end

	addEvent(resetTheStorage,5)

end

function onStepIn(cid, item, position, fromPosition)

	if getGlobalStorageValue(Event_Start) > 0 and getGlobalStorageValue(Event_timeend) > 0 then

		if isTeamOne(cid) and blueStolen() < 0 then

			if not flagOwner(cid) then

				doTeleportThing(cid, fromPosition,TRUE)

				doSendMagicEffect(getThingPos(cid),2)

				doPlayerSendTextMessage(cid, 27, "This is your team flag, you cant take it!")

			end

		elseif isTeamOne(cid) and blueStolen() > 0 and redStolen() < 0 then

			doPlayerSendTextMessage(cid, 27, "Your team's Flag has been stolen, go get it back!")

			doTeleportThing(cid, fromPosition,TRUE)

			doSendMagicEffect(getThingPos(cid),2)

		 return true

		end

		if isTeamOne(cid) and flagOwner(cid) and redStolen() > 0 and blueStolen() < 0 then

			if getBlueScore() == FLAG_SCORE -1 then

				addEvent(eventEnded,1000)

				addToBlue()

				doTeleportThing(cid, fromPosition,TRUE)

				doChangeSpeed(cid, getTheSpeed(Players_Speed) - getCreatureSpeed(cid) )

				releaseRF(cid)

					for _,tid in ipairs(getPlayersOnline()) do

						if isTeamOne(tid) or isTeamTwo(tid) then

							doPlayerSendTextMessage(tid,22,getCreatureName(cid) .. " have captured the last flag and earned match win to the ".. TEAM1_NAME.." team!")

						end

					end

			else

				releaseRF(cid)

				addToBlue()

				doTeleportThing(cid, fromPosition,TRUE)

				doChangeSpeed(cid, getTheSpeed(Players_Speed) - getCreatureSpeed(cid) )

					for _,tid in ipairs(getPlayersOnline()) do

						if isTeamOne(tid) or isTeamTwo(tid) then

							doPlayerSendTextMessage(tid,22,getCreatureName(cid) .. " have captured the flag and earned 1 point to the ".. TEAM1_NAME.." team!")

								if Teleport_On_Score == true then

									doTeleportThing(tid,( isTeamTwo(tid) and Red_Position or Blue_Position ), false)

									doSendMagicEffect(getThingPos(tid),10)

								end

						end

					end

			end

		end

		if isTeamTwo(cid) then

			if blueStolen() > 0 and redStolen() < 0 then

				if flagOwner(cid) then

					doPlayerSendTextMessage(cid, 27, "You already holding the flag!")

					doTeleportThing(cid, fromPosition,TRUE)

					doSendMagicEffect(getThingPos(cid),2)

				elseif (not flagOwner(cid)) then

					doPlayerSendTextMessage(cid, 27, "Your Team mates already stole the oponent flag, defend him!")

					doTeleportThing(cid, fromPosition,TRUE)

					doSendMagicEffect(getThingPos(cid),2)

				end

			elseif redStolen() > 0 and blueStolen() < 0 then

				doPlayerSendTextMessage(cid, 27, "Your team's flag is taken you can't capture or steel a flag!")

				doTeleportThing(cid, fromPosition,TRUE)

				doSendMagicEffect(getThingPos(cid),2)

			end

			if blueStolen() < 0 and redStolen() < 0 then

				setGlobalStorageValue(FLAG_IN,1)

				setflagOwner(cid)

				setPlayerStorageValue(cid,103, os.time()+300)

				doTeleportThing(cid, fromPosition,TRUE)

				doChangeSpeed(cid, getTheSpeed(Flag_Holder_Speed)- getCreatureSpeed(cid) )

					for _,tid in ipairs(getPlayersOnline()) do

						if isTeamOne(tid) or isTeamTwo(tid) then

							doPlayerSendTextMessage(tid,22,getCreatureName(cid) .. " stolen the "..TEAM1_NAME.." team flag!")

						end

					end

			end

		end

	end

return true

end

]]></movevent>

  <globalevent name="ctf" interval="900" event="script"><![CDATA[

domodlib('toto')

domodlib('CTF-lib')

local players = {}

local bmale = createConditionObject(CONDITION_OUTFIT)

		setConditionParam(bmale, CONDITION_PARAM_TICKS, -1)

		addOutfitCondition(bmale, {lookType = math.random(128,134), lookHead = 115, lookBody =114, lookLegs = 81, lookFeet = 81, lookTypeEx = 0, lookAddons = 3})


	local bfemale = createConditionObject(CONDITION_OUTFIT)

		setConditionParam(bfemale, CONDITION_PARAM_TICKS, -1)

		addOutfitCondition(bfemale, {lookType = math.random(136,142), lookHead = 115, lookBody =114, lookLegs = 81, lookFeet = 81, lookTypeEx = 0, lookAddons = 3})


	local rmale = createConditionObject(CONDITION_OUTFIT)

		setConditionParam(rmale, CONDITION_PARAM_TICKS, -1)

		addOutfitCondition(rmale, {lookType = math.random(128,134), lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94, lookTypeEx = 0, lookAddons = 3})


	local rfemale = createConditionObject(CONDITION_OUTFIT)

		setConditionParam(rfemale, CONDITION_PARAM_TICKS, -1)

		addOutfitCondition(rfemale, {lookType = math.random(136,142),lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94, lookTypeEx = 0, lookAddons = 3})

	local fight = createConditionObject(CONDITION_INFIGHT)

		setConditionParam(fight, CONDITION_PARAM_TICKS, -1)

function eventEnd()

	if getGlobalStorageValue(Event_Start) > 0 and getGlobalStorageValue(Event_timeend) > 0 then

		if getRedScore() > getBlueScore() then

			doBroadcastMessage('CTF-Event : The '.. TEAM2_NAME..' team won and recieved their reward.')

				for _,cid in ipairs(getPlayersOnline()) do

					if isTeamTwo(cid) then

						doTeleportThing(cid,getTownTemplePosition(getPlayerTown(cid)),false)

						doSendMagicEffect(getTownTemplePosition(getPlayerTown(cid)),10)

						doRemoveConditions(cid,false)

						resetTheTeams(cid)

						doChangeSpeed(cid, getTheSpeed(getPlayerLevel(cid)) - getCreatureSpeed(cid))

						giveReward(cid)

					elseif isTeamOne(cid) then

						doTeleportThing(cid,getTownTemplePosition(getPlayerTown(cid)),false)

						doSendMagicEffect(getTownTemplePosition(getPlayerTown(cid)),10)

						doRemoveConditions(cid,false)

						doPlayerSendTextMessage(cid,22,'Your team have lost.')

						resetTheTeams(cid)

						doChangeSpeed(cid, getTheSpeed(getPlayerLevel(cid)) - getCreatureSpeed(cid))

					end

				end


		elseif getRedScore() < getBlueScore() then

			doBroadcastMessage('CTF-Event : The '.. TEAM1_NAME..' team won and recieved their reward.')

				for _,cid in ipairs(getPlayersOnline()) do

					if isTeamOne(cid) then

						doTeleportThing(cid,getTownTemplePosition(getPlayerTown(cid)),false)

						doSendMagicEffect(getTownTemplePosition(getPlayerTown(cid)),10)

						doRemoveConditions(cid,false)

						resetTheTeams(cid)

						doChangeSpeed(cid, getTheSpeed(getPlayerLevel(cid)) - getCreatureSpeed(cid))

						giveReward(cid)

					elseif isTeamTwo(cid) then

						doTeleportThing(cid,getTownTemplePosition(getPlayerTown(cid)),false)

						doSendMagicEffect(getTownTemplePosition(getPlayerTown(cid)),10)

						doRemoveConditions(cid,false)

						doPlayerSendTextMessage(cid,22,'Your team have lost.')

						resetTheTeams(cid)

						doChangeSpeed(cid, getTheSpeed(getPlayerLevel(cid)) - getCreatureSpeed(cid))

					end

				end

		elseif getRedScore() == getBlueScore() then

			doBroadcastMessage('CTF-Event : The Event ended with a draw between both teams.')

				for _,cid in ipairs(getPlayersOnline()) do

					if isTeamTwo(cid) or isTeamOne(cid) then

						doTeleportThing(cid,getTownTemplePosition(getPlayerTown(cid)),false)

						doSendMagicEffect(getTownTemplePosition(getPlayerTown(cid)),10)

						doRemoveConditions(cid,false)

						doPlayerSendTextMessage(cid,22,'It was a draw between both teams.')

						resetTheTeams(cid)

						doChangeSpeed(cid, getTheSpeed(getPlayerLevel(cid)) - getCreatureSpeed(cid))

					end

				end


		end

		addEvent(resetTheStorage,1000)

	end

end


function eventStart()

	doSetStorage(Event_Tile_Close,-1)

	setGlobalStorageValue(Event_timeend,1)

	setGlobalStorageValue(Timer, os.time() + Event_MaxTime*60)

	addEvent(eventEnd,Event_MaxTime*60*1000)




			for v = frompos.x , topos.x do

				for k = frompos.y , topos.y do

					for i = 1, 200 do

						position = {x = v, y = k, z = 7, stackpos = i}

						pid = getThingfromPos(position).uid

							if(pid ~= nil and isPlayer(pid)) then

								table.insert(players, pid)

							end

					end

				end

			end

			if math.mod(#players, 2) ~= 0 then

				doTeleportThing(players[#players],getTownTemplePosition(getPlayerTown(players[#players])),false)

				doSendMagicEffect(getThingPosition(players[#players]),10)

				doPlayerSendTextMessage(players[#players], 19, "Sorry, you have been kicked from event to balance teams.")

				table.remove(players)

			end

			if #players < Players_Least_Number then

				doBroadcastMessage("CTF event was cancelled because less than "..Players_Least_Number.." players joined")

				resetTheStorage()

					if #players > 0 then

						for i = 1,#players do

							 doTeleportThing(players[i],getTownTemplePosition(getPlayerTown(players[i])),false)

							 doSendMagicEffect(getThingPos(players[i]), 10)

						end

					end

			else

					 doBroadcastMessage("CTF started")

						for i = 1, math.floor(#players/2) do

							setFirstTeam(players[i])

						end

						for i = math.floor(#players/2)+1 , #players do

							setSecondTeam(players[i])

						end

						for _,cid in ipairs(getPlayersOnline()) do

							if isTeamOne(cid) then

								if getPlayerSex(cid) == 1 then

									doAddCondition(cid, bmale)

								elseif getPlayerSex(cid) ~= 1 then

									doAddCondition(cid, bfemale)

								end

								doAddCondition(cid, fight)

								doTeleportThing(cid,Blue_Position,false)

								doSendMagicEffect(Blue_Position, 10)

								doChangeSpeed(cid, getTheSpeed(Players_Speed) - getCreatureSpeed(cid))

							elseif  isTeamTwo(cid) then

								if getPlayerSex(cid) == 1 then

									doAddCondition(cid, rmale)

								elseif getPlayerSex(cid) ~= 1 then

									doAddCondition(cid, rfemale)

								end

								doAddCondition(cid, fight)

								doTeleportThing(cid,Red_Position,false)

								doSendMagicEffect(Red_Position, 10)

								doChangeSpeed(cid, getTheSpeed(Players_Speed) - getCreatureSpeed(cid))

							end

						end

						players = {}


			end

end

function onThink(interval)

   if getGlobalStorageValue(Event_Start) < 0 then

		setGlobalStorageValue(Event_Start,1)

		doSetStorage(Event_Tile_Close,1)

		doBroadcastMessage("CTF event is opened and teleport is created. It will start in "..Event_WaitTime.." minutes.")

		players = {}

		if getTileItemById(Tp_Place, 1387).uid < 1 then

			doItemSetAttribute(doCreateItem(1387,1, Tp_Place), "aid", 3435)

		end


		f= Event_WaitTime - 1

			for i = 1,Event_WaitTime-1 do

				addEvent(doBroadcastMessage,i*60*1000,"CTF event is opened and teleport is created. It will start in "..f.." minutes.")

				f= f-1

			end

		addEvent(eventStart,Event_WaitTime*60*1000)

	end

return true

end

]]></globalevent>

  <event type="think" name="ctff" event="script"><![CDATA[

domodlib('toto')

domodlib('CTF-lib')


local bl = BLUE_FLAG

local re = RED_FLAG

function onThink(interval)

	if getGlobalStorageValue(Event_Start) > 0 and getGlobalStorageValue(Event_timeend) > 0 then

		if redStolen() < 0 then

			doSendAnimatedText(re,"FLAG!",TEXTCOLOR_DARKRED)

			doSendMagicEffect(re, CONST_ME_SOUND_RED)

		end

		if blueStolen() < 0 then

			doSendAnimatedText(bl,"FLAG!",TEXTCOLOR_GREEN)

			doSendMagicEffect(bl, CONST_ME_SOUND_GREEN)

		end

		for _, cid in ipairs(getPlayersOnline()) do

			if flagOwner(cid) then

				if isTeamOne(cid) or isTeamTwo(cid) then

					if hasCondition(cid,CONDITION_HASTE) then

						doRemoveCondition(cid,CONDITION_HASTE)

					end

				end

				pl = getThingPos(cid)

					if isTeamTwo(cid) then

						if getPlayerStorageValue(cid,103) < os.time() then

							releaseBF(cid)

								for _,cid in ipairs(getPlayersOnline()) do

									if isTeamOne(cid) or isTeamTwo(cid) then

										doPlayerSendTextMessage(cid,22,getCreatureName(cid) .. " wasted 5 minutes with FLAG."..TEAM2_NAME.." flag is again on spawn!")

									end

								end

						else

							doSendAnimatedText(pl,"FLAG!",TEXTCOLOR_GREEN)

							doSendMagicEffect(pl, CONST_ME_SOUND_GREEN)

						end

					elseif isTeamOne(cid) then

						if getPlayerStorageValue(cid,103) < os.time() then

							releaseRF(cid)

								for _,cid in ipairs(getPlayersOnline()) do

									if isTeamOne(cid) or isTeamTwo(cid) then

										doPlayerSendTextMessage(cid,22,getCreatureName(cid) .. " wasted 5 minutes with FLAG."..TEAM1_NAME.." flag is again on spawn!")

									end

								end

						else

							doSendAnimatedText(pl,"FLAG!",COLOR_RED)

							doSendMagicEffect(pl, CONST_ME_SOUND_RED)

						end

					end

			end

		end

	end

  return true

end

]]></event>

  <globalevent name="timer" interval="0.4" event="script"><![CDATA[

domodlib('toto')

domodlib('CTF-lib')


function onThink(interval)

	for _,cid in ipairs(getPlayersOnline()) do

		if isTeamOne(cid) or isTeamTwo(cid) then

			if getGlobalStorageValue(Event_Start) > 0 and getGlobalStorageValue(Event_timeend) > 0 then

				if getGlobalStorageValue(Timer)- os.time() >= 0 then

					doPlayerSendCancel(cid, "Time -> ".. os.date("%M:%S ",getGlobalStorageValue(Timer)- os.time()) .. "  |  ".. TEAM1_NAME.." Score : "..getBlueScore(cid).."/"..FLAG_SCORE.." captures  |  ".. TEAM2_NAME.." Score : "..getRedScore(cid).."/"..FLAG_SCORE.." captures")

				end

			end

		end

	end

return true

end

]]></globalevent>

  <globalevent name="starting" type="startup" event="script"><![CDATA[

domodlib('toto')

domodlib('CTF-lib')

function onStartup()

	resetTheStorage()


return true

end

]]></globalevent>

</mod>

Créditos:

Está no script

 http://baiakuza.com/
IP: baiakuza.com
TIBIA: 10.96
Baiak Custom [ High Exp Rate ]

 

 

 

 

Link para o post
Compartilhar em outros sites
  • Respostas 57
  • Created
  • Última resposta

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

Ai está um MOD CTF , como nos velhos tempos Se já exister no forum , peço desculpas ;( <?xml version="1.0" encoding="utf-8"?> <mod name="CTF" version="1.0" author="Doggynub"

Man nao precisá ficar chingando de 'animal' que ele tem problema mental e so avisar

Ok!

Queria jogar um capture flag como antigamente. =(

Unico OT sem RPG que vale apena..

@Topico.

Parabens ai.. Talvez usarei ele ainda. KKKK

tumblr_lz9jp5shzM1qdlh1io1_r1_400.gif

[ Hack Win ]

Link para o post
Compartilhar em outros sites

UHAHU.

Esse script eu já li mais de 30x, pra intender cada passo.. é muito útil para criações de novos eventos.

Que talvez irei fazer exclusivo :P

 http://baiakuza.com/
IP: baiakuza.com
TIBIA: 10.96
Baiak Custom [ High Exp Rate ]

 

 

 

 

Link para o post
Compartilhar em outros sites
  • 4 weeks later...

E afinal... pra que serve?

O SkyDangerous fez o post somente pra quem conhece o script ou a sigla CTF ?

E pra quem não conhece ou nunca jogou isso?

Tenso néh =|

Explica por gentileza?

queria saber do que se trata

tk-melhor.png

Link para o post
Compartilhar em outros sites
  • 2 weeks later...
FezZinN

Postado 03 agosto 2011 - 12:24

É legal esse modo, já joguei apenas um OTServ com ele!

Seria legal mais OTs com o CTF '-'

eu vi esta msg em outro forum. e o conteudo do postador foi o SkyDangerous.

acredito que seja o mesmo removido do outro forum.

e queria dizer que eu tbm só joguei 1 server de rouyba bandeira (CTF)

Link para o post
Compartilhar em outros sites

Eu tô com problema nesse mod, o evento inicia e alguns instantes depois termina dizendo que terminou em empate, sendo que o tempo do CTF é de 15 minutos!

Link para o post
Compartilhar em outros sites
ERRO1

[03/04/2012 08:57:32] [Error - GlobalEvent Interface]

[03/04/2012 08:57:32] data/globalevents/scripts/starting.lua:onStartup

[03/04/2012 08:57:32] Description:

[03/04/2012 08:57:32] data/globalevents/scripts/starting.lua:4: attempt to call global 'resetTheStorage' (a nil value)

[03/04/2012 08:57:32] stack traceback:

[03/04/2012 08:57:32] data/globalevents/scripts/starting.lua:4: in function <data/globalevents/scripts/starting.lua:3>

ERRO2

[03/04/2012 08:58:04] Account Manager has logged in.

[03/04/2012 08:58:04] [Error - CreatureScript Interface]

[03/04/2012 08:58:04] data/creaturescripts/scripts/Tutorial Login.lua:onLogin

[03/04/2012 08:58:04] Description:

[03/04/2012 08:58:04] data/creaturescripts/scripts/Tutorial Login.lua:5: attempt to call global 'isTeamOne' (a nil value)

[03/04/2012 08:58:04] stack traceback:

[03/04/2012 08:58:04] data/creaturescripts/scripts/Tutorial Login.lua:5: in function <data/creaturescripts/scripts/Tutorial Login.lua:3>

[03/04/2012 08:58:04] Account Manager has logged out.

pode me ajuda?

Link para o post
Compartilhar em outros sites

AFE OS CARA POSTA OS NEGOCIO E DEIXA LARGADO.. nem ajuda mais :s

Link para o post
Compartilhar em outros sites

Nunca deu esse problema comigo, você ta pondo na pasta mods?

 http://baiakuza.com/
IP: baiakuza.com
TIBIA: 10.96
Baiak Custom [ High Exp Rate ]

 

 

 

 

Link para o post
Compartilhar em outros sites

NOSSA! amém .-. agradeçe ae. man :D

Link para o post
Compartilhar em outros sites

eu coloquei conforme achei que fossse. EXP:

Globalevents.xml >>> <event type="think" name="ctff" event="script">

Scripts/ctff.lua

domodlib('toto')

domodlib('CTF-lib')

local bl = BLUE_FLAG

local re = RED_FLAG

function onThink(interval)

if getGlobalStorageValue(Event_Start) > 0 and getGlobalStorageValue(Event_timeend) > 0 then

if redStolen() < 0 then

doSendAnimatedText(re,"FLAG!",TEXTCOLOR_DARKRED)

doSendMagicEffect(re, CONST_ME_SOUND_RED)

end

if blueStolen() < 0 then

doSendAnimatedText(bl,"FLAG!",TEXTCOLOR_GREEN)

doSendMagicEffect(bl, CONST_ME_SOUND_GREEN)

end

for _, cid in ipairs(getPlayersOnline()) do

if flagOwner(cid) then

if isTeamOne(cid) or isTeamTwo(cid) then

if hasCondition(cid,CONDITION_HASTE) then

doRemoveCondition(cid,CONDITION_HASTE)

end

end

pl = getThingPos(cid)

if isTeamTwo(cid) then

if getPlayerStorageValue(cid,103) < os.time() then

releaseBF(cid)

for _,cid in ipairs(getPlayersOnline()) do

if isTeamOne(cid) or isTeamTwo(cid) then

doPlayerSendTextMessage(cid,22,getCreatureName(cid) .. " wasted 5 minutes with FLAG."..TEAM2_NAME.." flag is again on spawn!")

end

end

else

doSendAnimatedText(pl,"FLAG!",TEXTCOLOR_GREEN)

doSendMagicEffect(pl, CONST_ME_SOUND_GREEN)

end

elseif isTeamOne(cid) then

if getPlayerStorageValue(cid,103) < os.time() then

releaseRF(cid)

for _,cid in ipairs(getPlayersOnline()) do

if isTeamOne(cid) or isTeamTwo(cid) then

doPlayerSendTextMessage(cid,22,getCreatureName(cid) .. " wasted 5 minutes with FLAG."..TEAM1_NAME.." flag is again on spawn!")

end

end

else

doSendAnimatedText(pl,"FLAG!",COLOR_RED)

doSendMagicEffect(pl, CONST_ME_SOUND_RED)

end

end

end

end

end

return true

end

Link para o post
Compartilhar em outros sites

o serve vai ser do roba bandeira.

ajuda ae man. sem maldade!

TEAM RED

TEAM GREEN

Azul: Centro

Amarelo: Templo

imagemktv.png

Uploaded with ImageShack.us

Link para o post
Compartilhar em outros sites

o arquivo é pra na pasta mod e configurar as coordenadas.

não precisa de ficar instalando e configurando nas pastas glboalevents,creaturescript .. é automatico.

 http://baiakuza.com/
IP: baiakuza.com
TIBIA: 10.96
Baiak Custom [ High Exp Rate ]

 

 

 

 

Link para o post
Compartilhar em outros sites

cmo eu faço pra ligar ? é só colocar e pronto?

Link para o post
Compartilhar em outros sites

oque é isso? e oque coloco?

--[[ Storage Settings]]--

Owner = 1900 -- put empty storage

FLAG2_INn = 4000 -- put empty storage

FLAG_IN = 4001 -- put empty storage

TEAM1_FLAGS = 3030 -- put empty storage

TEAM2_FLAGS = 3031 -- put empty storage

Event_Start = 3032 -- put empty storage

Event_timeend = 3033 -- put empty storage

Event_Tile_Close = 3039 -- put empty storage

joined = 2023 --put empty storage

Timer = 1010 --put empty storage

_____________________________________________________________________________

--[[Event setting ]]--

Event_WaitTime = 20 -- time for the collection of player then event will start (in minutes)

Event_MaxTime = 30 --- in minutes ( this is the max time for an event to bb running )

Players_Speed = 20000 -- put the level of base speed in event ( like if you want the speed of lvl 300 then wright 300)

Flag_Holder_Speed = 15000 -- [Old-Styled feature] speed for the player when he hold a flag better not to increase.

TEAM2_NAME = "Red" -- team 2 name

TEAM1_NAME = "Green" -- team 1 name

FLAG_SCORE = 5 -- score when team gets he wins

Teleport_On_Score = true -- this teleport all players to their team main position when some one score a flag , make false to disable.

Players_Least_Number = 1 -- this means if there is less than 2 players joined the event will be cancelled

Min_Join_Level = 150 -- min lvl for a player to join event

rewards_random = {

[60] = { -- Rewards of 60% , if it is then it will randomly give one of the items in the items verible if there you put more than one item there

items = {9971,9971,9971}

},

[30] = { -- Rewards of 30%

items = {9971,9971,9971}

},

[10] = { -- Rewards of 10%

items = {9971,9971,9971}

}

}

</config>

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

ricardo3

Eu sei que você quer esse sistema no seu servidor, mais você esta cometando varias infrações.

Por favor, leia as regras

Sistema MODS é só colocar na pasta \mods do seu servidor na extensão .xml

É só você configurar ao seu gosto.

Link para o post
Compartilhar em outros sites

SABE QUAL A MINHA MAIOR DECEPÇÃO?

esperar ajuda de vocês! :s

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 MatheusMkalo
      Todos os scripts foram testados em um ot 8.6
      Bem o script é auto-explicativo, e ainda tem um video do sistema, acho que nao preciso explicar o que faz ne?
      AGORA EM MOD, MUITO MAIS PRATICO DE INSTALAR. SE FOR USAR O MOD VA ATE O FINAL DO POST, É EXATAMENTE IGUAL A VERSAO NORMAL, SO QUE MAIS PRATICO. FUNCIONA DO MESMO JEITO.
      Video:
      obs: Veja em fullscreen para ver melhor as msgs que retornam.
      Vá em data/lib e adicione esse script.lua com o nome de WarArenaLib:
        -- [[ Area and Positions Infos ]] -- areaplayersteam = { {1,1,1,1}, {1,1,1,1}, {1,1,1,1}, {1,1,1,1}, {1,1,1,1} } areateam1ext = {x=80, y=305, z=7} -- Ponta superior esquerda da area do time um areateam2ext = {x=87, y=305, z=7} -- Ponta superior esquerda da area do time dois leaderteam1pos = {x=83, y=307, z=7, stackpos=255} -- Posição do lider do time um (que puxara a alavanca) leaderteam2pos = {x=87, y=307, z=7, stackpos=255} -- Posição do lider do time dois (que puxara a alavanca) newplayersposteam1 = {x=67, y=300, z=7} -- Posição para onde os players do time um serao teleportados newplayersposteam2 = {x=67, y=330, z=7} -- Posição para onde os players do time dois serao teleportados team1leverpos = {x=84, y=307, z=7, stackpos=1} -- Posição da alavanca que o lider do time um puxara team2leverpos = {x=86, y=307, z=7, stackpos=1} -- Posição da alavanca que o lider do time dois puxara leverafter, leverbefore = 9825, 9826 -- Ids das alavancas antes de puxadas e depois, consecutivamente (9825 = antes; 9826 = depois) posbenterteam1 = {x=78, y=307, z=7} -- Posiçao do sqm antes de entrar na arena do time 1 posbenterteam2 = {x=92, y=307, z=7} -- Posiçao do sqm antes de entrar na arena do time 2 backteampos = {x=77, y=307, z=7} -- [[ Storage Infos ]] -- team1leverstorage = 123497 -- Storage que sera usado quando puxarem a alavanca do time 1 team2leverstorage = 123498 -- Storage que sera usado quando puxarem a alavanca do time 2 haveteaminarena = 123499 -- Storage que sera usado para ve se tem algum time lutando na arena storageteam1death = 123500 -- Storage usado para ver quantos morreram do time 1 storageteam2death = 123501 -- Storage usado para ver quantos morreram do time 2 storageteam1 = 123502 -- Storage usado para ver quantas pessoas entraram na arena no time 1 storageteam2 = 123503 -- Storage usado para ver quantas pessoas entraram na arena no time 2 storageleader1 = 123504 -- Storage onde ficara guardado o uid do lider do time 1 storageleader2 = 123505 -- Storage onde ficara guardado o uid do lider do time 2 storageplayersteam1 = 123506 -- Storage que todos os players do team 1 iram ter. storageplatersteam2 = 123507 -- Storage que todos os players do team 2 iram ter. -- [[ Player Infos ]] -- needlevelarena = 20 -- Level que os outros jogadores sem ser o lider teram que ter. leaderlevel = 4000 -- Level que o lider tera que ter. onlyguildwars = true -- Se os membros de um time tem que ser da mesma guild do lider. (Nesse caso somente o lider da guild podera puxar a alavanca.) needplayers = 2 -- Quantidade de players que cada time tem que ter. -- [[ Functions ]] -- function getUidsFromArea(firstpos, area) local result = {} for i,x in pairs(area) do for s,z in pairs(x) do if isPlayer(getThingFromPos({x=firstpos.x+s-1, y=firstpos.y+i-1, z=firstpos.z, stackpos=255}).uid) then table.insert(result, getThingFromPos({x=firstpos.x+s-1, y=firstpos.y+i-1, z=firstpos.z, stackpos=255}).uid) end end end return result end function teleportUidsToPos(uids, pos) for i,x in pairs(uids) do doTeleportThing(x, pos) end end function isAllUidsSameGuild(uids, guildid) for i,x in pairs(uids) do if not (getPlayerGuildId(x) == guildid) then return false end end return true end function isAllUidsLevel(uids, level) for i,x in pairs(uids) do if not (getPlayerLevel(x) >= level) then return false end end return true end function haveQuantPlayersInArea(firstpos, area, quant) local result = 0 for i,x in pairs(area) do for s,z in pairs(x) do if isPlayer(getThingFromPos({x=firstpos.x+s-1, y=firstpos.y+i-1, z=firstpos.z, stackpos=255}).uid) then result = result+1 end end end return result >= quant end function addStorageToUids(uids, storage, value) for i,x in pairs(uids) do setPlayerStorageValue(x, storage, value) end end function checkPoses(pos1, pos2) if pos1.x == pos2.x and pos1.y == pos2.y and pos1.z == pos2.z then return true end return false end function startArena() setGlobalStorageValue(storageleader1, getThingFromPos(leaderteam1pos).uid) setGlobalStorageValue(storageleader2, getThingFromPos(leaderteam2pos).uid) addStorageToUids(team1uids, storageplayersteam1, 1) addStorageToUids(team2uids, storageplayersteam2, 1) teleportUidsToPos(team1uids, newplayersposteam1) teleportUidsToPos(team2uids, newplayersposteam2) setGlobalStorageValue(storageteam1, #team1uids) registerCreatureEventUids(team1uids, "DeathTeam1") registerCreatureEventUids(team2uids, "DeathTeam2") setGlobalStorageValue(storageteam2, #team2uids) setGlobalStorageValue(haveteaminarena, 1) setGlobalStorageValue(team1leverstorage, 0) setGlobalStorageValue(team2leverstorage, 0) doTransformItem(getThingFromPos(team1leverpos).uid, leverafter) doTransformItem(getThingFromPos(team2leverpos).uid, leverafter) end function haveTeamInArena() return getGlobalStorageValue(haveteaminarena) == 1 and true or false end function isSqmFromArea(firstpos, area, sqmpos) for i,x in pairs(area) do for s,z in pairs(x) do if sqmpos.x == firstpos.x+s-1 and sqmpos.y == firstpos.y+i-1 and sqmpos.z == firstpos.z then return true end end end return false end function registerCreatureEventUids(uids, event) for i,x in pairs(uids) do registerCreatureEvent(x, event) end end Agora vá em data/actions/scripts e adicione um script.lua com o nome de WarArenaLever:
        function onUse(cid, item, fromPosition, itemEx, toPosition) team1uids = getUidsFromArea(areateam1ext, areaplayersteam) team2uids = getUidsFromArea(areateam2ext, areaplayersteam) if haveTeamInArena() then return doPlayerSendCancel(cid, "Already have a team in arena.") end if checkPoses(toPosition, team1leverpos) then if checkPoses(getCreaturePosition(cid), leaderteam1pos) then if getGlobalStorageValue(team1leverstorage) == 1 then setGlobalStorageValue(team1leverstorage, 0) return doTransformItem(getThingFromPos(team1leverpos).uid, leverafter) end if onlyguildwars and getPlayerGuildLevel(cid) < 3 then return doPlayerSendCancel(cid, "You need to be the leader of your guild.") end if onlyguildwars and not isAllUidsSameGuild(team1uids, getPlayerGuildId(cid)) then return doPlayerSendCancel(cid, "All of your team need to be in your guild.") end if not isAllUidsLevel(team1uids, needlevelarena) then return doPlayerSendCancel(cid, "All of your team need to be level " .. needlevelarena .. " or more.") end if getPlayerLevel(cid) < leaderlevel then return doPlayerSendCancel(cid, "You, the leader of the team, need to be level " .. leaderlevel .. " or more.") end if not haveQuantPlayersInArea(areateam1ext, areaplayersteam, needplayers) then return doPlayerSendCancel(cid, "Your team need " .. tostring(needplayers) .. " players.") end setGlobalStorageValue(team1leverstorage, 1) doTransformItem(getThingFromPos(team1leverpos).uid, leverbefore) if getGlobalStorageValue(team2leverstorage) >= 1 then startArena() end else doPlayerSendCancel(cid, "You must be the leader of the team to pull the lever.") end elseif checkPoses(toPosition, team2leverpos) then if checkPoses(getCreaturePosition(cid), leaderteam2pos) then if getGlobalStorageValue(team2leverstorage) == 1 then setGlobalStorageValue(team2leverstorage, 0) return doTransformItem(getThingFromPos(team2leverpos).uid, leverafter) end if onlyguildwars and getPlayerGuildLevel(cid) < 3 then return doPlayerSendCancel(cid, "You need to be the leader of your guild.") end if onlyguildwars and not isAllUidsSameGuild(team2uids, getPlayerGuildId(cid)) then return doPlayerSendCancel(cid, "All of your team need to be in your guild.") end if not isAllUidsLevel(team2uids, needlevelarena) then return doPlayerSendCancel(cid, "All of your team need to be level " .. needlevelarena .. " or more.") end if getPlayerLevel(cid) < leaderlevel then return doPlayerSendCancel(cid, "You, the leader of the team, need to be level " .. leaderlevel .. " or more.") end if not haveQuantPlayersInArea(areateam2ext, areaplayersteam, needplayers) then return doPlayerSendCancel(cid, "Your team need " .. tostring(needplayers) .. " players.") end setGlobalStorageValue(team2leverstorage, 1) doTransformItem(getThingFromPos(team2leverpos).uid, leverbefore) if getGlobalStorageValue(team1leverstorage) >= 1 then startArena() end else doPlayerSendCancel(cid, "You must be the leader of the team to pull the lever.") end end return TRUE end E em actions.xml bote essa linha:
        <action actionid="12349" event="script" value="WarArenaLever.lua"/> Agora vá em data/creaturescripts/scripts e adicione dois scripts.lua com esses nomes: WarArenaDeathTeam1:
        function onDeath(cid) setPlayerStorageValue(cid, storageplayersteam1, 0) setGlobalStorageValue(storageteam1death, getGlobalStorageValue(storageteam1death) >= 0 and getGlobalStorageValue(storageteam1death)+1 or 1) if getGlobalStorageValue(storageteam1death) >= getGlobalStorageValue(storageteam1) then if onlyguildwars then doBroadcastMessage("The Team 2 won the war, guild " .. getPlayerGuildName(getGlobalStorageValue(storageleader2)) .. ".") else doBroadcastMessage("The Team 2 won the war, team leader name is " .. getCreatureName(getGlobalStorageValue(storageleader2)) .. ".") end setGlobalStorageValue(storageteam1death, 0) setGlobalStorageValue(storageteam2death, 0) setGlobalStorageValue(haveteaminarena, 0) end return TRUE end WarArenaDeathTeam2:
        function onDeath(cid) setPlayerStorageValue(cid, storageplayersteam2, 0) setGlobalStorageValue(storageteam2death, getGlobalStorageValue(storageteam2death) >= 0 and getGlobalStorageValue(storageteam2death)+1 or 1) if getGlobalStorageValue(storageteam2death) >= getGlobalStorageValue(storageteam2) then if onlyguildwars then doBroadcastMessage("The Team 1 won the war, guild " .. getPlayerGuildName(getGlobalStorageValue(storageleader1)) .. ".") else doBroadcastMessage("The Team 1 won the war, team leader name is " .. getCreatureName(getGlobalStorageValue(storageleader1)) .. ".") end setGlobalStorageValue(storageteam1death, 0) setGlobalStorageValue(storageteam2death, 0) setGlobalStorageValue(haveteaminarena, 0) end return TRUE end Agora abra o creaturescripts.xml e adicione essas linhas:
        <event type="death" name="DeathTeam1" event="script" value="WarArenaDeathTeam1.lua"/> <event type="death" name="DeathTeam2" event="script" value="WarArenaDeathTeam2.lua"/> Agora vá em data/movements/scripts e adicione tres scripts.lua com esses nomes: WarArenaMovement1:
        function onStepOut(cid, item, position, fromPosition) local team = (fromPosition.x == leaderteam1pos.x and fromPosition.y == leaderteam1pos.y and fromPosition.z == leaderteam1pos.z) and "team1" or (fromPosition.x == leaderteam2pos.x and fromPosition.y == leaderteam2pos.y and fromPosition.z == leaderteam2pos.z) and "team2" if team == "team1" then if getGlobalStorageValue(team1leverstorage) == 1 then setGlobalStorageValue(team1leverstorage, 0) doTransformItem(getThingFromPos(team1leverpos).uid, leverafter) end elseif team == "team2" then if getGlobalStorageValue(team2leverstorage) == 1 then setGlobalStorageValue(team2leverstorage, 0) doTransformItem(getThingFromPos(team2leverpos).uid, leverafter) end end end WarArenaMovement2:
        function onStepIn(cid, item, position, fromPosition) local team = isSqmFromArea(areateam1ext, areaplayersteam, fromPosition) and "team1" or isSqmFromArea(areateam2ext, areaplayersteam, fromPosition) and "team2" if team == "team1" then if getGlobalStorageValue(team1leverstorage) == 1 then if not haveQuantPlayersInArea(areateam1ext, areaplayersteam, needplayers) then setGlobalStorageValue(team1leverstorage, 0) doTransformItem(getThingFromPos(team1leverpos).uid, leverafter) end end elseif team == "team2" then if getGlobalStorageValue(team2leverstorage) == 1 then if not haveQuantPlayersInArea(areateam2ext, areaplayersteam, needplayers) then setGlobalStorageValue(team2leverstorage, 0) doTransformItem(getThingFromPos(team2leverpos).uid, leverafter) end end end if getGlobalStorageValue(team1leverstorage) == 1 then if checkPoses(fromPosition, posbenterteam1) then doTeleportThing(cid, fromPosition) return doPlayerSendCancel(cid, "You can't enter now.") end elseif getGlobalStorageValue(team2leverstorage) == 1 then if checkPoses(fromPosition, posbenterteam2) then doTeleportThing(cid, fromPosition) return doPlayerSendCancel(cid, "You can't enter now.") end end end WarArenaMovement3:
        function onStepIn(cid, item, position, fromPosition) if getPlayerStorageValue(cid, storageplayersteam1) >= 1 then setPlayerStorageValue(cid, storageplayersteam1, 0) doTeleportThing(cid, posbenterteam1) setGlobalStorageValue(storageteam1death, getGlobalStorageValue(storageteam1death) >= 0 and getGlobalStorageValue(storageteam1death)+1 or 1) if getGlobalStorageValue(haveteaminarena) >= 1 then if getGlobalStorageValue(storageteam1death) >= getGlobalStorageValue(storageteam1) then if onlyguildwars then doBroadcastMessage("The Team 2 won the war, guild " .. getPlayerGuildName(getGlobalStorageValue(storageleader2)) .. ".") else doBroadcastMessage("The Team 2 won the war, team leader name is " .. getCreatureName(getGlobalStorageValue(storageleader2)) .. ".") end setGlobalStorageValue(storageteam1death, 0) setGlobalStorageValue(storageteam2death, 0) setGlobalStorageValue(haveteaminarena, 0) end end elseif getPlayerStorageValue(cid, storageplayersteam2) >= 1 then setPlayerStorageValue(cid, storageplayersteam2, 0) doTeleportThing(cid, posbenterteam2) setGlobalStorageValue(storageteam2death, getGlobalStorageValue(storageteam2death) >= 0 and getGlobalStorageValue(storageteam2death)+1 or 1) if getGlobalStorageValue(haveteaminarena) >= 1 then if getGlobalStorageValue(storageteam2death) >= getGlobalStorageValue(storageteam2) then if onlyguildwars then doBroadcastMessage("The Team 1 won the war, guild " .. getPlayerGuildName(getGlobalStorageValue(storageleader1)) .. ".") else doBroadcastMessage("The Team 1 won the war, team leader name is " .. getCreatureName(getGlobalStorageValue(storageleader1)) .. ".") end setGlobalStorageValue(storageteam1death, 0) setGlobalStorageValue(storageteam2death, 0) setGlobalStorageValue(haveteaminarena, 0) end end end return TRUE end E adicione essas linhas em movements.xml:
        <movevent type="StepOut" actionid="12350" event="script" value="WarArenaMovement1.lua"/> <movevent type="StepIn" actionid="12351" event="script" value="WarArenaMovement2.lua"/> <movevent type="StepIn" actionid="12352" event="script" value="WarArenaMovement3.lua"/> Pronto acabou rairiaria. Adicionando os Actions IDS: Nas 2 alavancas, adicione o actionid 12349. Nos 2 sqms que os players vao estar antes de entrar na arena adicione o actionid 12351. Nos 2 quadrados aonde os lideres irao ficar (na frente da alavanca) bote o actionid 12350. No sqm de sair da arena bote o actionid 12352. NA AREA DOS TIMES E NA ARENA, BOTE PELO MAP EDITOR PARA NAO PODER LOGAR. (Se voce nao fizer isso pode haver bugs.) Bem, se voce souber ler o script da lib, vai saber configura-lo para seu otserver. Versão MOD: (Abra o spoiler)
      O modo de configurar é exatamente igual ao normal. Flws.
      By MatheusMkalo
    • Por Garou
      ADVANCED FORGE SYSTEM
      O SISTEMA DE CRIAÇÃO DE ITENS PARA SEU SERVIDOR
       
      Creio que muitos já conhecem o sistema de forja criado por mim, acontece que o código já estava um pouco obsoleto, então resolvi reescrever ele do 0.
      Simplesmente consiste em um sistema de criação de itens avançado que ressuscita um pouco do RPG perdido nos servidores de hoje em dia. O jogador poderá criar itens através de forja, agindo como um verdadeiro ferreiro medieval. Adiciona itens em cima de uma bigorna previamente colocada no mapa e com um martelo cria um item totalmente novo.
      CARACTERÍSTICAS DA VERSÃO FINAL:
      - Configuração intuitiva e fácil de compreender;
      - Mini-tutorial auxiliando criação de novas receitas;
      - Receitas podem conter até 250 itens diferentes com suas respectivas quantidades;
      - Sistema inteligente que identifica uma receita em qualquer ordem;
      - Código totalmente orientado a objetos;
      - Possibilidade de configurar diferentes requerimentos, diferentes skills, magic level e level
       
      Há dois modos de instalar o Advanced Forge System, o primeiro é seguir os passos deste tópico e o segundo e baixar pasta data/ anexada no tópico com os arquivos em seus respectivos diretórios, precisando apenas o registro das chaves nos arquivos XML.
      Escolha o modo que mais convém a você.
       
      Crie um arquivo em data/lib chamado forgesystem.lua e cole o conteúdo abaixo:
        --[[ ADVANCED FORGE SYSTEM FINAL Criado por Oneshot É proibido a venda ou a cópia sem os devidos créditos desse script. ]]-- RecipeHandler = { itemtype = 0, items = {}, level = 1, maglevel = 0, skills = {[0] = 0, [1] = 0, [2] = 0, [3] = 0, [4] = 0, [5] = 0, [6] = 0} } Forge = { type = nil, position = nil, magicEffect = CONST_ME_MAGIC_GREEN, messages = { class = MESSAGE_STATUS_DEFAULT, success = "You have successfully forged a %s.", needskill = "You don't have enough %s to create a %s.", needlevel = "You need level %s to create a %s.", needmaglevel = "You need magic level %s to create a %s." } } function RecipeHandler:new(itemtype, items, level, maglevel, skills) local obj = { itemtype = (itemtype or 0), items = (items or {}), level = (level or 1), maglevel = (maglevel or 0), skills = (skills or {[0] = 0, [1] = 0, [2] = 0, [3] = 0, [4] = 0, [5] = 0, [6] = 0}) } table.insert(Recipes, obj) return setmetatable(obj, {__index = self}) end function RecipeHandler:setItem(itemtype) self.itemtype = (itemtype or 0) end function RecipeHandler:setRecipe(...) self.items = {...} end function RecipeHandler:setRecipeItem(itemid, amount) table.insert(self.items, {itemid, amount}) end function RecipeHandler:setSkill(skillid, value) self.skills[skillid] = value end function RecipeHandler:setLevel(value) self.level = value end function RecipeHandler:setMagLevel(value) self.maglevel = value end function RecipeHandler:check(position) local match = false for n, item in ipairs(self.items) do local thing = getTileItemById(position, item[1]) if thing.uid > 0 and math.max(1, thing.type) >= item[2] then if n == #self.items then match = true end else break end end return match end function RecipeHandler:get(position) if self:check(position) == true then return setmetatable({type = self, position = position}, {__index = Forge}) end return false end function Forge:create(cid) if self.type.itemid == 0 then print("[FORGE SYSTEM - ERROR] ATTEMPT TO CREATE A RECIPE ITEMID 0") return end local status = true if(cid) then if getPlayerLevel(cid) < self.type.level then doPlayerSendTextMessage(cid, self.messages.class, self.messages.needlevel:format(self.type.level, getItemNameById(self.type.itemtype))) return end if getPlayerMagLevel(cid) < self.type.maglevel then doPlayerSendTextMessage(cid, self.messages.class, self.messages.needmaglevel:format(self.type.maglevel, getItemNameById(self.type.itemtype))) return end for skillid, value in pairs(self.type.skills) do if getPlayerSkillLevel(cid, skillid) < value then status = false doPlayerSendTextMessage(cid, self.messages.class, self.messages.needskill:format(SKILL_NAMES[skillid], getItemNameById(self.type.itemtype))) break end end end if status == true then for _, item in ipairs(self.type.items) do local thing = getTileItemById(self.position, item[1]) doRemoveItem(thing.uid, item[2]) end doSendMagicEffect(self.position, self.magicEffect) doPlayerSendTextMessage(cid, self.messages.class, self.messages.success:format(getItemNameById(self.type.itemtype))) doCreateItem(self.type.itemtype, self.position) end end dofile(getDataDir() .."/lib/recipes.lua") Crie um arquivo em data/lib chamado recipes.lua e adicione o conteúdo abaixo:
        ---------------------------------------- -----** TUTORIAL DE CONFIGURAÇÃO **----- ---------------------------------------- --[[ O 'ADVANCED FORGE SYSTEM' é muito fácil e intuitivo de configurar, você só precisa chamar a função RecipeHandler:new(...), sendo que você já configurar os atributos da receita nela ou usar outras funções para isso. Por exemplo, quero criar uma Magic Sword que precise de 100 Gold Nuggets. RecipeHandler:new(2400, {{2157, 100}}) Ou então Magic_Sword = RecipeHandler:new() Magic_Sword:setItem(2400) Magic_Sword:setRecipe({2157, 100}) Funções do Sistema: RecipeHandler:new(itemtype, items, level, maglevel, skills) --> Cria uma nova instância de forja. RecipeHandler:setItem(itemtype) --> Atribui um certo itemid como resultado da receita. RecipeHandler:setRecipe(recipe) --> Atribui uma receita. RecipeHandler:setRecipeItem(itemid, amount) --> Adiciona um itemid e sua quantidade a receita. RecipeHandler:setSkill(skillid, value) --> Atribui um valor necessário de uma certa skill para poder criar a receita. RecipeHandler:setLevel(value) --> Atribui o level necessário para criar uma receita. RecipeHandler:setMagLevel(value) --> Atribui o magic level necessário para criar uma receita. ]]-- --[[ Este é um exemplo de receita usando algumas funções. É uma Magic Sword (ITEMID: 2400) que precisa de 100 Gold Nuggets (ITEMID: 2157), além disso, o personagem que tentar forjar, precisa ter Level 100 e Sword Fighting 50. ]]-- Recipes = {} magicsword = RecipeHandler:new() magicsword:setItem(2400) magicsword:setRecipeItem(2157, 100) magicsword:setLevel(100) magicsword:setSkill(2, 50) Agora em data/actions/scripts, crie um arquivo chamado iron_hammer.lua e adicione o conteúdo abaixo:
        function onUse(cid, item, fromPosition, itemEx, toPosition) local recipe = nil for _, v in ipairs(Recipes) do recipe = v:get(toPosition) if(recipe ~= false) then break end end if(recipe) then recipe:create(cid) else doPlayerSendCancel(cid, "This is not a valid recipe.") end return true end E por fim em actions.xml, adicione a seguinte linha:
        <action itemid="4846" event="script" value="iron_hammer.lua"/> OPCIONAL - TALKACTION A talkaction abaixo mostra ao jogadoras receitas configuradas no servidor que ele pode fazer. Em data/talkactions/scripts, crie um arquivo chamado recipes.lua e adicione o conteúdo abaixo:
        function onSay(cid, words, param, channel) local ret = {} local msg = " ADVANCED FORGE SYSTEM\n" for _, recipe in ipairs(Recipes) do local skills = true for skillid, value in pairs(recipe.skills) do if getPlayerSkillLevel(cid, skillid) < value then skills = false break end end if skills == true then if getPlayerLevel(cid) >= recipe.level and getPlayerMagLevel(cid) >= recipe.maglevel then table.insert(ret, {recipe, true}) else table.insert(ret, {recipe, false}) end else table.insert(ret, {recipe, false}) end end for _, recipe in ipairs(ret) do msg = msg .."\nRecipe for ".. getItemNameById(recipe[1].itemtype) ..":\n\n" if recipe[2] == true then for _, item in ipairs(recipe[1].items) do msg = msg .."* ".. getItemNameById(item[1]) .." [".. math.min(item[2], math.max(0, getPlayerItemCount(cid, item[1]))) .."/".. item[2] .."]\n" end else msg = msg .."[LOCKED]\n" end end doShowTextDialog(cid, 2555, msg) return true end Em data/talkactions/talkactions.xml, adicione a linha:
        <talkaction words="/recipes" event="script" value="recipes.lua"/> Siga as instruções para configuração de novas receitas.
      Em breve vídeo de funcionamento
      Advanced Forge System.rar



×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo