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

Solved Storage script

Cloow

Active Member
Joined
May 10, 2010
Messages
1,086
Reaction score
35
I don't get it, why wont these scripts work?


Lua:
function onUse(cid, item, frompos, item2, topos)
	if item.uid == 6124 then 
     setPlayerStorageValue(cid, 5184, 1)
	 doSendMagicEffect(cid,12)
	 doPlayerSendTextMessage(cid,22,'You found some strange power.')
	 end
		else
	if getPlayerStorageValue(cid, 5184) < 0 then
	doPlayerSendCancel(cid, "You already found the power.")
return true
end

Lua:
function onUse(cid, item, frompos, item2, topos)
	doPlayerAddItem(cid, 12339)
	doPlayerSendTextMessage(cid, "You found a ab1!")
	setPlayerStorageValue(cid, 51212, 1)
	end
	if getPlayerStorageValue(cid, 51212) < 0 then
	doPlayerSendCancel(cid, "There is nothing there")
	return true
 end

[20/01/2013 16:05:52] [Error - Action Interface]
[20/01/2013 16:05:52] data/actions/scripts/ab1.lua
[20/01/2013 16:05:52] Description:
[20/01/2013 16:05:52] (luaGetCreatureStorage) Creature not found

[20/01/2013 16:05:53] [Error - Action Interface]
[20/01/2013 16:05:53] data/actions/scripts/ab1.lua
[20/01/2013 16:05:53] Description:
[20/01/2013 16:05:53] data/actions/scripts/ab1.lua:6: attempt to compare boolean with number
[20/01/2013 16:05:53] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/ab1.lua)
[20/01/2013 16:05:53] data/actions/scripts/accestoquestdoorms.lua:8: 'then' expected near 'doPlayerSendCancel'
[20/01/2013 16:05:53] [Error - LuaScriptInterface::loadFile] data/actions/scripts/accestoquestdoorms.lua:7: 'end' expected (to close 'function' at line 1) near 'else'
[20/01/2013 16:05:53] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/accestoquestdoorms.lua)
[20/01/2013 16:05:53] data/actions/scripts/accestoquestdoorms.lua:7: 'end' expected (to close 'function' at line 1) near 'else'

thanks in advance
 
Try this:
Lua:
function onUse(cid, item, frompos, item2, topos)
	if item.uid == 6124 and getPlayerStorageValue(cid, 5184) <= 0 then 
        setPlayerStorageValue(cid, 5184, 1)
	doSendMagicEffect(cid,12)
	doPlayerSendTextMessage(cid,22,"You found some strange power.")
	elseif getPlayerStorageValue(cid, 5184) >= 1 then
	doPlayerSendCancel(cid, "You already found the power.")
	end
	return true
end
Lua:
function onUse(cid, item, frompos, item2, topos)
	if getPlayerStorageValue(cid, 51212) <= 0 then
	doPlayerAddItem(cid, 12339)
	doPlayerSendTextMessage(cid, "You found a ab1!")
	setPlayerStorageValue(cid, 51212, 1)
	elseif getPlayerStorageValue(cid, 51212) >= 1 then
	doPlayerSendCancel(cid, "There is nothing there")
	end
	return true
 end
 
Thanks alot!

Could someone help me with this one to? :)

Lua:
local id = 5578 --this is the action id u need to edit to the item in map editor
local place = {x=2499, y=2499, z=7} --location where player will be tped
local item = 12339
function onStepIn(cid, item, position, fromPosition)
if item.actionid == id and doPlayerRemoveItem(cid, item, 1) then
doTeleportThing(cid, place)
doSendMagicEffect(getPlayerPosition(cid), 10)
elseif item.actionid == id and doPlayerRemoveItem(cid, item, ~= 1) 
doPlayerSendCancel(cid, 'You need to sacriface a sword stone to get past here')
		end
end
end

[20/01/2013 18:13:07] [Error - LuaScriptInterface::loadFile] data/movements/scripts/teleportms.lua:8: unexpected symbol near '~='
[20/01/2013 18:13:07] [Warning - Event::loadScript] Cannot load script (data/movements/scripts/teleportms.lua)
[20/01/2013 18:13:07] data/movements/scripts/teleportms.lua:8: unexpected symbol near '~='
 
Enjoy!
Lua:
        function onStepIn(cid, item, position, fromPosition)
	local place = {x=2499, y=2499, z=7} --location where player will be tped
	local item = 12339
	
	if not (isPlayer(cid)) then return true end
	if doPlayerRemoveItem(cid, item) == 1 then
		doSendMagicEffect(getPlayerPosition(cid), 10)
		doTeleportThing(cid, place)
	else
		doTeleportThing(cid, fromPosition)
		doPlayerSendCancel(cid, 'You need to sacriface a sword stone to get past here')
		end
	return true
