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

Arena svargrond.

Raks One

Member
Joined
May 10, 2008
Messages
92
Reaction score
5
I have a problem, i try to make arena, i pay, enter on tp, and when i kill the monster and try to go to next area..
13:38 You must kill the monster first!
13:38 You must kill the monster first!
Any solution? Im using Realmap project v0.8
Thanks
 
The arena dosnt work there

The RealMap Project V0.8 Arena works Perfectly...
Not sure why you say it doesn't work

Action.xml
Code:
<action actionid="42366" script="svararena/arenadoors.lua"/>
    <action actionid="42376" script="svararena/arenadoors.lua"/>
    <action actionid="42386" script="svararena/arenadoors.lua"/>
    <action actionid="42357" script="svararena/arenadoors.lua"/>
    <action actionid="42361" script="svararena/arenareward.lua"/>
    <action actionid="42362" script="svararena/arenareward.lua"/>
    <action actionid="42363" script="svararena/arenareward.lua"/>
    <action actionid="42364" script="svararena/arenareward.lua"/>
    <action actionid="42365" script="svararena/arenareward.lua"/>
    <action actionid="42371" script="svararena/arenareward.lua"/>
    <action actionid="42372" script="svararena/arenareward.lua"/>
    <action actionid="42373" script="svararena/arenareward.lua"/>
    <action actionid="42374" script="svararena/arenareward.lua"/>
    <action actionid="42375" script="svararena/arenareward.lua"/>
    <action actionid="42381" script="svararena/arenareward.lua"/>
    <action actionid="42382" script="svararena/arenareward.lua"/>
    <action actionid="42383" script="svararena/arenareward.lua"/>
    <action actionid="42384" script="svararena/arenareward.lua"/>
    <action actionid="42385" script="svararena/arenareward.lua"/>

Arenadoors.lua
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local cidPosition = getCreaturePosition(cid)
	if item.actionid ~= 42357 then
		if (item.actionid == 42366 and getPlayerStorageValue(cid,42355) >= 1) or (item.actionid == 42376 and getPlayerStorageValue(cid,42355) >= 2) or (item.actionid == 42386 and getPlayerStorageValue(cid,42355) == 3) then
			if cidPosition.x < toPosition.x then
				doTeleportThing(cid, {x=toPosition.x+1,y=toPosition.y,z=toPosition.z}, TRUE)
			else
				doTeleportThing(cid, {x=toPosition.x-1,y=toPosition.y,z=toPosition.z}, TRUE)
			end
			return TRUE
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You can not enter this room yet. You need to complete the required difficulty level.")
			return TRUE
		end
	elseif (item.actionid == 42357 and getPlayerStorageValue(cid,42351) == 1) then
		if cidPosition.x < toPosition.x then
			doTeleportThing(cid, {x=toPosition.x+1,y=toPosition.y,z=toPosition.z}, TRUE)
		else
			doTeleportThing(cid, {x=toPosition.x-1,y=toPosition.y,z=toPosition.z}, TRUE)
		end
		return TRUE
	else
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You must first pay a fee to Halvar before entering Barbarian Arena.")
		return TRUE
	end
	return FALSE
end

Arenareward.lua
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.actionid >= 42361 and item.actionid <= 42365 and getPlayerStorageValue(cid, 42361) ~= 1 then
		local reward = 0
		if item.actionid == 42361 then
			reward = doCreateItemEx(1990,1)
			doAddContainerItem(reward, 7372, 1)
			doAddContainerItem(reward, 6569, 10)
			doAddContainerItem(reward, 6574, 1)
			doAddContainerItem(reward, 2114, 1)
		elseif item.actionid == 42362 then
			reward = doCreateItemEx(7406,1)
		elseif item.actionid == 42363 then
			reward = doCreateItemEx(7380,1)
		elseif item.actionid == 42364 then
			reward = doCreateItemEx(7392,1)
		elseif item.actionid == 42365 then
			reward = doCreateItemEx(7342,1)
			doAddContainerItem(reward, 7365, 100)
			doAddContainerItem(reward, 7364, 100)
		end
		local additem = doPlayerAddItemEx(cid, reward, 0)
		if additem == RETURNVALUE_NOERROR then
			doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,'You have chosen a ' .. getItemName(getThing(reward).itemid) .. '.')
			setPlayerStorageValue(cid, 42361, 1)
		else
			doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,'Not enough capacity.')
		end
		
			elseif item.actionid >= 42361 and item.actionid <= 42365 and getPlayerStorageValue(cid, 42361) == 1 then
							doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,'You have already claimed your reward.')
			elseif item.actionid >= 42371 and item.actionid <= 42375 and getPlayerStorageValue(cid, 42371) == 1 then
							doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,'You have already claimed your reward.')
			elseif item.actionid >= 42381 and item.actionid <= 42385 and getPlayerStorageValue(cid, 42381) == 1 then
							doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,'You have already claimed your reward.')
	elseif item.actionid >= 42371 and item.actionid <= 42375 and getPlayerStorageValue(cid, 42371) ~= 1 then
		local reward = 0
		if item.actionid == 42371 then
			reward = doCreateItemEx(1990,1)
			doAddContainerItem(reward, 7372, 1)
			doAddContainerItem(reward, 6569, 10)
			doAddContainerItem(reward, 6574, 1)
			doAddContainerItem(reward, 7183, 1)
		elseif item.actionid == 42372 then
			reward = doCreateItemEx(7384,1)
		elseif item.actionid == 42373 then
			reward = doCreateItemEx(7389,1)
		elseif item.actionid == 42374 then
			reward = doCreateItemEx(7415,1)
		elseif item.actionid == 42375 then
			reward = doCreateItemEx(7342,1)
			doAddContainerItem(reward, 7365, 100)
			doAddContainerItem(reward, 2547, 100)
			doAddContainerItem(reward, 2547, 100)
			doAddContainerItem(reward, 2311, 50)
			doAddContainerItem(reward, 2304, 50)
					end
					
		local additem = doPlayerAddItemEx(cid, reward, 0)
		if additem == RETURNVALUE_NOERROR then
			doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,'You have found a ' .. getItemName(getThing(reward).itemid) .. '.')
			setPlayerStorageValue(cid, 42371, 1)
		else
			doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,'Not enough capacity.')
		end
	elseif item.actionid >= 42381 and item.actionid <= 42385 and getPlayerStorageValue(cid, 42381) ~= 1 then
		local reward = 0
		if item.actionid == 42381 then
			reward = doCreateItemEx(1990,1)
			doAddContainerItem(reward, 7372, 1)
			doAddContainerItem(reward, 6569, 10)
			doAddContainerItem(reward, 6574, 1)
			doAddContainerItem(reward, 6568, 1)
		elseif item.actionid == 42382 then
			reward = doCreateItemEx(7429,1)
		elseif item.actionid == 42383 then
			reward = doCreateItemEx(7434,1)
		elseif item.actionid == 42384 then
			reward = doCreateItemEx(7390,1)
		elseif item.actionid == 42385 then
			reward = doCreateItemEx(7342,1)
			doAddContainerItem(reward, 2273, 50)
			doAddContainerItem(reward, 2268, 50)
			doAddContainerItem(reward, 7443, 1)
			doAddContainerItem(reward, 7440, 1)
			doAddContainerItem(reward, 6529, 100)
		end
		local additem = doPlayerAddItemEx(cid, reward, 0)
		if additem == RETURNVALUE_NOERROR then
			doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,'You have found a ' .. getItemName(getThing(reward).itemid) .. '.')
			setPlayerStorageValue(cid, 42381, 1)
		else
			doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,'Not enough capacity.')
		end
	end
	return TRUE
end

Forgot the Movements!
Movements.xml

