• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Action Remove/Add Stone with Lever

Ates.tr

Im back
Joined
Nov 11, 2007
Messages
1,046
Reaction score
2
Location
Sweden
Hello,


This script should work, not tested yet!

What its that script for ?:

1. Its can be for questes/hunt places
2. When you 'use' a lever then a stone will be removed at the location you used (If you click again then the stone adds)

"lever (stone).lua"
Code:
-- Script by Ates, Add/Remove Stone!
-- Edited by Gelio (bugs fixed)
-- Help by Colandus
function onUse(cid, item, fromPosition, itemEx, toPosition)
local pos = {X=XXX, Y=YYY, Z=ZZZ} -- The Pos [EDIT HERE][Example: X=1000, Y=1000, Z=7]
local stone = 1304 -- ID of the stone [DO NOT EDIT]
local stoneFromPos = getThingfromPos(pos)  -- It get item uid

if item.itemid == 1945 then -- DO NOT EDIT
doRemoveItem(stoneFromPos.uid, 1) -- DO NOT EDIT
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You removed the Stone.") -- DO NOT EDIT
doTransformItem(item.uid, 1946)  -- It transform switch to id 1946
elseif item.itemid == 1946 then -- DO NOT EDIT
doCreateItem(stone, 1, pos) -- DO NOT EDIT
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You added the Stone.") -- DO NOT EDIT
doTransformItem(item.uid, 1945)  -- It transform switch to id 1945
end
end
<action uniqueid="10000" script="lever (stone).lua"/>[/CODE]

and in Remere Map Editor higher click a lever with id 1945 and write in UNIQUE ID 10000


/REPORT BUGS!
 
Last edited:
Isnt this just dhq script with a function added?

Can you do so the lver automatically pulls back when going on a tile ?

check my thread in requests
 
I can try make when you enter a tile with uid 1000 example the stone its removing, and when move out from tile the stone adds again!
 
Ehh. Next bug I found in your scripts. Red - bugs. Script edited by me:
Code:
-- Script by Ates, Add/Remove Stone!
-- Edited by Gelio (bugs fixed)
function onUse(cid, item, fromPosition, itemEx, toPosition)
local pos = {X=XXX, Y=YYY, Z=ZZZ} -- The Pos [EDIT HERE][Example: X=1000, Y=1000, Z=7]
local stone = 1304 -- ID of the stone [DO NOT EDIT]
[COLOR="Red"]local stoneFromPos = getThingfromPos(pos)[/COLOR]  -- It get item uid

if item.itemid == 1945 then -- DO NOT EDIT
[COLOR="Red"]doRemoveItem(stoneFromPos,1)[/COLOR] -- DO NOT EDIT
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You removed the Stone.") -- DO NOT EDIT
[COLOR="Red"]doTransformItem(item.uid,1946)[/COLOR]  -- It transform switch to id 1946
elseif item.itemid == 1946 then -- DO NOT EDIT
[COLOR="Red"]doCreateItem(stone,1,pos)[/COLOR] -- DO NOT EDIT
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You added the Stone.") -- DO NOT EDIT
[COLOR="Red"]doTransformItem(item.uid,1945)[/COLOR]  -- It transform switch to id 1945
end
end
I hope in your next script there willn't be bugs :)

Yours,
Gelio
 
Hahaah ;P thanks again... i just learning/testing!

Sorry for double posting but, why need doTransformItem? its auto switching "ID" .... ?

local stoneFromPos = getThingfromPos(pos) -- It get item uid


? im naab but you can choose uid on action.xml ?


Its good that you helping me ;) im learning!
 
Last edited by a moderator:
local stoneFromPos = getThingfromPos(pos) -- It get item uid
Gets stone id. You can't remove something without got this uid. And on some OT auto increase/decrease id is not made.

Yours,
Gelio

P.S.: Sorry for my english ;p
 
Back
Top