end
 
Last edited:
[20/01/2013 19:03:01] [Error - MoveEvents Interface]
[20/01/2013 19:03:01] data/movements/scripts/teleportms.lua:eek:nStepIn
[20/01/2013 19:03:01] Description:
[20/01/2013 19:03:01] (luaDoPlayerRemoveItem) Player not foun

Heppens when I walk over the tile
 
Which script is that?

- - - Updated - - -

I updated the post, the script was badly made so i remade it.
 
[20/01/2013 19:18:28] [Error - MoveEvents Interface]
[20/01/2013 19:18:28] data/movements/scripts/teleportms.lua:eek:nStepIn
[20/01/2013 19:18:28] Description:
[20/01/2013 19:18:28] (luaDoPlayerRemoveItem) Player not found

Im still getting the error.

Could it be because of group ids?
 
Retry :p
Lua:
 function onStepIn(cid, item, position, fromPosition)
	local place = {x=2499, y=2499, z=7} --location where player will be tped
	local item = 12339
 
	if not (isPlayer(cid)) then return true end
	if getPlayerItemCount(cid, item) >= 1 then
		doSendMagicEffect(getPlayerPosition(cid), 10)
		doTeleportThing(cid, place)
		doPlayerRemoveItem(cid,item,1)
	else
		doTeleportThing(cid, fromPosition)
		doPlayerSendCancel(cid, 'You need to sacriface a sword stone to get past here')
		end
	return true
end
 
Last edited:
[20/01/2013 19:23:37] [Error - MoveEvents Interface]
[20/01/2013 19:23:37] data/movements/scripts/teleportms.lua:eek:nStepIn
[20/01/2013 19:23:37] Description:
[20/01/2013 19:23:37] (luaDoRemoveItem) Item not found

Im getting teleported to the correct position, still having my item in the bag (12339)


-- Edit --

Also noticed another script that wont run ..

Lua:
local t = {
	storage = 32000,
	interval = 120,
	monster = {"Theruay", {x=2502, y=2499, z=7}},
	msg = "Theruay appears!"
}
function onStepIn(cid, item, position, fromPosition)
	if os.difftime(os.time(), getGlobalStorageValue(t.storage)) >= t.interval then       
		doCreatureSay(cid, t.msg, TALKTYPE_ORANGE_1)
		doSummonCreature(t.monster[1], t.monster[2])
		setGlobalStorageValue(t.storage, os.time())
	end
end

I have no idea why, the script is made by Cykotitan also..
there is no errors in the console
 
Last edited:
My fault typo :p
Now:
Lua:
function onStepIn(cid, item, position, fromPosition)
	local place = {x=2499, y=2499, z=7} --location where player will be tped
	local item = 12339
 
	if not (isPlayer(cid)) then return true end
	if getPlayerItemCount(cid, item) >= 1 then
		doSendMagicEffect(getPlayerPosition(cid), 10)
		doTeleportThing(cid, place)
		doPlayerRemoveItem(cid,item,1)
	else
		doTeleportThing(cid, fromPosition)
		doPlayerSendCancel(cid, 'You need to sacriface a sword stone to get past here')
		end
	return true
end
 
Here:
Lua:
local t = {
	storage = 32000,
	interval = 5,
	monster = {"Theruay", {x=1006, y=1006, z=7}},
	msg = "Theruay appears!"
}
function onStepIn(cid, item, position, fromPos, fromPosition)
if isPlayer(cid) then
	if exhaustion.get(cid, t.storage) == FALSE then      
		doCreatureSay(cid, t.msg, TALKTYPE_ORANGE_1)
		doSummonCreature(t.monster[1], t.monster[2])
		exhaustion.set(cid, t.storage, t.interval)
	else
	        doPlayerSendTextMessage(cid, 19, "You have to wait for "..getPlayerStorageValue(cid, t.storage)-os.time().." seconds to enter again.")
	        doTeleportThing(cid, fromPosition)
	    end
	end
end
 
Here:
Lua:
local t = {
	storage = 32000,
	interval = 5,
	monster = {"Theruay", {x=1006, y=1006, z=7}},
	msg = "Theruay appears!"
}
function onStepIn(cid, item, position, fromPos, fromPosition)
if isPlayer(cid) then
	if exhaustion.get(cid, t.storage) == FALSE then      
		doCreatureSay(cid, t.msg, TALKTYPE_ORANGE_1)
		doSummonCreature(t.monster[1], t.monster[2])
		exhaustion.set(cid, t.storage, t.interval)
	else
	        doPlayerSendTextMessage(cid, 19, "You have to wait for "..getPlayerStorageValue(cid, t.storage)-os.time().." seconds to enter again.")
	        doTeleportThing(cid, fromPosition)
	    end
	end
end

