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

Xikini's Free Scripting Service. [0.3.7 & (0.3.6/0.4)]

Status
Not open for further replies.

Xikini

I whore myself out for likes
Senator
Joined
Nov 17, 2010
Messages
6,829
Solutions
586
Reaction score
5,410
Doing quick (30 min or less) scripts for [0.3.7 & (0.3.6/0.4)]
I am not here to fix your broken scripts, although I will give advice if requested.
I am here for script requests of scripts not already available on the forum.
If you require support for your scripting issues please make a thread in the support section.

For clarity's sake,
I will script actionscripts, creaturescripts, globalevents, talkactions, movements, npcs for you.
I will not script spells, weapons, raids or monster scripts.
Additionally, source editing, websites and database queries are a no go as well.

Code:
How to make shorter links to posts.
https://otland.net/threads/234306/page-14#post-2330703
 
Last edited:
So, I installed it and tested it but it has a problem.

When I use the lever it says this (which is normal ofc.)

9b7e0dd31883454be428a7356d9065d8.png


And I get teleported and the Rat spawns but if I kill it the server/script doesn't spawn any monsters from the waves.

Scripts how they are now:

Code:
local config = {
   reward_position = {x = 1053, y = 880, z = 9}, -- Teleport location when Arena is Cleared.
   global_storage = 13457, -- any free storage
   top_left_corner = {x = 1031, y = 891, z = 9}, -- top left corner of arena
   bottom_right_corner = {x = 1039, y = 898, z = 9} -- bottom right corner of arena
}

local monsters = { -- All monsters in arena (including joke monster)
   [1] = "rat",
   [2] = "cave rat",
   [3] = "spider",
   [4] = "snake",
   [1] = "bug"
}

local monster_config_wave_one = { -- wave 1
   [1] = {position = { x = 1032, y = 892, z = 9 }, name = "morgaroth"},
   [2] = {position = { x = 1038, y = 893, z = 9 }, name = "ghazbaran"},
   [3] = {position = { x = 1037, y = 897, z = 9 }, name = "apocalypse"},
   [4] = {position = { x = 1032, y = 898, z = 9 }, name = "zugurosh"}
}

local monster_config_wave_two = { -- wave 2
   [1] = {position = { x = 1032, y = 892, z = 9 }, name = "morgaroth"},
   [2] = {position = { x = 1038, y = 893, z = 9 }, name = "apocalypse"},
   [3] = {position = { x = 1037, y = 897, z = 9 }, name = "cobra"},
   [4] = {position = { x = 1032, y = 898, z = 9 }, name = "cobra"}
}

local monster_config_wave_three = { -- wave 3
   [1] = {position = { x = 1032, y = 892, z = 9 }, name = "ghazbaran"},
   [2] = {position = { x = 1038, y = 893, z = 9 }, name = "zugurosh"},
   [3] = {position = { x = 1037, y = 897, z = 9 }, name = "acid blob"},
   [4] = {position = { x = 1032, y = 898, z = 9 }, name = "cobra"}
}

function onKill(cid, target, damage, flags)
   -- check if target is player
   if isPlayer(target) then
     return true
   end

   -- check if target is on list of monsters in arena
   local name = getCreatureName(target):lower()
   count = 0
   for i = 1, #monsters do
     if name == monsters[i]:lower() then
       count = count + 1
     end
   end
   if count == 0 then -- if target is not on list
     return true
   end

   -- check if target is in area and add to global storage if it is
   for t = config.top_left_corner.x, config.bottom_right_corner.x do
     for f = config.top_left_corner.y, config.bottom_right_corner.y do
       pos = {x = t, y = f, z = 7}
       pid = getTopCreature(pos).uid
       if pid == target then
         setGlobalStorageValue(global_storage, getGlobalStorageValue(global_storage) + 1)
       end
     end
   end

   -- Start checks for waves of arena

   -- Wave 1
   if getGlobalStorageValue(global_storage) == 1 then
     for i = 1, #monster_config_wave_one do
       doCreateMonster(monster_config_wave_one[i].name, monster_config_wave_one[i].position)
     end
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Wave 1.")
   end

   -- Wave 2
   if getGlobalStorageValue(global_storage) == 5 then
     for i = 1, #monster_config_wave_two do
       doCreateMonster(monster_config_wave_two[i].name, monster_config_wave_two[i].position)
     end
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Wave 2.")
   end

   -- Wave 3
   if getGlobalStorageValue(global_storage) == 9 then
     for i = 1, #monster_config_wave_three do
       doCreateMonster(monster_config_wave_three[i].name, monster_config_wave_three[i].position)
     end
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Wave 3. Final Wave.")
   end

   -- When final wave ends

   -- Teleport player
   if getGlobalStorageValue(global_storage) == 13 then
     doTeleportThing(cid, config.reward_position)
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Congratulations! Go collect your reward.")
   end

   return true
end

Code:
---------------------------------- Start Config -------------------------------

local config = {
   arena_position = {x = 1035, y = 895, z = 9}, -- Player Arena Position
   failed_position = {x = 1000, y = 999, z = 7}, -- Player took too long position
   lever_reset_time = 15, -- in minutes (how long until another player can kick them out)
   global_storage = 11541, -- any free storage
   top_left_corner = {x = 1031, y = 891, z = 9}, -- top left corner of arena
   bottom_right_corner = {x = 1039, y = 898, z = 9}, -- bottom right corner of arena
   joke_monster = "rat" -- They will kill this monster to start the waves
}

----------------------------------- End Config --------------------------------

local function reset(p)
   doTransformItem(getTileItemById(p, 1946).uid, 1945)
end

local function teleport(cid)
   doTeleportThing(cid, config.arena_position)
   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "---------------------------------------")
   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Kill the creature to start Wave 1.")
   doCreateMonster(config.joke_monster, config.arena_position)
end

function onUse(cid, item, fromPosition, itemEx, toPosition)

   -- check if lever is currently used
   if item.itemid == 1946 then
     return doPlayerSendTextMessage(cid, 22, "Wait for switch to reset. It resets automatically every ".. config.lever_reset_time .." minutes.")
   end

   -- check for players/monsters in arena, and kick them out/remove them
   for t = config.top_left_corner.x, config.bottom_right_corner.x do
     for f = config.top_left_corner.y, config.bottom_right_corner.y do
       pos = {x = t, y = f, z = 7}
       pid = getTopCreature(pos).uid
       if isPlayer(pid) then
         doTeleportThing(pid, config.failed_position)
         doPlayerSendTextMessage(pid, MESSAGE_STATUS_CONSOLE_BLUE, "Another player started the arena. You have been removed. Better luck next time!")
       end
       if isMonster(pid) then
         doRemoveCreature(pid)
       end
     end
   end

   -- tell player what to do
   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Lever resets automatically every ".. config.lever_reset_time .." minutes.")
   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Once the lever resets another player can start the arena.")
   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "If your still inside when another player starts, you will be removed from the arena and unable to continue.")

   -- reset global storage
   setGlobalStorageValue(global_storage, 0)

   -- teleport player to arena, send start message, create start/joke monster
   addEvent(teleport, 5000, cid)

   -- transform lever, and add reset
   doTransformItem(item.uid, item.itemid + 1)
   addEvent(reset, ((config.lever_reset_time * 60 * 1000) + 5000), toPosition)

   return true
end

I did add:
registerCreatureEvent(cid, "Arena_Death")
in "login.lua". And the action/event in "action.xml" and "creaturescripts.lua".

Do you know whats wrong?


Thanks for your effort and time. ;)

I use 0.3.6.
 
Last edited by a moderator:
So, I installed it and tested it but it has a problem.

When I use the lever it says this (which is normal ofc.)

9b7e0dd31883454be428a7356d9065d8.png


And I get teleported and the Rat spawns but if I kill it the server/script doesn't spawn any monsters from the waves.

Scripts how they are now:

Code:
local config = {
   reward_position = {x = 1053, y = 880, z = 9}, -- Teleport location when Arena is Cleared.
   global_storage = 13457, -- any free storage
   top_left_corner = {x = 1031, y = 891, z = 9}, -- top left corner of arena
   bottom_right_corner = {x = 1039, y = 898, z = 9} -- bottom right corner of arena
}

local monsters = { -- All monsters in arena (including joke monster)
   [1] = "rat",
   [2] = "cave rat",
   [3] = "spider",
   [4] = "snake",
   [1] = "bug"
}

local monster_config_wave_one = { -- wave 1
   [1] = {position = { x = 1032, y = 892, z = 9 }, name = "morgaroth"},
   [2] = {position = { x = 1038, y = 893, z = 9 }, name = "ghazbaran"},
   [3] = {position = { x = 1037, y = 897, z = 9 }, name = "apocalypse"},
   [4] = {position = { x = 1032, y = 898, z = 9 }, name = "zugurosh"}
}

local monster_config_wave_two = { -- wave 2
   [1] = {position = { x = 1032, y = 892, z = 9 }, name = "morgaroth"},
   [2] = {position = { x = 1038, y = 893, z = 9 }, name = "apocalypse"},
   [3] = {position = { x = 1037, y = 897, z = 9 }, name = "cobra"},
   [4] = {position = { x = 1032, y = 898, z = 9 }, name = "cobra"}
}

local monster_config_wave_three = { -- wave 3
   [1] = {position = { x = 1032, y = 892, z = 9 }, name = "ghazbaran"},
   [2] = {position = { x = 1038, y = 893, z = 9 }, name = "zugurosh"},
   [3] = {position = { x = 1037, y = 897, z = 9 }, name = "acid blob"},
   [4] = {position = { x = 1032, y = 898, z = 9 }, name = "cobra"}
}

