pimmie2333
New Member
- Joined
- Feb 12, 2008
- Messages
- 24
- Reaction score
- 1
I made a script for useful for solo bosses. It's not optimal yet and still needs implementation for player storage,
but it has most of important the functionality.
How it works:
Upon stepping in the tile with the AID, an area from position1 to position2 is checked for a player or creature.
If a player is found in the room he / she will be pushed back to a previous position, which also happens if there is no
(boss) creature or if the specified storage value is too high.
The player has an x amount of time to defeat to boss before he / she gets teleported out of the room.
Here's the code:
Here a necessary global function I use to make the script valid.
You could place it in your library:
And there you go
As I said, it's not completelty optimal, but I'll be updating.
but it has most of important the functionality.
How it works:
Upon stepping in the tile with the AID, an area from position1 to position2 is checked for a player or creature.
If a player is found in the room he / she will be pushed back to a previous position, which also happens if there is no
(boss) creature or if the specified storage value is too high.
The player has an x amount of time to defeat to boss before he / she gets teleported out of the room.
Here's the code:
Code:
local storage = 12007 -- storage for this quest
local positions = {
[1] = {x = 1000, y = 1232, z = 8}, -- home position
[2] = {x = 994, y = 1232, z = 9} -- boss room position
}
local coords = {
[1] = 979, -- upper left corner of room
[2] = 996, -- upper right corner "
[3] = 1228, -- upper left corner "
[4] = 1241, -- bottom left corner "
[5] = 9 -- z position
}
function onStepIn(cid)
local typemsg = MESSAGE_INFO_DESCR
local isBoss
if(getCreatureStorage(cid, storage) < 2) then
for xPos = coords[1], coords[2] do
for yPos = coords[3], coords[4] do
pos = {x = xPos, y = yPos, z = coords[5]}
local pid = getTopCreature(pos).uid
if(isPlayer(pid)) then
msg = "Someone else is already doing this quest, wait a little longer."
doTeleport(cid, positions[1], msg, typemsg)
elseif(isCreature(pid)) then
isBoss = true
end
end
end
if(isBoss) then
typemsg = MESSAGE_STATUS_WARNING
msg = "You have 10 minutes to defeat this boss, for you will be kicked out after that time passes."
doTeleport(cid, positions[2], msg, typemsg)
addEvent(bossTimer, 10*60*1000, cid)
elseif(not isBoss) then
msg = "This boss was just defeated, please wait for it to respawn."
doTeleport(cid, positions[1], msg, typemsg)
else
msg = "You have already defeated this boss."
doTeleport(cid, positions[1], msg, typemsg)
return true
end
end
end
function bossTimer(cid)
for xPos = coords[1], coords[2] do
for yPos = coords[3], coords[4] do
pos = {x = xPos, y = yPos, z = coords[5]}
local pid = getTopCreature(pos).uid
if(isPlayer(pid)) then
if(cid == pid) then
doTeleport(pid, positions[1])
end
end
end
end
end
Here a necessary global function I use to make the script valid.
You could place it in your library:
Code:
function doTeleport(cid, position, msg, typemsg)
if(msg ~= nil) then
doPlayerSendTextMessage(cid, typemsg, msg)
end
doTeleportThing(cid, position, false)
doSendMagicEffect(position, CONST_ME_TELEPORT)
end
And there you go
As I said, it's not completelty optimal, but I'll be updating.
Last edited: