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

[1.3] Arena for exp.

DukeeH

Active Member
Joined
Dec 6, 2010
Messages
550
Solutions
3
Reaction score
39
Hello, I'd like to request an arena script, I'll try my best to explain what I want, already tried a few ways to do it, requested for a few ppl, but after lots of tries and errors I'm here.

Would be 4 arena "types" (One monster each type).
6 Rooms for each type.
Map SS:
.eJwNyUsOhCAMANC7cAAqJXzqbQgSNKOUQM0szNx9XL68R93jVKvaRfpcAbZjZh6bnsIj1aIrcz1L6sfUmS9IIinvV2kyAUMkt3iLaMkhUXSA0SzGv7AmvOspwN0-jb9N91bV7w8KwyL9.-qULMPIlKo6e-a9NPtes453ZZa0

How it works?
Player enter the teleport in front of the room, gets teleported inside.
Room is now busy (nobody else can enter, until he dies/leave/storage finishes)
The monster spawns and everytime it gets killed, it spawns again.
If the player leaves/die/storage finishes the monster is removed and the room gets free (someone can enter)

I've tried mkalo's advanced arena, worked flawless. (One arena for test)
Script i've made using it: hastebin
But as he stated, it works but it's not made for this and could be heavy.
I know it will probably be heavy because it needs to check all arenas and everything, but if someone knows a better way I really need it for my server.

Thanks eveyone.
 
How I would do it for 0.3.7..
I'd make it out of 1 movement script, with a table I guess.

When a player enters teleport, remove teleport, teleport player inside and create monster.
Now the script loops, and checks the room every 10 seconds or so, to see if the player is still inside, and also to check if the monster still exists.
If no monster, summon a new monster. If no player, replace teleport. If players storage is complete, teleport them out and replace teleport.

You only need to check if the players position is inside the arena, you don't need to scan the entire area for a player.
Same with the monster, each time a monster is summoned, grab it's creature id, and simply check if it exists anymore.

1 separate script for onLogin, in case the server reset while someone was inside..
Just check if the player is within any of the arena area's, and if yes, teleport them outside.

Altogether this shouldn't take more then 20-30 minutes to make.

Hopefully it this gives you enough information to create the script yourself, or someone else an easy base to follow from.

Good luck.

Xikini
 
How I would do it for 0.3.7..
I'd make it out of 1 movement script, with a table I guess.

When a player enters teleport, remove teleport, teleport player inside and create monster.
Now the script loops, and checks the room every 10 seconds or so, to see if the player is still inside, and also to check if the monster still exists.
If no monster, summon a new monster. If no player, replace teleport. If players storage is complete, teleport them out and replace teleport.

You only need to check if the players position is inside the arena, you don't need to scan the entire area for a player.
Same with the monster, each time a monster is summoned, grab it's creature id, and simply check if it exists anymore.

1 separate script for onLogin, in case the server reset while someone was inside..
Just check if the player is within any of the arena area's, and if yes, teleport them outside.

Altogether this shouldn't take more then 20-30 minutes to make.

Hopefully it this gives you enough information to create the script yourself, or someone else an easy base to follow from.

Good luck.

Xikini
Thanks for all the info, I know that you work with 0.3.7, I don't think it would take so long to make (for someone experienced)
I'm still thinking of ways to make it, I'm still not that good with tables to do like 6 arenas of the same type on one script.
I'll try to figure something new tomorrow, but still looking for another experienced help.
 
It would be nice if someone can do it for 0.4
blhmvMS.png

data/lib/000-constant.lua (I suggest putting it near the bottom, but anywhere is fine)
Lua:
arenas = {
    --[arena_start_tile]          = {{teleport_position}, {top_left_corner}, {bottom_right_corner}, "monster_name_lowercase", {monster_spawn_position}}
    ["x = 1000, y = 1000, z = 7"] = {{x = 1000, y = 1000, z = 7}, {x = 1000, y = 1000, z = 7}, {x = 1000, y = 1000, z = 7}, "rat", {x = 1000, y = 1000, z = 7}},
    ["x = 1000, y = 1000, z = 7"] = {{x = 1000, y = 1000, z = 7}, {x = 1000, y = 1000, z = 7}, {x = 1000, y = 1000, z = 7}, "rat", {x = 1000, y = 1000, z = 7}},
    ["x = 1000, y = 1000, z = 7"] = {{x = 1000, y = 1000, z = 7}, {x = 1000, y = 1000, z = 7}, {x = 1000, y = 1000, z = 7}, "rat", {x = 1000, y = 1000, z = 7}}
}
data/creaturescripts/creaturescripts.xml
XML:
<event type="login" name="monster_arena_xikini" event="script" value="monster_arena_xikini.lua"/>
data/creaturescripts/scripts/login.lua [somewhere near the bottom with the other registered events]
Lua:
registerCreatureEvent(cid, "monster_arena_xikini")
data/creaturescripts/scripts/monster_arena_xikini.lua
Lua:
function onLogin(cid)
    local cid_pos = getThingPosition(cid)
    for k, v in pairs(arenas) do
        if cid_pos.z >= v[2].z and cid_pos.z <= v[3].z then
            if cid_pos.x >= v[2].x and cid_pos.x <= v[3].x then
                if cid_pos.y >= v[2].y and cid_pos.y <= v[3].y then
                    doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), true)
                    return true
                end
            end
        end
    end
    return true
end
data/movements/movements.xml (actionid goes under the teleport, and teleport has no destination set.)
XML:
<movevent type="StepIn" actionid="45001" event="script" value="monster_arena_xikini.lua"/>
data/movements/scripts/monster_arena_xikini.lua
Lua:
local function checkArena(cid, creature, arena_index, start_tile_pos)
    local count = 0
    if isPlayer(cid) then
        local cid_pos = getThingPosition(cid)
        if cid_pos.z >= arena_index[2].z and cid_pos.z <= arena_index[3].z then
            if cid_pos.x >= arena_index[2].x and cid_pos.x <= arena_index[3].x then
                if cid_pos.y >= arena_index[2].y and cid_pos.y <= arena_index[3].y then
                    count = 1
                    if not isCreature(creature) then
                        creature = doCreateMonster(arena_index[4], arena_index[5])
                    end
                end
            end
        end
    end
    if count > 0 then
        addEvent(checkArena, 2000, cid, creature, arena_index, start_tile_pos)
    else
        if isCreature(creature) then
            doRemoveCreature(creature)
        end
        doCreateItem(1387, 1, start_tile_pos)
    end
end

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
    local teleporter = getTileItemById(toPosition, 1387).uid
    if teleporter > 0 then
        local arena_index = arenas["x = " .. toPosition.x .. ", y = " .. toPosition.y .. ", z = " .. toPosition.z .. ""]
        if arena_index then
            doRemoveItem(teleporter)
            doTeleportThing(cid, arena_index[1], true)
            doSendMagicEffect(arena_index[1], CONST_ME_TELEPORT)
            addEvent(checkArena, 5000, cid, 0, arena_index, toPosition)
        end
    else
        doTeleportThing(cid, fromPosition, true)
        doSendMagicEffect(fromPosition, CONST_ME_POFF)
    end
    return true
end
 
Last edited:
Back
Top