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

Why does this script not work?

bump.
TFS Crying damson 0.3.6pl1 console


Problem 1.

This script should mix 2 items in 1 item but it gives no error neither any action. The ids etc i already got input except here V
PHP:
function onUse(cid, item, fromPosition, itemEx, toPosition)
-----------------------------------------------------

local firstID = X          -- id of the first item
local secondID = X          -- id of the second item
local newID = X           -- id of the new item
local count = 1                -- You get 1 of the new item

local effect = {
                pos = {x=1269, y=1146, z=9},
				pos2 = {x=1269, y=1147, z=9},
				pos3 = {x=1269, y=1148, z=9},
               }
			   
local piece1pos = {

        x = 1268,
        y = 1146,    -- Position of the first item
        z = 9,
}

local piece2pos = {
        x = 1268,
        y = 1148,    -- Position of the second item
        z = 9,



stackpos=255}
local getpiece1 = getThingfromPos(piece1pos)
local getpiece2 = getThingfromPos(piece2pos)
local playerpos = getPlayerPosition(cid)
        if ((getpiece1.itemid == firstID) and (getpiece2.itemid == secondID)) == 1 then
                if item.itemid == 1945 then
                        doTransformItem(item.uid,item.itemid+1)
                elseif item.itemid == 1946 then
                        doTransformItem(item.uid,item.itemid-1)
                end
                doRemoveItem(getpiece1.uid,1)
                doSendMagicEffect(piece1pos,15)
                doRemoveItem(getpiece2.uid,1)
                doSendMagicEffect(piece2pos,15)
                doPlayerAddItem(playerpos,newID,count)
                doSendMagicEffect(playerpos,15)
                doPlayerSendTextMessage(cid, 22, "X")
                doSendMagicEffect(effect.pos,11)
                doSendMagicEffect(effect.pos2,11)
                doSendMagicEffect(effect.pos3,11)
                end
        end

problem 2

On walk in remove stone, if walking out new stone like in dark shield quest.
PHP:
local stonepos1 = {x=1782, y=1415, z=7}        -- Blocking stone position.
local stone1 = getTileItemById(stonepos1, 1304) -- You can change the ID to any other kind of blocking item

function onStepIn(cid, item, frompos, item2, topos)
if getPlayerLevel(cid) < 15 then	
    doRemoveItem(stone1.uid, 1)
	doSendMagicEffect(stonepos1, 14)
	end



function onStepOut(cid, item, frompos, item2, topos)
    doCreateItem(1304, 1, stonepos1)
	doSendMagicEffect(stonepos1, 34)
	return true
end
end

Neither no errors or bugs.
 
Problem #2.

Try this.
Lua:
local sp,i = {x=1782,y=1415,z=7,stackpos=0},1304
function onStepIn(cid,item,frompos,itemEx,topos)
local s = getTileItemById(sp,i)
	if getPlayerLevel(cid) <= 15 then
		doRemoveItem(s.uid,1)
		doSendMagicEffect(sp,CONST_ME_MAGIC_GREEN)
	else
		doPlayerSendCancel(cid,'You must be level 15 or lower.')
	end
	return true
end

function onStepOut(cid, item, frompos, item2, topos)
local v = getThingPos(cid)
	if getPlayerLevel(cid) <= 15 then
		doCreateItem(i,1,sp)
		doSendMagicEffect(sp,CONST_ME_GROUNDSHAKER)
	else
		doPlayerSendCancel(v,CONST_ME_POFF)
	end
	return true
end
 
Try this for 2nd problem
Lua:
local stonepos = {x=1782, y=1415, z=7, stackpos = 1} -- Blocking stone position.
local stone = xxxx -- You can change the ID to any other kind of blocking item
local stonepos1 = {x=1782, y=1415, z=7} 

function onStepIn(cid, item, pos)
if getPlayerLevel(cid) < 15 then
   if getThingfromPos(stonepos1).itemid == stone then    
      doRemoveItem(stonepos.uid, 1)
      doSendMagicEffect(stonepos1, 14)
   end
