• 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!

Solved Weird bug O.o

Snach

Sensei
Joined
Aug 8, 2009
Messages
1,694
Reaction score
84
Location
Estonia
If I add less stones it works, wtf? xd
script:
Code:
local fromX=998 --start x
local toX=1003 --end x
local fromY=998 --start Y
local toY=1002 --end Y
local remove = 14000 --time until start
function onThink(cid, interval)

for x = fromX, toX do
	for y = fromY, toY do
		if isMonster(getTopCreature({x=x,y=y,z=7}).uid) then
		doRemoveCreature(getTopCreature({x=x,y=y,z=7}).uid)
		elseif isPlayer(getTopCreature({x=x,y=y,z=7}).uid) then
		doCreatureSetStorage(getTopCreature({x=x,y=y,z=7}).uid, 30027, 2) ---kick out
		end
	end
end

function Check(parameter)
local fromX=998 --start x
local toX=1003 --end x
local fromY=998 --start Y
local toY=1002 --end Y
local itenz={1285, 3325}
local f = {
[1] = "Troll",
[2] = "Frost Troll",
	    }
monsters = 0
	for y = fromY, toY do
		for x = fromX, toX do
				if isPlayer(getTopCreature({x=x,y=y,z=7}).uid)==FALSE then
					if isMonster(getTopCreature({x=x,y=y,z=7}).uid)==FALSE then
						if isInArray(itenz, getThingfromPos({x=x,y=y,z=7}).itemid)==FALSE then
							if monsters ~= 20 then
								doCreateMonster(f[math.random(2)], {x=x,y=y,z=7})
								monsters = monsters + 1
							end
						end
					end
				end
		end
	end
return TRUE
end

local item = doCreateItem(2601, 1, {x=1003, y=1006, z=7})
	doItemSetAttribute(item, 'uid',1008)
	addEvent(doRemoveItem, remove, 1008, 1)
	addEvent(Check, remove + 1, {})
return TRUE
end


picture:
VhmWykmy4c.png
 
Last edited:
This:
LUA:
local c = {
	area = {{x=998,y=998,z=7},{x=1003,y=1002}},
	monsters = {"Troll", "Frost Troll"},
	items = {1285, 3325},
	remove = 14000
}

function Check()
	local summoned = 0
	for x = c.area[1].x, c.area[2].x do
		for y = c.area[1].y, c.area[2].y do
			local pos = {x=x,y=y,z=c.area[1].z, stackpos=253}
			if not(isCreature(getThingFromPos(pos).uid)) then
				local found = false
				for i = 1, #c.items do
					if getTileItemById(pos, c.items[i]).uid > 0 then
						found = true
						break
					end
				end
				if not found then
					doCreateMonster(c.monsters[math.random(#c.monsters)],pos)
					summoned = summoned + 1
					if summoned == 20 then return true end
				end
			end
		end
	end
return true
end

function onThink(cid, interval)
	for x = c.area[1].x, c.area[2].x do
		for y = c.area[1].y, c.area[2].y do
			local creature = getThingFromPos({x=x,y=y,z=7,stackpos=253}).uid
			if isMonster(creature) then
				doRemoveCreature(creature)
			elseif isPlayer(creature) then
				doCreatureSetStorage(creature, 30027, 2) ---kick out
			end
		end
	end

	local item = doCreateItem(2601, 1, {x=1003, y=1006, z=7})
	doItemSetAttribute(item, 'uid',1008)
	addEvent(doRemoveItem, c.remove, 1008)
	addEvent(Check, 1000, c.remove-1)
	
return true
end
 
This:
LUA:
local c = {
	area = {{x=998,y=998,z=7},{x=1003,y=1002}},
	monsters = {"Troll", "Frost Troll"},
	items = {1285, 3325},
	remove = 14000
}

function Check()
	local summoned = 0
	for x = c.area[1].x, c.area[2].x do
		for y = c.area[1].y, c.area[2].y do
			local pos = {x=x,y=y,z=c.area[1].z, stackpos=253}
			if not(isCreature(getThingFromPos(pos).uid)) then
				local found = false
				for i = 1, #c.items do
					if getTileItemById(pos, c.items[i]).uid > 0 then
						found = true
						break
					end
				end
				if not found then
					doCreateMonster(c.monsters[math.random(#c.monsters)],pos)
					summoned = summoned + 1
					if summoned == 20 then return true end
				end
			end
		end
	end
return true
end

function onThink(cid, interval)
	for x = c.area[1].x, c.area[2].x do
		for y = c.area[1].y, c.area[2].y do
			local creature = getThingFromPos({x=x,y=y,z=7,stackpos=253}).uid
			if isMonster(creature) then
				doRemoveCreature(creature)
			elseif isPlayer(creature) then
				doCreatureSetStorage(creature, 30027, 2) ---kick out
			end
		end
	end

	local item = doCreateItem(2601, 1, {x=1003, y=1006, z=7})
	doItemSetAttribute(item, 'uid',1008)
	addEvent(doRemoveItem, c.remove, 1008)
	addEvent(Check, 1000, c.remove-1)
	
return true
end

thnx. rep
 
Back
Top