• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Machete with charges

razzr.

;-)
Joined
May 12, 2011
Messages
39
Reaction score
3
Location
Allenstein
Hello, I need a script - Machete with 1000 charges.
I tried to do it by myself, but I'm unexperienced too much to script it. :F

BIG REP FOR HELP.
 
XML:
	<item id="2442" article="a" name="heavy machete">
		<attribute key="weight" value="1840" />
		<attribute key="defense" value="10" />
		<attribute key="attack" value="16" />
		<attribute key="weaponType" value="sword" />
		<attribute key="charges" value="1000" />
		<attribute key="decayTo" value="2420" />
		<attribute key="showcharges" value="1" />
	</item>
LUA:
TOOLS.MACHETE = function(cid, item, fromPosition, itemEx, toPosition, destroy)
	local v = getItemAttribute(item.uid, "charges") or 0
	if(isInArray(JUNGLE_GRASS, itemEx.itemid)) then
		doTransformItem(itemEx.uid, itemEx.itemid - 1)
		doDecayItem(itemEx.uid)
		if v >= 1 then
			doItemSetAttribute(item.uid, "charges", v - 1)
		else
			doTransformItem(item.uid, 2420)			
		end
		return true
	end

	if(isInArray(WILD_GROWTH, itemEx.itemid)) then
		doSendMagicEffect(toPosition, CONST_ME_POFF)
		doRemoveItem(itemEx.uid)
		if v >= 1 then
			doItemSetAttribute(item.uid, "charges", v - 1)
		else
			doTransformItem(item.uid, 2420)			
		end
		return true
	end

		if v >= 1 then
			doItemSetAttribute(item.uid, "charges", v - 1)
		else
			doTransformItem(item.uid, 2420)			
		end
	return destroy and destroyItem(cid, itemEx, toPosition) or false
end
tested on tfs 0.4
:)
useful? klick here :)
 
XML:
	<item id="2442" article="a" name="heavy machete">
		<attribute key="weight" value="1840" />
		<attribute key="defense" value="10" />
		<attribute key="attack" value="16" />
		<attribute key="weaponType" value="sword" />
		<attribute key="charges" value="1000" />
		<attribute key="decayTo" value="2420" />
		<attribute key="showcharges" value="1" />
	</item>
LUA:
TOOLS.MACHETE = function(cid, item, fromPosition, itemEx, toPosition, destroy)
	local v = getItemAttribute(item.uid, "charges") or 0
	if(isInArray(JUNGLE_GRASS, itemEx.itemid)) then
		doTransformItem(itemEx.uid, itemEx.itemid - 1)
		doDecayItem(itemEx.uid)
		if v >= 1 then
			doItemSetAttribute(item.uid, "charges", v - 1)
		else
			doTransformItem(item.uid, 2420)			
		end
		return true
	end

	if(isInArray(WILD_GROWTH, itemEx.itemid)) then
		doSendMagicEffect(toPosition, CONST_ME_POFF)
		doRemoveItem(itemEx.uid)
		if v >= 1 then
			doItemSetAttribute(item.uid, "charges", v - 1)
		else
			doTransformItem(item.uid, 2420)			
		end
		return true
	end

		if v >= 1 then
			doItemSetAttribute(item.uid, "charges", v - 1)
		else
			doTransformItem(item.uid, 2420)			
		end
	return destroy and destroyItem(cid, itemEx, toPosition) or false
end
tested on tfs 0.4
:)
useful? klick here :)

Gives me an error when running it this page: Lua: demo

LUA:
input:31: attempt to index global 'TOOLS' (a nil value)
 
Andy, you are becoming quite helpful for these member's, although you should remember the rules for support & resources.

You are supplying support for the latest Subversion, to people who do not have access (through OtLand) to download it. I would hate to see someone get in trouble.

To prevent that, simply ask what version of TFS they're using, before you begin spewing code.



Sincerely,
TibiaWR

Woooooowww
i didnt notice that but it doesnt fell like that cuz andy use 0.4 and it didnt work and his OT sooo?
But anyways good point.
 
Back
Top