• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

All scrippters-take a look. I need a bit help!

richux

Tibera.org
Joined
Aug 18, 2008
Messages
3,666
Reaction score
26
Location
---------
Hello! I have seached all around, but i couldn't make annihi for my ot that would work more than 1 time after restart. I tried like 10 other scripts, I even edited mine script, but it always isnt working after I do changes, cuz im messing it up Lol :( Im nooby in scriptting, so thats why Im asking help. So, can someone edit this script so it would reset lever so quest can be done more times. Im asking it cuz I know its not hard and does not take long time.

This is the script that Im using atm:

Code:
-- player?pos = The position of the players before teleport.
-- player? = Get the thing from playerpos.
-- player?level = Get the players levels.
-- questslevel = The level you have to be to do this quest.
-- questtatus? = Get the quest status of the players.
-- demon?pos = The position of the demons.
-- nplayer?pos = The position where the players should be teleported too.
--
-- UniqueIDs used:
-- 10019 = The switch.

function onUse(cid, item, frompos, item2, topos)
	if item.uid == 10019 then
		if item.itemid == 1945 then

			player1pos = {x=1057, y=735, z=7, stackpos=253}
			player1 = getThingfromPos(player1pos)

			player2pos = {x=1056, y=735, z=7, stackpos=253}
			player2 = getThingfromPos(player2pos)

			player3pos = {x=1055, y=735, z=7, stackpos=253}
			player3 = getThingfromPos(player3pos)

			player4pos = {x=1054, y=735, z=7, stackpos=253}
			player4 = getThingfromPos(player4pos)


			if player1.itemid > 0 and player2.itemid > 0 and player3.itemid > 0 and player4.itemid > 0 then

				player1level = getPlayerLevel(player1.uid)
				player2level = getPlayerLevel(player2.uid)
				player3level = getPlayerLevel(player3.uid)
				player4level = getPlayerLevel(player4.uid)

				questlevel = 100

				if player1level >= questlevel and player2level >= questlevel and player3level >= questlevel and player4level >= questlevel then

					queststatus1 = getPlayerStorageValue(player1.uid,10020)
					queststatus2 = getPlayerStorageValue(player2.uid,10020)
					queststatus3 = getPlayerStorageValue(player3.uid,10020)
					queststatus4 = getPlayerStorageValue(player4.uid,10020)

					if queststatus1 == -1 and queststatus2 == -1 and queststatus3 == -1 and queststatus4 == -1 then
			
						demon1pos = {x=1058, y=735, z=8}
						demon2pos = {x=1059, y=735, z=8}
						demon3pos = {x=1055, y=733, z=8}
						demon4pos = {x=1057, y=733, z=8}
						demon5pos = {x=1054, y=737, z=8}
						demon6pos = {x=1056, y=737, z=8}
						 
						doSummonCreature("Demon", demon1pos)
						doSummonCreature("Demon", demon2pos)
						doSummonCreature("Demon", demon3pos)
						doSummonCreature("Demon", demon4pos)
						doSummonCreature("Demon", demon5pos)
						doSummonCreature("Demon", demon6pos)

						nplayer1pos = {x=1057, y=735, z=8}
						nplayer2pos = {x=1056, y=735, z=8}
						nplayer3pos = {x=1055, y=735, z=8}
						nplayer4pos = {x=1054, y=735, z=8}

						doSendMagicEffect(player1pos,2)
						doSendMagicEffect(player2pos,2)
						doSendMagicEffect(player3pos,2)
						doSendMagicEffect(player4pos,2)

						doTeleportThing(player1.uid,nplayer1pos)
						doTeleportThing(player2.uid,nplayer2pos)
						doTeleportThing(player3.uid,nplayer3pos)
						doTeleportThing(player4.uid,nplayer4pos)

						doSendMagicEffect(nplayer1pos,10)
						doSendMagicEffect(nplayer2pos,10)
						doSendMagicEffect(nplayer3pos,10)
						doSendMagicEffect(nplayer4pos,10)

						doTransformItem(item.uid,item.itemid+1)

					else
						doPlayerSendCancel(cid,"Some one in your team has already done this quest.")
					end
				else
					doPlayerSendCancel(cid,"All players must be "..questlevel.." to do this quest.")
				end
			else
				doPlayerSendCancel(cid,"You need 4 players for this quest.")
			end
		elseif item.itemid == 1946 then
			if getPlayerAccess(cid) == 3 then
				doTransformItem(item.uid,item.itemid-1)
			else
				doPlayerSendCancel(cid,"Sorry, not possible.")
			end
		end
	end
	return 1
end
 
Last edited:
:) Btw, do you know how to add this code at the end of my script?

Code:
elseif item.itemid == 1946 then
doTransformItem(item.uid,1945)
end

I tried to add it, but annihi did not load after that. ;S
 
Modified TFS Annihilator script (Perfect :wub:) - Summon monsters, delete monsters, repair doors, clean positions.

