• 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 thx to cykotitan]

Exmortis

Member
Joined
Jun 27, 2008
Messages
189
Reaction score
5
I've been searching the forums for a good post about the demonhelmet scripts.
I found one that isn't working, it only says that docreateteleport is a nil value.
If someone could make me a simple script like this: you pull a lever, the pink stone disappears and then after 2 minutes, the stone goes back to the same place and the lever resets. maybe some flashing text that says, "you opened a passage."
I dont need any teleporter to be created since i already have one.
Rep+ for anyone who does this.
(im useing TFS 0.2.7)


This is the script so far, snagged a little from different scripts since im not a scripter at all.
I cant get this timer to work.

Code:
local gatepos = {x=1327, y=1107, z=12, stackpos=1}
local leverPos = {x=1343, y=1106, z=12}

local function reset(leverPos)
	doCreateItem(1355, 1, gatePos)
	doTransformItem(getTileItemById(leverPos, 1946).uid, 1945)
end

function onUse(cid, item, frompos, item2, topos)
local getgate = getThingfromPos(gatepos)


if item.itemid == 1945 and getgate.itemid == 1355 then
doRemoveItem(getgate.uid, 1)
doTransformItem(item.uid, item.itemid+1)
addEvent(reset, 5000, fromPosition)
elseif item.itemid == 1946 and getgate.itemid == 0 then
doCreateItem(1355, 1, gatepos)
doTransformItem(item.uid, item.itemid-1)
else
doPlayerSendCancel(cid,"Sorry, not possible.")
end
return 1
end

This is the error im getting:
attempt to index a nil value
stack traceback:
[C]: in function 'docreateitem'
data/actions/scripts/quests/demonhelmet2.lua:5: in function data/actions/scripts/quests/demonhelmet2.lua
 
Last edited:
local gatepos = {x=344, y=793, z=12, stackpos=1}

function onUse(cid, item, frompos, item2, topos)
local getgate = getThingfromPos(gatepos)

if item.itemid == 1945 and getgate.itemid == 1355 then
doRemoveItem(getgate.uid, 1)
doTransformItem(item.uid, item.itemid+1)
elseif item.itemid == 1946 and getgate.itemid == 0 then
doCreateItem(1355, 1, gatepos)
doTransformItem(item.uid, item.itemid-1)
else
doPlayerSendCancel(cid,"Sorry, not possible.")
end
return 1
end
that works for me. i found it on this forum months ago with search try using it sometime
 
If you would have taken the time yourself to read my post, you can clearly see at the top that I said "I've been searching the forums for a good post about the demonhelmet scripts."
Thanks for your help, i'll try it right away.
Rep+
 
Lua:
local pos, event = {x=1327, y=1107, z=12}, 0
local time = 120 -- in seconds
 
local function reset(leverPos)
	doCreateItem(1355, 1, pos)
	doTransformItem(getTileItemById(leverPos, 1946).uid, 1945)
end
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 then
		doRemoveItem(getTileItemById(pos, 1355).uid)
		event = addEvent(reset, time * 1000, fromPosition)
		doTransformItem(item.uid, 1946)
	else
		stopEvent(event)
		reset(fromPosition)
	end
	return TRUE
end
 
Last edited:
dhelm.jpg
Well you do know what i want?
I want the lever to be pulled so the stone is removed.
And after 2min i want it ro reset. thats all.
 
Works great, as always when you respond. Thanks mate
Unfortuneatly i'll have to spread some rep before giving it to you again, which i will do right away.
 
Back
Top