What's new

Skrypty & Kody Ma?y problem z hunting arena.

Status
Not open for further replies.

givera12

Active User
Joined
Jul 3, 2010
Messages
121
Reaction score
4
Witam!

Mam problem z hunting aren?, a mianowicie, gdy stan? na kratk? po kt?rej powinny zrespi? si? potwory, na czacie pisze "Monsters has been spawned.", ale si? nie respi?.

jest to kod 0.4 a ja posiadam TFS 0.3.6. Da rad? kto? przerobi?? Nie wiem jaka to funkcja, dlatego prosz? o pomoc :)

Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Hunting_rooms" version='2.0' author='VirrageS' contact='otland.net' enabled='yes'>
	<config name="huntingConfig">
		<![CDATA[
			huntingConfig = {
				[1] = {
					fromPos = {x=2062, y=857, z=7}, -- left top corner of event room
					toPos = {x=2072, y=867, z=7},
					teleportPos = {x=2067, y=862, z=7},

					expireTime = 900, -- w sekundach
					enteryAid = 7001,
					monsters = {'Grim Reaper', 4}
				},

				[2] = {
					fromPos = {x=2080, y=857, z=7},
					toPos = {x=2090, y=867, z=7},
					teleportPos = {x=2085, y=862, z=7},

					expireTime = 900, -- w sekundach
					enteryAid = 7002,
					monsters = {'Grim Reaper', 4}
				},
				[3] = {
					fromPos = {x=2098, y=857, z=7},
					toPos = {x=2108, y=867, z=7},
					teleportPos = {x=2103, y=862, z=7},

					expireTime = 900, -- w sekundach
					enteryAid = 7003,
					monsters = {'Grim Reaper', 4}
				},
				[4] = {
					fromPos = {x=2116, y=857, z=7},
					toPos = {x=2126, y=867, z=7},
					teleportPos = {x=2121, y=862, z=7},

					expireTime = 900, -- w sekundach
					enteryAid = 7004,
					monsters = {'Grim Reaper', 4}
				},
				[5] = {
					fromPos = {x=2062, y=875, z=7},
					toPos = {x=2072, y=885, z=7},
					teleportPos = {x=2067, y=880, z=7},

					expireTime = 900, -- w sekundach
					enteryAid = 7005,
					monsters = {'Grim Reaper', 4}
				},
				[6] = {
					fromPos = {x=2080, y=875, z=7},
					toPos = {x=2090, y=885, z=7},
					teleportPos = {x=2085, y=880, z=7},

					expireTime = 900, -- w sekundach
					enteryAid = 7006,
					monsters = {'Grim Reaper', 4}
				},
				[7] = {
					fromPos = {x=2098, y=875, z=7},
					toPos = {x=2108, y=885, z=7},
					teleportPos = {x=2103, y=880, z=7},

					expireTime = 900, -- w sekundach
					enteryAid = 7007,
					monsters = {'Grim Reaper', 4}
				},
				[8] = {
					fromPos = {x=2116, y=875, z=7},
					toPos = {x=2126, y=875, z=7},
					teleportPos = {x=2121, y=880, z=7},

					expireTime = 900, -- w sekundach
					enteryAid = 7008,
					monsters = {'Grim Reaper', 4}
				},
				[9] = {
					fromPos = {x=2062, y=893, z=7},
					toPos = {x=2072, y=903, z=7},
					teleportPos = {x=2067, y=898, z=7},

					expireTime = 900, -- w sekundach
					enteryAid = 7009,
					monsters = {'Undead Dragon', 3}
				},
				[10] = {
					fromPos = {x=2080, y=893, z=7},
					toPos = {x=2090, y=903, z=7},
					teleportPos = {x=2085, y=898, z=7},

					expireTime = 900, -- w sekundach
					enteryAid = 7010,
					monsters = {'Undead Dragon', 3}
				},
				[11] = {
					fromPos = {x=2098, y=893, z=7},
					toPos = {x=2108, y=903, z=7},
					teleportPos = {x=2103, y=898, z=7},

					expireTime = 900, -- w sekundach
					enteryAid = 7011,
					monsters = {'Nightmare', 4}
				},
				[12] = {
					fromPos = {x=2116, y=893, z=7},
					toPos = {x=2126, y=903, z=7},
					teleportPos = {x=2121, y=898, z=7},

					expireTime = 900, -- w sekundach
					enteryAid = 7012,
					monsters = {'Nightmare', 4}
				},
				[13] = {
					fromPos = {x=2062, y=911, z=7},
					toPos = {x=2072, y=921, z=7},
					teleportPos = {x=2067, y=916, z=7},

					expireTime = 900, -- w sekundach
					enteryAid = 7013,
					monsters = {'Ghastly Dragon', 2}
				},
				[14] = {
					fromPos = {x=2080, y=911, z=7},
					toPos = {x=2090, y=921, z=7},
					teleportPos = {x=2085, y=916, z=7},

					expireTime = 900, -- w sekundach
					enteryAid = 7014,
					monsters = {'Nightmare', 4}
				},
				[15] = {
					fromPos = {x=2098, y=911, z=7},
					toPos = {x=2108, y=921, z=7},
					teleportPos = {x=2103, y=916, z=7},

					expireTime = 900, -- w sekundach
					enteryAid = 7015,
					monsters = {'Nightmare', 4}
				},
				[16] = {
					fromPos = {x=2116, y=911, z=7},
					toPos = {x=2126, y=921, z=7},
					teleportPos = {x=2121, y=916, z=7},

					expireTime = 900, -- w sekundach
					enteryAid = 7016,
					monsters = {'Ghastly Dragon', 2}
				},
				[17] = {
					fromPos = {x=1947, y=856, z=7},
					toPos = {x=1957, y=866, z=7},
					teleportPos = {x=1952, y=861, z=7},

					expireTime = 900, -- w sekundach
					enteryAid = 7017,
					monsters = {'Diabolic Imp', 5}
				},
				[18] = {
					fromPos = {x=1964, y=856, z=7},
					toPos = {x=1974, y=866, z=7},
					teleportPos = {x=1969, y=861, z=7},

					expireTime = 900, -- w sekundach
					enteryAid = 7018,
					monsters = {'Diabolic Imp', 5}
				},
				[19] = {
					fromPos = {x=1981, y=856, z=7},
					toPos = {x=1991, y=866, z=7},
					teleportPos = {x=1986, y=861, z=7},

					expireTime = 900, -- w sekundach
					enteryAid = 7019,
					monsters = {'Diabolic Imp', 5}
				},
				[20] = {
					fromPos = {x=1998, y=856, z=7},
					toPos = {x=2008, y=866, z=7},
					teleportPos = {x=2003, y=861, z=7},

					expireTime = 900, -- w sekundach
					enteryAid = 7020,
					monsters = {'Diabolic Imp', 5}
				},
				[21] = {
					fromPos = {x=1947, y=873, z=7},
					toPos = {x=1957, y=883, z=7},
					teleportPos = {x=1952, y=878, z=7},

					expireTime = 900, -- w sekundach
					enteryAid = 7021,
					monsters = {'Diabolic Imp', 5}
				},
				[22] = {
					fromPos = {x=1964, y=873, z=7},
					toPos = {x=1974, y=883, z=7},
					teleportPos = {x=1969, y=878, z=7},

					expireTime = 900, -- w sekundach
					enteryAid = 7022,
					monsters = {'Diabolic Imp', 5}
				},
				[23] = {
					fromPos = {x=1981, y=873, z=7},
					toPos = {x=1991, y=883, z=7},
					teleportPos = {x=1986, y=878, z=7},

					expireTime = 900, -- w sekundach
					enteryAid = 7023,
					monsters = {'Dragon Lord', 5}
				},
				[24] = {
					fromPos = {x=1998, y=873, z=7},
					toPos = {x=2008, y=883, z=7},
					teleportPos = {x=2003, y=878, z=7},

					expireTime = 900, -- w sekundach
					enteryAid = 7024,
					monsters = {'Dragon Lord', 5}
				},
				[25] = {
					fromPos = {x=1947, y=890, z=7},
					toPos = {x=1957, y=900, z=7},
					teleportPos = {x=1952, y=895, z=7},

					expireTime = 900, -- w sekundach
					enteryAid = 7025,
					monsters = {'Dragon Lord', 5}
				},
				[26] = {
					fromPos = {x=1964, y=890, z=7},
					toPos = {x=1974, y=900, z=7},
					teleportPos = {x=1969, y=895, z=7},

					expireTime = 900, -- w sekundach
					enteryAid = 7026,
					monsters = {'Dragon Lord', 5}
				},
				[27] = {
					fromPos = {x=1981, y=890, z=7},
					toPos = {x=1991, y=900, z=7},
					teleportPos = {x=1986, y=895, z=7},

					expireTime = 900, -- w sekundach
					enteryAid = 7027,
					monsters = {'Hellfire Fighter', 3}
				},
				[28] = {
					fromPos = {x=1998, y=890, z=7},
					toPos = {x=2008, y=900, z=7},
					teleportPos = {x=2003, y=895, z=7},

					expireTime = 900, -- w sekundach
					enteryAid = 7028,
					monsters = {'Hellfire Fighter', 3}
				},
				[29] = {
					fromPos = {x=1947, y=907, z=7},
					toPos = {x=1957, y=917, z=7},
					teleportPos = {x=1952, y=912, z=7},

					expireTime = 900, -- w sekundach
					enteryAid = 7029,
					monsters = {'Fury', 3}
				},
				[30] = {
					fromPos = {x=1964, y=907, z=7},
					toPos = {x=1974, y=917, z=7},
					teleportPos = {x=1969, y=912, z=7},

					expireTime = 900, -- w sekundach
					enteryAid = 7030,
					monsters = {'Fury', 3}
				},
				[31] = {
					fromPos = {x=1981, y=907, z=7},
					toPos = {x=1991, y=917, z=7},
					teleportPos = {x=1986, y=912, z=7},

					expireTime = 900, -- w sekundach
					enteryAid = 7031,
					monsters = {'Demon', 3}
				},
				[32] = {
					fromPos = {x=1998, y=907, z=7},
					toPos = {x=2008, y=917, z=7},
					teleportPos = {x=2003, y=912, z=7},

					expireTime = 900, -- w sekundach
					enteryAid = 7032,
					monsters = {'Demon', 3}
				},
				[33] = {
					fromPos = {x=2177, y=858, z=7},
					toPos = {x=2187, y=868, z=7},
					teleportPos = {x=2182, y=863, z=7},

					expireTime = 900, -- w sekundach
					enteryAid = 7033,
					monsters = {'Defiler', 3}
				},
				[34] = {
					fromPos = {x=2196, y=858, z=7},
					toPos = {x=2206, y=868, z=7},
					teleportPos = {x=2201, y=863, z=7},

					expireTime = 900, -- w sekundach
					enteryAid = 7034,
					monsters = {'Defiler', 3}
				},
				[35] = {
					fromPos = {x=2216, y=858, z=7},
					toPos = {x=2226, y=868, z=7},
					teleportPos = {x=2221, y=863, z=7},

					expireTime = 900, -- w sekundach
					enteryAid = 7035,
					monsters = {'Defiler', 3}
				},
				[36] = {
					fromPos = {x=2235, y=858, z=7},
					toPos = {x=2245, y=868, z=7},
					teleportPos = {x=2240, y=863, z=7},

					expireTime = 900, -- w sekundach
					enteryAid = 7036,
					monsters = {'Defiler', 3}
				},
				[37] = {
					fromPos = {x=2177, y=877, z=7},
					toPos = {x=2187, y=887, z=7},
					teleportPos = {x=2182, y=882, z=7},

					expireTime = 900, -- w sekundach
					enteryAid = 7037,
					monsters = {'Hellhound', 3}
				},
				[38] = {
					fromPos = {x=2196, y=877, z=7},
					toPos = {x=2206, y=887, z=7},
					teleportPos = {x=2201, y=882, z=7},

					expireTime = 900, -- w sekundach
					enteryAid = 7038,
					monsters = {'Hellhound', 3}
				},
				[39] = {
					fromPos = {x=2216, y=877, z=7},
					toPos = {x=2226, y=887, z=7},
					teleportPos = {x=2221, y=882, z=7},

					expireTime = 900, -- w sekundach
					enteryAid = 7039,
					monsters = {'Hellhound', 3}
				},
				[40] = {
					fromPos = {x=2235, y=877, z=7},
					toPos = {x=2245, y=887, z=7},
					teleportPos = {x=2240, y=882, z=7},

					expireTime = 900, -- w sekundach
					enteryAid = 7040,
					monsters = {'Hellhound', 3}
				},
				[41] = {
					fromPos = {x=2177, y=896, z=7},
					toPos = {x=2187, y=906, z=7},
					teleportPos = {x=2182, y=901, z=7},

					expireTime = 900, -- w sekundach
					enteryAid = 7041,
					monsters = {'Medusa', 3}
				},
				[42] = {
					fromPos = {x=2196, y=896, z=7},
					toPos = {x=2206, y=906, z=7},
					teleportPos = {x=2201, y=901, z=7},

					expireTime = 900, -- w sekundach
					enteryAid = 7042,
					monsters = {'Medusa', 3}
				},
				[43] = {
					fromPos = {x=2216, y=896, z=7},
					toPos = {x=2226, y=906, z=7},
					teleportPos = {x=2221, y=901, z=7},

					expireTime = 900, -- w sekundach
					enteryAid = 7043,
					monsters = {'Medusa', 3}
				},
				[44] = {
					fromPos = {x=2235, y=896, z=7},
					toPos = {x=2245, y=906, z=7},
					teleportPos = {x=2240, y=901, z=7},

					expireTime = 900, -- w sekundach
					enteryAid = 7044,
					monsters = {'Medusa', 3}
				},
				[45] = {
					fromPos = {x=2177, y=915, z=7},
					toPos = {x=2187, y=925, z=7},
					teleportPos = {x=2182, y=920, z=7},

					expireTime = 900, -- w sekundach
					enteryAid = 7045,
					monsters = {'Hydra', 4}
				},
				[46] = {
					fromPos = {x=2196, y=915, z=7},
					toPos = {x=2206, y=925, z=7},
					teleportPos = {x=2201, y=920, z=7},

					expireTime = 900, -- w sekundach
					enteryAid = 7046,
					monsters = {'Hydra', 4}
				},
				[47] = {
					fromPos = {x=2216, y=915, z=7},
					toPos = {x=2226, y=925, z=7},
					teleportPos = {x=2221, y=920, z=7},

					expireTime = 900, -- w sekundach
					enteryAid = 7047,
					monsters = {'Bog Raider', 5}
				},
				[48] = {
					fromPos = {x=2235, y=915, z=7},
					toPos = {x=2245, y=925, z=7},
					teleportPos = {x=2240, y=920, z=7},

					expireTime = 900, -- w sekundach
					enteryAid = 7048,
					monsters = {'Bog Raider', 5}
				},
				[49] = {
					fromPos = {x=1832, y=1313, z=7},
					toPos = {x=1842, y=1323, z=7},
					teleportPos = {x=1837, y=1318, z=7},

					expireTime = 900, -- w sekundach
					enteryAid = 7049,
					monsters = {'Frost Dragon', 4}
				},
				[50] = {
					fromPos = {x=1845, y=1301, z=7},
					toPos = {x=1855, y=1311, z=7},
					teleportPos = {x=1850, y=1306, z=7},

					expireTime = 900, -- w sekundach
					enteryAid = 7050,
					monsters = {'Frost Dragon', 4}
				},
				[51] = {
					fromPos = {x=1858, y=1314, z=7},
					toPos = {x=1868, y=1324, z=7},
					teleportPos = {x=1863, y=1319, z=7},

					expireTime = 900, -- w sekundach
					enteryAid = 7051,
					monsters = {'Frost Dragon', 4}
				},

				[52] = {
					fromPos = {x=1845, y=1326, z=7}, -- left top corner of event room
					toPos = {x=1855, y=1336, z=7},
					teleportPos = {x=1850, y=1331, z=7},

					expireTime = 900, -- w sekundach
					enteryAid = 7052,
					monsters = {'Yeti', 3}
				},
				[53] = {
					fromPos = {x=1701, y=1372, z=7}, -- left top corner of event room
					toPos = {x=1711, y=1382, z=7},
					teleportPos = {x=1706, y=1377, z=7},

					expireTime = 7200, -- w sekundach
					enteryAid = 7053,
					monsters = {'Grim Reaper', 4}
				},
				[54] = {
					fromPos = {x=2077, y=199, z=7}, -- left top corner of event room
					toPos = {x=2087, y=129, z=7},
					teleportPos = {x=2082, y=124, z=7},

					expireTime = 1300, -- w sekundach
					enteryAid = 7066,
					monsters = {'Ice Golem', 3}
				},
				[55] = {
					fromPos = {x=2096, y=119, z=7}, -- left top corner of event room
					toPos = {x=2106, y=129, z=7},
					teleportPos = {x=2101, y=124, z=7},

					expireTime = 1300, -- w sekundach
					enteryAid = 7055,
					monsters = {'Enlightened Of The Cult', 3}
				},
				[56] = {
					fromPos = {x=2115, y=119, z=7}, -- left top corner of event room
					toPos = {x=2125, y=129, z=7},
					teleportPos = {x=2120, y=124, z=7},

					expireTime = 1300, -- w sekundach
					enteryAid = 7056,
					monsters = {'Yeti', 3}
				},
				[57] = {
					fromPos = {x=2077, y=132, z=7}, -- left top corner of event room
					toPos = {x=2087, y=142, z=7},
					teleportPos = {x=2082, y=137, z=7},

					expireTime = 1300, -- w sekundach
					enteryAid = 7057,
					monsters = {'Defiler', 3}
				},
				[58] = {
					fromPos = {x=2096, y=132, z=7}, -- left top corner of event room
					toPos = {x=2103, y=142, z=7},
					teleportPos = {x=2101, y=137, z=7},

					expireTime = 1300, -- w sekundach
					enteryAid = 7058,
					monsters = {'Hellhound', 3}
				},
				[59] = {
					fromPos = {x=2115, y=132, z=7}, -- left top corner of event room
					toPos = {x=2125, y=142, z=7},
					teleportPos = {x=2120, y=137, z=7},

					expireTime = 1300, -- w sekundach
					enteryAid = 7059,
					monsters = {'Bog Raider', 5}
				},
				[60] = {
					fromPos = {x=2077, y=145, z=7}, -- left top corner of event room
					toPos = {x=2087, y=155, z=7},
					teleportPos = {x=2082, y=150, z=7},

					expireTime = 1300, -- w sekundach
					enteryAid = 7060,
					monsters = {'Diabolic Imp', 5}
				},
				[61] = {
					fromPos = {x=2096, y=145, z=7}, -- left top corner of event room
					toPos = {x=2106, y=155, z=7},
					teleportPos = {x=2101, y=150, z=7},

					expireTime = 1300, -- w sekundach
					enteryAid = 7061,
					monsters = {'Diabolic Imp', 5}
				},
				[62] = {
					fromPos = {x=2115, y=145, z=7}, -- left top corner of event room
					toPos = {x=2125, y=155, z=7},
					teleportPos = {x=2120, y=150, z=7},

					expireTime = 1300, -- w sekundach
					enteryAid = 7062,
					monsters = {'Dragon Lord', 5}
				},
				[63] = {
					fromPos = {x=2077, y=158, z=7}, -- left top corner of event room
					toPos = {x=2087, y=168, z=7},
					teleportPos = {x=2082, y=163, z=7},

					expireTime = 1300, -- w sekundach
					enteryAid = 7063,
					monsters = {'Grim Reaper', 4}
				},
				[64] = {
					fromPos = {x=2069, y=158, z=7}, -- left top corner of event room
					toPos = {x=2106, y=168, z=7},
					teleportPos = {x=2101, y=163, z=7},

					expireTime = 1300, -- w sekundach
					enteryAid = 7064,
					monsters = {'Ghastly Dragon', 2}
				},
				[65] = {
					fromPos = {x=2115, y=158, z=7}, -- left top corner of event room
					toPos = {x=2125, y=168, z=7},
					teleportPos = {x=2120, y=163, z=7},

					expireTime = 1300, -- w sekundach
					enteryAid = 7065,
					monsters = {'Grim Reaper', 4}
				}
			}

			configHunting = {
				storage = 25050, -- jakies wolne storage
				
				timeStorage = 45648, -- jakies wolne storage
				
				storageExh = 25051, -- jakies wolne storage
				exhaust = 1, -- seckundy

				exhaustStorage = 4546,
				exhaustTime = 10, -- sekundy

				itemId = 2157
			}
		]]>
	</config>

	<talkaction words="!timeleft" event="script">
		<![CDATA[
			domodlib("huntingConfig")

			function onSay(cid, words, param)
				if getCreatureStorage(cid, configHunting.storage) <= 0 then
					return doPlayerSendCancel(cid, 'You can\'t do it if you aren\'t in hunting room.')
				end
				
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You have '..getCreatureStorage(cid, configHunting.timeStorage)-os.time()..' seconds until you are teleporting out.')
				return true
			end
		]]>
	</talkaction>

	<!-- wyjscie -->
	<movement type="StepIn" actionid="2900" event="script">
		<![CDATA[
			domodlib("huntingConfig")

			function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
				if isPlayer(cid) then
					for k, v in pairs(huntingConfig) do
						if isInRange(getThingPos(cid), v.fromPos, v.toPos) then
							for x = v.fromPos.x, v.toPos.x do
								for y = v.fromPos.y, v.toPos.y do
									doCleanTile({x=x, y=y, z=v.toPos.z})
									local t = getTopCreature({x=x, y=y, z=v.toPos.z}).uid
									if t ~= 0 then
										if isMonster(t) then
											doRemoveCreature(t)
										end
									end
								end
							end
							stopEvent(getCreatureStorage(cid, configHunting.storage))
							doCreatureSetStorage(cid, configHunting.storage, -1)
							doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), true)
							doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Your leaved from the room.')
							break
						end
					end
				end
				return true
			end
		]]>
	</movement>


	<!-- to jest do tworzenia potworow -->
	<movement type="StepIn" actionid="2860" event="script">
		<![CDATA[
			domodlib("huntingConfig")

			function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
				local monsters, player = false, false
				if isPlayer(cid) then
					for k, v in pairs(huntingConfig) do
						if isInRange(getThingPos(cid), v.fromPos, v.toPos) then
							for x = v.fromPos.x, v.toPos.x do
								for y = v.fromPos.y, v.toPos.y do
									doCleanTile({x=x, y=y, z=v.toPos.z})
									local t = getTopCreature({x=x, y=y, z=v.toPos.z}).uid
									if t ~= 0 then
										if isMonster(t) then
											monsters = true
										end
									end
								end
							end
							
							if monsters then
								doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You haven\'t killed all monsters.')
								doTeleportThing(cid, fromPosition)
							else
								if exhaustion.check(cid, configHunting.storageExh) then
									doPlayerSendCancel(cid, 'You have to wait: '..exhaustion.get(cid, configHunting.storageExh)..' sec to respawn monsters again.')
									doTeleportThing(cid, fromPosition)
								else
									exhaustion.set(cid, configHunting.storageExh, configHunting.exhaust)
									doTeleportThing(cid, fromPosition, true)
									doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Monsters has been spawned.')
									for i = 1, v.monsters[2] do
										doCreateMonster(v.monsters[1], v.teleportPos, false, false, false)
									end
								end
							end
							break
						end
					end
				end
				return true
			end
		]]>
	</movement>

	<!-- to jest do wchodzenia do roomow -->
	<movement type="StepIn" actionid="7001-7065" event="script">
		<![CDATA[
			domodlib("huntingConfig")

			function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
				if isPlayer(cid) then
					if getPlayerItemCount(cid, configHunting.itemId) < 1 then
						return doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You don\'t have required item. [' ..  getItemInfo(configHunting.itemId).name .. ']'), doTeleportThing(cid, fromPosition)
					end

					if exhaustion.check(cid, configHunting.exhaustStorage) ~= false then
						return doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You must to wait a ' .. exhaustion.get(cid, configHunting.exhaustStorage) .. ' sec.'), doTeleportThing(cid, fromPosition)
					end

					local monsters, player = {}, false
					for k, v in pairs(huntingConfig) do
						if v.enteryAid == item.actionid then
							for x = v.fromPos.x, v.toPos.x do
								for y = v.fromPos.y, v.toPos.y do
									doCleanTile({x=x, y=y, z=v.toPos.z})
									local t = getTopCreature({x=x, y=y, z=v.toPos.z}).uid
									if t ~= 0 then
										if isMonster(t) then
											table.insert(monsters, t)
										else
											if isPlayer(t) then
												player = true
											end
										end
									end
								end
							end
							
							if not player then
								doTeleportThing(cid, v.teleportPos, true)
								doPlayerRemoveItem(cid, configHunting.itemId, 1)
								doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You entered into room.')

								local x = addEvent(removePlayerFromRoom, v.expireTime * 1000, cid, configHunting, huntingConfig)
								doCreatureSetStorage(cid, configHunting.storage, x)
								doCreatureSetStorage(cid, configHunting.timeStorage, os.time()+v.expireTime)
								
								for _, v in ipairs(monsters) do
									if isCreature(v) then
										doRemoveCreature(v)
									end
								end
							else
								doTeleportThing(cid, fromPosition, true)
								doPlayerSendCancel(cid, 'This room is full. Come later.')
							end
							break
						end
					end

					exhaustion.set(cid, configHunting.exhaustStorage, configHunting.exhaustTime)
				end
				return true
			end

			function removePlayerFromRoom(pid, configHunting, huntingConfig)
				if isPlayer(pid) then
					doTeleportThing(cid, getTownTemplePosition(getPlayerTown(pid)), true)
					doPlayerSendTextMessage(pid, MESSAGE_STATUS_WARNING, 'Your time expired.')
					doCreatureSetStorage(pid, configHunting.storage, -1)
				end
			end
		]]>
	</movement>

	<event type="login" name="huntingRoom_login" event="script">
		<![CDATA[
			domodlib("huntingConfig")

			function onLogin(cid)
				registerCreatureEvent(cid, "huntingRoom_death")
				return true
			end
		]]>
	</event>

	<event type="death" name="huntingRoom_death" event="script">
		<![CDATA[
			domodlib("huntingConfig")

			function onDeath(cid, target, damage, flags)
				if isPlayer(cid) then
					if getCreatureStorage(cid, configHunting.storage) > 0 then
						stopEvent(getCreatureStorage(cid, configHunting.storage))
						doCreatureSetStorage(cid, configHunting.storage, -1)

						for k, v in pairs(huntingConfig) do
							if isInRange(getThingPos(cid), v.fromPos, v.toPos) then
								for x = v.fromPos.x, v.toPos.x do
									for y = v.fromPos.y, v.toPos.y do
										doCleanTile({x=x, y=y, z=v.toPos.z})
										local t = getTopCreature({x=x, y=y, z=v.toPos.z}).uid
										if t ~= 0 then
											if isMonster(t) then
												doRemoveCreature(t)
											end
										end
									end
								end
								break
							end
						end
					end
				end
				return true
			end
		]]>
	</event>