Code:
local playerPosition =
{
	{x = 2858, y = 651, z = 13, stackpos = STACKPOS_TOP_CREATURE},
	{x = 2859, y = 651, z = 13, stackpos = STACKPOS_TOP_CREATURE},
	{x = 2860, y = 651, z = 13, stackpos = STACKPOS_TOP_CREATURE},
	{x = 2861, y = 651, z = 13, stackpos = STACKPOS_TOP_CREATURE}
}

local newPosition =
{
	{x = 2859, y = 641, z = 13},
 	{x = 2860, y = 641, z = 13},
	{x = 2861, y = 641, z = 13},
	{x = 2862, y = 641, z = 13}
}

local monstersPos =
{
	{x = 2859, y = 639, z = 13, stackpos = STACKPOS_TOP_CREATURE},
	{x = 2861, y = 639, z = 13, stackpos = STACKPOS_TOP_CREATURE},
	{x = 2860, y = 643, z = 13, stackpos = STACKPOS_TOP_CREATURE},
	{x = 2862, y = 643, z = 13, stackpos = STACKPOS_TOP_CREATURE},
	{x = 2863, y = 641, z = 13, stackpos = STACKPOS_TOP_CREATURE},
	{x = 2864, y = 641, z = 13, stackpos = STACKPOS_TOP_CREATURE},
}

local doorPos = {x = 2865, y = 641, z = 13, stackpos = 1}

local function updateDoors()
	cleanPos(doorPos)
	doCreateItem(5107, doorPos)
end

local function updateAnni()
	for _, pos in pairs(monstersPos) do
		if isCreature(getThingfromPos(pos).uid) == FALSE then
			doSummonCreature("Demon", pos)
		end
	end
	for _, pos in pairs(newPosition) do
		cleanPos(pos)
	end
	updateDoors()
end

-- Do not modify the declaration lines below.
local player = {0, 0, 0, 0}
local failed = FALSE
local reason = 0

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 then
		for i = 1, 4 do
			failed = TRUE
			reason = 0
			player[i] = getThingfromPos(playerPosition[i])
			if player[i].itemid > 0 then
				if isPlayer(player[i].uid) == TRUE then
					reason = 1
					if getPlayerStorageValue(player[i].uid, 30015) == -1 then
						reason = 2
						if getPlayerLevel(player[i].uid) >= 100 then
							failed = FALSE
						end
					end
				end
			end

			if failed == TRUE then
				if reason == 1 then
					doPlayerSendCancel(cid, "Sorry, not possible. (Ktos juz wykonal questa i wziol nagrode)")
				elseif reason == 2 then
					doPlayerSendCancel(cid, "Sorry, not possible. (Niespelnione wymagania)")
				else
					doPlayerSendCancel(cid, "Sorry, not possible.")
				end
				return TRUE
			end
		end

		updateAnni()

		for i = 1, 4 do
			doSendMagicEffect(playerPosition[i], CONST_ME_POFF)
			doTeleportThing(player[i].uid, newPosition[i], FALSE)
			doSendMagicEffect(newPosition[i], CONST_ME_ENERGYAREA)
		end
		doTransformItem(item.uid, item.itemid + 1)
	elseif item.itemid == 1946 then
		doTransformItem(item.uid, item.itemid - 1)
	end

	return TRUE
end

You need also to add this function in function.lua
Code:
function cleanPos(pos)
	pos.stackpos = 1
	local item = nil
	local errors = 1
	while(TRUE) do
		item = getThingfromPos(pos)
		if item.uid > 0 and isCreature(item.uid) == FALSE then
			if doRemoveItem(item.uid) ~= LUA_NO_ERROR then
				errors = errors + 1
			end

			if(errors > 2) then --prevent infinite loop
				break
			end
		else
			break
		end
	end
end
 
Its not working, it only spawns demons in the quest room, but does not tp players. I got following error:

Code:
data/actions/scripts/quests/Annihilator.lua:41: attempt to call global 'cleanPos' (a nil value)
[18/02/2009 18:35:10] stack traceback:
[18/02/2009 18:35:10] 	data/actions/scripts/quests/Annihilator.lua:41: in function 'updateAnni'
[18/02/2009 18:35:10] 	data/actions/scripts/quests/Annihilator.lua:81: in function <data/actions/scripts/quests/Annihilator.lua:51>
 
Read my previous post more accurately. (about adding something to lib/function.lua file, or global.lua)

Global.lua? U didnt say anything about globabl.lua What do I need to add to global.lua? I added the script u told me to functions.lua And I read everything correct. Maybe I added it wrong ? :s
 
If you added this function which i said (cleanPos) then it must work :)

Error you posted is about this function - server think that it doesn't exist. You can try to adding it at the top of this annihilator script.
 
If you added this function which i said (cleanPos) then it must work :)

Error you posted is about this function - server think that it doesn't exist. You can try to adding it at the top of this annihilator script.

K. Trying it.

Edit: Still not working, i got the same error :S
 
Last edited:
Bump! Is there anyone that has good/working annihi script or can change mine script so it would reset lever so quest can be done more than 1 time after restart? Thank you.
 
Back
Top