else
    doPlayerSendCancel(cid, "You need to be under level 15 to do this quest")
    doSendMagicEffect(getPlayerPosition(cid),CONST_ME_POFF)
end
return true
end

local stonepos1 = {x=1782, y=1415, z=7}    
function onStepOut(cid, item, pos)
    doCreateItem(1304, 1, stonepos1)
    doSendMagicEffect(stonepos1, 34)
    return true
end
 
Last edited:
#1
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
-----------------------------------------------------

local firstID = X          -- id of the first item
local secondID = X          -- id of the second item
local newID = X           -- id of the new item
local count = 1                -- You get 1 of the new item

local effect = {
                pos = {x=1269, y=1146, z=9},
                pos2 = {x=1269, y=1147, z=9},
                pos3 = {x=1269, y=1148, z=9},
               }
               
local piece1pos = {

        x = 1268,
        y = 1146,    -- Position of the first item
        z = 9,
}

local piece2pos = {
        x = 1268,
        y = 1148,    -- Position of the second item
        z = 9,



stackpos=255}
local getpiece1 = getThingfromPos(piece1pos)
local getpiece2 = getThingfromPos(piece2pos)
local playerpos = getPlayerPosition(cid)
        if ((getpiece1.itemid == firstID) and (getpiece2.itemid == secondID)) == 1 then
                if item.itemid == 1945 then
                        doTransformItem(item.uid,item.itemid+1)
                elseif item.itemid == 1946 then
                        doTransformItem(item.uid,item.itemid-1)
                end
                doRemoveItem(getpiece1.uid,1)
                doSendMagicEffect(piece1pos,15)
                doRemoveItem(getpiece2.uid,1)
                doSendMagicEffect(piece2pos,15)
                doPlayerAddItem(playerpos,newID,count)
                doSendMagicEffect(playerpos,15)
                doPlayerSendTextMessage(cid, 22, "X")
                doSendMagicEffect(effect.pos,11)
                doSendMagicEffect(effect.pos2,11)
                doSendMagicEffect(effect.pos3,11)
        end
        return true
end
 
#1
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
-----------------------------------------------------

local firstID = X          -- id of the first item
local secondID = X          -- id of the second item
local newID = X           -- id of the new item
local count = 1                -- You get 1 of the new item

local effect = {
                pos = {x=1269, y=1146, z=9},
                pos2 = {x=1269, y=1147, z=9},
                pos3 = {x=1269, y=1148, z=9},
               }
               
local piece1pos = {

        x = 1268,
        y = 1146,    -- Position of the first item
        z = 9,
}

local piece2pos = {
        x = 1268,
        y = 1148,    -- Position of the second item
        z = 9,



stackpos=255}
local getpiece1 = getThingfromPos(piece1pos)
local getpiece2 = getThingfromPos(piece2pos)
local playerpos = getPlayerPosition(cid)
        if ((getpiece1.itemid == firstID) and (getpiece2.itemid == secondID)) == 1 then
                if item.itemid == 1945 then
                        doTransformItem(item.uid,item.itemid+1)
                elseif item.itemid == 1946 then
                        doTransformItem(item.uid,item.itemid-1)
                end
                doRemoveItem(getpiece1.uid,1)
                doSendMagicEffect(piece1pos,15)
                doRemoveItem(getpiece2.uid,1)
                doSendMagicEffect(piece2pos,15)
                doPlayerAddItem(playerpos,newID,count)
                doSendMagicEffect(playerpos,15)
                doPlayerSendTextMessage(cid, 22, "X")
                doSendMagicEffect(effect.pos,11)
                doSendMagicEffect(effect.pos2,11)
                doSendMagicEffect(effect.pos3,11)
        end
        return true
end

Doesn't work, i can't even pull the lever i click on it but nothing happens also no errors :/
 