function onKill(cid, target, damage, flags)
   -- check if target is player
   if isPlayer(target) then
     return true
   end

   -- check if target is on list of monsters in arena
   local name = getCreatureName(target):lower()
   count = 0
   for i = 1, #monsters do
     if name == monsters[i]:lower() then
       count = count + 1
     end
   end
   if count == 0 then -- if target is not on list
     return true
   end

   -- check if target is in area and add to global storage if it is
   for t = config.top_left_corner.x, config.bottom_right_corner.x do
     for f = config.top_left_corner.y, config.bottom_right_corner.y do
       pos = {x = t, y = f, z = 7}
       pid = getTopCreature(pos).uid
       if pid == target then
         setGlobalStorageValue(global_storage, getGlobalStorageValue(global_storage) + 1)
       end
     end
   end

   -- Start checks for waves of arena

   -- Wave 1
   if getGlobalStorageValue(global_storage) == 1 then
     for i = 1, #monster_config_wave_one do
       doCreateMonster(monster_config_wave_one[i].name, monster_config_wave_one[i].position)
     end
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Wave 1.")
   end

   -- Wave 2
   if getGlobalStorageValue(global_storage) == 5 then
     for i = 1, #monster_config_wave_two do
       doCreateMonster(monster_config_wave_two[i].name, monster_config_wave_two[i].position)
     end
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Wave 2.")
   end

   -- Wave 3
   if getGlobalStorageValue(global_storage) == 9 then
     for i = 1, #monster_config_wave_three do
       doCreateMonster(monster_config_wave_three[i].name, monster_config_wave_three[i].position)
     end
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Wave 3. Final Wave.")
   end

   -- When final wave ends

   -- Teleport player
   if getGlobalStorageValue(global_storage) == 13 then
     doTeleportThing(cid, config.reward_position)
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Congratulations! Go collect your reward.")
   end

   return true
end

Code:
---------------------------------- Start Config -------------------------------

local config = {
   arena_position = {x = 1035, y = 895, z = 9}, -- Player Arena Position
   failed_position = {x = 1000, y = 999, z = 7}, -- Player took too long position
   lever_reset_time = 15, -- in minutes (how long until another player can kick them out)
   global_storage = 11541, -- any free storage
   top_left_corner = {x = 1031, y = 891, z = 9}, -- top left corner of arena
   bottom_right_corner = {x = 1039, y = 898, z = 9}, -- bottom right corner of arena
   joke_monster = "rat" -- They will kill this monster to start the waves
}

----------------------------------- End Config --------------------------------

local function reset(p)
   doTransformItem(getTileItemById(p, 1946).uid, 1945)
end

local function teleport(cid)
   doTeleportThing(cid, config.arena_position)
   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "---------------------------------------")
   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Kill the creature to start Wave 1.")
   doCreateMonster(config.joke_monster, config.arena_position)
end

function onUse(cid, item, fromPosition, itemEx, toPosition)

   -- check if lever is currently used
   if item.itemid == 1946 then
     return doPlayerSendTextMessage(cid, 22, "Wait for switch to reset. It resets automatically every ".. config.lever_reset_time .." minutes.")
   end

   -- check for players/monsters in arena, and kick them out/remove them
   for t = config.top_left_corner.x, config.bottom_right_corner.x do
     for f = config.top_left_corner.y, config.bottom_right_corner.y do
       pos = {x = t, y = f, z = 7}
       pid = getTopCreature(pos).uid
       if isPlayer(pid) then
         doTeleportThing(pid, config.failed_position)
         doPlayerSendTextMessage(pid, MESSAGE_STATUS_CONSOLE_BLUE, "Another player started the arena. You have been removed. Better luck next time!")
       end
       if isMonster(pid) then
         doRemoveCreature(pid)
       end
     end
   end

   -- tell player what to do
   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Lever resets automatically every ".. config.lever_reset_time .." minutes.")
   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Once the lever resets another player can start the arena.")
   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "If your still inside when another player starts, you will be removed from the arena and unable to continue.")

   -- reset global storage
   setGlobalStorageValue(global_storage, 0)

   -- teleport player to arena, send start message, create start/joke monster
   addEvent(teleport, 5000, cid)

   -- transform lever, and add reset
   doTransformItem(item.uid, item.itemid + 1)
   addEvent(reset, ((config.lever_reset_time * 60 * 1000) + 5000), toPosition)

   return true
end

I did add: in "login.lua". And the action/event in "action.xml" and "creaturescripts.lua".

Do you know whats wrong?


Thanks for your effort and time. ;)

I use 0.3.6.
You need to add the creatures to the list of monsters in arena_death, and both global storages need to be the same.
 
You need to add the creatures to the list of monsters in arena_death, and both global storages need to be the same.
Hm, I set the global storages the same and added the monsters is arena_death.lua but It doesn't work did I added them wrong?

Code:
local config = {
   reward_position = {x = 1053, y = 880, z = 9}, -- Teleport location when Arena is Cleared.
   global_storage = 13457, -- any free storage
   top_left_corner = {x = 1031, y = 891, z = 9}, -- top left corner of arena
   bottom_right_corner = {x = 1039, y = 898, z = 9} -- bottom right corner of arena
}

local monsters = { -- All monsters in arena (including joke monster)
   [1] = "rat",
   [2] = "cave rat",
   [3] = "spider",
   [4] = "snake",
   [5] = "morgaroth",
-- Also tested it with morgaroth, ghazbaran ect. on [1], [2] ect.
   [6] = "ghazbaran",
   [7] = "apocalypse",
   [8] = "zugurosh"
}

