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

Lua Switch Reset help. Should be simple

destroyer667

Member
Joined
Nov 21, 2007
Messages
290
Reaction score
6
im trying to get my switch to reset back so people can use it again for the quest but it wont go back!

LUA:
function onUse(cid, item, frompos, item2, topos) 
gatepos = {x=33314, y=31592, z=15, stackpos=1} 
getgate = getThingfromPos(gatepos) 

if item.uid == 4560 and item.itemid == 1945 and getgate.itemid == 1355 then 
doRemoveItem(getgate.uid,1) 
addEvent(doTransformItem, 10*60*1000, item.uid, 1945) 
addEvent(onTimer5, 10*60*1000) 
doTransformItem(item.uid,item.itemid+1) 
else 
doPlayerSendCancel(cid,"Sorry you must wait for the switch to reset.") 
end 
  return 1 
  end 

function onTimer5() 

wallnewpos = {x=33314, y=31592, z=15}  
        doCreateItem(1355,1,wallnewpos) 
end


Works perfect use this script if you want to! + rep
 
Last edited:
thanks trying it now

it works.. but i tried it like this.. and i got a mossy wall id: 1944 on the switch

See above for working script
 
Last edited:
thanks trying it now

here if the past change didn't work:
LUA:
function onUse(cid, item, frompos, item2, topos) 
local gatepos = {x=33314, y=31592, z=15, stackpos=1} 
local getgate = getThingfromPos(gatepos)  
return item.uid == 4560 and item.itemid == 1945 and getgate.itemid == 1355 and (doRemoveItem(getgate.uid,1) and addEvent(onTimer5, 1*60*1000) and addEvent(doTransformItem, 1*60*1000, item.uid, item.itemid-1) and doTransformItem(item.uid,item.itemid+1)) and true or doPlayerSendCancel(cid,"Sorry you must wait for the switch to reset.")
end 

function onTimer5() 
local wallnewpos = {x=33314, y=31592, z=15}  
doCreateItem(1355,1,wallnewpos) 
end
 
here if the past change didn't work:
Lua Code:
function onUse(cid, item, frompos, item2, topos)
local gatepos = {x=33314, y=31592, z=15, stackpos=1}
local getgate = getThingfromPos(gatepos)
return item.uid == 4560 and item.itemid == 1945 and getgate.itemid == 1355 and (doRemoveItem(getgate.uid,1) and addEvent(onTimer5, 1*60*1000) and addEvent(doTransformItem, 1*60*1000, item.uid, item.itemid-1) and doTransformItem(item.uid,item.itemid+1)) and true or doPlayerSendCancel(cid,"Sorry you must wait for the switch to reset.")
end

function onTimer5()
local wallnewpos = {x=33314, y=31592, z=15}

doCreateItem(1355,1,wallnewpos)



that script also gives me a mossy wall when it resets the switch but on this new script the switch doesn't change from 1945 to 1946 when you pull it.





EDIT: Also im using Avesta Server v4 for 7.6



See above for working script
 
Last edited:
No matter what i try i still get a mossy wall with that line u told me to add even if i chance the + to a - and move it around.

this is what i have the script works perfectly... i just keep getting a mossy wall even if the switch is "1946".... it should change it back to 1945 but it doesn't it acts like its not even reading that the switch was changed at all it keeps thinking its 1945

See above for working script
 
Last edited:
No matter what i try i still get a mossy wall with that line u told me to add even if i chance the + to a - and move it around.

this is what i have the script works perfectly... i just keep getting a mossy wall even if the switch is "1946".... it should change it back to 1945 but it doesn't it acts like its not even reading that the switch was changed at all it keeps thinking its 1945

LUA:
function onUse(cid, item, frompos, item2, topos) 
gatepos = {x=33314, y=31592, z=15, stackpos=1} 
getgate = getThingfromPos(gatepos) 

if item.uid == 4560 and item.itemid == 1945 and getgate.itemid == 1355 then 
doRemoveItem(getgate.uid,1) 
doTransformItem(item.uid,item.itemid+1)
addEvent(onTimer5, 1*60*1000) 
addEvent(doTransformItem, 1*60*1000, item.uid, 1945)
else 
doPlayerSendCancel(cid,"Sorry you must wait for the switch to reset.") 
end 
  return 1 
  end 

function onTimer5() 

wallnewpos = {x=33314, y=31592, z=15}  
        doCreateItem(1355,1,wallnewpos) 
end

Have you tried to change item.itemid-1 to 1945?
 
Back
Top