• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Castle By Kawon (Bug)

Grabek980

New Member
Joined
Aug 9, 2010
Messages
70
Reaction score
0
Witam posiadam skrypt castle by kawon wszystko ładnie działa do momentu gdy pojawi się boss ;P
ponieważ jak boss sie pojawia i go zabijamy to nikt nie dostaje zamku...

za pomoc w tym skrypcie dam rep++

oto link do tematu z tym systemem http://otland.net/f82/talkactions-globalevents-lib-monsters-castle-war-system-maps-111115/

a oto mój lib czyli plik gdzie sie wszystko ustawia:

PHP:
local castleConfig = {
	days = {1,2,3,4,5},
	time_1 = 1*60*1000, -- time from start event to fight
	time_2 = 40*60*1000, -- time from fight to end event
	guildOwnStorage = 17000,
	attackersStorage = 17002,
	enabledStorage = 17006,
	endedStorage = 17007,
	leaderLevel = 2500,
	membersNeeded = 1,
	monster = "Roxon King",
	monsterSpawn = {x = 884, y = 624, z = 4},
	startAttackers = {
		[1] = {x = 857, y = 637, z = 7},
		[2] = {x = 905, y = 612, z = 7},
		[3] = {x = 906, y = 651, z = 7}
	},
	gates = {

                -- 1 Pozycja Guildi
		[1] = {pos = {x = 870, y = 635, z = 7}, itemid = 9533},
		[2] = {pos = {x = 870, y = 636, z = 7}, itemid = 9533},
		[3] = {pos = {x = 866, y = 628, z = 7}, itemid = 9533},
		[4] = {pos = {x = 866, y = 629, z = 7}, itemid = 9533},
		[5] = {pos = {x = 866, y = 630, z = 7}, itemid = 9533},
                -- 2 Pozycja Guildi		
		[6] = {pos = {x = 899, y = 516, z = 7}, itemid = 9486},
		[7] = {pos = {x = 900, y = 516, z = 7}, itemid = 9486},
		[8] = {pos = {x = 901, y = 516, z = 7}, itemid = 9486},
		[9] = {pos = {x = 902, y = 516, z = 7}, itemid = 9486},
		[10] = {pos = {x = 904, y = 519, z = 7}, itemid = 9486},
		[11] = {pos = {x = 905, y = 519, z = 7}, itemid = 9486},
		[12] = {pos = {x = 906, y = 519, z = 7}, itemid = 9486},
                -- 3 Pozycja Guildi
		[13] = {pos = {x = 899, y = 646, z = 7}, itemid = 9485},
		[14] = {pos = {x = 900, y = 646, z = 7}, itemid = 9485},
		[15] = {pos = {x = 901, y = 646, z = 7}, itemid = 9485},				
		[16] = {pos = {x = 912, y = 649, z = 7}, itemid = 9533},					
		[17] = {pos = {x = 912, y = 650, z = 7}, itemid = 9533},
		[18] = {pos = {x = 912, y = 651, z = 7}, itemid = 9533},
		[19] = {pos = {x = 912, y = 652, z = 7}, itemid = 9533},
	

		
	},
}
CASTLE_DAYS = {2,5}

function getCastleConfig(value)
	if (value ~= nil) then
		return castleConfig[value] or false 
	else
		return false
	end
end

function removeNotKilledKing(cid)
	if isMonster(cid) and getCreatureName(cid) == castleConfig.monster then
		doRemoveCreature(cid)
	end
	return true
end