Code:
<movevent event="StepIn" actionid="42360" script="arenagoblet.lua"/>
    	<movevent event="StepIn" actionid="42370" script="arenagoblet.lua"/>
    	<movevent event="StepIn" actionid="42380" script="arenagoblet.lua"/>
    	<movevent event="StepOut" actionid="42360" script="arenagoblet.lua"/>
    	<movevent event="StepOut" actionid="42370" script="arenagoblet.lua"/>
    	<movevent event="StepOut" actionid="42380" script="arenagoblet.lua"/>
    	<movevent event="StepIn" actionid="42300" script="arenaroom.lua"/>
    	<movevent event="StepIn" actionid="42301" script="arenaroom.lua"/>
    	<movevent event="StepIn" actionid="42302" script="arenaroom.lua"/>
    	<movevent event="StepIn" actionid="42303" script="arenaroom.lua"/>
    	<movevent event="StepIn" actionid="42304" script="arenaroom.lua"/>
    	<movevent event="StepIn" actionid="42305" script="arenaroom.lua"/>
    	<movevent event="StepIn" actionid="42306" script="arenaroom.lua"/>
    	<movevent event="StepIn" actionid="42307" script="arenaroom.lua"/>
    	<movevent event="StepIn" actionid="42308" script="arenaroom.lua"/>
    	<movevent event="StepIn" actionid="42309" script="arenaroom.lua"/>
    	<movevent event="StepIn" actionid="42310" script="didarenalevel.lua"/>
    	<movevent event="StepIn" actionid="42321" script="leavearena.lua"/>
    	<movevent event="StepIn" actionid="42322" script="leavearena.lua"/>
    	<movevent event="StepIn" actionid="42323" script="leavearena.lua"/>
    	<movevent event="StepIn" actionid="42324" script="leavearena.lua"/>
    	<movevent event="StepIn" actionid="42325" script="leavearena.lua"/>
    	<movevent event="StepIn" actionid="42326" script="leavearena.lua"/>
    	<movevent event="StepIn" actionid="42327" script="leavearena.lua"/>
    	<movevent event="StepIn" actionid="42328" script="leavearena.lua"/>
    	<movevent event="StepIn" actionid="42329" script="leavearena.lua"/>
    	<movevent event="StepIn" actionid="42330" script="leavearena.lua"/>

Arenaroom.lua
Lua:
function onStepIn(cid, item, position, fromPosition)
	if InitArenaScript == 0 then
		InitArenaScript = 1
		checkArenaRooms({})
	end
	local arena_room = item.actionid
	local player_arena = getPlayerStorageValue(cid, 42355)
	if getPlayerStorageValue(cid, arena_room+getPlayerStorageValue(cid, 42355)*10-1) == 1 or arena_room+getPlayerStorageValue(cid, 42355)*10-1 == 42299 then
		if getGlobalStorageValue(cid, arena_room) == 0 then
			local monster_uid = getGlobalStorageValue(arena_room+100)
			if monster_uid > 0 then
				if isCreature(monster_uid) == TRUE then
					doRemoveCreature(monster_uid)
				end
			end
			local spawn_pos = getThingPos(arena_room)
			local monster = doSummonCreature(arena_monsters[arena_room+getPlayerStorageValue(cid, 42355)*10], {x=spawn_pos.x+2,y=spawn_pos.y-4,z=spawn_pos.z})
			setGlobalStorageValue(arena_room+100, monster)
			doTeleportThing(cid, spawn_pos, TRUE)
			        doSendMagicEffect(getPlayerPosition(cid), 10)
				doCreatureSay(cid, "Fight!", TALKTYPE_ORANGE_1)
			setGlobalStorageValue(arena_room, cid)
			setGlobalStorageValue(arena_room-1, 0)
			setPlayerStorageValue(cid, 42350, os.time()+arena_room_max_time)
		else
			doTeleportThing(cid, {x=fromPosition.x+1, y=fromPosition.y, z=fromPosition.z}, FALSE)
			doSendMagicEffect(getPlayerPosition(cid), 10)
			doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_ORANGE,getCreatureName(getGlobalStorageValue(cid, arena_room))..' is currently in the next arena pit. You will have to wait untill he or she leaves.')
		end
	else
		doTeleportThing(cid, {x=fromPosition.x+1, y=fromPosition.y, z=fromPosition.z}, FALSE)
			doSendMagicEffect(getPlayerPosition(cid), 10)
		doPlayerSendTextMessage(cid,25,'You must kill the monster first!')
	end
	if arena_room == 42300 then
		setPlayerStorageValue(cid, 42351, 0)
		setPlayerStorageValue(cid, 42352, 1)
	end
	return TRUE
