• 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 Tool Gear (SGOG, SSOE & WDOF)

Siramix

CEO
Senator
Premium User
Joined
Jan 6, 2010
Messages
3,554
Reaction score
262
Location
Sweden, Europe
Hello!

I'm brought here today to release a very useful script for
open-tibia servers.

What is it?
It's a tool, under three different names.
They are, Squeezing Gear of Girlpower, Sneaky Stabber of Eliteness
and Whacking Driller of Fate

How do they look?
Just match the color of the font above and the color of
the sprite given on the items below. For color-blinds, I'll write next to the item too!

Squeezing_Gear_of_Girlpower.gif
Squeezing Gear of Girlpower.
Sneaky_Stabber_of_Eliteness.gif
Sneaky Stabber of Eliteness.
Whacking_Driller_of_Fate.gif
Whacking Driller of Fate.

What do they do?
These magnificent tool are useful. Why?
I'm going to tell you a secret, it works as a Rope, Shovel, Pick, Machete, Hammer and a Crowbar! :eek:
All in the same tool, and it weights only 3.00 oz.

Isn't that great?! :D

Script and Guide:

First of all, we'll go to the Actions.xml, inside of your server
directory to make sure that you will direct the script right!

Open actions.xml in any software that allows you to modify with.
Following lines should be placed anywhere. But I suggest you to
make an own section for it. So just copy and paste! :)

Actions.xml
Code:
  <!-- Tool Squeezings -->
    <action fromid="10511" toid="10516" event="script" value="tools/squeezings.lua"/>

And then just go with a basic save of your document.
Now! We'll head in to action scripts, in; ServerDirectory/data/actions/scripts/tools.

Create a LUA file there, and paste all this in the file.

Squeezings.lua

Code:
local holes = {468, 481, 483, 7932}
local holeId = {294, 369, 370, 383, 392, 408, 409, 427, 428, 430, 462, 469, 470, 482, 484, 485, 489, 924, 3135, 3136}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local value = getPlayerStorageValue(cid, 10)
	if(value ~= -1 and os.clock()-value < 60)then
		doPlayerSay(cid, "The tool jammed. Please wait " .. 60-math.floor(os.clock()-value) .. " seconds before using it again.", TALKTYPE_MONSTER)
		return TRUE
	end
	if(math.random(1, 10) == 1)then
		setPlayerStorageValue(cid, 10, os.clock())
		doPlayerSay(cid, "The tool jammed. Please wait 60 seconds before using it again.", TALKTYPE_MONSTER)
		return TRUE
	end
	-- Shovel
	if isInArray(holes, itemEx.itemid) == TRUE then
		doTransformItem(itemEx.uid, itemEx.itemid + 1) 
		doDecayItem(itemEx.uid)
		return FALSE
	-- Rope
	elseif toPosition.x == CONTAINER_POSITION or toPosition.x == 0 and toPosition.y == 0 and toPosition.z == 0 then
		return FALSE
	end

	local groundTile = getThingfromPos(toPosition)
	if groundTile.itemid == 384 or groundTile.itemid == 418 or groundTile.itemid == 8278 then
		doTeleportThing(cid, {x = toPosition.x, y = toPosition.y + 1, z = toPosition.z - 1}, FALSE)
	elseif isInArray(holeId, itemEx.itemid) == TRUE then
		local hole = getThingfromPos({x = toPosition.x, y = toPosition.y, z = toPosition.z + 1, stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE})
		if hole.itemid > 0 then
			doTeleportThing(hole.uid, {x = toPosition.x, y = toPosition.y + 1, z = toPosition.z}, FALSE)
		else
			doPlayerSendCancel(cid, "Sorry, not possible.")
		end
		return FALSE
	-- Pick
	elseif (itemEx.uid <= 65535 or itemEx.actionid > 0) and (itemEx.itemid == 354 or itemEx.itemid == 355 or itemEx.itemid == 9024 or itemEx.itemid == 9025) then
		doTransformItem(itemEx.uid, 392)
		doDecayItem(itemEx.uid)
		return TRUE
	elseif itemEx.uid == 60001 then
		doTeleportThing(cid, {x=329, y=772, z=10})
		doSendMagicEffect({x=329, y=772, z=10},10)
		return TRUE
	-- Machete
	elseif itemEx.itemid == 2782 then
		doTransformItem(itemEx.uid, 2781)
		doDecayItem(itemEx.uid)
		return TRUE
	elseif itemEx.itemid == 1499 then
		doRemoveItem(itemEx.uid)
		return TRUE
	-- Scythe
	elseif itemEx.itemid == 2739 then 
		doTransformItem(itemEx.uid, 2737)
		doCreateItem(2694, 1, toPosition)
		doDecayItem(itemEx.uid)
		return TRUE
	end
	return destroyItem(cid, itemEx, toPosition)
end

That was everything I guess! :thumbup:
One more thing!

Is the script tested?
It's tested, and I verify the script as complete.
Tested on: TFS 3.6.0pl1(Crying Damson)
TFS 0.4.0 as well.

Hope you will enjoy it, because I do!

