Exedion
Active Member
- Joined
- Jun 11, 2007
- Messages
- 629
- Reaction score
- 30
Well is based in the original script from tfs, the script in "tfs-mods" and "Demon Oak Quest" (you need the function "getCreaturesInRange" search in forum), well is easy to understend and set, here leave the script
Enjoy Please!
If you like, please rep++ me
LUA:
local config = {
level = 100,
storage = 30015,
entry =
{
{x = 4912, y = 5006, z = 10},
{x = 4911, y = 5006, z = 10},
{x = 4910, y = 5006, z = 10},
{x = 4909, y = 5006, z = 10}
},
destination =
{
{x = 4924, y = 5012, z = 10},
{x = 4923, y = 5012, z = 10},
{x = 4922, y = 5012, z = 10},
{x = 4921, y = 5012, z = 10}
},
monsters =
{
{{x = 4925, y = 5012, z = 10}, "Demon"},
{{x = 4926, y = 5012, z = 10}, "Demon"},
{{x = 4921, y = 5010, z = 10}, "Demon"},
{{x = 4923, y = 5010, z = 10}, "Demon"},
{{x = 4922, y = 5014, z = 10}, "Demon"},
{{x = 4924, y = 5014, z = 10}, "Demon"}
},
areaPosition =
{
{x=4920, y=5006, z=10, stackpos = 255},
{x=4939, y=5015, z=10, stackpos = 255}
}
}
config.daily = getBooleanFromString(config.daily)
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(item.itemid == 1946) then
if getCreaturesInRange("player", config.areaPosition[1], config.areaPosition[2], "count") > 0 then
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Please wait until the team finish the quest."), false
end
doTransformItem(item.uid, item.itemid - 1)
return true
end
if(item.itemid ~= 1945) then
return true
end
local players = {}
for _, position in ipairs(config.entry) do
local pid = getTopCreature(position).uid
if(pid == 0 or not isPlayer(pid) or getCreatureStorage(pid, config.storage) > 0 or getPlayerLevel(pid) < config.level) then
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "A player in your team have done this quest or don't have the required level."), false
end
table.insert(players, pid)
end
for i, pos in pairs(config.destination) do
local creature = getTopCreature(pos).uid
if(creature > 0 and not isPlayer(creature)) then
doRemoveCreature(creature)
end
end
for _, monster in pairs(config.monsters) do
local creature = getTopCreature(monster[1]).uid
if(creature > 0 and not isPlayer(creature)) then
doRemoveCreature(creature)
end
doCleanTile(monster[1])
doCreateMonster(monster[2], monster[1])
end
for i, pid in ipairs(players) do
doSendMagicEffect(config.entry[i], CONST_ME_POFF)
doTeleportThing(pid, config.destination[i], false)
doSendMagicEffect(config.destination[i], CONST_ME_ENERGYAREA)
end
doTransformItem(item.uid, item.itemid + 1)
return true
end
Enjoy Please!
If you like, please rep++ me