local monster_config_wave_one = { -- wave 1
   [1] = {position = { x = 1032, y = 892, z = 9 }, name = "morgaroth"},
   [2] = {position = { x = 1038, y = 893, z = 9 }, name = "ghazbaran"},
   [3] = {position = { x = 1037, y = 897, z = 9 }, name = "apocalypse"},
   [4] = {position = { x = 1032, y = 898, z = 9 }, name = "zugurosh"}
}

local monster_config_wave_two = { -- wave 2
   [1] = {position = { x = 1032, y = 892, z = 9 }, name = "morgaroth"},
   [2] = {position = { x = 1038, y = 893, z = 9 }, name = "apocalypse"},
   [3] = {position = { x = 1037, y = 897, z = 9 }, name = "cobra"},
   [4] = {position = { x = 1032, y = 898, z = 9 }, name = "cobra"}
}

local monster_config_wave_three = { -- wave 3
   [1] = {position = { x = 1032, y = 892, z = 9 }, name = "ghazbaran"},
   [2] = {position = { x = 1038, y = 893, z = 9 }, name = "zugurosh"},
   [3] = {position = { x = 1037, y = 897, z = 9 }, name = "acid blob"},
   [4] = {position = { x = 1032, y = 898, z = 9 }, name = "cobra"}
}

function onKill(cid, target, damage, flags)
   -- check if target is player
   if isPlayer(target) then
     return true
   end

   -- check if target is on list of monsters in arena
   local name = getCreatureName(target):lower()
   count = 0
   for i = 1, #monsters do
     if name == monsters[i]:lower() then
       count = count + 1
     end
   end
   if count == 0 then -- if target is not on list
     return true
   end

   -- check if target is in area and add to global storage if it is
   for t = config.top_left_corner.x, config.bottom_right_corner.x do
     for f = config.top_left_corner.y, config.bottom_right_corner.y do
       pos = {x = t, y = f, z = 7}
       pid = getTopCreature(pos).uid
       if pid == target then
         setGlobalStorageValue(global_storage, getGlobalStorageValue(global_storage) + 1)
       end
     end
   end

   -- Start checks for waves of arena

   -- Wave 1
   if getGlobalStorageValue(global_storage) == 1 then
     for i = 1, #monster_config_wave_one do
       doCreateMonster(monster_config_wave_one[i].name, monster_config_wave_one[i].position)
     end
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Wave 1.")
   end

   -- Wave 2
   if getGlobalStorageValue(global_storage) == 5 then
     for i = 1, #monster_config_wave_two do
       doCreateMonster(monster_config_wave_two[i].name, monster_config_wave_two[i].position)
     end
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Wave 2.")
   end

   -- Wave 3
   if getGlobalStorageValue(global_storage) == 9 then
     for i = 1, #monster_config_wave_three do
       doCreateMonster(monster_config_wave_three[i].name, monster_config_wave_three[i].position)
     end
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Wave 3. Final Wave.")
   end

   -- When final wave ends

   -- Teleport player
   if getGlobalStorageValue(global_storage) == 13 then
     doTeleportThing(cid, config.reward_position)
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Congratulations! Go collect your reward.")
   end

   return true
end

Code:
---------------------------------- Start Config -------------------------------

local config = {
   arena_position = {x = 1035, y = 895, z = 9}, -- Player Arena Position
   failed_position = {x = 1000, y = 999, z = 7}, -- Player took too long position
   lever_reset_time = 15, -- in minutes (how long until another player can kick them out)
   global_storage = 13457, -- any free storage
   top_left_corner = {x = 1031, y = 891, z = 9}, -- top left corner of arena
   bottom_right_corner = {x = 1039, y = 898, z = 9}, -- bottom right corner of arena
   joke_monster = "rat" -- They will kill this monster to start the waves
}

----------------------------------- End Config --------------------------------

local function reset(p)
   doTransformItem(getTileItemById(p, 1946).uid, 1945)
end

local function teleport(cid)
   doTeleportThing(cid, config.arena_position)
   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "---------------------------------------")
   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Kill the creature to start Wave 1.")
   doCreateMonster(config.joke_monster, config.arena_position)
end

function onUse(cid, item, fromPosition, itemEx, toPosition)

   -- check if lever is currently used
   if item.itemid == 1946 then
     return doPlayerSendTextMessage(cid, 22, "Wait for switch to reset. It resets automatically every ".. config.lever_reset_time .." minutes.")
   end

   -- check for players/monsters in arena, and kick them out/remove them
   for t = config.top_left_corner.x, config.bottom_right_corner.x do
     for f = config.top_left_corner.y, config.bottom_right_corner.y do
       pos = {x = t, y = f, z = 7}
       pid = getTopCreature(pos).uid
       if isPlayer(pid) then
         doTeleportThing(pid, config.failed_position)
         doPlayerSendTextMessage(pid, MESSAGE_STATUS_CONSOLE_BLUE, "Another player started the arena. You have been removed. Better luck next time!")
       end
       if isMonster(pid) then
         doRemoveCreature(pid)
       end
     end
   end

   -- tell player what to do
   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Lever resets automatically every ".. config.lever_reset_time .." minutes.")
   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Once the lever resets another player can start the arena.")
   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "If your still inside when another player starts, you will be removed from the arena and unable to continue.")

   -- reset global storage
   setGlobalStorageValue(global_storage, 0)

   -- teleport player to arena, send start message, create start/joke monster
   addEvent(teleport, 5000, cid)

   -- transform lever, and add reset
   doTransformItem(item.uid, item.itemid + 1)
   addEvent(reset, ((config.lever_reset_time * 60 * 1000) + 5000), toPosition)

   return true
