• 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!

Anni lever 'One Player' (no demon spawn)

chackie

New Member
Joined
Nov 1, 2009
Messages
87
Reaction score
0
EDITED:
Can someone help me fix this script:
Code:
local annihistorage = 8790
local annihiglobalstorage = 8679
local demonposition = {x=EDIT, y=EDIT, z=EDIT} ------ Position where player will be teleported.
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerStorageValue(cid,annihistorage) < 1 then
   if getGlobalStorageValue(cid,annihiglobalstorage) < 1 then
      setGlobalStorageValue(cid,annihiglobalstorage,1)
      doTeleportThing(cid,demonposition)
   else
       doPlayerSendCancel(cid, "You cannot enter until whos there finishes the quest!")
   end
else
    doPlayerSendCancel(cid, "You have already done this quest")
end
return true
end

Code:
<movevent type="StepIn" uniqueid="29333" event="script" value="tp.lua"/>

Code:
local annihiglobalstorage = 8679
local position = {x=EDIT, y=EDIT, z=EDIT} ---- Position you go when you leave annihi reward room
function onStepIn(cid, item, pos)
         doTeleportThing(cid,position)
         setGlobalStorageValue(cid,annihiglobalstorage,-1)
    return true
end

THE PROBLEM:
The things that needs to be fixed.. If Player A pulled the lever and dies in the quest, then player B gets message: "you cannot enter until whos there finishes the quest!" Can someone fix if player A gets offline (dies or logg off) then player B can pulled the lever.
 
Last edited:
Try now
Lua:
local playerr1 = {x=532, y=577, z=5, stackpos=253}

local posisionn1 = {x=530, y=579, z=7}   

local uniqueidoflever = 6889                        

function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.uid == uniqueidoflever and item.itemid == 1945 then
   player1pos = player1		
   player1 = getThingfromPos(player1pos)


		if player1.itemid > 0 then
			queststatus1 = getPlayerStorageValue(player1.uid,uniqueidoflever)

			if queststatus1 == -1 then
				nplayer1pos = posisionn1

				doSendMagicEffect(player1pos,2)

				doTeleportThing(player1.uid,nplayer1pos)

				doSendMagicEffect(nplayer1pos,10)

				doTransformItem(item.uid,item.itemid+1)
			else
				doPlayerSendCancel(cid,"You has already done this quest.")
			end
		else
			doPlayerSendCancel(cid,"You need one player for this quest.")
		end

	elseif item.uid == uniqueidoflever and item.itemid == 1946 then
		if getPlayerAccess(cid) > 0 then
			doTransformItem(item.uid,item.itemid-1)
		else
			doPlayerSendCancel(cid,"Sorry, not possible.")
		end
	else
		return 0
	end

	return 1
end
 
Well, I get no errors in the beginning when I start .exe
But when I pull the lever in-game I get error in .exe like:
[Error - Action Interface]
data/action/scripts/other/lever.lua: onUse
Description:
attempt to index a nil value
Stack traceback:
[C]: in function 'getThingsfromPos'
data/action/scripts/other/lever.lua:10: in function <data/action/scripts/other/lever.lua:7>
 
Didnt find any errors, make sure you have put the positions well.
Lua:
local playerr1 = {x=532, y=577, z=5, stackpos=253}
 
local posisionn1 = {x=530, y=579, z=7}   
 
local uniqueidoflever = 6889                        
player1pos = player1		
player1 = getThingfromPos(player1pos) 

function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.uid == uniqueidoflever and item.itemid == 1945 then

if player1.itemid > 0 then
   queststatus1 = getPlayerStorageValue(player1.uid,uniqueidoflever)
if queststatus1 == -1 then
   nplayer1pos = posisionn1
   doSendMagicEffect(player1pos,2)
   doTeleportThing(player1.uid,nplayer1pos)
   doSendMagicEffect(nplayer1pos,10)
   doTransformItem(item.uid,item.itemid+1)
else
    doPlayerSendCancel(cid,"You has already done this quest.")
end
   else
   doPlayerSendCancel(cid,"You need one player for this quest.")
end
elseif item.uid == uniqueidoflever and item.itemid == 1946 then
       if getPlayerAccess(cid) > 0 then
          doTransformItem(item.uid,item.itemid-1)
       else
           doPlayerSendCancel(cid,"Sorry, not possible.")
           end
	else
		return 0
	end
 
	return 1
end
 
