Action Advanced Annihilator

Azi

Banned User
Joined
Aug 12, 2007
Messages
1,167
Best answers
0
Reaction score
51
Location
Włocławek
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
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"/>
6969 -- uniqueid of lever.
 
Last edited:

StreamSide

Joseluis Gonzalez
Support Team
Joined
Aug 31, 2007
Messages
3,329
Best answers
33
Reaction score
832
Location
Arica - Chile
Good, very good
Simple and very usefull :B
I use this for other quest xdd

P.S.: Sorry for my english :D
 

pierroth

Mar Co.
Joined
Sep 11, 2008
Messages
343
Best answers
0
Reaction score
10
Location
Mexico - California
[15/11/2008 03:56:04] Warning: [Event::loadScript] Can not load script. data/actions/scripts/quests/annihilator.lua
[15/11/2008 03:56:04] data/actions/scripts/quests/annihilator.lua:55: unexpected symbol near '['


Any help.. pls.
Can this be run on TFS 0.3?
 

elf

Sing, sing blue silver
Joined
Dec 11, 2007
Messages
3,665
Best answers
1
Reaction score
116
Location
Cracow, Poland
very messed up script, and the tabs... hell. Also, table.maxn(sometable) looks better than #sometable (like a comment? u.u)
I propose, to look at TFS' Annihilator script
 

pierroth

Mar Co.
Joined
Sep 11, 2008
Messages
343
Best answers
0
Reaction score
10
Location
Mexico - California
very messed up script, and the tabs... hell. Also, table.maxn(sometable) looks better than #sometable (like a comment? u.u)
I propose, to look at TFS' Annihilator script
I did and set the chests on the map and on actions.xml to 9001~9004 but whenever they try to open them, the chest converts to levers.
 

Awesome Slayer

New Member
Joined
Jul 16, 2008
Messages
58
Best answers
0
Reaction score
0
can you please post the script after its been fixed??
[17/11/2008 18:41:55] Warning: [Event::loadScript] Can not load script. data/actions/scripts/quests/annihilator1.lua
[17/11/2008 18:41:55] data/actions/scripts/quests/annihilator1.lua:55: unexpected symbol near '['
 

mpa

Member
Joined
Oct 8, 2008
Messages
319
Best answers
0
Reaction score
13
Location
Sweden
very messed up script, and the tabs... hell. Also, table.maxn(sometable) looks better than #sometable (like a comment? u.u)
I propose, to look at TFS' Annihilator script
Does that script summon the demons?
 

Serginov

Onkonkoronkonk
Joined
Jun 28, 2008
Messages
1,322
Best answers
0
Reaction score
18
Location
Sweden - Dalarna
I get error.
PHP:
[13/12/2008 17:15:56] Warning: [Event::loadScript] Can not load script. data/actions/scripts/anni.lua
[13/12/2008 17:15:56] data/actions/scripts/anni.lua:56: unexpected symbol near '['
 

averatec

Intermediate OT User
Joined
Jun 1, 2007
Messages
2,222
Best answers
2
Reaction score
145
Location
Poland
Code:
Warning: [Event::loadScript] Can not load script. data/actions/scripts/anihilator.lua
data/actions/scripts/anihilator.lua:56: unexpected symbol near '['
why can not I do it for 0.2?
 
Last edited:
Top