Lua:
local items, reward = {
	{{x=1268, y=1146, z=9}, xxxx},
	{{x=1268, y=1148, z=9}, xxxx}
}, {xxxx, 1}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local t = {}
	for i = 1, #items do
		local v = getTileItemById(items[i][1], items[i][2]).uid
		if v == 0 then
			return false
		end
		table.insert(t, v)
	end
	for i = 1, #t do
		doRemoveItem(t[i])
		doSendMagicEffect(items[i][1], CONST_ME_HITBYFIRE)
	end
	doPlayerAddItem(cid, reward[1], reward[2])
	doSendMagicEffect(getThingPos(cid), CONST_ME_HITBYFIRE)
	doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'X')
	for y = 1146, 1148 do
		doSendMagicEffect({x=1269, y=y, z=9}, CONST_ME_ENERGYHIT)
	end
	return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
end
Lua:
local pos = {x=1782, y=1415, z=7}

function onStepIn(cid, item, position, fromPosition)
	if isPlayer(cid) then
		doRemoveItem(getTileItemById(pos, 1304).uid)
		doSendMagicEffect(pos, 14)
	end
end

function onStepOut(cid, item, position, fromPosition)
	if isPlayer(cid) then
		doCreateItem(1304, 1, pos)
		doSendMagicEffect(pos, 34)
	end
end
 
Last edited:
@up thanks it worked but on the stepon script it got a problem when a player stands on it the stone removes but if he leaves the tile the stond won't return no errors no bugs!
 
Problem 1 a bug
effect doesnt appear

error:
PHP:
[Error - Creaturescript inferface ]
date/creaturescript/scripts/bosskill.lua:onKill
Description:
attempt to index a number value
stack traceback:
         [C]: in fuction 'doSendAnimatedText'
          data/creaturescript/scripts/bosskill.lua:41: in function <data/creature
scripts/scripts/bosskill.lua:37>
[error - creaturescript interface]
data/creaturescripts/scripts/bosskill.lua:onKill
Description:
<luaGetCreatureStorage> Creature not found

Lua:
local config = {
		message = "BOSS +1",
		color = COLOR_WHITE,
        bosses = { -- Monster Name,  Storagevalue,
                ["Ra revenge"] = {storage=51001},
				["warshabaal"] = {storage=51002},
				["Seadevil"] = {storage=51003},
                ["Haunted dragon"] = {storage=51004},
                ["Thunder dragon"] = {storage=51005},
				["green-eyes red dragon"] = {storage=51006},
				["Chaos emperor dragon"] = {storage=51007},
				["Vampire genesis"] = {storage=51008},
				["dark ruler ha des"] = {storage=51009},
				["Amidamaru"] = {storage=51010},
				["Bason"] = {storage=51011},
				["eliza faust"] = {storage=51012},
				["fortress golem"] = {storage=51013},
				["illusionist"] = {storage=51014},
				["iron maiden jeanne"] = {storage=51015},
				["kouki"] = {storage=51016},
				["zenki"] = {storage=51017},
				["lanancuras"] = {storage=51018},
				["red eyes ultimate dragon"] = {storage=51019},
				["silva"] = {storage=51020},
				["zorc necrophadus"] = {storage=51021},
				["King scorpion"] = {storage=51022},
				["Bazir"] = {storage=51023},
				["Apocal"] = {storage=51024},
				["infernal"] = {storage=51025},
				["Orshabaal"] = {storage=51026},
				["Morgaroth"] = {storage=51027},
				["verminor"] = {storage=51028},
				["saggi the dark clown"] = {storage=51029}
			}
		}
		
function onKill(cid, target, lastHit)
	if(config.bosses[getCreatureName(target)]) then
		local t = config.bosses[getCreatureName(target)]
			if getPlayerStorageValue(cid, t.storage, 1) == 0 then
	setPlayerStorageValue(cid, t.storage, 1)
	doSendAnimatedText(cid, config.message, config.color)
else
	end
	end
return TRUE
end
 
Last edited:
on creaturescripts, change
Lua:
doSendAnimatedText(cid, config.message, config.color)

To:
Lua:
doSendAnimatedText(getCreaturePosition(cid), config.message, config.color)
 
@up still this error
Lua:
[error - creaturescript interface]
data/creaturescripts/scripts/bosskill.lua:onKill
Description:
<luaGetCreatureStorage> Creature not found
 
Back
Top