Your sincerely,
Siramix!
 
Last edited:
Alright, sir.
Well, thanks for reputation. Gave you some back! :D

For furthers. Reputation is appreciated, but not necessarily. :)
 
shorter like
Lua:
<!-- Tool Squeezings -->
    <action fromid="10511" toid="10516" event="script" value="tools/squeezings.lua"/>
or
Lua:
<!-- Tool Squeezings -->
    <action itemid="10511-10516" event="script"  value="tools/squeezings.lua"/>
 
Easy enough to find out what it does.. and the text doesn't kill my eyes.. so rep for you :D
 
Good job

For the past few months I been thinking about how I was going to script these things. You totally answered my prayers. Ty so much man I repped you. again Thank you!


Works flawlessly on 0.4 dev too :)
 
The only thing it doesn't do is have a chance of jamming for 60 seconds and not working, otherwise its pretty close. Thanks! Enjoy your second rep bar
 
Help :S I get this in console when I go :S

[19/03/2010 22:21:06] [Error - Action Interface]
[19/03/2010 22:21:06] data/actions/scripts/tools/squeezings.lua:eek:nUse
[19/03/2010 22:21:06] Description:
[19/03/2010 22:21:06] data/actions/scripts/tools/squeezings.lua:49: attempt to call global 'destroyItem' (a nil value)
[19/03/2010 22:21:06] stack traceback:
[19/03/2010 22:21:06] data/actions/scripts/tools/squeezings.lua:49: in function <data/actions/scripts/tools/squeezings.lua:3>
 
What version are you using?
Did you take a look at the script and checked if you could notice any
uncommon symbols.
 
Alright, that will be added in further days. Thanks for your suggestion, and feedback. I will add it, for sure! :)
 
Updated script with jammed system.
For now it's 10% chance that the tool will be jammed for 60 seconds.

Code:
local holes = {468, 481, 483, 7932}
local holeId = {294, 369, 370, 383, 392, 408, 409, 427, 428, 430, 462, 469, 470, 482, 484, 485, 489, 924, 3135, 3136}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local value = getPlayerStorageValue(cid, 10)
	if(value ~= -1 and os.clock()-value < 60)then
		doPlayerSay(cid, "The tool jammed. Please wait " .. 60-math.floor(os.clock()-value) .. " seconds before using it again.", TALKTYPE_MONSTER)
		return TRUE
	end
	if(math.random(1, 10) == 1)then
		setPlayerStorageValue(cid, 10, os.clock())
		doPlayerSay(cid, "The tool jammed. Please wait 60 seconds before using it again.", TALKTYPE_MONSTER)
		return TRUE
	end
	-- Shovel
	if isInArray(holes, itemEx.itemid) == TRUE then
		doTransformItem(itemEx.uid, itemEx.itemid + 1) 
		doDecayItem(itemEx.uid)
		return FALSE
	-- Rope
	elseif toPosition.x == CONTAINER_POSITION or toPosition.x == 0 and toPosition.y == 0 and toPosition.z == 0 then
		return FALSE
	end

	local groundTile = getThingfromPos(toPosition)
	if groundTile.itemid == 384 or groundTile.itemid == 418 or groundTile.itemid == 8278 then
		doTeleportThing(cid, {x = toPosition.x, y = toPosition.y + 1, z = toPosition.z - 1}, FALSE)
	elseif isInArray(holeId, itemEx.itemid) == TRUE then
		local hole = getThingfromPos({x = toPosition.x, y = toPosition.y, z = toPosition.z + 1, stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE})
		if hole.itemid > 0 then
			doTeleportThing(hole.uid, {x = toPosition.x, y = toPosition.y + 1, z = toPosition.z}, FALSE)
		else
			doPlayerSendCancel(cid, "Sorry, not possible.")
		end
		return FALSE
	-- Pick
	elseif (itemEx.uid <= 65535 or itemEx.actionid > 0) and (itemEx.itemid == 354 or itemEx.itemid == 355 or itemEx.itemid == 9024 or itemEx.itemid == 9025) then
		doTransformItem(itemEx.uid, 392)
		doDecayItem(itemEx.uid)
		return TRUE
	elseif itemEx.uid == 60001 then
		doTeleportThing(cid, {x=329, y=772, z=10})
		doSendMagicEffect({x=329, y=772, z=10},10)
		return TRUE
	-- Machete
	elseif itemEx.itemid == 2782 then
		doTransformItem(itemEx.uid, 2781)
		doDecayItem(itemEx.uid)
		return TRUE
	elseif itemEx.itemid == 1499 then
		doRemoveItem(itemEx.uid)
		return TRUE
	-- Scythe
	elseif itemEx.itemid == 2739 then 
		doTransformItem(itemEx.uid, 2737)
		doCreateItem(2694, 1, toPosition)
		doDecayItem(itemEx.uid)
		return TRUE
	end
	return destroyItem(cid, itemEx, toPosition)
end

UPDATED MAINPOST TOO!
 
No, it should only have a chance to get jammed if you use it on a valid item.
 
Back
Top