• 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 Fusion script (new, much better) - ver. 1 (beta)

Gesior.pl

Mega Noob&LOL 2012
Senator
Joined
Sep 18, 2007
Messages
3,389
Solutions
125
Reaction score
4,253
Location
Poland
GitHub
gesior
EDIT:
Version 2:
http://otland.net/f81/fusion-upgrade-script-ver-2-final-recipes-forgotten-server-0-3-4-a-34880/
--------------------------------------------------------
TESTED ON TFS 0.3.5beta (rev. 2055)

Idea from Shawak thread:
http://otland.net/f81/fusion-item-item-new-item-34557/

Player put bag/backpack/box (container) with items on one 'pos', use switch and if in bag are needed items script create new item(s) on second 'pos'. Number of items required (backpack size '20'!)/created and recipes unlimited. You can require runes/items with count/charges (like require rune SD x25 only available from one quest on ots)
How to configure? It's simple. Default config:
PHP:
local item_config = {{{{2197,999}, {2197,999}}, {{2171,0}, {2171,0}, {2154,0}}}, {{{2197,99}, {2197,99}}, {{2171,0}, {2154,0}}}}
There are 2 'recipes':
1 - put in bag item 2171(subtype/count = 0), 2171(subtype/count = 0), 2154(subtype/count = 0) and you will get item 2197 (subtype/count = 999) and item 2197 (subtype/count = 999) [2 x platium amulet, yellow gem and you get 2x SSA (each x999)]
2 - put in bag item 2171(subtype/count = 0), 2154(subtype/count = 0) and you will get item 2197 (subtype/count = 99) and item 2197 (subtype/count = 999) [1x platium amulet, yellow gem and you get 2xSSA (each x99)

Fusion.JPG

(in my script it's not first/second position, it's just a position)
actions.xml:
PHP:
<action actionid="8000" event="script" value="quests/fusion.lua"/>
fusion.lua:
PHP:
-- Script by Gesior  --
-- Fusion Script ver. 1 (BETA)--

local item_config = {{{{2197,999}, {2197,999}}, {{2171,0}, {2171,0}, {2154,0}}}, {{{2197,99}, {2197,99}}, {{2171,0}, {2154,0}}}}
local pos_1 = {x = 1035, y = 1226, z = 7}
local pos_2 = {x = 1037, y = 1226, z = 7}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local create_item_pos = pos_2
	local container = getTileItemByType(pos_1, ITEM_TYPE_CONTAINER)
	if(container.uid == 0 or not(isContainer(container.uid))) then
		create_item_pos = pos_1
		container = getTileItemByType(pos_2, ITEM_TYPE_CONTAINER)
	end
	if(container.uid == 0 or not(isContainer(container.uid))) then
		doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "Put bag or backpack with items to fusion.")
		return FALSE
	end
	items_in_container = {}
	item_slot = 0
	while(true) do
		item_in = getContainerItem(container.uid, item_slot)
		if item_in.itemid > 0 then
			table.insert(items_in_container, item_in)
		else
			break
		end
		item_slot = item_slot+1
	end
	local fusion_id = 0
	for i = 1, table.getn(item_config) do
		fusion_items = item_config[i]
		items_create = fusion_items[1]
		items_required = fusion_items[2]
		local tmp_items_required = {}
		for s = 1, table.getn(items_required) do
			table.insert(tmp_items_required, items_required[s])
		end
		if(table.getn(items_in_container) == table.getn(tmp_items_required)) then
			for c = 1, table.getn(items_in_container) do
				local item_in_container = items_in_container[c]
				for r = 1, table.getn(tmp_items_required) do
					local item_required = tmp_items_required[r]
					if(item_in_container.itemid == item_required[1] and item_in_container.type == item_required[2]) then
						table.remove(tmp_items_required, r)
						break
					end
				end
			end
			if(table.getn(tmp_items_required) == 0) then
				fusion_id = i
				break
			end
		end
	end
	if(fusion_id > 0) then
		while(true) do
			item_in = getContainerItem(container.uid, 0)
			if item_in.uid > 0 then
				doRemoveItem(item_in.uid)
			else
				break
			end
		end
		for u = 1, table.getn(items_create) do
			local item_to_create = items_create[u]
			local new_item_uid = doCreateItemEx(item_to_create[1], item_to_create[2])
			doTileAddItemEx(create_item_pos, new_item_uid)
		end
		doSendMagicEffect(pos_1,CONST_ME_GREEN_RINGS)
		doSendMagicEffect(pos_2,CONST_ME_GREEN_RINGS)
		doSendMagicEffect(getPlayerPosition(cid),CONST_ME_MAGIC_GREEN)
	else
		doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "Unknown recipe.")
	end
	if(item.itemid == 1945) then
		doTransformItem(item.uid,item.itemid+1)
	elseif(item.itemid == 1946) then
		doTransformItem(item.uid,item.itemid-1)
	end
	return TRUE
end

You can post your recipes on your server site or hide in bookcases on server map.

POST BUGS IN THIS THREAD!
 
Last edited:
And now you are fucking proud that you get a better version :huh:.

I am not lying when I say that you've done this script, to prove that you're better than me?
Right or false?

Regards,
Shawak
 
By all mean's correct me if I am wrong... But shouldnt Shawak or w/e get some credit's if it was his idea/script in the first place? ^^
 
And now you are fucking proud that you get a better version :huh:.

I am not lying when I say that you've done this script, to prove that you're better than me?
Right or false?

Regards,
Shawak
I made this script, because I found interesting idea in your thread, but your script is useless for my server.
------------------------------------------
If anyone want make quests with recipes (actually recipes only show player what items he should put in bag/bp):
actions.xml
PHP:
<action actionid="1750" event="script" value="quests/recipequests.lua"/>
recipequests.lua
PHP:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerStorageValue(cid, item.uid) ~= 1 and isContainer(item.uid) == TRUE then
		local item_in = getContainerItem(item.uid, 0)
		local uid = doPlayerAddItem(cid, item_in.itemid, 0, 1)
		doSetItemText(uid, getItemDescriptions(item_in.uid).text)
		setPlayerStorageValue(cid, item.uid, 1)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have found some interesting informations.')
	else
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'The chest is empty.')
	end
	return TRUE
end
In map editor:
recipes.png

ActionID of box/chest/bookcase - always 1750
UniqueID of box/chest/bookcase - id of player storage to save information 'quest done'
In box/chest/bookcase put 1 writeable item and edit text.
Player will receive copy of item with same text.
------------------------------------------
Tommorow I'll post fusion script with 'create item' modificators.
Like player put bag with items:
Magic Sword
Giant Sword
Boots of Haste
5 Crystal Coin
Recipe with ActionID = 12345 (I'll post recipequests.lua that copy ActionID of recipe in box/chest)
and player receive item:
Name: Super Magic Sword
Attack: (like magic sword) +5
Def: (like magic sword) + 5
Attack speed: (time between attacks like normal weapon -0.2 sec)
ActionID: 12345
You can add other recipe that need item with id of Magic Sword and ActionID 12345! Milions of items :p
 
And now you are fucking proud that you get a better version :huh:.

I am not lying when I say that you've done this script, to prove that you're better than me?
Right or false?

Regards,
Shawak
Sure hes better than you,bye
@onTheard
Cool script. i might use it
 
Back
Top