</mod>
 

Placek

Blue Waffle
Joined
Sep 30, 2008
Messages
6,793
Reaction score
672
Age
9
Odp: Ma?y problem z hunting arena.

Jakies bledy w konsoli?

Code:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
				local monsters, player = false, false
				if isPlayer(cid) then
					for k, v in pairs(huntingConfig) do
						if isInRange(getThingPos(cid), v.fromPos, v.toPos) then
							for x = v.fromPos.x, v.toPos.x do
								for y = v.fromPos.y, v.toPos.y do
									doCleanTile({x=x, y=y, z=v.toPos.z})
									local t = getTopCreature({x=x, y=y, z=v.toPos.z}).uid
									if t ~= 0 then
										if isMonster(t) then
											monsters = true
										end
									end
								end
							end
							
							if monsters then
								doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You haven\'t killed all monsters.')
								doTeleportThing(cid, fromPosition)
							else
								if exhaustion.check(cid, configHunting.storageExh) then
									doPlayerSendCancel(cid, 'You have to wait: '..exhaustion.get(cid, configHunting.storageExh)..' sec to respawn monsters again.')
									doTeleportThing(cid, fromPosition)
								else
									exhaustion.set(cid, configHunting.storageExh, configHunting.exhaust)
									doTeleportThing(cid, fromPosition, true)
									doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Monsters has been spawned.')
									for i = 1, v.monsters[2] do
										doCreateMonster(v.monsters[1], v.teleportPos, false, false, false)
									end
								end
							end
							break
						end
					end
				end
				return true
			end