end

function checkArenaRooms(param)
	addEvent(checkArenaRooms, 1000, {})
	for i = 42300, 42309 do
		local player = getGlobalStorageValue(i)
		if isPlayer(player) == TRUE then
			local player_storage = getPlayerStorageValue(player, 42350)
			if player_storage <= os.time() then
				doTeleportThing(player, arenaKickPosition, TRUE)
				doSendMagicEffect(getCreaturePosition(player), 10)
				setPlayerStorageValue(player, 42350, 0)
				setGlobalStorageValue(i, 0)
				doPlayerSendTextMessage(player,MESSAGE_STATUS_CONSOLE_ORANGE,'You have been thrown out of the arena room!')
			elseif player_storage - 10 <= os.time() then
				doPlayerSendTextMessage(player,MESSAGE_EVENT_DEFAULT,'You have to pass this level in ' .. player_storage - os.time() .. ' seconds or you will be thrown out of the arena room!')
			end
		else
			setGlobalStorageValue(i, 0)
		end
	end
end

Arenagoblet.lua
Lua:
function onStepIn(cid, item, position, fromPosition)
	local gobletPos = getThingPos(item.uid)
	if item.actionid == 42360 then
		if getPlayerStorageValue(cid, 42360) ~= 1 then
			setPlayerStorageValue(cid, 42360, 1)
			local goblet = doCreateItemEx(5807, 1)
			doSetItemSpecialDescription(goblet, "It is given to the courageous victor of the barbarian arena at greenhorn difficulty level.\nAwarded to " .. getCreatureName(cid) .. ".")
pos = {x=gobletPos.x,y=gobletPos.y-1,z=gobletPos.z}
doSendMagicEffect(pos,12)
			doTileAddItemEx({x=gobletPos.x,y=gobletPos.y-1,z=gobletPos.z}, goblet)
		end
	elseif item.actionid == 42370 then
		if getPlayerStorageValue(cid, 42370) ~= 1 then
			setPlayerStorageValue(cid, 42370, 1)
			local goblet = doCreateItemEx(5806, 1)
			doSetItemSpecialDescription(goblet, "It is given to the courageous victor of the barbarian arena at scrapper difficulty level.\nAwarded to " .. getCreatureName(cid) .. ".")
pos = {x=gobletPos.x,y=gobletPos.y-1,z=gobletPos.z}
doSendMagicEffect(pos,12)
			doTileAddItemEx({x=gobletPos.x,y=gobletPos.y-1,z=gobletPos.z}, goblet)
		end
	elseif item.actionid == 42380 then
		if getPlayerStorageValue(cid, 42380) ~= 1 then
			setPlayerStorageValue(cid, 42380, 1)
			local goblet = doCreateItemEx(5805, 1)
			doSetItemSpecialDescription(goblet, "It is given to the courageous victor of the barbarian arena at warlord difficulty level.\nAwarded to " .. getCreatureName(cid) .. ".")
pos = {x=gobletPos.x,y=gobletPos.y-1,z=gobletPos.z}
doSendMagicEffect(pos,12)
			doTileAddItemEx({x=gobletPos.x,y=gobletPos.y-1,z=gobletPos.z}, goblet)
		end
	end
	doTransformItem(item.uid, item.itemid - 1)
	return TRUE