I tried you last Lua code:
.exe error in loading
[Error - Action Interface]
data/action/scripts/other/lever.lua: onUse
Description:
attempt to index a nil value
[Warning - Event::loadscript] Cannot load script <data/action/scripts/other/lever.lua>

I have the position right
local playerr1 = Start position? Mine are: x=532, y=577, z=5,
local posisionn1 = new position? Mine are: x=530, y=579, z=7
 
Last edited:
Whatever, I did a new one for ya, since its just 1 player, no need to check the position so:
Lua:
local annihistorage = 8790
local annihiglobalstorage = 8679
local demonposition = {x=EDIT, y=EDIT, z=EDIT} ------ Position where player will be teleported.
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerStorageValue(cid,annihistorage) < 1 then
   if getGlobalStorageValue(cid,annihiglobalstorage) < 1 then
      setGlobalStorageValue(cid,annihiglobalstorage,1)
      doTeleportThing(cid,demonposition)
   else
       doPlayerSendCancel(cid, "You cannot enter until whos there finishes the quest!")
   end
else
    doPlayerSendCancel(cid, "You have already done this quest")
end
return true
end

Okay, now...
Set all the annihi part in your RME to a no-logout zone.
And put this in the teleport (Which brings you back from quest)

data/movements/movements.xml
XML:
<movevent type="StepIn" uniqueid="29333" event="script" value="tp.lua"/>

data/movements/scripts/tp.lua
Lua:
local annihiglobalstorage = 8679
local position = {x=EDIT, y=EDIT, z=EDIT} ---- Position you go when you leave annihi reward room
function onStepIn(cid, item, pos)
         doTeleportThing(cid,position)
         setGlobalStorageValue(cid,annihiglobalstorage,-1)
    return true
end

Now just make a teleport in reward room with that uniqueID (Dont put positions at RME cuz u have to put 'em at script)
I think it shud work.
 
If I understand you correctly... If player 'A' are in that no-logout zone in that quest then the player B tries to pulled the lever its get the message: You cannot enter until whos there finishes the quest! And then when player A enter 'uniqueid=29333 teleport'. Then player B can enter the quest?
And why do u need to put all in no-logout zone? :)
its not a anni "room" its a big quest. Should I anyway put all in 'no-logout zone'?
 
Lua:
local config = {
	daily = "no",
	level = 100,
	storage = 30015,
	stand =
	{
		{x = 100, y =100, z = 7}
	},
	destination =
	{
		{x = 100, y = 100, z = 7}
	}
}

config.daily = getBooleanFromString(config.daily)
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(item.itemid == 1946) then
		if(config.daily) then
			doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
		else
			doTransformItem(item.uid, item.itemid - 1)
		end

		return true
	end

	if(item.itemid ~= 1945) then
		return true
	end

	local players = {}
	for _, position in ipairs(config.stand) 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
			doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
			return true
		end

		table.insert(players, pid)
	end

	for i, pid in ipairs(players) do
		doSendMagicEffect(config.stand[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
 
If I understand you correctly... If player 'A' are in that no-logout zone in that quest then the player B tries to pulled the lever its get the message: You cannot enter until whos there finishes the quest! And then when player A enter 'uniqueid=29333 teleport'. Then player B can enter the quest?
And why do u need to put all in no-logout zone? :)
its not a anni "room" its a big quest. Should I anyway put all in 'no-logout zone'?

The reward room should be no-logout zone. Since if someone logsout then no one can go in till he gets online and passes through tp :p
 
If someone dies then, no one can get trough tp? :p If not then nice.. :)
If there is a problem if someone dies, no one can get through. Can you change this instead
santiggg: Istead of "You cannot enter until whos there finishes the quest" why not make exhausted time on the lever like 30min wait time. And the player who is pulled the lever gets the message like "You must wait for your turn!"

JDB: There seems to be a normal lever tp? Is there are check if player already done the quest?
 
Last edited:
If someone dies then, no one can get trough tp? :p If not then nice.. :)

Well, yes but we can also use a login function.
So if player with 'x' storage logins, it makes the globalstorage go back to -1.
Or just make sth like this:
Lua:
local area = {
{x = XXXX, y = YYYY, z = Z},
{x = XXXX, y = YYYY, z = Z}
}

local players = getPlayersOnline()
                        for _, pid in ipairs(players) do
					if isInRange(getCreaturePosition(pid), area[1], area[2]) == true then

Ill try later, no time to do it atm :p
 