-- it sux but don`t have idea how to make it better, attackers Index
function Castle_getGuildPos(guildId)
	local attackers = Castle_getAttackers()
	for i,value in ipairs(attackers) do
		if (tonumber(guildId) == tonumber(value)) then
			ret = i
		end
	end
	return ret
end

function Castle_enableSaving()
	doBroadcastMessage("[ Castle Event Enabled! ]\n\nIf you're a guild leader and you have at least ".. castleConfig.membersNeeded .." members you can sign in your guild by saying !castle in default channel.", MESSAGE_INFO_DESCR)
	setGlobalStorageValue(castleConfig.enabledStorage, 1)
	--setGlobalStorageValue(castleConfig.endedStorage, 0)
	Castle_cleanUp()
	addEvent(Castle_startEvent, castleConfig.time_1)
	return true
end

function Castle_getAttackers()
	local ret = {}
	local query = string.explode(getGlobalStorageValue(castleConfig.attackersStorage), ",")
	for _,value in ipairs(query) do
		if isNumber(value) then
			table.insert(ret, value)
		end
	end
	return ret
end

function Castle_startEvent()
	setGlobalStorageValue(castleConfig.enabledStorage, 0)
	setGlobalStorageValue(castleConfig.endedStorage, 0)
	if(#Castle_getAttackers() == 0) then
		doBroadcastMessage("[ Castle Event Failed! ]\n\nWe have not attackers!", MESSAGE_INFO_DESCR)
		return true
	end
	doBroadcastMessage("[ Castle Event Fight! ]\n\nEvent has been started. Kill Furox King !!!", MESSAGE_INFO_DESCR)
	local monster = doSummonCreature(castleConfig.monster, castleConfig.monsterSpawn)
	for _, gate in pairs(castleConfig.gates) do
		doRemoveItem(getTileItemById(gate.pos, gate.itemid).uid)
	end
	addEvent(Castle_endEvent, castleConfig.time_2, false)
	addEvent(removeNotKilledKing, castleConfig.time_2, monster)
	return true
end

function Castle_endEvent(killed, damages)
	local playersOnline = getPlayersOnline()
	local dmgCount = 0
	local message = ""
	local winner = 0
	
	if (getGlobalStorageValue(castleConfig.endedStorage) ~= 1) then
		if (killed) then
			for _,value in ipairs(Castle_getAttackers()) do
				message = message.."\n"..getGuildName(value)..":"..damages[Castle_getGuildPos(value)].." dmg"
				if damages[Castle_getGuildPos(value)] > dmgCount then
					winner = value
					dmgCount = damages[Castle_getGuildPos(value)]
				end
			end
			doBroadcastMessage("[ Castle Event End! ]\n\n> Statistics " .. message .."\nWINNER:"..getGuildName(winner), MESSAGE_INFO_DESCR)
			
			local attackers = Castle_getAttackers()
			table.insert(attackers, getGlobalStorageValue(castleConfig.guildOwnStorage))
			for _, pid in ipairs(playersOnline) do
				if ((isInArray(attackers, getPlayerGuildId(pid)) or getGlobalStorageValue(castleConfig.guildOwnStorage) == getPlayerGuildId(pid)) and not(tonumber(getPlayerGuildId(pid)) == tonumber(winner))) then
					doRemoveCondition(pid, CONDITION_INFIGHT)
					doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))
				end
			end
			setGlobalStorageValue(castleConfig.guildOwnStorage, winner)
		else
			doBroadcastMessage("[ Castle Event End! ]\n\n> Castle has been saved by owner.", MESSAGE_INFO_DESCR)
		end
		setGlobalStorageValue(castleConfig.endedStorage, 1)
	end
	Castle_cleanUp()
	return true
end

function Castle_cleanUp()
	setGlobalStorageValue(castleConfig.attackersStorage, ",")
	return true
end

function Castle_getGuildMembers(guildId)
	local playersOnline = getPlayersOnline()
	local members = {}
	for _, pid in ipairs(playersOnline) do
		if (getPlayerGuildId(pid) == guildId) then
			table.insert(members, pid)
		end
	end
	return members
end


function Castle_trySave(cid)
	if not(getPlayerGuildLevel(cid) == GUILDLEVEL_LEADER) then
		doPlayerSendCancel(cid, "Sorry, but you have to be a leader of guild.")
		return true
	end

	if (getGlobalStorageValue(castleConfig.enabledStorage) ~= 1) then
		doPlayerSendCancel(cid, "Sorry, but it's not time yet.")
		return true
	end

	if (getPlayerLevel(cid) < castleConfig.leaderLevel) then
		doPlayerSendCancel(cid, "Sorry, but your level is too low.")
		return true
	end

	local players = Castle_getGuildMembers(getPlayerGuildId(cid))
	if (#players == 1) then
		doPlayerSendCancel(cid, "Sorry, but you haven't any online members in guild.")
		return true
	end

	if (#players < castleConfig.membersNeeded) then
		doPlayerSendCancel(cid, "Sorry, but you need at least ".. castleConfig.membersNeeded .." guild members online.")
		return true
	end
	if (tonumber(getGlobalStorageValue(castleConfig.guildOwnStorage)) == tonumber(getPlayerGuildId(cid))) then
		doPlayerSendCancel(cid, "Your guild should protect Castle, not attack.")
		return true
	end

	if (#Castle_getAttackers() == 3) then
		doPlayerSendCancel(cid, "Sorry, we have already 3 attacking guilds.")
		return true
	end
	if (isInArray(Castle_getAttackers(), getPlayerGuildId(cid))) then
		doPlayerSendCancel(cid, "Be patient, war will start in a few minutes.")
		return true
	end

	setGlobalStorageValue(castleConfig.attackersStorage, getGlobalStorageValue(castleConfig.attackersStorage)..getPlayerGuildId(cid)..",")
	doBroadcastMessage("[ Castle Event Info ]\n\nGuild ".. getPlayerGuildName(cid) .." will fight for Castle.\nAttackers: ".. #Castle_getAttackers() .." / 3", MESSAGE_INFO_DESCR)

	for i, pid in ipairs(getPlayersOnline()) do
		if (isInArray(getPlayerGuildId(cid), getPlayerGuildId(pid))) then
			doTeleportThing(pid, castleConfig.startAttackers[#Castle_getAttackers()])
		end
	end
	return true
end
 
By Kawon ? Przeciez to moj skrypt jest..
On go tylko publikował, nigdzie nie napisał w temacie że jest jego - więc nie możemy powiedzieć, że przywłaszczyć sobie twoją prace.

Co do tematu, wszystkie creatureevents dodałeś/zarejstrowałeś?
 
Jakbyś nie zauważył to na tnp ja tego tematu nie założyłem :) ja tego skryptu nie pisałem
 
czy ja pisałem że ty założyłeś??? czytaj uważnie napisałem że jest taki temat a nie kto go pisał i pomoże ktoś ?
 
czy ja pisałem że ty założyłeś??? czytaj uważnie napisałem że jest taki temat a nie kto go pisał i pomoże ktoś ?

napisałeś coś takiego "no ale on miał taki temat na tibia net" :) ja takiego tematu nie mam i tylko grzecznie informuję że to nie ja napisałem ten skrypt :)
 
mniejsza o to -.- zamiast sie kłucić kto go napisał itp to może byś pomógł ?
 
Ale to nie jest w moim interesie, żeby szukać... Jak chce, żebym mu pomógł to niech sprawdzi, proste.
Co ma sprawdzić jakie ma bugi, jak napisał, że podał w tym temacie. Bo już nie wiem o co ci chodzi.

Jeśli chodzi o temat, napisz jeszcze jakiego TFS używasz.
 
Up2 O co ci chodzi toć podałem linki itp.

Alissow 0.4.1 << może to przez niego
 
Co ma sprawdzić jakie ma bugi, jak napisał, że podał w tym temacie. Bo już nie wiem o co ci chodzi.

Jeśli chodzi o temat, napisz jeszcze jakiego TFS używasz.

Na prawdę jesteś tak pusty? chodzi mi o to, żeby sprawdził czy konsola nic nie wypluwa w momencie zabicia bossa, tak ciężko to zrozumieć?...
 
Na prawdę jesteś tak pusty? chodzi mi o to, żeby sprawdził czy konsola nic nie wypluwa w momencie zabicia bossa, tak ciężko to zrozumieć?...
Idiota. Totalny idiota.


Przecież napisał, że wypluwa to:
Code:
[24/06/2012 08:14:00] [Error - GlobalEvent Interface] 
[24/06/2012 08:14:00] In a timer event called from: 
[24/06/2012 08:14:00] data/globalevents/scripts/castle.lua:onTimer
[24/06/2012 08:14:00] Description: 
[24/06/2012 08:14:00] (luaDoRemoveItem) Item not found

[24/06/2012 08:14:00] [Error - GlobalEvent Interface] 
[24/06/2012 08:14:00] In a timer event called from: 
[24/06/2012 08:14:00] data/globalevents/scripts/castle.lua:onTimer
[24/06/2012 08:14:00] Description: 
[24/06/2012 08:14:00] (luaDoRemoveItem) Item not found

[24/06/2012 08:14:00] [Error - GlobalEvent Interface] 
[24/06/2012 08:14:00] In a timer event called from: 
[24/06/2012 08:14:00] data/globalevents/scripts/castle.lua:onTimer
[24/06/2012 08:14:00] Description: 
[24/06/2012 08:14:00] (luaDoRemoveItem) Item not found

[24/06/2012 08:14:00] [Error - GlobalEvent Interface] 
[24/06/2012 08:14:00] In a timer event called from: 
[24/06/2012 08:14:00] data/globalevents/scripts/castle.lua:onTimer
[24/06/2012 08:14:00] Description: 
[24/06/2012 08:14:00] (luaDoRemoveItem) Item not found

[24/06/2012 08:14:00] [Error - GlobalEvent Interface] 
[24/06/2012 08:14:00] In a timer event called from: 
[24/06/2012 08:14:00] data/globalevents/scripts/castle.lua:onTimer
[24/06/2012 08:14:00] Description: 
[24/06/2012 08:14:00] (luaDoRemoveItem) Item not found

[24/06/2012 08:14:00] [Error - GlobalEvent Interface] 
[24/06/2012 08:14:00] In a timer event called from: 
[24/06/2012 08:14:00] data/globalevents/scripts/castle.lua:onTimer
[24/06/2012 08:14:00] Description: 
[24/06/2012 08:14:00] (luaDoRemoveItem) Item not found

[24/06/2012 08:14:00] [Error - GlobalEvent Interface] 
[24/06/2012 08:14:00] In a timer event called from: 
[24/06/2012 08:14:00] data/globalevents/scripts/castle.lua:onTimer
[24/06/2012 08:14:00] Description: 
[24/06/2012 08:14:00] (luaDoRemoveItem) Item not found
[24/06/2012 08:15:45] Tysikije has logged out.

[24/06/2012 08:18:39] [Error - CreatureScript Interface] 
[24/06/2012 08:18:39] data/creaturescripts/scripts/castle_kill.lua:onDeath
[24/06/2012 08:18:39] Description: 
[24/06/2012 08:18:39] data/lib/102-castle.lua:122: attempt to call global 'getGuildName' (a nil value)
[24/06/2012 08:18:39] stack traceback:
[24/06/2012 08:18:39]     data/lib/102-castle.lua:122: in function 'Castle_endEvent'
[24/06/2012 08:18:39]     data/creaturescripts/scripts/castle_kill.lua:3: in function <data/creaturescripts/scripts/castle_kill.lua:1>
 
Idiota. Totalny idiota.


Przecież napisał, że wypluwa to:
Code:
[24/06/2012 08:14:00] [Error - GlobalEvent Interface] 
[24/06/2012 08:14:00] In a timer event called from: 
[24/06/2012 08:14:00] data/globalevents/scripts/castle.lua:onTimer
[24/06/2012 08:14:00] Description: 
[24/06/2012 08:14:00] (luaDoRemoveItem) Item not found

[24/06/2012 08:14:00] [Error - GlobalEvent Interface] 
[24/06/2012 08:14:00] In a timer event called from: 
[24/06/2012 08:14:00] data/globalevents/scripts/castle.lua:onTimer
[24/06/2012 08:14:00] Description: 
[24/06/2012 08:14:00] (luaDoRemoveItem) Item not found

[24/06/2012 08:14:00] [Error - GlobalEvent Interface] 
[24/06/2012 08:14:00] In a timer event called from: 
[24/06/2012 08:14:00] data/globalevents/scripts/castle.lua:onTimer
[24/06/2012 08:14:00] Description: 
[24/06/2012 08:14:00] (luaDoRemoveItem) Item not found

[24/06/2012 08:14:00] [Error - GlobalEvent Interface] 
[24/06/2012 08:14:00] In a timer event called from: 
[24/06/2012 08:14:00] data/globalevents/scripts/castle.lua:onTimer
[24/06/2012 08:14:00] Description: 
[24/06/2012 08:14:00] (luaDoRemoveItem) Item not found

[24/06/2012 08:14:00] [Error - GlobalEvent Interface] 
[24/06/2012 08:14:00] In a timer event called from: 
[24/06/2012 08:14:00] data/globalevents/scripts/castle.lua:onTimer
[24/06/2012 08:14:00] Description: 
[24/06/2012 08:14:00] (luaDoRemoveItem) Item not found

[24/06/2012 08:14:00] [Error - GlobalEvent Interface] 
[24/06/2012 08:14:00] In a timer event called from: 
[24/06/2012 08:14:00] data/globalevents/scripts/castle.lua:onTimer
[24/06/2012 08:14:00] Description: 
[24/06/2012 08:14:00] (luaDoRemoveItem) Item not found

[24/06/2012 08:14:00] [Error - GlobalEvent Interface] 
[24/06/2012 08:14:00] In a timer event called from: 
[24/06/2012 08:14:00] data/globalevents/scripts/castle.lua:onTimer
[24/06/2012 08:14:00] Description: 
[24/06/2012 08:14:00] (luaDoRemoveItem) Item not found
[24/06/2012 08:15:45] Tysikije has logged out.

[24/06/2012 08:18:39] [Error - CreatureScript Interface] 
[24/06/2012 08:18:39] data/creaturescripts/scripts/castle_kill.lua:onDeath
[24/06/2012 08:18:39] Description: 
[24/06/2012 08:18:39] data/lib/102-castle.lua:122: attempt to call global 'getGuildName' (a nil value)
[24/06/2012 08:18:39] stack traceback:
[24/06/2012 08:18:39]     data/lib/102-castle.lua:122: in function 'Castle_endEvent'
[24/06/2012 08:18:39]     data/creaturescripts/scripts/castle_kill.lua:3: in function <data/creaturescripts/scripts/castle_kill.lua:1>

Totalnym idiotom jesteś ty, napisałem że nie będę biegał, robił kont na innych forach żeby mu pomoc. Jak chce pomocy to niech da błąd tutaj pajacu.
 
Totalnym idiotom jesteś ty, napisałem że nie będę biegał, robił kont na innych forach żeby mu pomoc. Jak chce pomocy to niech da błąd tutaj pajacu.
Dobra, szczekaj sobie dalej. Błąd (log) był widoczny na forum bez potrzeby założenia konta. Jak dla ciebie latanie to kliknięcie w odsyłacz, to nie dziwię się że z domu nie wychodzisz. Twój świat to dom -> szkoła, szkoła -> dom, i jak widzę zostanie ci tak długo.
 
Dobra, szczekaj sobie dalej. Błąd (log) był widoczny na forum bez potrzeby założenia konta. Jak dla ciebie latanie to kliknięcie w odsyłacz, to nie dziwię się że z domu nie wychodzisz. Twój świat to dom -> szkoła, szkoła -> dom, i jak widzę zostanie ci tak długo.

Nie uczę się już bejbe, dom -> szkoła, szkoła -> dom, po czym wniosek i skąd takie założenie?
 
Back
Top