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

SIMPLE script WONT work

ziggy46802

Active Member
Joined
Aug 19, 2012
Messages
418
Reaction score
27
Here is the picture
FUCK.jpg
So, when I pull the lever, I get NOTHING in my console and NOTHING happens. Okay, what the F!!!

This is REALLY frustrating me since I see NOTHING wrong with the script and the probably ten different scripts that I have tried from other people's posts have just done nothing.

What is wrong here?
 
should be like this
XML:
<action uniqueid="1017" event="script" value="pohlever.lua"/>

also add bridge.pos instead of bridge and return true before end
 
okay, I changed the line of code in actions.xml to what you said and now my script looks like this

pohlever.lua
Code:
local bridge = {
{pos = {x=1377,y=1088,z=7}}
}
function onUse(cid, item, frompos, item2, topos)
	doCreateItem(1284,bridge.pos)
		return true
	end

And I'm still getting nothing at all, no errors or no nothing in my console, the "dirt, id = 103" where it is supposed to change to bridge does nothing, even if i leave the screen and come back, nothing.

I am using OTServ 0.6.3 SVN by the way if that means anything.
 
why are you using a table if you only have one thing inside of it?

LUA:
local pos = {x = 1377, y = 1088, z = 7}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if isPlayer(cid) then
		doCreateItem(1284, 1, pos)
	end
	return true
end
 
Okay, it still won't work.

So I deleted the lever and put the tree nearby as unique id 1017 and changed actions.xml item id and it all of a sudden works! I do not know why the lever would not work but I guess I just have to use something other than a lever.
 
Thank you, both of you, for your help. I tried decaying the lever but it still won't work, but I'm not worried about it, I can just use a special looking item it is no big deal. Here is the script that I made up that actually does work, but it is just a tester script (not real positions or ids), if anyone else wanted to "use" an item to create a bridge or any other item.

pohlever.lua
Code:
local posa = {x=1377,y=1088,z=7}
local posb = {x=1377,y=1089,z=7}
local posc = {x=1377,y=1087,z=7}

function dissapear(cid, item, pos)
	doCreateItem(103, 1, posa)
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if isPlayer(cid) then
		doCreateItem(1284, 1, posa)
		addEvent(dissapear, 5000)
	end
	return true
end

I know there is probably a better way to make this happen with doDecayItem or doTransformItem but I really could care less, as long as it works like it should then there is no difference to me.

Here is the actual script that I am using, if anyone else can get a good use out of it, who knows.

pohlever.lua
Code:
local posa = {x=1335,y=1107,z=7}
local posb = {x=1335,y=1106,z=7}
local posc = {x=1335,y=1105,z=7}
local posd = {x=1335,y=1104,z=7}

local pose = {x=1336,y=1107,z=7}
local posf = {x=1336,y=1106,z=7}
local posg = {x=1336,y=1105,z=7}
local posh = {x=1336,y=1104,z=7}

function dissapear(cid, item, pos)
	doCreateItem(406, 1, posa)
	doCreateItem(4608, 1, posb)
	doCreateItem(4608, 1, posc)
	doCreateItem(406, 1, posd)	
	doCreateItem(4608, 1, pose)
	doCreateItem(4608, 1, posf)
	doCreateItem(406, 1, posg)
	doCreateItem(407, 1, posh)	
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if isPlayer(cid) then
		doCreateItem(1284, 1, posa)
		doCreateItem(1284, 1, posb)
		doCreateItem(1284, 1, posc)
		doCreateItem(1284, 1, posd)
		doCreateItem(1284, 1, pose)
		doCreateItem(1284, 1, posf)
		doCreateItem(1284, 1, posg)
		doCreateItem(1284, 1, posh)		
		addEvent(dissapear, 30 * 1000)
	end
	return true
end

by the way, if you change the coordinates, this is the "making" of the bridge in the mini-POH in TFS's map, but I changed a few tiles as well too and made a backup lever so it is impossible to get stuck, even if your in the middle of the bridge when it disappears, you can still get out.
 
Last edited:
why are you using a table if you only have one thing inside of it?

LUA:
local pos = {x = 1377, y = 1088, z = 7}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if isPlayer(cid) then
		doCreateItem(1284, 1, pos)
	end
	return true
end

Why do you check "isPlayer" on a lever? Monsters don't walk up to levers and pull them. ^_^
 
Back
Top