• 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 Zao Arena - Not working lever

Galaxy

New Member
Joined
Feb 24, 2011
Messages
108
Reaction score
1
Location
Ireland/Carlow
Hello everyone.

I tried to solve this by myself using my poor .lua skills but I couldn't. Then I searched in google for different topics with this script hoping that there will be a solution to my problem but there wasn't.

I found a Zao Arena script on this forum but either I did something wrong or the script just doesn't work.

Here is the script:
Code:
local t, player = {
	pedestals = {
		{x=33098, y=31003, z=2},
		{x=33099, y=31003, z=2}
	},
	newPos = {
		{x=33072, y=31023, z=3},
		{x=33072, y=31025, z=3}
	},
	area = {
		fromX = 33097, toX = 33100,
		fromY = 31002, toY = 31004,
		z = 2
	},
	storageDone = 4767,
	level = 80
}, {0, 0}
 
function getCreaturesInRange(position, radiusx, radiusy, showMonsters, showPlayers, showSummons)
	local creaturesList = {}
	for x = -radiusx, radiusx do
		for y = -radiusy, radiusy do
			if not (x == 0 and y == 0) then
				creature = getTopCreature({x = position.x+x, y = position.y+y, z = position.z, stackpos = 253})
				if (creature.type == 1 and showPlayers == TRUE) or (creature.type == 2 and showMonsters == TRUE and (showSummons == FALSE or (showSummons == TRUE and getCreatureMaster(creature.uid) == (creature.uid)))) then
					table.insert(creaturesList, creature.uid)
				end
			end
		end
	end
 
	local creature = getTopCreature(position)
	if (creature.type == 1 and showPlayers == TRUE) or (creature.type == 2 and showMonsters == TRUE and (showSummons == FALSE or (showSummons == TRUE and getCreatureMaster(creature.uid) == (creature.uid)))) then
		if not(table.find(creaturesList, creature.uid)) then
			table.insert(creaturesList, creature.uid)
		end
	end
    return creaturesList
end
 
function Wave1()
       doSendMagicEffect(getCreaturePosition(doCreateMonster('Baron Brute', {x = 33081, y = 31021, z = 3})), CONST_ME_TELEPORT)
	doSendMagicEffect(getCreaturePosition(doCreateMonster('The Axeorcist', {x = 33081, y = 31021, z = 3})), CONST_ME_TELEPORT)
	addEvent(Wave2, 30 * 1000)
end
 
function Wave2()
       doSendMagicEffect(getCreaturePosition(doCreateMonster('Menace', {x = 33081, y = 31021, z = 3})), CONST_ME_TELEPORT)
	doSendMagicEffect(getCreaturePosition(doCreateMonster('Fatality', {x = 33081, y = 31021, z = 3})), CONST_ME_TELEPORT) 
	addEvent(Wave3, 35 * 1000)
end
 
function Wave3()
       doSendMagicEffect(getCreaturePosition(doCreateMonster('Incineron', {x = 33081, y = 31021, z = 3})), CONST_ME_TELEPORT)
	doSendMagicEffect(getCreaturePosition(doCreateMonster('Coldheart', {x = 33081, y = 31021, z = 3})), CONST_ME_TELEPORT)
	addEvent(Wave4, 40 * 1000)
end
 
function Wave4()
       doSendMagicEffect(getCreaturePosition(doCreateMonster('Dreadwing', {x = 33081, y = 31021, z = 3})), CONST_ME_TELEPORT)
	doSendMagicEffect(getCreaturePosition(doCreateMonster('Doomhowl', {x = 33081, y = 31021, z = 3})), CONST_ME_TELEPORT)
	addEvent(Wave5, 40 * 1000)
end
 
function Wave5()
       doSendMagicEffect(getCreaturePosition(doCreateMonster('Haunter', {x = 33081, y = 31021, z = 3})), CONST_ME_TELEPORT)
	addEvent(Wave6, 40 * 1000)
end
 
