ralke
(҂ ͠❛ ෴ ͡❛)ᕤ
Hi, I want to request some modifications for this script, to use it as quest/boss room script.
a) No matter if you fill all the positions, or go alone, you can enter the quest.
b) Get kicked out from area if you stay longer than 15 minutes.
c) Check multi-clients (can't place 2 MC's in player positions).
d) Clean-up monsters when room is empty and players pull the lever to enter, spawn new ones in desired positions.
The annihilator script:
Annihilator example V2 (with monster spawn):
Multiclient check example:
Check area example:
Kick-out example:
I guess that the check area can't be an action. Also recopiled information but im not skilled enought to do the script myself.
If possible, don't use revscript system, I would like to have the scripts separately and register them.
Thanks in advance!
Edit// Sorry for double-posting, found something similar to what I requested here:
There's some functions I requested that still missing, but the one I found is really good!
a) No matter if you fill all the positions, or go alone, you can enter the quest.
b) Get kicked out from area if you stay longer than 15 minutes.
c) Check multi-clients (can't place 2 MC's in player positions).
d) Clean-up monsters when room is empty and players pull the lever to enter, spawn new ones in desired positions.
The annihilator script:
Code:
local playerPosition = {
{x = 247, y = 659, z = 13},
{x = 247, y = 660, z = 13},
{x = 247, y = 661, z = 13},
{x = 247, y = 662, z = 13}
}
local newPosition = {
{x = 189, y = 650, z = 13},
{x = 189, y = 651, z = 13},
{x = 189, y = 652, z = 13},
{x = 189, y = 653, z = 13}
}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if item.itemid == 1945 then
local players = {}
for _, position in ipairs(playerPosition) do
local topPlayer = Tile(position):getTopCreature()
if topPlayer == nil or not topPlayer:isPlayer() or topPlayer:getLevel() < 100 or topPlayer:getStorageValue(30015) ~= -1 then
player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_NOTPOSSIBLE))
return false
end
players[#players + 1] = topPlayer
end
for i, targetPlayer in ipairs(players) do
Position(playerPosition[i]):sendMagicEffect(CONST_ME_POFF)
targetPlayer:teleportTo(newPosition[i], false)
targetPlayer:getPosition():sendMagicEffect(CONST_ME_ENERGYAREA)
end
item:transform(1946)
elseif item.itemid == 1946 then
player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_NOTPOSSIBLE))
end
return true
end
Annihilator example V2 (with monster spawn):
Code:
-- Annihilator by Shawak v2.1
-- CONFIG --
local room = { -- room with demons
fromX = 1497,
fromY = 990,
fromZ = 13,
--------------
toX = 1504,
toY = 998,
toZ = 13
}
local monster_pos = {
[1] = {pos = {1499, 992, 13}, monster = "Annihilator"},
[2] = {pos = {1501, 992, 13}, monster = "Annihilator"},
[3] = {pos = {1500, 996, 13}, monster = "Annihilator"},
[4] = {pos = {1502, 996, 13}, monster = "Annihilator"},
[5] = {pos = {1503, 994, 13}, monster = "Annihilator"},
[6] = {pos = {1504, 994, 13}, monster = "Annihilator"}
}
local players_pos = {
{x = 1505, y =1006, z = 13, stackpos = 253},
{x = 1504, y =1006, z = 13, stackpos = 253},
{x = 1503, y =1006, z = 13, stackpos = 253},
{x = 1502, y =1006, z = 13, stackpos = 253}
}
local new_player_pos = {
{x = 1502, y = 994, z = 13},
{x = 1501, y = 994, z = 13},
{x = 1500, y = 994, z = 13},
{x = 1499, y = 994, z = 13}
}
local playersOnly = "yes"
local questLevel = 100
------------------------------------------------------
--- CONFIG END ---------------------------------------
------------------------------------------------------
function onUse(cid, item, fromPosition, itemEx, toPosition)
local all_ready, monsters, player, level = 0, 0, {}, 0
if item.itemid == 1945 then
for i = 1, #players_pos do
table.insert(player, 0)
end
for i = 1, #players_pos do
player[i] = getThingfromPos(players_pos[i])
if player[i].itemid > 0 then
if string.lower(playersOnly) == "yes" then
if isPlayer(player[i].uid) == TRUE then
all_ready = all_ready+1
else
monsters = monsters+1
end
else
all_ready = all_ready+1
end
end
end
if all_ready == #players_pos then
for i = 1, #players_pos do
player[i] = getThingfromPos(players_pos[i])
if isPlayer(player[i].uid) == TRUE then
if getPlayerLevel(player[i].uid) >= questLevel then
level = level+1
end
else
level = level+1
end
end
if level == #players_pos then
if string.lower(playersOnly) == "yes" and monsters == 0 or string.lower(playersOnly) == "no" then
local door = getTileItemById({x=1505, y=994, z=13}, 5109).uid
if door > 0 then
doTransformItem(door, 5108)
end
for _, area in pairs(monster_pos) do
doSummonCreature(area.monster,{x=area.pos[1],y=area.pos[2],z=area.pos[3]})
end
for i = 1, #players_pos do
doSendMagicEffect(players_pos[i], CONST_ME_POFF)
doTeleportThing(player[i].uid, new_player_pos[i], FALSE)
doSendMagicEffect(new_player_pos[i], CONST_ME_ENERGYAREA)
doTransformItem(item.uid,1946)
end
else
doPlayerSendTextMessage(cid,19,"Only players can do this quest.")
end
else
doPlayerSendTextMessage(cid,19,"All players have to be level "..questLevel.." to do this quest.")
end
else
doPlayerSendTextMessage(cid,19,"You need "..table.getn(players_pos).." players to do this quest.")
end
elseif item.itemid == 1946 then
local player_room = 0
for x = room.fromX, room.toX do
for y = room.fromY, room.toY do
for z = room.fromZ, room.toZ do
local pos = {x=x, y=y, z=z,stackpos = 253}
local thing = getThingfromPos(pos)
if thing.itemid > 0 then
if isPlayer(thing.uid) == TRUE then
player_room = player_room+1
end
end
end
end
end
if player_room >= 1 then
doPlayerSendTextMessage(cid,19,"There is already a team in the quest room.")
elseif player_room == 0 then
for x = room.fromX, room.toX do
for y = room.fromY, room.toY do
for z = room.fromZ, room.toZ do
local pos = {x=x, y=y, z=z,stackpos = 253}
local thing = getThingfromPos(pos)
if thing.itemid > 0 then
doRemoveCreature(thing.uid)
end
end
end
end
doTransformItem(item.uid,1945)
end
end
return TRUE
end
Multiclient check example:
Code:
local checkMc = {}
for i = 1, #config.playerPositions do
playerTile = Tile(config.playerPositions[i]):getTopCreature()
local getIp = playerTile:getIp()
if checkMc[getIp] == true then
return false -- here is someone with mc
end
checkMc[getIp] = true
end
Check area example:
Code:
local function doCheckArea()
local upConer = {x = 32424, y = 32507, z = 7} -- upLeftCorner
local downConer = {x = 32459, y = 32542, z = 7} -- downRightCorner
for i = upConer.x, downConer.x do
for j = upConer.y, downConer.y do
for k = upConer.z, downConer.z do
local room = {x = i, y = j, z = k}
local tile = Tile(room)
if tile then
local creatures = tile:getCreatures()
if creatures and #creatures > 0 then
for _, c in pairs(creatures) do
if isPlayer(c) then
return true
end
Kick-out example:
CreatureEvent - [TFS 1.1] Classic PVP Arena
If you playd on 7.6 you probably know how famous pvp arena from yur evo or sinteria worked. This place allows you to test your pvp skills without risk of death. Installation(lever script coming soon so I included stuff from action already) creaturescripts.xml pvparena.lua local arena = {...
otland.net
Code:
function kick_r()
if getCreaturesInQuestArea(TYPE_PLAYER, arena.frompos, arena.topos, GET_COUNT) > 1 then
for a = arena.frompos.x, arena.topos.x do
for b = arena.frompos.y, arena.topos.y do
pos = {x=a,y=b,z=11,stackpos = 255}
if(isPlayer(getTopCreature(pos).uid)) then
doPlayerSendTextMessage(getTopCreature(pos).uid,MESSAGE_INFO_DESCR,"Time up. Round drawn.")
doTeleportThing(getTopCreature(pos).uid,arena.exitpos)
end
end
end
end
return true
end
I guess that the check area can't be an action. Also recopiled information but im not skilled enought to do the script myself.
If possible, don't use revscript system, I would like to have the scripts separately and register them.
Thanks in advance!
Post automatically merged:
Edit// Sorry for double-posting, found something similar to what I requested here:
Lua - [TFS 1.3] Free Scripting Service 📝
I am bored, and I have some days in which I will not have much to do, if you need a script you can post here what you want and if it meets the requirements below, I will do it for you 🗒 Requirements: 🔶 TFS engine 1.3+ 🔶 That does not include changes in the sources (if you don't know what this...
otland.net
There's some functions I requested that still missing, but the one I found is really good!
Last edited: