I greet you, this is a script written by me and once used on my own server. I decided to share it with you, this is a script in the Annihilator, but it can be used for many other quests, because very easily change the requirements for players and the monsters, and most importantly their quantity. simply add to the table, and the script automatically detects their quantity.
Additional benefits to the script:
• Automatic removal of monsters, after passing the time
• Automatic shifting lever after a certain period of time in order for the quest again
• Other players will not block the peace will be cast out after a given time (if someone will perform quest)
• Creating the monsters are always fresh, so there is no question about it, that will have a monster such as the tip of life.
data/actions/scripts: anni.lua
in actions.xml
6969 -- uniqueid of lever.
Additional benefits to the script:
• Automatic removal of monsters, after passing the time
• Automatic shifting lever after a certain period of time in order for the quest again
• Other players will not block the peace will be cast out after a given time (if someone will perform quest)
• Creating the monsters are always fresh, so there is no question about it, that will have a monster such as the tip of life.
data/actions/scripts: anni.lua
Code:
--- Coded by Azi [ ersiu ] ---
function onUse(cid, item, fromPosition, itemEx, toPosition)
local monstTime = 60 -- minutes to remove summoned monsters
local leverTime = 120 -- minutes to back lever to can use quest again
local players = { -- player quest need info
{standPos = {x=68, y=69, z=77}, -- player must stay on position to go quest
inroomPos = {x=120, y=121, z=9}, -- player teleport to quest position
allowVoc = {1,2,3,4,5,6,7,8}, -- player vocation allow go to quest
needLv = 100}, -- player required level to go quest
{standPos = {x=68, y=68, z=77},
inroomPos = {x=120, y=120, z=9},
allowVoc = {1,2,3,4,5,6,7,8},
needLv = 100},
{standPos = {x=68, y=67, z=77},
inroomPos = {x=120, y=119, z=9},
allowVoc = {1,2,3,4,5,6,7,8},
needLv = 100},
{standPos = {x=68, y=66, z=77},
inroomPos = {x=120, y=118, z=9},
allowVoc = {1,2,3,4,5,6,7,8},
needLv = 100}
}
local monsters = { -- summon monsters
{monsterPos = {x=66, y=69, z=77}, --- monster position
monsterName = "Demon"}, -- monster name
{monsterPos = {x=66, y=67, z=77},
monsterName = "Demon"},
{monsterPos = {x=70, y=68, z=77},
monsterName = "Demon"},
{monsterPos = {x=70, y=66, z=77},
monsterName = "Demon"},
{monsterPos = {x=68, y=70, z=77},
monsterName = "Demon"},
{monsterPos = {x=68, y=71, z=77},
monsterName = "Demon"}
}
local messages = { -- messages about error's with player requireds
'You need '..#players..' player\'s to go.',
'Someone in your team don\'t have required level.',
'Someone in your team don\'t have required vocation.'
}
local monster = {}
local goQuest = 0
local getError = 0
if(item.itemid == 1945)then
for p=1, #players do
players[p].standPos = {stackpos=253}
local thingPos[p] = getThingfromPos(players[p].standPos)
if(isPlayer(thingPos[p].uid) == TRUE and getError == 0)then
if(getPlayerLevel(thingPos[p].uid) > players[p].needLv and getError == 0)then
if(isInArray(players[p].allowVoc, getPlayerVocation(thingPos[p].uid)) and getError == 0)then
goQuest = 1
else
getError = 3
end
else
getError = 2
end
else
getError = 1
end
end
if(goQuest == 1)then
for m=1, #monsters do
monsters[m].monsterPos = {stackpos=253}
local thingPos[m] = getThingfromPos(monsters[m].monsterPos)
if(isCreature(thingPos[m].uid) == FALSE)then
monster[m] = doSummonCreature(monsters[m].monsterName, monsters[m].monsterPos)
else
doRemoveCreature(thingPos[m].uid)
monster[m] = doSummonCreature(monsters[m].monsterName, monsters[m].monsterPos)
end
end
for p=1, #players do
players[p].standPos = {stackpos=253}
local thingPos[p] = getThingfromPos(players[p].standPos)
players[p].inroomPos = {stackpos=253}
local roomThingPos[p] = getThingfromPos(players[p].inroomPos)
if(isPlayer(roomThingPos[p]) == FALSE)then
doTeleportThing(thingPos[p].uid, players[p].inroomPos)
else
doTeleportThing(roomThingPos[p].uid, players[p].standPos)
doTeleportThing(thingPos[p].uid, players[p].inroomPos)
end
end
elseif(getError > 0)then
doPlayerSendCancel(cid, messages[getError])
end
local function removeMonsters(monster)
for a=1, #monster do
doRemoveCreature(monster[a])
end
end
local function backlever(a)
doTransformItem(a.item.uid, a.item.itemid-1)
end
doTransformItem(item.uid, item.itemid+1)
addEvent(removeMonsters, 60*1000*monstTime, monster)
addEvent(backLever, 60*1000*leverTime, {'item'=item})
end
end
in actions.xml
Code:
<action uniqueid="6969" script="anni.lua"/>
Last edited: