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

[Action] Remove a stone with a switch (FTS 0.3.1 CryingDamson)

Pentagratta

ancientwars.servegame.com
Joined
Mar 15, 2009
Messages
76
Reaction score
0
Location
São Paulo - Brazil
HAS BEEN RESOLVED,
THANKS KUBEN!



Greetings,

Im here to ask if someone have a script which when i use a switch (
14ybu9w.jpg
) a stone (
208cyac.png
) is removed from a XYZ coord. and when i used it again the stone back to same place...
I use: The Forgotten Server - Version 0.3.1 (Crying Damson)


Ill be glad if someone can give it to me, please...
And i know it isnt so much, but ill give rep+ :)
- sorry for bad english -

My sincere thanks,
Pentagratta.
 
Last edited:
Here...

Code:
local gatepos = {[COLOR="Red"]x=2446, y=2854, z=15[/COLOR], stackpos=1} 
local newstone = 0
function onUse(cid, item, frompos, item2, topos) 
	local getgate = getThingfromPos(gatepos) 
	if(item.uid == [COLOR="Blue"]10200[/COLOR]) then
		if(item.itemid == 1945 and getgate.itemid == 1355) then 
			doRemoveItem(getgate.uid, 1) 
			doTransformItem(item.uid, 1946)
			newstone = addEvent(recreateStone, 1000*[COLOR="DarkOrange"]30[/COLOR], {pos = gatepos, item = item})
		elseif(item.itemid == 1946 and getgate.itemid == 0) then 
			doCreateItem([COLOR="Green"]1304[/COLOR],1,gatepos) 
			doTransformItem(item.uid, 1945)
			stopEvent(newstone)
		end
	else 
		doPlayerSendCancel(cid,"Sorry, not possible.") 
	end
	return TRUE
end 
function recreateStone(param)
	doCreateItem([COLOR="Green"]1304[/COLOR], 1, param.pos)
	doTransformItem(param.item.uid, 1945)
	newstone = 0
end

Red: Coordinates of the stone.
Blue: UniqueID of the switch.
Orange: The time (1 = 1sec) when the stone appears again.
Green: The Stone itemID.
 
make sure this...

the directory is data/actions/scripts/dhlever.lua

Code:
local gatepos = {x=2446, y=2854, z=15, stackpos=1} 
local newstone = 0
function onUse(cid, item, frompos, item2, topos) 
	local getgate = getThingfromPos(gatepos) 
	if(item.uid == [COLOR="Blue"]10200[/COLOR]) then
		if(item.itemid == 1945 and getgate.itemid == 1355) then 
			doRemoveItem(getgate.uid, 1) 
			doTransformItem(item.uid, 1946)
			newstone = addEvent(recreateStone, 1000*30, {pos = gatepos, item = item})
		elseif(item.itemid == 1946 and getgate.itemid == 0) then 
			doCreateItem(1304,1,gatepos) 
			doTransformItem(item.uid, 1945)
			stopEvent(newstone)
		end
	else 
		doPlayerSendCancel(cid,"Sorry, not possible.") 
	end
	return TRUE
end 
function recreateStone(param)
	doCreateItem(1304, 1, param.pos)
	doTransformItem(param.item.uid, 1945)
	newstone = 0
end

and in data/actions/actions.xml

Code:
<action uniqueid="[COLOR="Blue"]10200[/COLOR]" script="dhlever.lua" />

is the same UniqueID
 
Maybe This:

Code:
doTransformItem(param.[B]item.uid, 1945)[/B]

Should Be:

Code:
doTransformItem(param.[B]item.itemid, 1945)[/b]

I dont know...
I'm not an expert.
 
Yeah everythings allright (i think)

If you want, you can check it here
obs.: the stone position in map is only for check if the script works, know xD


-- Edit 1 --

Thanks justin234 for reply!
I gonna try do it

-- Edit 2 --
justin234 it dont works too x(
 
Last edited:
this work i think...

Code:
local gatepos = {x=1000, y=1016, z=7, stackpos=1} 
local newstone = 0
function onUse(cid, item, frompos, item2, topos) 
	local getgate = getThingfromPos(gatepos) 
	if(item.uid == 10200) then
		if(item.itemid == 1945 and getgate.itemid == 1304) then 
			doRemoveItem(getgate.uid, 1) 
			doTransformItem(item.uid, 1946)
			newstone = addEvent(recreateStone, 1000*30, {pos = gatepos, item = item})
		elseif(item.itemid == 1946 and getgate.itemid == 0) then 
			doCreateItem(1304,1,gatepos) 
			doTransformItem(item.uid, 1945)
			stopEvent(newstone)
		end
	else 
		doPlayerSendCancel(cid,"Sorry, not possible.") 
	end
	return TRUE
end 
function recreateStone(param)
	doCreateItem(1304, 1, param.pos)
	doTransformItem(param.item.uid, 1945)
	newstone = 0
end
 

Similar threads

Replies
0
Views
134
Back
Top