end

function onStepOut(cid, item, pos)
	doTransformItem(item.uid, item.itemid + 1)
	return TRUE
end

Didarenalevel.lua
Lua:
function onStepIn(cid, item, pos, fromPosition)
	if getPlayerStorageValue(cid, item.actionid+getPlayerStorageValue(cid, 42355)*10-1) == 1 then
		setPlayerStorageValue(cid, 42355, getPlayerStorageValue(cid, 42355)+1) --did arena level X
		setPlayerStorageValue(cid, item.actionid+getPlayerStorageValue(cid, 42355)*10, 1) --did arena level X
		setGlobalStorageValue(item.actionid-1, 0) -- room free
		setPlayerStorageValue(cid, 42350, os.time()+5) -- time to kick 0
		setPlayerStorageValue(cid, 42352, 0) -- is not in arena
		doTeleportThing(cid, arenaKickPosition, TRUE)
		if getPlayerStorageValue(cid, 42355) == 1 then
		doSendMagicEffect(getPlayerPosition(cid), CONST_ME_FIREWORK_BLUE)
		doCreatureSay(cid, "Welcome back, little hero", TALKTYPE_ORANGE_1) 
		doPlayerSendTextMessage(cid,25,'You have completed Greenhorn difficulty level! Go to the northern rooms where you can choose one of five prizes!')
				elseif getPlayerStorageValue(cid, 42355) == 2 then
				doSendMagicEffect(getPlayerPosition(cid), CONST_ME_FIREWORK_YELLOW)
				doCreatureSay(cid, "Congratulations, brave warrior!", TALKTYPE_ORANGE_1) 
		doPlayerSendTextMessage(cid,25,'You have completed Scrapper difficulty level! Go to the northern rooms where you can choose one of five prizes!')
				elseif getPlayerStorageValue(cid, 42355) == 3 then
				doSendMagicEffect(getPlayerPosition(cid), CONST_ME_FIREWORK_RED)
				doCreatureSay(cid, "Respect and honour to you, champion!", TALKTYPE_ORANGE_1) 
				doPlayerSendTextMessage(cid,25,'You have completed Warlord difficulty level! Go to the northern rooms where you can choose one of five prizes!')
				else
						doPlayerSendTextMessage(cid,25,'You have completed this difficulty level! Go to the northern rooms where you can choose one of five prizes!')
		end
				

	else
		doTeleportThing(cid, {x=fromPosition.x+1, y=fromPosition.y, z=fromPosition.z}, FALSE)
			doSendMagicEffect(getPlayerPosition(cid), 10)
		doPlayerSendTextMessage(cid,25, 'Kill the monster first!')
	end
	return TRUE
end

and
leavearena.lua
Lua:
function onStepIn(cid, item, pos, fromPosition)
	if getPlayerStorageValue(cid, 42309) < 1 then
		for i = 42300, 42309 do
			setPlayerStorageValue(cid, i, 0)
		end
	end
	-- if he did not make full arena 2 he must start from zero
	if getPlayerStorageValue(cid, 42319) < 1 then
		for i = 42310, 42319 do
			setPlayerStorageValue(cid, i, 0)
		end
	end
	-- if he did not make full arena 3 he must start from zero
	if getPlayerStorageValue(cid, 42329) < 1 then
		for i = 42320, 42329 do
			setPlayerStorageValue(cid, i, 0)
		end
	end
	doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_ORANGE,'You have left the arena!')
	doTeleportThing(cid, arenaKickPosition, TRUE)
	setGlobalStorageValue(item.actionid-21, 0) -- free room
	setPlayerStorageValue(cid, 42350, os.time()+5) -- time to kick 0
	setPlayerStorageValue(cid, 42352, 0) -- is not in arena
	return TRUE
end


Works perfect for me :-O


Signed.
 
Last edited:
Back
Top