I changed my mind, I want it to give the player a storage so it cant be summoned again by the same player.
something like this, but I cant get it to work ..

Lua:
local t = {
monster = {"MONSTER", {x=2502, y=2499, z=7}}, 
}
function onStepIn(cid, item, position, fromPosition)
  setPlayerStorageValue(cid, 4565, 1)
  doCreateMonster(t.monster[1], t.monster[2]) 
  elseif getPlayerStorageValue(cid, 4565) >= 1 then
  doPlayerSendCancel(cid, "")
  return TRUE
 end
end



This script wont work either! :mad:

Lua:
local walls = { 
{{x=2490, y==2478, z=7, stackpos=1},1354},  
} 
local str = "Something has moved not too far away." 
isWallRemoved = FALSE 
function onUse(cid, item, frompos, item2, topos) 
    if item.itemid == 1945 then 
        if isWallRemoved == FALSE then 
            for i=1,#walls do 
                doRemoveItem(getThingFromPos(walls[i][1]).uid, 1) 
            end 
                isWallRemoved = TRUE 
            else 
            for i=1,#walls do 
                doCreateItem(walls[i][2], 1, walls[i][1]) 
            isWallRemoved = FALSE 
            end 
        end 
        doTransformItem(item.uid, item.itemid+1) 
        doPlayerSendTextMessage(cid,22, str) 
    elseif item.itemid == 1946 then 
        doTransformItem(item.uid, item.itemid-1) 
end 
    return TRUE 
end


When I pull the switch I get the message but the stone wont remove itself.
Console:
[20/01/2013 20:23:10] [Error - Action Interface]
[20/01/2013 20:23:10] data/actions/scripts/stlever2.lua:eek:nUse
[20/01/2013 20:23:10] Description:
[20/01/2013 20:23:10] (luaGetThingFromPos) Tile not found

[20/01/2013 20:23:10] [Error - Action Interface]
[20/01/2013 20:23:10] data/actions/scripts/stlever2.lua:eek:nUse
[20/01/2013 20:23:10] Description:
[20/01/2013 20:23:10] (luaDoRemoveItem) Item not found
 
Last edited:
But i made it with timer, ok you are the boss.
Lua:
local t = {
	storage = 32000,
	interval = 5,
	monster = {"Theruay", {x=1006, y=1006, z=7}},
	msg = "Theruay appears!"
}

function onStepIn(cid, item, position, fromPos, fromPosition)
if isPlayer(cid) then
	if getPlayerStorageValue(cid, storage) <= 0 then    
		doCreatureSay(cid, t.msg, TALKTYPE_ORANGE_1)
		doSummonCreature(t.monster[1], t.monster[2])
		setPlayerStorageValue(cid,storage, 1)
	else
		doPlayerSendTextMessage(cid, 19, "You have already entered this tile.")
		doTeleportThing(cid, fromPosition)
		end
	end
end
 
But i made it with timer, ok you are the boss.
Lua:
local t = {
	storage = 32000,
	interval = 5,
	monster = {"Theruay", {x=1006, y=1006, z=7}},
	msg = "Theruay appears!"
}

function onStepIn(cid, item, position, fromPos, fromPosition)
if isPlayer(cid) then
	if getPlayerStorageValue(cid, storage) <= 0 then    
		doCreatureSay(cid, t.msg, TALKTYPE_ORANGE_1)
		doSummonCreature(t.monster[1], t.monster[2])
		setPlayerStorageValue(cid,storage, 1)
	else
		doPlayerSendTextMessage(cid, 19, "You have already entered this tile.")
		doTeleportThing(cid, fromPosition)
		end
	end
end

Thanks alot, cyko!
Sorry for taking so much of your time, but if you did not see I edited the last post with another script.
If you would have the time and such I would be forever grateful! :3

