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

Requesting 3 lever scripts please.

Elda Swok

Searching New Project
Joined
Jun 18, 2008
Messages
703
Reaction score
9
Location
Pittsburgh, Pa.
Alright, so I need 3 scripts made that I have attempted 2-3 times each. I have no experience in levers at all so it's been pretty fail. Here is a description of each lever. I have used the search feature and went through every lever post, none of which helped me in the way that I needed. Please assist me.

1. I need a lever that will teleport a player to a new position if there is a certain item on an alter. It needs to be re-usable as much as a player want's as long as they have the item on the alter.

2. I need a lever like in the INQ quest where you need a corpse on a tile to use a lever, and then it will remove a wall for 1 minute 30 seconds, then it will re-create the wall.

3. I need a lever that will merge 2 runes together no matter what their charges are. Just like Chaos OTs if you've ever played that.

Lever |\|,Alter1, Alter2.

You use the lever and what ever rune on Alter 2 is merged into Alter 1. So if you have a 10x rune on alter 2, and a 90x rune on alter 1. It will make one 100x rune on alter 1.
 
Rep++ then..

First one:
Code:
local config = {
	altar_pos = {x=1001,y=999,z=7},
	item = {2160,2},
	teleport = {x=1002,y=999,z=7}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local check = getTileItemById(config.altar_pos, config.item[1], config.item[2])
	if check.uid > 0 then
		doSendMagicEffect(getThingPos(cid), 2)
		doTeleportThing(cid, config.teleport)
		doSendMagicEffect(config.teleport, 10)
		doRemoveItem(check.uid)
	else
		doPlayerSendCancel(cid, "Please put ".. config.item[2].." "..getItemPluralNameById( config.item[1]).." on the altar.")
	end
	return true
end

Edit:
Second:
Code:
local config = {
	tile = {x=1001, y=999, z=7},
	corpse_id = 2160,
	wall_pos = {x=1001, y=1000, z=7},
	wall_id = 1642,
	delay = 15
}
function leaverBack(pos, id, new)
	return doTransformItem(getTileItemById(pos, id).uid, new)
end


function onUse(cid, item, fromPosition, itemEx, toPosition)
	local corpse = getTileItemById(config.tile, config.corpse_id)
	if item.itemid ~= 1945 then return doPlayerSendCancel(cid, "Sorry not possible.") end
	if not(corpse.uid > 0) then
		return doPlayerSendCancel(cid, "Something is missing.")
	end
	local wall = getTileItemById(config.wall_pos, config.wall_id)
	doRemoveItem(wall.uid)
	doRemoveItem(corpse.uid,1)
	doTransformItem(item.uid, 1946)
	addEvent(doCreateItem, config.delay*1000, config.wall_id, 1, config.wall_pos)
	addEvent(leaverBack, config.delay*1000, getThingPos(item.uid), 1946, 1945)
	return true
end

Third:
Code:
local config = {
	altars = {{x=1001, y=999, z=7, stackpos=255},{x=1001, y=1000, z=7, stackpos=255}}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local items = {getThingFromPos(config.altars[1]),getThingFromPos(config.altars[2])}
	if not(isItemRune(items[1].itemid) and isItemRune(items[2].itemid)) then
		return doPlayerSendCancel(cid, "Please put the runes you want to merge on the altars.")
	end	
	if not(items[1].itemid == items[2].itemid) then
		return doPlayerSendCancel(cid, "The runes need to be of the same type to merge them.")
	end
	local max = items[1].type + items[2].type
	doRemoveItem(items[1].uid)
	doRemoveItem(items[2].uid)
	while max > 100 do
		doCreateItem(items[1].itemid, 100, config.altars[1])
		max = max - 100
	end
	if max ~= 0 then doCreateItem(items[1].itemid, max, config.altars[1]) end
	
	doTransformItem(item.uid, (item.itemid == 1945 and 1946 or 1945))
	return true
end

Did I say Rep++ ^^
 
Last edited:
Alright, I love the scripts rep++ now can you help me implement them? Your scripting is so much different than I've ever seen before. Here are the 2 scripts that I made while OTland was down. Neither are working properly. Help me please :P

LUA:
local config = {
	Tear = {2346},
	Alter = { x = 2140, y = 1184, z = 10, stackpos = 255},
	Position1 = { x = 2140, y = 1183, z = 10},
	Position2 = { x = 2308, y = 1041, z = 10}
}
 
function onUse(cid, item, frompos, item2, topos)
	local thing = getTileItemById(config.Alter, config.Tear)
	if(thing.uid >= 1) then
		doRemoveItem(thing.uid, 1)
		doTeleportThing(cid, config.Position2)
		doSendMagicEffect(config.Position1, CONST_ME_MAGIC_BLUE)
		doSendMagicEffect(config.Position2, CONST_ME_MAGIC_RED)
	else
		doPlayerSendTextMessage(cid,19,"You must have a Tear of Chaos on the Alter to enter.")
	end
end

LUA:
local config = {
	Stonepos = {x=2428,y=1246,z=10, stackpos = 255},
	Dustpos = {x=2431,y=1247,z=10, stackpos = 255},
	Stoneid = {1354},
	Dustid = {8955}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(getThingFromPos(config.Dustpos).itemid == config.Dustid) then
		if(getThingFromPos(config.Stonepos).itemid == config.Stoneid) then
			doRemoveItem(getThingFromPos(config.Stonepos).uid)
			addEvent(createstone, 3*60*1000)
		end
	end
end
 
function createstone()
	if(getThingFromPos(config.Stonepos).itemid ~= config.Stoneid) then
		doCreateItem(config.Stoneid, 1, config.Stonepos)
	end
	return true
end
 
Last edited:
Why you want your scripts if mine are working? or what. I don't get your prob now
 
Im just saying that I made those 2 that aren't working, I'd like to know how to make them work for future reference. To expand my knowledge in scripting. I don't know how to implement yours to be honest. What do I make the Uid? Like the lever?
 
Rep++

1.
LUA:
local tear = 2346
local newpos = {x=2308, y=1041, z=10} --Where player gets teleported
local effect1 = {x=2140, y=1183, z=10, stackpos=1}
local effect2 = {x=2308, y=1041, z=10, stackpos=1}
local piece1pos = {x=2140, y=1184, z=10, stackpos=1} --Altar pos where tear should be
local getpiece1 = getThingfromPos(piece1pos)
function onUse(cid, item, frompos, item2, topos)
	if getpiece1.itemid == tear then
		 doRemoveItem(getpiece1.uid,1)
		doTeleportThing(cid, newpos)
		doSendMagicEffect(effect1, CONST_ME_MAGIC_BLUE)
		doSendMagicEffect(effect2, CONST_ME_MAGIC_RED)
	else
		doPlayerSendTextMessage(cid,19,"You must have a Tear of Chaos on the Alter to enter.")
	end
	return true
end

2.
LUA:
local dust = 8955 --Dust itemid
local stoneid = 1354 --stone itemid
local pausa = 180000 --Time before it makes new stone. Based to 0.4. If 0.3.6 then put 180.
local piece7pos = {x=32864, y=32556, z=11, stackpos=1} --Position of the stone
local dusti = {x=32864, y=32556, z=11, stackpos=1} --Position of the dust
local getpiece7 = getThingfromPos(piece7pos)
local dustpos = getThingfromPos(dusti)
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getpiece7.itemid == stoneid then
    if dustpos.itemid == dust then
    doRemoveItem(getpiece7.uid,1)
	doSendMagicEffect(piece7pos,17)
	addEvent(wait1,pausa,piece7pos)
	else
	doPlayerSendTextMessage(cid,22,"You have to place "..getItemNameById(dust).." to the altar!")
	end
else
	doPlayerSendTextMessage(cid,22,"Stone has already removed!")
end
return TRUE
end

function wait1(piece7pos)
 doCreateItem(stoneid,1,piece7pos)
end
 
Last edited:
local variable always win plax.
Use getTileItemById so you don't need to enter a specific stackpos.
doSendMagicEffect doesn't need stackpos (first)

Why:
Code:
addEvent(wait1,pausa,piece7pos)

function wait1(piece7pos)
 doCreateItem(1354,1,piece7pos)
end
If you can use:
Code:
addEvent(doCreateItem, pause, 1354, 1, piece7pos)
 
local variable always win plax.
Use getTileItemById so you don't need to enter a specific stackpos.
doSendMagicEffect doesn't need stackpos (first)

Why:
Code:
addEvent(wait1,pausa,piece7pos)

function wait1(piece7pos)
 doCreateItem(1354,1,piece7pos)
end
If you can use:
Code:
addEvent(doCreateItem, pause, 1354, 1, piece7pos)

Thanks, new tips are always welcome! But my scripts still work.
Btw. if I use local XXX = XXX does it work under every function in a script?
 
LUA:
local tear = 2346
local newpos = {x=2308, y=1041, z=10} --Where player gets teleported
local effect1 = {x=2140, y=1183, z=10, stackpos=1}
local effect2 = {x=2308, y=1041, z=10, stackpos=1}
local piece1pos = {x=2140, y=1184, z=10, stackpos=255} --Altar pos where tear should be
local getpiece1 = getThingfromPos(piece1pos)
function onUse(cid, item, frompos, item2, topos)
	if getpiece1.itemid == tear then
		 doRemoveItem(getpiece1.uid,1)
		doTeleportThing(cid, newpos)
		doSendMagicEffect(effect1, CONST_ME_MAGIC_BLUE)
		doSendMagicEffect(effect2, CONST_ME_MAGIC_RED)
	else
		doPlayerSendTextMessage(cid,19,"You must have a Tear of Chaos on the Alter to enter.")
	end
	return true
end
 
Back
Top