function Wave6()
       doSendMagicEffect(getCreaturePosition(doCreateMonster('The Dreadorian', {x = 33081, y = 31021, z = 3})), CONST_ME_TELEPORT)
	doSendMagicEffect(getCreaturePosition(doCreateMonster('Rocko', {x = 33081, y = 31021, z = 3})), CONST_ME_TELEPORT)
       doSendMagicEffect(getCreaturePosition(doCreateMonster('Tremorak', {x = 33081, y = 31021, z = 3})), CONST_ME_TELEPORT)
	addEvent(Wave7, 40 * 1000)
end
 
function Wave7()
	doSendMagicEffect(getCreaturePosition(doCreateMonster('Tirecz', {x = 33081, y = 31021, z = 3})), CONST_ME_TELEPORT)
end
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local failed = false
	for i = 1, #t.pedestals do
		player[i] = getTopCreature(t.pedestals[i]).uid
		if(not(player[i] > 0 and isPlayer(player[i]) == TRUE and getPlayerStorageValue(player[i], t.storageDone) < 1 and getPlayerLevel(player[i]) >= t.level)) then
			failed = true
			break
		end
	end
	if not failed then
		if #getCreaturesInRange({x=33082, y=31023,z=3}, 10, 9, FALSE, TRUE) > 0 then
			doPlayerSendTextMessage(cid,MESSAGE_EVENT_DEFAULT, "Some people are already in the arena.")
			return true
		end
		for i = 1, #player do
			doTeleportThing(player[i], t.newPos[i])
		end
		Wave1()
		doTransformItem(item.uid, 1946)
	else
		doPlayerSendDefaultCancel(cid, RETURNVALUE_CANNOTUSETHISOBJECT)
	end
	return true
end

The problem is that I can't push the lever - it doesn't react. I don't know why. I found this script in THIS thread on otland.

Thanks for helping me out! :)
 
actually, look at the few last lines in this scrtipt:

Code:
Wave1()
		[COLOR="#0000CD"]doTransformItem(item.uid, [U]1946[/U])[/COLOR]
	else
		doPlayerSendDefaultCancel(cid, RETURNVALUE_CANNOTUSETHISOBJECT)
	end
	return true
end