(need to spread some rep before giving, i'll give asap!)
 
Found this by Cykotitan:
Lua:
local pos, e = {x=535, y=1266, z=10}, 0
local f = function(p)
	doCreateItem(1304, 1, pos)
	doTransformItem(getTileItemById(p, 1946).uid, 1945)
end
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 then
		doRemoveItem(getTileItemById(pos, 1304).uid)
		e = addEvent(f, 5 * 60 * 1000, fromPosition)
		doTransformItem(item.uid, 1946)
	else
		stopEvent(e)
		e = 0
		f(fromPosition)
	end
	return true
end
 
Found this by Cykotitan:
Lua:
local pos, e = {x=535, y=1266, z=10}, 0
local f = function(p)
	doCreateItem(1304, 1, pos)
	doTransformItem(getTileItemById(p, 1946).uid, 1945)
end
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 then
		doRemoveItem(getTileItemById(pos, 1304).uid)
		e = addEvent(f, 5 * 60 * 1000, fromPosition)
		doTransformItem(item.uid, 1946)
	else
		stopEvent(e)
		e = 0
		f(fromPosition)
	end
	return true
end


Getting errors
[20/01/2013 20:48:42] [Error - Action Interface]
[20/01/2013 20:48:42] data/actions/scripts/stlever1.lua:eek:nUse
[20/01/2013 20:48:42] Description:
[20/01/2013 20:48:42] (luaDoRemoveItem) Item not found

[20/01/2013 20:48:53] [Error - Action Interface]
[20/01/2013 20:48:53] data/actions/scripts/stlever1.lua:eek:nUse
[20/01/2013 20:48:53] Description:
[20/01/2013 20:48:53] (luaDoCreateItem) Tile not found

Lua:
local pos, e = {x=2490, y==2478, z=7}, 1354
local f = function(p)
local str = "Something has moved not too far away." 
	doCreateItem(1354, 1, pos)
	doTransformItem(getTileItemById(p, 1946).uid, 1945)
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 then
		doRemoveItem(getTileItemById(pos, 1354).uid)
		e = addEvent(f, 5 * 60 * 1000, fromPosition)
		doTransformItem(item.uid, 1946)
		doPlayerSendTextMessage(cid,22, str) 
	else
		stopEvent(e)
		e = 0
		f(fromPosition)
	end
	return true
end
 
Last edited:
Enjoy!
Lua:
local cyko = {
	remove_item = 2767, -- id of the item which going to be removed
	create_item = 2768, -- id of the item which going to be created
	pos = {x=1045, y=1058, z=7}, -- pos of the item which will be removed and also created
	remove_time = 30, -- how long should the item be removed
	create_removed_time = 31, -- always put 1 sec after the remove time
}
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 then
		if getTileItemById(cyko.pos, cyko.remove_item).uid > 0 then
			doRemoveItem(getTileItemById(cyko.pos, cyko.remove_item).uid)
			doCreatureSay(cid, 'Something has been moved for '..cyko.remove_time..' seconds, please explore', TALKTYPE_MONSTER)
			addEvent(doCreateItem, 1 * 1000, cyko.create_item, 1, cyko.pos) -- no edit
			addEvent(doCleanTile, cyko.remove_time * 1000,cyko.pos,false)
			addEvent(doCreateItem, cyko.create_removed_time * 1000, cyko.remove_item, 1, cyko.pos)
		else
			doPlayerSendCancel(cid, 'The lever is already used.')
		end
	end
	return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
end
 
Lua:
local cyko = {
	remove_item = 1354, -- id of the item which going to be removed
	create_item = 1354, -- id of the item which going to be created
	pos = {x=2490, y==2478, z=7}, -- pos of the item which will be removed and also created
	remove_time = 59, -- how long should the item be removed
	create_removed_time = 60, -- always put 1 sec after the remove time
}
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 then
		if getTileItemById(cyko.pos, cyko.remove_item).uid > 0 then
			doRemoveItem(getTileItemById(cyko.pos, cyko.remove_item).uid)
			doCreatureSay(cid, 'Something has been moved for '..cyko.remove_time..' seconds, please explore', TALKTYPE_MONSTER)
			addEvent(doCreateItem, 1 * 1000, cyko.create_item, 1, cyko.pos) -- no edit
			addEvent(doCleanTile, cyko.remove_time * 1000,cyko.pos,false)
			addEvent(doCreateItem, cyko.create_removed_time * 1000, cyko.remove_item, 1, cyko.pos)
		else
			doPlayerSendCancel(cid, 'The lever is already used.')
		end
	end
	return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
end

When I pull the switch I get "The lever is already used" and the stone is still in it place.
No console errors
 
Remaded the script, Enjoy:
Lua:
local Cyko = {
	LeverPos = {x=1001, y=1010, z=7, stackpos=1}, --Posistion of the lever, so players can use it again
	ItemPos = {x=999, y=1010, z=7, stackpos=1}, -- Posistion of the item which will be removed and also created
	Timer = 5, --How long should the item be removed
	ItemId = 1285 --ID of the removed item
}

function onUse(cid, item, fromPos, item2, toPos)
    if item.itemid == 1945 then
        doRemoveItem(getThingfromPos(Cyko.ItemPos).uid, 1)
        doTransformItem(item.uid, 1946)
        addEvent(onBack, Cyko.Timer*1000)
        doCreatureSay(cid, 'Something has been moved for '..Cyko.Timer..' seconds, please explore', TALKTYPE_MONSTER)
    else
        doPlayerSendCancel(cid, "Sorry, but someone already used this switch.")
    end
return true
end
 
function onBack()
    doTransformItem(getThingFromPos(Cyko.LeverPos).uid, 1945)
    doCreateItem(Cyko.ItemId,1,Cyko.ItemPos)
end
 
Back
Top