end

Am I just retarded and added the monsters wrong? o_O:oops:

Thanks for your help and fast replies :)
 
Last edited by a moderator:
Hm, I set the global storages the same and added the monsters is arena_death.lua but It doesn't work did I added them wrong?

Code:
local config = {
   reward_position = {x = 1053, y = 880, z = 9}, -- Teleport location when Arena is Cleared.
   global_storage = 13457, -- any free storage
   top_left_corner = {x = 1031, y = 891, z = 9}, -- top left corner of arena
   bottom_right_corner = {x = 1039, y = 898, z = 9} -- bottom right corner of arena
}
 
local monsters = { -- All monsters in arena (including joke monster)
   [1] = "rat",
   [2] = "morgaroth",
   [3] = "ghazbaran",
   [4] = "apocalypse",
   [5] = "zugurosh",
   [6] = "cobra",
}
 
local monster_config_wave_one = { -- wave 1
   [1] = {position = { x = 1032, y = 892, z = 9 }, name = "morgaroth"},
   [2] = {position = { x = 1038, y = 893, z = 9 }, name = "ghazbaran"},
   [3] = {position = { x = 1037, y = 897, z = 9 }, name = "apocalypse"},
   [4] = {position = { x = 1032, y = 898, z = 9 }, name = "zugurosh"}
}
 
local monster_config_wave_two = { -- wave 2
   [1] = {position = { x = 1032, y = 892, z = 9 }, name = "morgaroth"},
   [2] = {position = { x = 1038, y = 893, z = 9 }, name = "apocalypse"},
   [3] = {position = { x = 1037, y = 897, z = 9 }, name = "cobra"},
   [4] = {position = { x = 1032, y = 898, z = 9 }, name = "cobra"}
}
 
local monster_config_wave_three = { -- wave 3
   [1] = {position = { x = 1032, y = 892, z = 9 }, name = "ghazbaran"},
   [2] = {position = { x = 1038, y = 893, z = 9 }, name = "zugurosh"},
   [3] = {position = { x = 1037, y = 897, z = 9 }, name = "acid blob"},
   [4] = {position = { x = 1032, y = 898, z = 9 }, name = "cobra"}
}
 
function onKill(cid, target, damage, flags)
   -- check if target is player
   if isPlayer(target) then
     return true
   end
 
   -- check if target is on list of monsters in arena
   local name = getCreatureName(target):lower()
   count = 0
   for i = 1, #monsters do
     if name == monsters[i]:lower() then
       count = count + 1
     end
   end
   if count == 0 then -- if target is not on list
     return true
   end
 
   -- check if target is in area and add to global storage if it is
   for t = config.top_left_corner.x, config.bottom_right_corner.x do
     for f = config.top_left_corner.y, config.bottom_right_corner.y do
       pos = {x = t, y = f, z = 7}
       pid = getTopCreature(pos).uid
       if pid == target then
         setGlobalStorageValue(global_storage, getGlobalStorageValue(global_storage) + 1)
       end
     end
   end
 
   -- Start checks for waves of arena
 
   -- Wave 1
   if getGlobalStorageValue(global_storage) == 1 then
     for i = 1, #monster_config_wave_one do
       doCreateMonster(monster_config_wave_one[i].name, monster_config_wave_one[i].position)
     end
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Wave 1.")
   end
 
   -- Wave 2
   if getGlobalStorageValue(global_storage) == 5 then
     for i = 1, #monster_config_wave_two do
       doCreateMonster(monster_config_wave_two[i].name, monster_config_wave_two[i].position)
     end
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Wave 2.")
   end
 
   -- Wave 3
   if getGlobalStorageValue(global_storage) == 9 then
     for i = 1, #monster_config_wave_three do
       doCreateMonster(monster_config_wave_three[i].name, monster_config_wave_three[i].position)
     end
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Wave 3. Final Wave.")
   end
 
   -- When final wave ends
 
   -- Teleport player
   if getGlobalStorageValue(global_storage) == 13 then
     doTeleportThing(cid, config.reward_position)
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Congratulations! Go collect your reward.")
   end
 
   return true
end

Code:
---------------------------------- Start Config -------------------------------
 
local config = {
   arena_position = {x = 1035, y = 895, z = 9}, -- Player Arena Position
   failed_position = {x = 1000, y = 999, z = 7}, -- Player took too long position
   lever_reset_time = 15, -- in minutes (how long until another player can kick them out)
   global_storage = 13457, -- any free storage
   top_left_corner = {x = 1031, y = 891, z = 9}, -- top left corner of arena
   bottom_right_corner = {x = 1039, y = 898, z = 9}, -- bottom right corner of arena
   joke_monster = "rat" -- They will kill this monster to start the waves
}
 
----------------------------------- End Config --------------------------------
 
local function reset(p)
   doTransformItem(getTileItemById(p, 1946).uid, 1945)
end
 
local function teleport(cid)
   doTeleportThing(cid, config.arena_position)
   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "---------------------------------------")
   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Kill the creature to start Wave 1.")
   doCreateMonster(config.joke_monster, config.arena_position)
end
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
 
   -- check if lever is currently used
   if item.itemid == 1946 then
     return doPlayerSendTextMessage(cid, 22, "Wait for switch to reset. It resets automatically every ".. config.lever_reset_time .." minutes.")
   end
 
   -- check for players/monsters in arena, and kick them out/remove them
   for t = config.top_left_corner.x, config.bottom_right_corner.x do
     for f = config.top_left_corner.y, config.bottom_right_corner.y do
       pos = {x = t, y = f, z = 7}
       pid = getTopCreature(pos).uid
       if isPlayer(pid) then
         doTeleportThing(pid, config.failed_position)
         doPlayerSendTextMessage(pid, MESSAGE_STATUS_CONSOLE_BLUE, "Another player started the arena. You have been removed. Better luck next time!")
       end
       if isMonster(pid) then
         doRemoveCreature(pid)
       end
     end
   end
 
   -- tell player what to do
   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Lever resets automatically every ".. config.lever_reset_time .." minutes.")
   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Once the lever resets another player can start the arena.")
   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "If your still inside when another player starts, you will be removed from the arena and unable to continue.")
 
   -- reset global storage
   setGlobalStorageValue(global_storage, 0)
 
   -- teleport player to arena, send start message, create start/joke monster
   addEvent(teleport, 5000, cid)
 
   -- transform lever, and add reset
   doTransformItem(item.uid, item.itemid + 1)
   addEvent(reset, ((config.lever_reset_time * 60 * 1000) + 5000), toPosition)
 
   return true
end

Am I just retarded and added the monsters wrong? o_O:oops:

Thanks for your help and fast replies :)
Nope. This is more of a scripting issue. I didnt plan on people placing the arena on anything other then ground 7. I'm on my phone so very limited text ability. Because your arena is on floor 9 instead of floor 7 you'll need to edit both scripts.. this line ugh
editing this soon

-- Edit

Monsters should look like this.
(should be removing un-needed monsters and adding ALL monsters in your script to this list.)
Code:
local monsters = { -- All monsters in arena (including joke monster)
[1] = "rat",
[2] = "morgaroth",
[3] = "ghazbaran",
[4] = "apocalypse",
[5] = "zugurosh",
[6] = "cobra",
[7] = "acid blob"
}
and this line needs to be changed. in BOTH scripts.
Code:
pos = {x = t, y = f, z = 7}
to this (your floor level)
Code:
pos = {x = t, y = f, z = 9}

My work computer blows some serious.. ugh.

But yeah, that's your main problem.
 
Last edited:
Nope. This is more of a scripting issue. I didnt plan on people placing the arena on anything other then ground 7. I'm on my phone so very limited text ability. Because your arena is on floor 9 instead of floor 7 you'll need to edit both scripts.. this line ugh
editing this soon
Ohh, okay, can I also copy and paste everything to floor 7 and change the coordinates?
 
Monsters should look like this.
(should be removing un-needed monsters and adding ALL monsters in your script to this list.)
Code:
local monsters = { -- All monsters in arena (including joke monster)
[1] = "rat",
[2] = "morgaroth",
[3] = "ghazbaran",
[4] = "apocalypse",
[5] = "zugurosh",
[6] = "cobra",
[7] = "acid blob"
}
Yea, I was kinda desperate and I tried much things so It looked kinda messy :p

Okay, Really nice it works now! but there is (probally) 1 problem left. That's that Wave 3 doesn't spawn. Well I was looking into it myself but I see nothing weird. I changed something, but same outcome I changed it back again. Here is it:
Code:
local config = {
   reward_position = {x = 1053, y = 880, z = 9}, -- Teleport location when Arena is Cleared.
   global_storage = 13457, -- any free storage
   top_left_corner = {x = 1031, y = 891, z = 9}, -- top left corner of arena
   bottom_right_corner = {x = 1039, y = 898, z = 9} -- bottom right corner of arena
}

local monsters = { -- All monsters in arena (including joke monster)
[1] = "rat",
[2] = "morgaroth",
[3] = "ghazbaran",
[4] = "apocalypse",
[5] = "zugurosh",
[6] = "cobra",
[7] = "acid blob"
}

local monster_config_wave_one = { -- wave 1
   [1] = {position = { x = 1032, y = 892, z = 9 }, name = "morgaroth"},
   [2] = {position = { x = 1038, y = 893, z = 9 }, name = "ghazbaran"},
   [3] = {position = { x = 1037, y = 897, z = 9 }, name = "apocalypse"},
   [4] = {position = { x = 1032, y = 898, z = 9 }, name = "zugurosh"}
}

local monster_config_wave_two = { -- wave 2
   [1] = {position = { x = 1032, y = 892, z = 9 }, name = "morgaroth"},
   [2] = {position = { x = 1038, y = 893, z = 9 }, name = "apocalypse"},
   [3] = {position = { x = 1037, y = 897, z = 9 }, name = "cobra"},
   [4] = {position = { x = 1032, y = 898, z = 9 }, name = "cobra"}
}

local monster_config_wave_three = { -- wave 3
   [1] = {position = { x = 1032, y = 892, z = 9 }, name = "ghazbaran"},
   [2] = {position = { x = 1038, y = 893, z = 9 }, name = "zugurosh"},
   [3] = {position = { x = 1037, y = 897, z = 9 }, name = "acid blob"},
   [4] = {position = { x = 1032, y = 898, z = 9 }, name = "cobra"}
}

function onKill(cid, target, damage, flags)
   -- check if target is player
   if isPlayer(target) then
     return true
   end

   -- check if target is on list of monsters in arena
   local name = getCreatureName(target):lower()
   count = 0
   for i = 1, #monsters do
     if name == monsters[i]:lower() then
       count = count + 1
     end
   end
   if count == 0 then -- if target is not on list
     return true
   end

   -- check if target is in area and add to global storage if it is
   for t = config.top_left_corner.x, config.bottom_right_corner.x do
     for f = config.top_left_corner.y, config.bottom_right_corner.y do
       pos = {x = t, y = f, z = 9}
       pid = getTopCreature(pos).uid
       if pid == target then
         setGlobalStorageValue(global_storage, getGlobalStorageValue(global_storage) + 1)
       end
     end
   end

   -- Start checks for waves of arena

   -- Wave 1
   if getGlobalStorageValue(global_storage) == 1 then
     for i = 1, #monster_config_wave_one do
       doCreateMonster(monster_config_wave_one[i].name, monster_config_wave_one[i].position)
     end
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Wave 1.")
   end

   -- Wave 2
   if getGlobalStorageValue(global_storage) == 5 then
     for i = 1, #monster_config_wave_two do
       doCreateMonster(monster_config_wave_two[i].name, monster_config_wave_two[i].position)
     end
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Wave 2.")
   end

   -- Wave 3
   if getGlobalStorageValue(global_storage) == 9 then
     for i = 1, #monster_config_wave_three do
       doCreateMonster(monster_config_wave_three[i].name, monster_config_wave_three[i].position)
     end
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Wave 3. Final Wave.")
   end

   -- When final wave ends

   -- Teleport player
   if getGlobalStorageValue(global_storage) == 13 then
     doTeleportThing(cid, config.reward_position)
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Congratulations! Go collect your reward.")
   end

   return true
end

Thanks for your time <3
 
Yea, I was kinda desperate and I tried much things so It looked kinda messy :p

Okay, Really nice it works now! but there is (probally) 1 problem left. That's that Wave 3 doesn't spawn. Well I was looking into it myself but I see nothing weird. I changed something, but same outcome I changed it back again. Here is it:
Code:
local config = {
   reward_position = {x = 1053, y = 880, z = 9}, -- Teleport location when Arena is Cleared.
   global_storage = 13457, -- any free storage
   top_left_corner = {x = 1031, y = 891, z = 9}, -- top left corner of arena
   bottom_right_corner = {x = 1039, y = 898, z = 9} -- bottom right corner of arena
}

local monsters = { -- All monsters in arena (including joke monster)
[1] = "rat",
[2] = "morgaroth",
[3] = "ghazbaran",
[4] = "apocalypse",
[5] = "zugurosh",
[6] = "cobra",
[7] = "acid blob"
}

local monster_config_wave_one = { -- wave 1
   [1] = {position = { x = 1032, y = 892, z = 9 }, name = "morgaroth"},
   [2] = {position = { x = 1038, y = 893, z = 9 }, name = "ghazbaran"},
   [3] = {position = { x = 1037, y = 897, z = 9 }, name = "apocalypse"},
   [4] = {position = { x = 1032, y = 898, z = 9 }, name = "zugurosh"}
}

local monster_config_wave_two = { -- wave 2
   [1] = {position = { x = 1032, y = 892, z = 9 }, name = "morgaroth"},
   [2] = {position = { x = 1038, y = 893, z = 9 }, name = "apocalypse"},
   [3] = {position = { x = 1037, y = 897, z = 9 }, name = "cobra"},
   [4] = {position = { x = 1032, y = 898, z = 9 }, name = "cobra"}
}

local monster_config_wave_three = { -- wave 3
   [1] = {position = { x = 1032, y = 892, z = 9 }, name = "ghazbaran"},
   [2] = {position = { x = 1038, y = 893, z = 9 }, name = "zugurosh"},
   [3] = {position = { x = 1037, y = 897, z = 9 }, name = "acid blob"},
   [4] = {position = { x = 1032, y = 898, z = 9 }, name = "cobra"}
}