I changed that to uniqueid of the lever instead of it's normal id... But still didn't work. ;(

actually, should it be uniqueid or actionid of the lever?
 
Last edited:
i'm not the best scripter or anything like that but compare with like Annhi that also have a lever and it prolly works there so compare annhi lever with your zao arena lever and check if its a uniqueid or actionID... in rme ofc.


I'm not really sure since i don't have zao arena myself.
 
I think I know where the problem is...

Code:
local t, player = {
	pedestals = {
		{x=33098, y=31003, z=2},
		{x=33099, y=31003, z=2}
	},
	newPos = {
		{x=33072, y=31023, z=3},
		{x=33072, y=31025, z=3}
	},
	area = {
		fromX = 33097, toX = 33100,
		fromY = 31002, toY = 31004,
		z = 2
	},
	[COLOR="#FF0000"]storageDone = 4767,[/COLOR]
	level = 80
}, {0, 0}
 
function getCreaturesInRange(position, radiusx, radiusy, showMonsters, showPlayers, showSummons)
	local creaturesList = {}
	for x = -radiusx, radiusx do
		for y = -radiusy, radiusy do
			if not (x == 0 and y == 0) then
				creature = getTopCreature({x = position.x+x, y = position.y+y, z = position.z, stackpos = 253})
				if (creature.type == 1 and showPlayers == TRUE) or (creature.type == 2 and showMonsters == TRUE and (showSummons == FALSE or (showSummons == TRUE and getCreatureMaster(creature.uid) == (creature.uid)))) then
					table.insert(creaturesList, creature.uid)
				end
			end
		end
	end
 
	local creature = getTopCreature(position)
	if (creature.type == 1 and showPlayers == TRUE) or (creature.type == 2 and showMonsters == TRUE and (showSummons == FALSE or (showSummons == TRUE and getCreatureMaster(creature.uid) == (creature.uid)))) then
		if not(table.find(creaturesList, creature.uid)) then
			table.insert(creaturesList, creature.uid)
		end
	end
    return creaturesList
end
 
function Wave1()
       doSendMagicEffect(getCreaturePosition(doCreateMonster('Baron Brute', {x = 33081, y = 31021, z = 3})), CONST_ME_TELEPORT)
	doSendMagicEffect(getCreaturePosition(doCreateMonster('The Axeorcist', {x = 33081, y = 31021, z = 3})), CONST_ME_TELEPORT)
	addEvent(Wave2, 30 * 1000)
end
 
function Wave2()
       doSendMagicEffect(getCreaturePosition(doCreateMonster('Menace', {x = 33081, y = 31021, z = 3})), CONST_ME_TELEPORT)
	doSendMagicEffect(getCreaturePosition(doCreateMonster('Fatality', {x = 33081, y = 31021, z = 3})), CONST_ME_TELEPORT) 
	addEvent(Wave3, 35 * 1000)
end
 
function Wave3()
       doSendMagicEffect(getCreaturePosition(doCreateMonster('Incineron', {x = 33081, y = 31021, z = 3})), CONST_ME_TELEPORT)
	doSendMagicEffect(getCreaturePosition(doCreateMonster('Coldheart', {x = 33081, y = 31021, z = 3})), CONST_ME_TELEPORT)
	addEvent(Wave4, 40 * 1000)
end
 
function Wave4()
       doSendMagicEffect(getCreaturePosition(doCreateMonster('Dreadwing', {x = 33081, y = 31021, z = 3})), CONST_ME_TELEPORT)
	doSendMagicEffect(getCreaturePosition(doCreateMonster('Doomhowl', {x = 33081, y = 31021, z = 3})), CONST_ME_TELEPORT)
	addEvent(Wave5, 40 * 1000)
end
 
function Wave5()
       doSendMagicEffect(getCreaturePosition(doCreateMonster('Haunter', {x = 33081, y = 31021, z = 3})), CONST_ME_TELEPORT)
	addEvent(Wave6, 40 * 1000)
end
 
function Wave6()
       doSendMagicEffect(getCreaturePosition(doCreateMonster('The Dreadorian', {x = 33081, y = 31021, z = 3})), CONST_ME_TELEPORT)
	doSendMagicEffect(getCreaturePosition(doCreateMonster('Rocko', {x = 33081, y = 31021, z = 3})), CONST_ME_TELEPORT)
       doSendMagicEffect(getCreaturePosition(doCreateMonster('Tremorak', {x = 33081, y = 31021, z = 3})), CONST_ME_TELEPORT)
	addEvent(Wave7, 40 * 1000)
end
 
function Wave7()
	doSendMagicEffect(getCreaturePosition(doCreateMonster('Tirecz', {x = 33081, y = 31021, z = 3})), CONST_ME_TELEPORT)
end
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local failed = false
	for i = 1, #t.pedestals do
		player[i] = getTopCreature(t.pedestals[i]).uid
		if(not(player[i] > 0 and isPlayer(player[i]) == TRUE and getPlayerStorageValue(player[i], t.storageDone) < 1 and getPlayerLevel(player[i]) >= t.level)) then
			failed = true
			break
		end
	end
	if not failed then
		if #getCreaturesInRange({x=33082, y=31023,z=3}, 10, 9, FALSE, TRUE) > 0 then
			doPlayerSendTextMessage(cid,MESSAGE_EVENT_DEFAULT, "Some people are already in the arena.")
			return true
		end
		for i = 1, #player do
			doTeleportThing(player[i], t.newPos[i])
		end
		Wave1()
		doTransformItem(item.uid, 1946)
	else
		doPlayerSendDefaultCancel(cid, RETURNVALUE_CANNOTUSETHISOBJECT)
	end
	return true
end

the red part at the beginning...

It's a storage when you talked to NPC Chrak and then you can pull the lever. But I dont know how to make npc for that ;( I would like this script to be without any storagedone... Because I dont want to to the whole quest - just last mission...
 
Back
Top