JDB: There seems to be a normal lever tp? Is there are check if player already done the quest?

Yes. This one should work with 0.3.6.

Lua:
local config = {
	daily = "no",
	level = 100,
	storage = 30015,
	stand = {x = 100, y =100, z = 7},
	destination = {x = 100, y = 100, z = 7}
}
 
config.daily = getBooleanFromString(config.daily)
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(item.itemid == 1946) then
		if(config.daily) then
			doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
		else
			doTransformItem(item.uid, item.itemid - 1)
		end
 
		return true
	end
 
	if(item.itemid ~= 1945) then
		return true
	end
 
	local players = {}
	for _, position in ipairs(config.stand) do
		local pid = getTopCreature(position).uid
		if(pid == 0 or not isPlayer(pid) or getPlayerStorageValue(pid, config.storage) > 0 or getPlayerLevel(pid) < config.level) then
			doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
			return true
		end
 
		table.insert(players, pid)
	end
 
	for i, pid in ipairs(players) do
		doSendMagicEffect(config.stand[i], CONST_ME_POFF)
		doTeleportThing(pid, config.destination[i], false)
		doSendMagicEffect(config.destination[i], CONST_ME_ENERGYAREA)
		setPlayerStorageValue(pid, config.storage, 1)
	end
 
	doTransformItem(item.uid, item.itemid + 1)
	return true
end
 
If JDB's dont work, (which I highly doubt)
Try this
Lua:
local annihistorage = 8790
local demonposition = {x=EDIT, y=EDIT, z=EDIT} ------ Position where player will be teleported.
function onUse(cid, item, fromPosition, itemEx, toPosition)
local players = getSpectators({x=EDIT, y=EDIT, z=EDIT}, 10, 10) 
if players == true then
   if getPlayerStorageValue(cid,annihistorage) < 1 then
      doTeleportThing(cid,demonposition)
   else
    doPlayerSendCancel(cid, "You have already done this quest")
   end
else
    doPlayerSendCancel(cid, "Theres someone inside! You must wait till he finishes")
end
return true
end
 
Lua:
local players = getSpectators({x=EDIT, y=EDIT, z=EDIT}, 10, 10)

getSpectators The position is the centerposition of the place, 10 is the Xrange and the other 10 is the Y range
So from centerposition it covers an area 10 >>>> <<<< and ^^^^VVV :p

If that wont work, then isAtRange shud xD
 
Dident understand I thing.. but I will try it. So you do not edit those lines? let it just be?
I think is working now. I get the message "Theres someone inside! You must wait till he finishes" when I pulled the lever. No .exe error.
So how do I fix so it works perfectly?
Should I add your movements script with a teleport?
 
Last edited:
No need of, since now I did not put globalstorage (Now the tp is useless), just put a normal TP :)

Let me explain to you again:
Lua:
local players = getSpectators({x=EDIT, y=EDIT, z=EDIT}, 10, 10)

First positions will be the CENTERPOS of the demon room.
10 -> X range, which means, from that CENTERPOS to < and > , 10 SQM. (AREA)
The other ten is the same but with Y position, it checks ^ and V
 
Well I did change the centerpos of the quest room. Still got the "Theres someone inside! You must wait till he finishes" ;//
 
Not my day, but try anyway :l
Lua:
local area = 
{
        {x=81, y=128, z=7, stackpos = 255},  ---- Top south - west corner
        {x=84, y=126, z=7, stackpos = 255} ----- Top north - east corner
}

local annihistorage = 17865
local demonposition = {x=81, y=128, z=7} ------ Position where player will be teleported.
function onUse(cid, item, fromPosition, itemEx, toPosition)
local players = getPlayersOnline()
for _, pid in ipairs(players) do
	if getPlayerStorageValue(cid,annihistorage) < 1 then
		if isInRange(getCreaturePosition(pid), area[1], area[2]) == false then
			doTeleportThing(cid,demonposition)
		else
			doPlayerSendCancel(cid, "Wait til " .. getCreatureName(pid) .. " has finished the quest!")
		end
	else
		doPlayerSendCancel(cid, "You have already done this quest")
	end
end
return true
end
 
Now is working to be teleported :)
But this
Wait til " .. getCreatureName(pid) .. " has finished the quest
dosent work... I had the A player in the local area and player B who pulled the lever. Player B gets the message Wait til Player A has finished the quest. And player B gets teleported anyway to local demonposition xD
 
Back
Top