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

Remake this script to MOD

Joined
Jun 19, 2009
Messages
1,852
Reaction score
5
Hello!

How can I remake this script to mod? :P

Code:
local t = {
	[8887] = 7884,
	[2501] = 11296,
	[8886] = 11295,
	[8885] = 11350,
	[2300] = 2298,
	[2539] = 8908,
	[9931] = 11113,
	[7886] = 11114,
	[9932] = 11234
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local i = t[itemEx.itemid]
	if i then
		doRemoveItem(item.uid)
		doTransformItem(itemEx.uid, i)
		doCreatureSay(cid, getItemNameById(i), TALKTYPE_ORANGE_1)
		return true
	end
end
 
Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="I have no idea" enabled="yes">
	<action uniqueid="idno" event="buffer"><![CDATA[
		local t = {
			[8887] = 7884,
			[2501] = 11296,
			[8886] = 11295,
			[8885] = 11350,
			[2300] = 2298,
			[2539] = 8908,
			[9931] = 11113,
			[7886] = 11114,
			[9932] = 11234
		}
		local i = t[itemEx.itemid]
		if i then
			doRemoveItem(item.uid)
			doTransformItem(itemEx.uid, i)
			doCreatureSay(cid, getItemNameById(i), TALKTYPE_ORANGE_1)
		end
		return true
	]]></action>
</mod>
 
thanks but, should it be like this;

Code:
<action itemid="2556" event="buffer">

since in my actions.xml was:

Code:
<action itemid="2556" event="script" value="upg.lua"/>

?
 
ok.. I tried that but it didn't work xD now when I use the hammer on one of the items, it won't upgrade (remove item.uid, adds the new item and remove the old item)

;<

edit: mega error in console when trying the script xD

[2:14:32.143] [Error - Action Interface]
[2:14:32.144] local cid = 268455210
[2:14:32.144] local item = {
[2:14:32.150] uid = 70019,
[2:14:32.151] itemid = 2556,
[2:14:32.154] type = 0,
[2:14:32.155] actionid = 0
[2:14:32.155] }
[2:14:32.156] local fromPosition = {
[2:14:32.157] x = 65535,
[2:14:32.158] y = 64,
[2:14:32.158] z = 0,
[2:14:32.159] stackpos = 0
[2:14:32.160] }
[2:14:32.160] local itemEx = {
[2:14:32.162] uid = 70020,
[2:14:32.162] itemid = 8885,
[2:14:32.163] type = 0,
[2:14:32.163] actionid = 0
[2:14:32.164] }
[2:14:32.164] local toPosition = {
[2:14:32.166] x = 65535,
[2:14:32.166] y = 64,
[2:14:32.167] z = 1,
[2:14:32.168] stackpos = 1
[2:14:32.169] }
[2:14:32.169] local t = {
[2:14:32.170] [8887] = 7884,
[2:14:32.171] [2501] = 11296,
[2:14:32.171] [8886] = 11295,
[2:14:32.172] [8885] = 11350,
[2:14:32.172] [2300] = 2298,
[2:14:32.173] [2539] = 8908,
[2:14:32.173] [9931] = 11113,
[2:14:32.174] [7886] = 11114,
[2:14:32.174] [9932] = 11234
[2:14:32.175] }
[2:14:32.176] local i = t[itemEx.itemid]
[2:14:32.176] if i then
[2:14:32.177] doRemoveItem(item.uid)
[2:14:32.180] doTransformItem(itemEx.uid, i)
[2:14:32.181] doCreatureSay(cid, getItemNameById(i), TALKTYPE_
ORANGE_1)
[2:14:32.181] end
[2:14:32.182] return true
[2:14:32.182]
[2:14:32.183] Description:
[2:14:32.184] (luaDoTransformItem) Item not found
 
was ur script working? :S, if it was, this 1 should work :S
anyway try this;
Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="I have no idea" enabled="yes">
	<action itemid="2556" event="buffer"><![CDATA[
		local t = {
			{8887, 7884},
			{2501, 11296},
			{8886, 11295},
			{8885, 11350},
			{2300, 2298},
			{2539, 8908},
			{9931, 11113},
			{7886, 11114},
			{9932, 11234}
		}
		for _, v in ipairs(t) do
			if itemEx.itemid == v[1] then
				doRemoveItem(item.uid)
				doTransformItem(itemEx.uid, v[2])
				doCreatureSay(cid, getItemNameById(v[2]), TALKTYPE_ORANGE_1)
			end
		end
		return true
	]]></action>
</mod>
 
Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="I have no idea" enabled="yes">
	<action itemid="2556" event="buffer"><![CDATA[
		local t = {
			{8887, 7884},
			{2501, 11296},
			{8886, 11295},
			{8885, 11350},
			{2300, 2298},
			{2539, 8908},
			{9931, 11113},
			{7886, 11114},
			{9932, 11234}
		}
		for _, v in ipairs(t) do
			if itemEx.itemid == v[1] then
				doPlayerRemoveItem(cid, item.itemid, 1)
				doPlayerRemoveItem(cid, itemEx.itemid, 1)
				doPlayerAddItem(cid, v[2], 1)
				doCreatureSay(cid, getItemNameById(v[2]), TALKTYPE_ORANGE_1)
			end
		end
		return true
	]]></action>
</mod>
 
I just found a bug. When you put the hammer and one of the items on the floor, and upgrade, you get all of the items (the hammer, the one of the items PLUS the new item)

;U
 
Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="I have no idea" enabled="yes">
	<action itemid="2556" event="buffer"><![CDATA[
		local t = {
			{8887, 7884},
			{2501, 11296},
			{8886, 11295},
			{8885, 11350},
			{2300, 2298},
			{2539, 8908},
			{9931, 11113},
			{7886, 11114},
			{9932, 11234}
		}
		for _, v in ipairs(t) do
			if itemEx.itemid == v[1] then
				doRemoveItem(item.uid)
				doRemoveItem(itemEx.uid)
				doPlayerAddItem(cid, v[2], 1)
				doCreatureSay(cid, getItemNameById(v[2]), TALKTYPE_ORANGE_1)
				_result = true
				break
			end
		end
	]]></action>
</mod>
...
 
It's because of buffer ;/
Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="I have no idea" enabled="yes">
	<action itemid="2556" event="script"><![CDATA[
		local t = {
			[8887] = 7884,
			[2501] = 11296,
			[8886] = 11295,
			[8885] = 11350,
			[2300] = 2298,
			[2539] = 8908,
			[9931] = 11113,
			[7886] = 11114,
			[9932] = 11234
		}
		function onUse(cid, item, fromPosition, itemEx, toPosition)
			local i = t[itemEx.itemid]
			if i then
				doRemoveItem(item.uid)
				doRemoveItem(itemEx.uid)
				doPlayerAddItem(cid, i, 1)
				doCreatureSay(cid, getItemNameById(i), TALKTYPE_ORANGE_1)
				return true
			end
		end
	]]></action>
</mod>
 
Back
Top