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

Script Bugged or nop?

Status
Not open for further replies.

president vankk

Web Developer & AuraOT Owner
Joined
Jul 10, 2009
Messages
5,719
Solutions
9
Reaction score
339
LUA:
function onUse(cid, item, frompos, item2, topos)
wall = {x=408, y=1389, z=10, stackpos=0}
local getwall = getThingfromPos(wall) 
if item.uid == 10203 and item.itemid == 1945 then
   doTransformItem(item.uid,item.itemid+1)
   doTransformItem(getwall.uid,5770)
elseif item.uid == 10203 and item.itemid == 1946 then


   doTransformItem(item.uid,item.itemid-1)
   doTransformItem(getwall.uid,493)
bplayer = {x=408, y=1389, z=10, stackpos=253}
bplayer2 = getThingfromPos(bplayer)
if isCreature(bplayer2.uid) == TRUE then
   doMoveCreature(bplayer2.uid,WEST)
end
	end
   return 1
end


thx :)
 
to be away fromm the wrong stack pos use, as i can see it will not function well if the stackpos = 0
In checking for items by ids :
Code:
wall = {x=408, y=1389, z=10}
getTileItemById(wall,itemid).uid

instead of
Code:
getThingFromPos(pos+stack).uid

In checking for player/items by pos only :

Code:
bplayer = {x=408, y=1389, z=10, stackpos=253}
local pid = getTileThingByPos(bplayer).uid
if isCreature(pid) then
 
Last edited:
im noob at script but just wana learn a bit. i will give a try
local getwall = getThingfromPos(x=408, y=1389, z=10, stackpos=0)
would work? :)
 
The function is represented as...

Code:
getThingFromPos(pos[, displayError = true])

so you should technically use...

Code:
local getwall = getThingFromPos({x = 100, y = 100, z = 7}, false).uid

so it doesn't display any error if there is nothing there.
 
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	return
		doTransformItem(
			getTileItemById(
				{x=408, y=1389, z=10},
				item.itemid == 1945 and
					493
					or 5770
			).uid,
			item.itemid == 1945 and
				5770
			or 493
		)
	and
		doTransformItem(
			item.uid,
			item.itemid == 1945 and
				1946
			or 1945
		),
		item.itemid == 1946 and
			doRelocate({x=408, y=1389, z=10}, {x=407, y=1389, z=10})
end
??
 
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	return
		doTransformItem(
			getTileItemById(
				{x=408, y=1389, z=10},
				item.itemid == 1945 and
					493
					or 5770
			).uid,
			item.itemid == 1945 and
				5770
			or 493
		)
	and
		doTransformItem(
			item.uid,
			item.itemid == 1945 and
				1946
			or 1945
		),
		item.itemid == 1946 and
			doRelocate({x=408, y=1389, z=10}, {x=407, y=1389, z=10})
end
??

I like the way you tabbed it :D
 
I don't. It looks very unorganized, I can read through scripts by just looking at them, while that one does not allow me to do that... It looks too confusing! And it's just pointless doing it that way, dunno why you did anyway... We could make all our scripts that way but why would we ?

And why relocate? It will take all items on that pos too, he don't want that!

If Cyko's don't work, then use this:

LUA:
local wallPos = {x=408, y=1389, z=10}
local playerPos = {x=408, y=1389, z=10}

function onUse(cid, item, frompos, item2, topos)
    local getWall = getTileItemById(wallPos, WALL_ID_HERE)
    if(item.uid ~= 10203 or getWall.uid == 0) then
        return FALSE
    end

    if(item.itemid == 1945) then
        doTransformItem(item.uid, item.itemid+1)
        doTransformItem(getWall.uid, 5770)
    elseif(item.itemid == 1946) then
        doTransformItem(item.uid,item.itemid-1)
        doTransformItem(getWall.uid,493)

        local player = getThingfromPos(bplayer)
        if(isPlayer(player.uid) == TRUE) then
            doMoveCreature(player.uid, WEST)
        end
    end
    return TRUE
end
 
Last edited:
Status
Not open for further replies.
Back
Top