Action [Release] Annihilator v2.1

Shawak

Intermediate OT User
Joined
Sep 11, 2008
Messages
1,976
Best answers
2
Reaction score
101
Location
Germany
I decidet to release my first annihilator script to a new verion,
not 100% tested so please report bugs on this theard, thanks ^_^.

Version:
TFS 0.3.5pl1

Credits:
Script:
100% by me, :rolleyes:.

Changelog:
v2.1:
Code:
- Fixed variables
- fixed "playersOnly", is working now
- fixed clean area
v2.0:
Code:
- Added "playersOnly" in config
- Now you can set different monsters in config
- Now you can easy add more positions, and it will work (For a new players_pos you have to add a new new_players_pos)
- Says you how much player you need
- Fixed some bugs
v1.0:
[Old Version]: http://otland.net/f81/finished-annihaltor-annihaltor-chests-forgotten-server-0-3-4-a-40571/

Script:
- data/actions/actions.xml
Lua:
	<action uniqueid="3030" event="script" value="Annihilator.lua"/>
- data/actions/scripts/annihilator.lua
Lua:
        -- Annihilator by Shawak v2.1

        -- CONFIG --

        local room = {     -- room with demons
        fromX = 870,
        fromY = 1035,
	fromZ = 7,
        --------------
        toX = 875,
        toY = 1039,
	toZ = 7
        }

        local monster_pos = {
        [1] = {pos = {870, 1035, 7}, monster = "Demon"},
        [2] = {pos = {872, 1035, 7}, monster = "Demon"},
        [3] = {pos = {871, 1039, 7}, monster = "Demon"},
        [4] = {pos = {873, 1039, 7}, monster = "Demon"},
        [5] = {pos = {874, 1037, 7}, monster = "Demon"},
        [6] = {pos = {875, 1037, 7}, monster = "Demon"}
        }

        local players_pos = {
        {x = 895, y =1037, z = 7, stackpos = 253},
        {x = 895, y =1038, z = 7, stackpos = 253},
        {x = 895, y =1039, z = 7, stackpos = 253},
        {x = 895, y =1040, z = 7, stackpos = 253}
        }

        local new_player_pos = {
        {x = 873, y = 1037, z = 7},
        {x = 872, y = 1037, z = 7},
        {x = 871, y = 1037, z = 7},
        {x = 870, y = 1037, z = 7}
        }

        local playersOnly = "no"
        local questLevel = 101

        ------------------------------------------------------
        --- 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 
                                        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
If you don't understand the part where i wrote "room with demons", read this:
http://otland.net/448696-post25.html, :thumbup:.

I hope you like it, :).

Regards,
Shawak
 
Last edited:

Syntax

Developer
Joined
Oct 10, 2007
Messages
2,840
Best answers
0
Reaction score
200
Location
Texas
holy skittles batman this is a nice release. Gratz buddy.
 

Wodian

Lorensia Developer.
Joined
Jun 2, 2007
Messages
204
Best answers
0
Reaction score
7
Location
The Netherlands
Many thanks about this code. Seems it is working perfectly on TFS 0.3.5pl1 :)

You deserve rep++
Wodian,,
 
OP
Shawak

Shawak

Intermediate OT User
Joined
Sep 11, 2008
Messages
1,976
Best answers
2
Reaction score
101
Location
Germany
Many thanks about this code. Seems it is working perfectly on TFS 0.3.5pl1 :)

You deserve rep++
Wodian,,
Ohh, thanks ^_^.
But why people only give comments, after bumping? ...
 

leyendario

kind of scripter
Joined
Aug 1, 2009
Messages
49
Best answers
0
Reaction score
14
Location
Venezuela
this script dont work for me...
it always says "only players can do this quest"
but we are all players... ???
 
OP
Shawak

Shawak

Intermediate OT User
Joined
Sep 11, 2008
Messages
1,976
Best answers
2
Reaction score
101
Location
Germany

leyendario

kind of scripter
Joined
Aug 1, 2009
Messages
49
Best answers
0
Reaction score
14
Location
Venezuela
yes 100% sure!
it kep sayn "only players can do this quest"
and i like ur anihi v.1 that works...
but this is not working for me... :S
 
Last edited:
OP
Shawak

Shawak

Intermediate OT User
Joined
Sep 11, 2008
Messages
1,976
Best answers
2
Reaction score
101
Location
Germany
Check if..
  • ..you have right positions.
  • ..you are using one of the listened distros.
I tested the script and it works 100% you can't deceive me :).
 

Koci1994

Banned User
Joined
Dec 27, 2008
Messages
807
Best answers
0
Reaction score
0
09:51 Only players can do this quest.
?? I use players ...
 
OP
Shawak

Shawak

Intermediate OT User
Joined
Sep 11, 2008
Messages
1,976
Best answers
2
Reaction score
101
Location
Germany
Updated, fixed some bugs, it's working now, ;).

Version 2.1:
Code:
- Fixed variables
- fixed "playersOnly", is working now
- fixed clean area
I hope you'll try it out, :).
 

LeOoX

New Member
Joined
Jul 20, 2008
Messages
329
Best answers
0
Reaction score
0
ok i use this script it works but not properly No place in script is where is the chest rewards for annih so I have made it default in rme. But then its not really annih cuz u can get all 4 items! can you make it work with the same script one script with both?

this script and the reward to default annih reward?

;)
 
OP
Shawak

Shawak

Intermediate OT User
Joined
Sep 11, 2008
Messages
1,976
Best answers
2
Reaction score
101
Location
Germany
ok i use this script it works but not properly No place in script is where is the chest rewards for annih so I have made it default in rme. But then its not really annih cuz u can get all 4 items! can you make it work with the same script one script with both?

this script and the reward to default annih reward?

;)
Look on the anninihilator theard v1.0, I remember there are the real ones, :thumbup:.
 

marcryzius

New Member
Joined
Mar 22, 2009
Messages
61
Best answers
0
Reaction score
0
this script is very large and has much that could be withdrawn.

to do it the much smaller and more complete.
 
Top