function onKill(cid, target, damage, flags)
   -- check if target is player
   if isPlayer(target) then
     return true
   end

   -- check if target is on list of monsters in arena
   local name = getCreatureName(target):lower()
   count = 0
   for i = 1, #monsters do
     if name == monsters[i]:lower() then
       count = count + 1
     end
   end
   if count == 0 then -- if target is not on list
     return true
   end

   -- check if target is in area and add to global storage if it is
   for t = config.top_left_corner.x, config.bottom_right_corner.x do
     for f = config.top_left_corner.y, config.bottom_right_corner.y do
       pos = {x = t, y = f, z = 9}
       pid = getTopCreature(pos).uid
       if pid == target then
         setGlobalStorageValue(global_storage, getGlobalStorageValue(global_storage) + 1)
       end
     end
   end

   -- Start checks for waves of arena

   -- Wave 1
   if getGlobalStorageValue(global_storage) == 1 then
     for i = 1, #monster_config_wave_one do
       doCreateMonster(monster_config_wave_one[i].name, monster_config_wave_one[i].position)
     end
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Wave 1.")
   end

   -- Wave 2
   if getGlobalStorageValue(global_storage) == 5 then
     for i = 1, #monster_config_wave_two do
       doCreateMonster(monster_config_wave_two[i].name, monster_config_wave_two[i].position)
     end
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Wave 2.")
   end

   -- Wave 3
   if getGlobalStorageValue(global_storage) == 9 then
     for i = 1, #monster_config_wave_three do
       doCreateMonster(monster_config_wave_three[i].name, monster_config_wave_three[i].position)
     end
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Wave 3. Final Wave.")
   end

   -- When final wave ends

   -- Teleport player
   if getGlobalStorageValue(global_storage) == 13 then
     doTeleportThing(cid, config.reward_position)
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Congratulations! Go collect your reward.")
   end

   return true
end

Thanks for your time <3
I see nothing wrong. Restart server and try again.. and post/check console for errors.
 
I see nothing wrong. Restart server and try again.. and post/check console for errors.
Hm, This is really weird. When I use the lever with a normal character (or a God Character) it doesn't go to Wave 3 after I killed every monster. When the NORMAL player pulls the lever and I go to the Arena with a God Character and Spam some spells so every monster die as quicly as possible it does spawn the Acid Blob :eek: (This happens only when the NORMAL player kills the Rat (Joke monster)).

Hope you understand. Because I don't lol.
No errors in Console. o_O

:(
 
Last edited by a moderator:
Hm, This is really weird. When I use the lever with a normal character (or a God Character) it doesn't go to Wave 3 after I killed every monster. When the NORMAL player pulls the lever and I go to the Arena with a God Character and Spam some spells so every monster die as quicly as possible it does spawn the Acid Blob :eek: (This happens only when the NORMAL player kills the Rat (Joke monster)).

Hope you understand. Because I don't lol.
No errors in Console. o_O

:(
Let's take this to pm, so we don't bump the thread to infinity. :p

-- Edit

Ending up being a monster naming issue.
Had edited custom monsters which had different file names then the actual monster name.

If this happens to you, spawn the monster using the filename, and check the monster name in the list of monsters.
(Or simply make all the monster filenames the same as the monster name and avoid the confusion.)

Cheers.
 
Last edited:
You scripts spells my friend? in that case i would like a spell for my "hunter" vocation (paladin) so he drops a open trap infront of him and when it shuts (do damage) it disappers.
only 1 trap at time :)
 
You scripts spells my friend? in that case i would like a spell for my "hunter" vocation (paladin) so he drops a open trap infront of him and when it shuts (do damage) it disappers.
only 1 trap at time :)
Nope. :( Spells are really different from the regular scripting. I have not worked with them, and when I've tried, it was just a giant waste of time. lol Sorry. :<
 
You scripts spells my friend? in that case i would like a spell for my "hunter" vocation (paladin) so he drops a open trap infront of him and when it shuts (do damage) it disappers.
only 1 trap at time :)
So basically you cast a spell like "i gotta go.. i gotta go real bad" and something falls on the ground making this "PLOP!", "Bloop!" "bloop.." then someone walks by and steps in/on it and they yell "Euwww" and it disappears on under their shoe and they run away...

Just kidding :p
 
naaah thats pretty much it Codex haha! no but i want the trap working just like it is in tibia right now, but just use it with a spell instead :) as RL i does not disapper when shut tho :)
 
naaah thats pretty much it Codex haha! no but i want the trap working just like it is in tibia right now, but just use it with a spell instead :) as RL i does not disapper when shut tho :)
It may not summon the item in front but its a start, I just took the animate dead script and edited it.
Code:
    local function doCreateTrap(pos)
        local trapId = 2579
        doCreateItem(trapId, 1, pos)
        doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
        return true
    end

    function onCastSpell(cid, var)
        local pos = variantToPosition(var)
        if(pos.x ~= 0 and pos.y ~= 0) then
            return doCreateTrap(pos)
        end

        doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
        doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
        return false
    end
 
Last edited:
Status
Not open for further replies.
Back
Top