Piifafa
Member
- Joined
- Apr 16, 2023
- Messages
- 67
- Reaction score
- 16
Hello friends, I'm trying to create a small Dungeon system on my server that is simple and functional. It uses almost an aside from my otserver's The Annihilator Quest script. In a few words I will show you how it works.
A person uses the lever and can pull it with up to 4 friends or alone.
Script:
1) Here I have a problem, I would like one person to enter, only every 24 hours, I don't know how to do this for the 4 who would enter there.
2) Another problem I have is how can I add more creatures than the ones I have? And how do I know why the dungeon is busy right now?
while they are there it is occupied, but if you go outside, it ends up being unoccupied, I would like the entire map to be occupied.
Thank you from the bottom of my heart to anyone who can help me! Good weekend to everyone.
A person uses the lever and can pull it with up to 4 friends or alone.
Script:
Lua:
function onUse(player, item, fromPosition, target, toPosition)
local annihiCenter = Position(6061, 5852, 7)
local spectators = Game.getSpectators(annihiCenter, false, false, 10, 10, 10, 10)
local needPlayers = 1
local demonSpots = {
Position(6057, 5856, 7),
Position(6059, 5857, 7),
Position(6060, 5862, 7),
Position(6058, 5862, 7),
Position(6056, 5865, 7),
Position(6058, 5871, 7),
Position(6057, 5879, 7),
Position(6068, 5879, 7),
Position(6065, 5876, 7),
Position(6070, 5871, 7),
Position(6077, 5875, 7),
Position(6082, 5867, 7),
Position(6075, 5853, 7),
Position(6064, 5858, 7),
Position(6064, 5868, 7),
}
for ci=1,#spectators do
local creature = spectators[ci]
if creature:isPlayer() then
player:sendTextMessage(MESSAGE_INFO_DESCR, "Have another team inside the annihilator.")
return true
end
end
for ci=1,#spectators do
local creature = spectators[ci]
if creature:isMonster() then
creature:remove()
end
end
for dsp=1,#demonSpots do
local dPos = demonSpots[dsp]
Game.createMonster('Big Orc Warrior',dPos)
end
local playersInside = {}
for pi=1,needPlayers do
local playerPos = Position(fromPosition.x-pi,fromPosition.y,fromPosition.z)
local PlayerTile = Tile(playerPos)
local player = PlayerTile:getTopCreature()
if player then
if player:isPlayer() then
local playerSpot = {pid=player,pos=playerPos}
table.insert(playersInside,playerSpot)
end
end
end
if #playersInside == needPlayers then
for pgo=1,needPlayers do
local player = playersInside[pgo].pid
local playerPos = playersInside[pgo].pos
playerPos:sendMagicEffect(CONST_ME_POFF)
local newPos = Position(annihiCenter.x-pgo,annihiCenter.y,annihiCenter.z)
player:teleportTo(newPos)
newPos:sendMagicEffect(CONST_ME_TELEPORT)
end
else
player:sendTextMessage(MESSAGE_INFO_DESCR, "You need ".. needPlayers .." players to start dungeon.")
return true
end
if item:getId() == 2773 then
item:transform(2772)
else
item:transform(2773)
end
return true
end
1) Here I have a problem, I would like one person to enter, only every 24 hours, I don't know how to do this for the 4 who would enter there.
2) Another problem I have is how can I add more creatures than the ones I have? And how do I know why the dungeon is busy right now?
while they are there it is occupied, but if you go outside, it ends up being unoccupied, I would like the entire map to be occupied.
Thank you from the bottom of my heart to anyone who can help me! Good weekend to everyone.