• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Action Anni Lever (3 Players, No demon spawn)

The ShincZ

Lua Scripter
Joined
Nov 4, 2010
Messages
14
Reaction score
0
Location
Sweden
Hello Otlanders!

This is my first release of a script.

Well. Goto Data\actions\action.xml

Paste This.
<action uniqueid="XXX" script="XXX.lua"/>

The first XXX is what unique id the lever that you pull to get teleported will get.

The second XXX is what the script in scripts folder is called.


Goto Data\Actions\Scripts\

and copy a file with, ".lua" paste this.

Code:
local playerr1 = {x=871, y=963, z=7, stackpos=253}
local playerr2 = {x=xxx, y=xxx, z=x, stackpos=253}     <--- These are from posision
local playerr3 = {x=xxx, y=xxx, z=x, stackpos=253}

local posisionn1 = {x=xxx, y=xxx, z=x}    <--- These are to posision XXX
local posisionn2 = {x=xxx, y=xxx, z=x}
local posisionn3 = {x=xxx, y=xxx, z=x}

Local uniqueidoflever = XXX                        <---- lever uniqueID

function onUse(cid, item, frompos, item2, topos)

   	if item.uid == uniqueidoflever and item.itemid == 1945 then
		player1pos = playerr1		
		player1 = getThingfromPos(player1pos)

		player2pos = playerr2
		player2 = getThingfromPos(player2pos)

		player3pos = playerr3
		player3 = getThingfromPos(player3pos)


		if player1.itemid > 0 and player2.itemid > 0 and player3.itemid > 0 then
			queststatus1 = getPlayerStorageValue(player1.uid,uniqueidoflever)
			queststatus2 = getPlayerStorageValue(player2.uid,uniqueidoflever)
			queststatus3 = getPlayerStorageValue(player3.uid,uniqueidoflever)

			if queststatus1 == -1 and queststatus2 == -1 and queststatus3 == -1 then
				nplayer1pos = posisionn1
				nplayer2pos = posisionn2
				nplayer3pos = posisionn3

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

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

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

				doTransformItem(item.uid,item.itemid+1)
			else
				doPlayerSendCancel(cid,"Somebody in your team has already done this quest.")
			end
		else
			doPlayerSendCancel(cid,"You need three players 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

It works for me on my server, it's messy, but it works.

Feel free to comment and give some rep++ :):) If it's worth it...

Regards ShincZ
 
Last edited:
You can edit this so it works for 10 players right?
 
True that there are loads there.
But it is indeed a really nice release since its really easy for people who got no idea of scripting to edit it.
Great release!
 
I tried to edit so its only work for one player

Code:
local playerr1 = {x=532, y=577, z=5, stackpos=253}

local posisionn1 = {x=530, y=579, z=7}    <--- These are to posision XXX

Local uniqueidoflever = 6889                        <---- lever uniqueID

function onUse (cid, item, frompos, item2, topos)

   	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

Did get a error in the .exe console like:
[Error - luascriptinterface::Loadfile] /data/action bla bla /lever.lua:7: '(' expect near 'onUse'
Warning - event::loadfile] cannot load script

any idea what I have done wrong?
 
Im not so good at lua but im sure this is the reason
Lua:
function onUse (cid, item, frompos, item2, topos)

change to this
Lua:
function onUse(cid, item, frompos, item2, topos)
 
You maybe did something wrong remove your code and paste this

Lua:
local player1 = {x=532, y=577, z=5, stackpos=253}

local position1 = {x=530, y=579, z=7}    <--- These are to posision XXX

Local uniqueidoflever = 6889                        <---- lever uniqueID

function onUse(cid, item, frompos, item2, topos)

   	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
 
Last edited:
Back
Top Bottom