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

Hindori

New Member
Joined
Jan 24, 2009
Messages
157
Reaction score
2
This is my first script. Very easy but i think usefull if you want something like bulding house system in your ots. When you use hammer(id 2557) wall transform to kit with wall.

In data\actions\scripts\tools create mlotek.lua and paste it:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(itemEx.itemid == 1040) then
		doTransformItem(itemEx.uid, 8693)
		doDecayItem(itemEx.uid)
	elseif(itemEx.itemid == 1039) then
		doTransformItem(itemEx.uid, 8692)
		doDecayItem(itemEx.uid)
	elseif(itemEx.itemid == 1038) then
		doTransformItem(itemEx.uid, 7962)
		doDecayItem(itemEx.uid)
	elseif(itemEx.itemid == 1037) then
		doTransformItem(itemEx.uid, 7961)
		doDecayItem(itemEx.uid)
	elseif(itemEx.itemid == 1036) then
		doTransformItem(itemEx.uid, 7960)
		doDecayItem(itemEx.uid)
		return true
	end
	return destroyItem(cid, itemEx, toPosition)
end

next in actions.xml paste it:
Code:
	<action itemid="2557" event="script" value="tools/mlotek.lua"/>

I'm free for sugestions what can I upgrade or change to better work.
 
LUA:
local T, c = {
	[1040] = 8693,
	[1039] = 8692,
	[1038] = 7962,
	[1037] = 7961,
	[1036] = 7960
	},
	math.random(100)
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if T[itemEx.itemid] then
		doTransformItem(itemEx.uid, T[itemEx.itemid][1])
		doDecayItem(itemEx.uid)
	else
		doPlayerSendCancel(cid, 'Not possible.')
	end	
	return (c < 20 and destroyItem(cid, itemEx, toPosition) or true) -- is destroyItem a function?
end
 
Your version have bug. For good work you need change this line
doTransformItem(itemEx.uid, T[itemEx.itemid][1])
to
doTransformItem(itemEx.uid, T[itemEx.itemid])

I'm using tfs 0.3.6pl1 maybe in other version it will be run ok.
 
Back
Top