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

Lua Add time to new monster to spawn in quest.

tompan

Member
Joined
Dec 13, 2008
Messages
646
Reaction score
24
Location
Sweden
can someone help me do this in this script or fix me another script ?
I want it to spawn new demons every 60 seconds at the same poss as the old demons.
and the time will tick 3 times and then it wont come more demons.


Code:
function onUse(cid, item, frompos, item2, topos)
	if item.uid == 5024 then
		if item.itemid == 1945 then
 
			player1pos = {x=1154, y=1582, z=7, stackpos=253}
			player1 = getThingfromPos(player1pos)
 
			player2pos = {x=1154, y=1581, z=7, stackpos=253}
			player2 = getThingfromPos(player2pos)
 
			player3pos = {x=1154, y=1580, z=7, stackpos=253}
			player3 = getThingfromPos(player3pos)
 
			player4pos = {x=1154, y=1579, z=7, stackpos=253}
			player4 = getThingfromPos(player4pos)
 
 
			if player1.itemid > 0 and player2.itemid > 0 and player3.itemid > 0 and player4.itemid > 0 then
 
				player1level = getPlayerLevel(player1.uid)
				player2level = getPlayerLevel(player2.uid)
				player3level = getPlayerLevel(player3.uid)
				player4level = getPlayerLevel(player4.uid)
 
				questlevel = 1
 
				if player1level >= questlevel and player2level >= questlevel and player3level >= questlevel and player4level >= questlevel then
 
					queststatus1 = getPlayerStorageValue(player1.uid,5024)
					queststatus2 = getPlayerStorageValue(player2.uid,5024)
					queststatus3 = getPlayerStorageValue(player3.uid,5024)
					queststatus4 = getPlayerStorageValue(player4.uid,5024)
 
					if queststatus1 == -1 and queststatus2 == -1 and queststatus3 == -1 and queststatus4 == -1 then
 
						wall1pos = {x=1155, y=1582, z=8}
						demon2pos = {x=1152, y=1584, z=8}
						demon3pos = {x=1152, y=1580, z=8}
						demon4pos = {x=1149, y=1582, z=8}

 
						doSummonCreature("Brick Wall", wall1pos)
						doSummonCreature("Demon", demon2pos)
						doSummonCreature("Demon", demon3pos)
						doSummonCreature("Demon", demon4pos)
						
						
 
						nplayer1pos = {x=1154, y=1582, z=8}
						nplayer2pos = {x=1153, y=1582, z=8}
						nplayer3pos = {x=1152, y=1582, z=8}
						nplayer4pos = {x=1151, y=1582, z=8}
 
						doSendMagicEffect(player1pos,2)
						doSendMagicEffect(player2pos,2)
						doSendMagicEffect(player3pos,2)
						doSendMagicEffect(player4pos,2)
						
 
						doTeleportThing(player1.uid,nplayer1pos)
						doTeleportThing(player2.uid,nplayer2pos)
						doTeleportThing(player3.uid,nplayer3pos)
						doTeleportThing(player4.uid,nplayer4pos)
 
						doSendMagicEffect(nplayer1pos,10)
						doSendMagicEffect(nplayer2pos,10)
						doSendMagicEffect(nplayer3pos,10)
						doSendMagicEffect(nplayer4pos,10)
						doTransformItem(item.uid,item.itemid+1)
 						

					
					else
						doPlayerSendCancel(cid,"Sorry, not possible.")
					end
				else
					doPlayerSendCancel(cid,"Sorry. not possible.")
				end
			else
				doPlayerSendCancel(cid,"Sorry, not possible.")
			end
		elseif item.itemid == 1946 then
			if getPlayerAccess(cid) == 3 then
				doTransformItem(item.uid,item.itemid-1)
			else
				doPlayerSendCancel(cid,"Sorry, not possible.")
			end
		end
	elseif item.uid == 5025 then
 
		queststatus = getPlayerStorageValue(cid,5024)
 
		if queststatus == -1 then
			doPlayerSendTextMessage(cid,22,"You have found a stonecutter axe.")
			doPlayerAddItem(cid,2431,1)
			setPlayerStorageValue(cid,5024,1)
		else
			doPlayerSendTextMessage(cid,22,"It is empty.")
		end
	elseif item.uid == 5026 then
 
		queststatus = getPlayerStorageValue(cid,5024)
 
		if queststatus == -1 then
			doPlayerSendTextMessage(cid,22,"You have found a thunder hammer.")
			doPlayerAddItem(cid,2421,1)
			setPlayerStorageValue(cid,5024,1)
		else
			doPlayerSendTextMessage(cid,22,"It is empty.")
		end
	elseif item.uid == 5027 then
 
		queststatus = getPlayerStorageValue(cid,5024)
 
		if queststatus == -1 then
			doPlayerSendTextMessage(cid,22,"You have found a magic sword.")
			doPlayerAddItem(cid,2400,1)
			setPlayerStorageValue(cid,5024,1)
		else
			doPlayerSendTextMessage(cid,22,"It is empty.")
		end
	elseif item.uid == 5028 then
 
		queststatus = getPlayerStorageValue(cid,5024)
 
		if queststatus == -1 then
			doPlayerSendTextMessage(cid,22,"You have found a pair of soft boots.")
			doPlayerAddItem(cid,2640,1)
			setPlayerStorageValue(cid,5024,1)
		else
			doPlayerSendTextMessage(cid,22,"It is empty.")
		end
	end
	return 1
end
 
LUA:
local from={x=33229, y=31697, z=14}
local to={x=33224, y=31697, z=14}
 
local summon={
	{'Brick Wall', {x=1155, y=1582, z=8}},
	{'Demon', {x=1152, y=1584, z=8}},
	{'Demon', {x=1152, y=1580, z=8}},
	{'Demon', {x=1149, y=1582, z=8}}
}
 
local playerA={
	{x=1154, y=1582, z=7},
	{x=1154, y=1581, z=7},
	{x=1154, y=1580, z=7},
	{x=1154, y=1579, z=7},
}
local playerB={
	{x=1154, y=1582, z=8},
	{x=1153, y=1582, z=8},
	{x=1152, y=1582, z=8},
	{x=1151, y=1582, z=8},
}
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local t = {}
	if item.itemid == 1945 then
		for i = 1, 4 do
			t[i]=getTopCreature(playerA[i]).uid
			if t[i] == 0 or not isPlayer(t[i]) then
				return doPlayerSendCancel(cid, 'You need 4 players for this quest.')
			elseif getPlayerLevel(t[i]) < 100 then
				return doPlayerSendCancel(cid, 'All players need to have level 100 or higher.')
			end
		end
		for i = 1, #summon do
			doCreateMonster(unpack(summon[i]))
		end
		for i = 1, #t do
			doTeleportThing(t[i], playerB[i])
			doSendMagicEffect(playerA[i], CONST_ME_POFF)
			doSendMagicEffect(playerB[i], CONST_ME_ENERGYAREA)
		end
	else
		for x = from.x, to.x do
			for y = from.y, to.y do
				local v = getTopCreature({x=x, y=y, z=from.z}).uid
				if v ~= 0 then
					if isPlayer(v) then
						return doPlayerSendCancel(cid, 'There is already a team in the quest room.')
					elseif isMonster(v) then
						table.insert(t, v)
					end
				end
			end
		end
		for i = 1, #t do
			doRemoveCreature(t[i])
		end
	end
	return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
end
 
Back
Top