To jest fragment odpowiadajacy za respienie potworow.
Konkretniej doCreateMonster. Sprawdz czy masz w ogole w silniku. Jak nie to zastap ja jakas ktora masz, lub dodaj ta.
 

givera12

Active User
Joined
Jul 3, 2010
Messages
121
Reaction score
4
Odp: Ma?y problem z hunting arena.

Wiem ?e to jest ten fragment, a b??d?w w konsoli nie ma. Dodam ?e na 0.4 na localu dzia?a?o, a na 0.3.6 na Dedyku nie dzia?a :(

Edit!

w luascript.cpp mam taki kod:

Code:
	//doCreateMonster(name, pos[, displayError = true])
	lua_register(m_luaState, "doCreateMonster", LuaScriptInterface::luaDoCreateMonster);

---------- Tre?? dodana o 20:56 ----------

Do zamkni?cia. :)

Zmieni?em
Code:
doCreateMonster(v.monsters[1], v.teleportPos, false, false, false)

na

Code:
doCreateMonster(v.monsters[1], v.teleportPos)
 
Last edited:

misztrz440

Banned
Joined
Dec 15, 2012
Messages
1,032
Reaction score
39
Odp: Ma?y problem z hunting arena.

W?a?nie w tych modsach jest dodane po 3x false na koniec nie wiadomo po co i dlatego nie dziala
 

Placek

Blue Waffle
Joined
Sep 30, 2008
Messages
6,793
Reaction score
672
Age
9
Odp: Ma?y problem z hunting arena.

@up
Wiadomo po co.
W 0.4 masz:
//doCreateMonster(name, pos[, extend = false[, force = false[, displayError = true]]])
lua_register(m_luaState, "doCreateMonster", LuaInterface::luaDoCreateMonster);

Jednym slowem lekko bardziej rozbudowana funkcja posiadajaca wiecej argumentow do jej konfiguracji.
Ale jak widac autor tematu sobie poradzil spiewajaco, wiec temat do zamkniecia :)
 
Status
Not open for further replies.
Top