• 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 [MOD]Alchemy System - New UPDATE!

Hello.
I have a question.

Where i can edit place, where i can do mix alchemy items? and how to level up in alchemy??

Thanks
 
Last edited:
[24/07/2010 17:25:32] [error - action interface]
[24/07/2010 17:25:32] buffer:eek:nuse
[24/07/2010 17:25:32] description:
[24/07/2010 17:25:32] [string "loadbuffer"]:7: Attempt to call global 'getcustomskill' (a nil value)
[24/07/2010 17:25:32] stack traceback:
[24/07/2010 17:25:32] [string "loadbuffer"]:7: In function <[string "loadbuffer"]:5>

helphelphelphelphelp
 
I'm planning make a few changes to the Custom Skill Function
[Install [Custom Skill] = Start]
Script Name: Custom Skill (By: Athern)
Type: function
Lua Location: data/lib/functions.lua
Lua Code:
Lua Code:
--[CustomSkill]-- By:Athern
function getCustomSkill(cid, storage)
return getPlayerStorageValue(cid, storage)
end

function addCustomSkill(cid, skillName, storage)
local skillStorage = math.max(10, getPlayerStorageValue(cid, storage))
local skillTries = math.max(0, getPlayerStorageValue(cid, storage+1))

doPlayerSetStorageValue(cid, storage, skillStorage+1)
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You advanced in " .. skillName .. ".")
doPlayerSetStorageValue(cid, storage+1, 0)
end

function addCustomSkillTry(cid, skillName, storage)
local skillStorage = math.max(10, getPlayerStorageValue(cid, storage))
local skillTries = math.max(0, getPlayerStorageValue(cid, storage+1))

doPlayerSetStorageValue(cid, storage+1, skillTries+getConfigInfo("rateSkill"))

if skillTries >= math.floor(20 * math.pow(1.1, (skillStorage-11)) / getConfigInfo("rateSkill")) then
addCustomSkill(cid, skillName, storage)
end
end

function getCustomSkillPercent(cid, storage)
local skillStorage = math.max(10, getPlayerStorageValue(cid, storage))
local skillTries = math.max(0, getPlayerStorageValue(cid, storage+1))
local triesNeeded = math.floor(20 * math.pow(1.1, (skillStorage-11)) / getConfigInfo("rateSkill"))
return math.floor(100*(1-skillTries / triesNeeded))
end
--[/CustomSkill]--
 
I don't have functions.lua in my lib.
That is list of my folders in data/lib/
000-constant, 001-class, 002-wait, 004-database, 011-string, 012-table, 031-vocations, 032-position, 033-ip, 034-exhaustion, 050-function, 100-compat
 
^^fail
Btw, can you make new function for this mod for mixing count items? If you dont understand there r info:
For mix you need: 1x flask, 1x flour and 5x whitemushroom. +editable in recipeinfo~ (only for stackable items).
That would be nice :)
 
^^fail
Btw, can you make new function for this mod for mixing count items? If you dont understand there r info:
For mix you need: 1x flask, 1x flour and 5x whitemushroom. +editable in recipeinfo~ (only for stackable items).
That would be nice :)

u can use 5 1x piles of white mushrooms and it will accomplish the same thing. maybe in the next update that will be added. but for now u can use that work around.
 
[Recognitions and Creator Details = Start]
Creator's Script Full Name: Alchemy System
Idea by:Whiskey - For the whole Idea
Functions by:Athern
Original Creator (Version 1):Shinmaru
(Version 1.1):Soul4Soul --Created the MOD. Made the whole MOD use only one table.
NPC Version 1:Shinmaru
(Version 2):Shinmaru and Soul4Soul --Movevent and One Config Alchemy List
NPC Version 1.5:Shinmaru and Soul4Soul --Shortened bug fixes, Little Touch ups
NPC version 2:Soul4Soul --Reorganized and Shortened
Current Final (Version 3):Soul4Soul --Functions moved to MOD, stacked items, Shortened Main script (1 For instead of 8 Ifs), new destroy option, removed the double window pop up on the recipe book.
[Creator Details = End]


alchd.png


[Install [Alchemy NPC 0.3.6] = Start]
Script Name: alchemyNPC.lua
Type: NPC
Lua Location: data/npc/scripts/
Lua Code:
Lua:
local focus = 0
local talk_start = 0

function onCreatureDisappear(cid, pos)
	if focus == cid then
		selfSay('Good bye then.')
		focus = 0
		talk_start = 0
	end
end

function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end

function onCreatureSay(cid, type, msg)
msg = string.lower(msg)

	if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then
		selfSay('Hello ' .. getCreatureName(cid) .. '! I sell all things related to "alchemy".')
		focus = cid
		talk_start = os.clock()

	elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
		selfSay('Sorry, ' .. getCreatureName(cid) .. '! I talk to you in a minute.')

	elseif focus == cid then
		talk_start = os.clock()

		if msgcontains(msg, 'alchemy') then
				selfSay('Ahh, yes I have "recipes", "recipe book", and "alchemic kits" , for sale which do you want to know more about?')
				talk_state = 1

		elseif talk_state == 1 then
			if msgcontains(msg, 'recipe book') then
					price = 1000
					selfSay('I have this recipe book that you can use to see the recipes you have learned, do you want to buy it for '.. price ..' gold?')
					talk_state = 4
					item = 1965
					rtrn = 1
			elseif msgcontains(msg, 'recipes') then
				if getPlayerStorageValue(cid, 50500) == -1 then
					selfSay('You don\'t seem to know much about alchemy go study first.')
					talk_state = 1
				else
					selfSay('Yes, I have a list of recipes for "beginner" and "advanced" Alchemists, which would you like to see?.')
					talk_state = 2
				end
			elseif msgcontains(msg, 'alchemic kit') then
					price = 10000
					selfSay('This is a special kit used just for alchemy, would you like to buy it for '.. price ..' gold?.')
					talk_state = 4
					item = 6104
					rtrn = 1
			elseif msgcontains(msg, 'bye') then
				selfSay('Good bye, ' .. getCreatureName(cid) .. '!')
				focus = 0
				talk_start = 0	
			end	
		elseif talk_state == 2 then
			if msgcontains(msg, 'beginner') then
				selfSay('At the beginner level I sell recipes for: "antidote", "platinum coin", "mind stone", "soul orb", "blood orb", "love potion", "ectoplasm", "weak mana rune", "crystal coin", "sparkling mummy doll". which one do you want?')
				talk_state = 3
			elseif msgcontains(msg, 'advanced') then
				selfSay('At the Advanced level I sell recipes for: "berserk potion", "mastermind potion", "bullseye potion", "mead horn", "gold bar", "mana rune", "clover amulet", "sword", "magic", "arrow". which one do you want?')
				talk_state = 3
			else
				selfSay('That\'s too bad, maybe next time.')
				talk_state = 1
			end
		elseif talk_state == 3 then
			item = 1954
			rtrn = 2
			if msgcontains(msg, 'antidote') then
				price = 1000
				selfSay('Do you want to buy an Antidote recipe for ' ..price.. ' gold?')
				action = 50001
				desc = 'This contains the recipe to make an Antidote.'
				talk_state = 4
			elseif msgcontains(msg, 'platinum coin') then
				price = 2000
				selfSay('For ' .. price ..' gold i can sell you the secert to minting platinum coins?')
				action = 50002
				desc = 'This contains the formula for minting Platinum Coins.'
				talk_state = 4
			elseif msgcontains(msg, 'mind stone') then
				price = 2000
				selfSay('Do you want to buy a Mind Stone recipe for ' ..price.. ' gold?')
				action = 50003
				desc = 'This contains the recipe to make a Mind Stones.'
				talk_state = 4	
			elseif msgcontains(msg, 'soul orb') then
				price = 2000
				selfSay('Do you want to buy a Soul Orb recipe for ' ..price.. ' gold?')
				action = 50004
				desc = 'This contains the recipe to make a Soul Orbs.'
				talk_state = 4	
			elseif msgcontains(msg, 'blood orb') then
				price = 5000
				selfSay('Do you want to buy a Blood Orb recipe for ' ..price.. ' gold?')
				action = 50005
				desc = 'This contains the recipe to make a Blood Orbs.'
				talk_state = 4
			elseif msgcontains(msg, 'love potion') then
				price = 30000
				selfSay('Do you want to buy a Love Potion recipe for ' ..price.. ' gold?')
				action = 50006
				desc = 'This contains the recipe to make a Love Potions.'
				talk_state = 4
			elseif msgcontains(msg, 'ectoplasm') then
				price = 20000
				selfSay('Do you want to buy a Ectoplasm recipe for ' ..price.. ' gold?')
				action = 50007
				desc = 'This contains the recipe to make some Ectoplasm.'
				talk_state = 4
			elseif msgcontains(msg, 'intense mana rune') then
				price = 60000
				selfSay('Do you want to buy a Intense Mana Rune recipe for ' ..price.. ' gold?')
				action = 50008
				desc = 'This contains the recipe to make a Intense Mana Runes.'
				talk_state = 4
			elseif msgcontains(msg, 'crystal coin') then
				price = 100000
				selfSay('For ' .. price ..' gold i can sell you the secert to minting crystal coins?')
				action = 50009
				desc = 'This contains the formula for minting Crystal coins.'
				talk_state = 4	
			elseif msgcontains(msg, 'sparkling mummy doll') then
				price = 100000
				selfSay('Do you want to buy a Sparkling Mummy Doll Recipe for ' ..price.. ' gold?')
				action = 50010
				desc = 'This contains the recipe to make a Sparkling Mummy Doll.'
				talk_state = 4
			elseif msgcontains(msg, 'berserk potion') then
				price = 100000	
				selfSay('Do you want to buy a Berserk Potion recipe for ' ..price.. ' gold?')
				action = 50018
				desc = 'This contains the recipe to make a Beserk Potion.'
				talk_state = 4	
			elseif msgcontains(msg, 'mastermind potion') then
				price = 100000
				selfSay('Do you want to buy a Mastermind Potion recipe for ' ..price.. ' gold?')
				action = 50019
				desc = 'This contains the recipe to make a Mastermind Potion.'
				talk_state = 4
			elseif msgcontains(msg, 'bullseye potion') then
				price = 100000
				selfSay('Do you want to buy a Bullseye Potion Recipe for ' ..price.. ' gold?')
				action = 50020
				desc = 'This contains the recipe to make a Bullseye Potion.'
				talk_state = 4	
			elseif msgcontains(msg, 'mead horn') then
				price = 200000
				selfSay('Do you want to buy a Mead Horn Recipe for ' ..price.. ' gold?')
				action = 50021
				desc = 'This contains the recipe to make a Mean Horn.'
				talk_state = 4	
			elseif msgcontains(msg, 'gold bar') then
				price = 10000000
				selfSay('For ' .. price ..' gold i can sell you the secret to minting gold bars?')
				action = 50022
				desc = 'This contains the formula for minting Gold Bars.'
				talk_state = 4
			elseif msgcontains(msg, 'ultimate mana rune') then
				price = 500000
				selfSay('Do you want to buy a Potion of Ultimate Mana Recipe for ' ..price.. ' gold?')
				action = 50023
				desc = 'This contains the recipe to make a Ultimate Mana rune.'
				talk_state = 4	
			elseif msgcontains(msg, 'clover amulet') then
				price = 1000000
				selfSay('Do you want to buy a Clover Amulet Recipe for ' ..price.. ' gold?')
				action = 50024
				desc = 'This contains the recipe to make a Clover Amulet.'
				talk_state = 4
			elseif msgcontains(msg, 'sword') then
				price = 2000000
				selfSay('Do you want to buy a sword Recipe for ' ..price.. ' gold?')
				action = 50025
				desc = 'This contains the recipe to make a sword.'
				talk_state = 4
			elseif msgcontains(msg, 'magic') then
				price = 2000000
				selfSay('Do you want to buy magic Recipe for ' ..price.. ' gold?')
				action = 50026
				desc = 'This contains the recipe to make magic.'
				talk_state = 4
			elseif msgcontains(msg, 'arrow') then
				price = 2000000
				selfSay('Do you want to buy an arrow Recipe for ' ..price.. ' gold?')
				action = 50027
				desc = 'This contains the recipe to make arrow.'
				talk_state = 4
			elseif msgcontains(msg, 'bye') then
				selfSay('Good bye, ' .. getCreatureName(cid) .. '!')
				focus = 0
				talk_start = 0	
			end	
		elseif talk_state == 4 then
			if msgcontains(msg, 'yes') then
				if getPlayerMoney(cid) >= price then
					selfSay('Here you go!')
					doPlayerRemoveMoney(cid, price)
					doPlayerAddItem(cid, item, 1)
					if action then
						doItemSetAttribute(getPlayerItemById(cid, true, 1954).uid, "aid", action)
					end
					if desc then
						doItemSetAttribute(getPlayerItemById(cid, true, 1954).uid, "description", desc)
					end	
					if rtrn == 1 then
						talk_state = 2
					else	
						talk_state = 3
					end	
				else
					selfSay('You don\'t seem to have enough money.')
					if rtrn == 1 then
						talk_state = 2
					else	
						talk_state = 3
					end	
				end
			else
				selfSay('That\'s too bad, maybe next time.')
				if rtrn == 1 then
					talk_state = 2
				else	
					talk_state = 3
				end		
			end	
		elseif msgcontains(msg, 'bye') then
			selfSay('Good bye, ' .. getCreatureName(cid) .. '!')
			focus = 0
			talk_start = 0
		end
	elseif msgcontains(msg, 'bye') and focus == cid then
		selfSay('Good bye, ' .. getCreatureName(cid) .. '!')
		focus = 0
		talk_start = 0	
	end
end

function onThink()
	doNpcSetCreatureFocus(focus)
	if (os.clock() - talk_start) > 30 then
		if focus > 0 then
			selfSay('Next Please...')
		end
		focus = 0
	end
	if focus ~= 0 then
		if getDistanceToCreature(focus) > 5 then
			selfSay('Good bye then.')
			focus = 0
		end
	end
end
XML Location: data/npc/elric.xml
XML Code:
PHP:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Elric" script="data/npc/scripts/alchemy.lua" walkinterval="3000">
<health now="100" max="100"/>
<look type="333"/>
</npc>
Extra Details: N/A
Description: NPC that sells all things related to Alchemy.
[Install [Alchemy NPC 0.3.6] = End]


[Install [Alchemy MOD 0.3.6] = Start]
Script Name: AlchemySystem.xml
Type: Action
MOD Location: mods/
MOD Code:
PHP:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Alchemy System" version="3.0" author="soul4soul" enabled="yes">
	<config name="recipeinfo"><![CDATA[
	t =  {
		--[uid] = {newitemid, lvl, slots = {{item to be used, count},{item to be used, count}},  difficulty = 10-100 by 10's, destroy = 'yes' or 'no'}, 
        [50001] = {item = 8474, alchemylvl = 10, slots = {{2007, 1}, {2795, 1}, {2760, 1}}, difficulty = 20, destroy = 'no'},
        [50002] = {item = 2152, alchemylvl = 15, slots = {{2148, 10}, {10608, 2}}, difficulty = 20, destroy = 'no'},
        [50003] = {item = 2178, alchemylvl = 20, slots = {{2177, 1}, {1295, 1}, {2146, 3}}, difficulty = 40, destroy = 'no'},
        [50004] = {item = 5944, alchemylvl = 20, slots = {{2177, 1}, {1295, 1}, {2150, 3}}, difficulty = 40, destroy = 'no'},
        [50005] = {item = 2363, alchemylvl = 25, slots = {{2177, 1}, {2177, 1}, {1295, 1}, {2798, 1}, {2788, 1}}, difficulty = 50, destroy = 'no'},
        [50006] = {item = 10092, alchemylvl = 30, slots = {{2677, 3}, {1685, 1}, {2013, 1}, {2015, 1}}, difficulty = 60, destroy = 'no'},
        [50007] = {item = 4864, alchemylvl = 35, slots = {{4850, 1}, {2913, 1}, {2144, 1}}, aid = 105, difficulty = 40, destroy = 'no'},
        [50008] = {item = 2276, alchemylvl = 40, slots = {{10558, 1}, {2260, 1}, {10554, 1}, {2151, 1}, {5951, 1}, {2265, 1}}, difficulty = 40, destroy = 'no'},
        [50009] = {item = 2160, alchemylvl = 45, slots = {{2152, 1}, {2145, 1}, {2146, 1}, {2800, 1}}, difficulty = 30, destroy = 'no'},
        [50010] = {item = 11201, alchemylvl = 45, slots = {{2759, 1}, {10565, 1}, {2803, 1}, {2692, 1}}, difficulty = 40, destroy = 'no'},
        [50011] = {item = 5892, alchemylvl = 50, slots = {{5468, 1}, {2393, 1}}, difficulty = 50, destroy = 'yes'},
        [50012] = {item = 5887, alchemylvl = 50, slots = {{5468, 1}, {2487, 1}}, difficulty = 50, destroy = 'yes'},
        [50013] = {item = 5888, alchemylvl = 50, slots = {{5468, 1}, {2462, 1}}, difficulty = 50, destroy = 'yes'},
        [50014] = {item = 5889, alchemylvl = 50, slots = {{5468, 1}, {2516, 1}}, difficulty = 50, destroy = 'yes'},
        [50015] = {item = 5891, alchemylvl = 55, slots = {{2195, 1}, {4265, 1}, {2151, 1}}, difficulty = 40, destroy = 'yes'},
        [50016] = {item = 5884, alchemylvl = 55, slots = {{2498, 1}, {2498, 1}, {2913, 1}, {5865, 1}}, difficulty = 40, destroy = 'yes'},
        [50017] = {item = 5885, alchemylvl = 55, slots = {{2475, 1}, {2475, 1}, {2475, 1}, {2475, 1}, {2015, 1}, {5865, 1}}, difficulty = 40, destroy = 'yes'},
        [50018] = {item = 7439, alchemylvl = 60, slots = {{6558, 1}, {2007, 1}, {4993, 1}, {5480, 1}, {2796, 1}}, difficulty = 30, destroy = 'no'},
        [50019] = {item = 7440, alchemylvl = 60, slots = {{6558, 1}, {2007, 1}, {4992, 1}, {3955, 1}, {7250, 1}}, difficulty = 30, destroy = 'no'},
        [50020] = {item = 7443, alchemylvl = 60, slots = {{6558, 1}, {2007, 1}, {4994, 1}, {2193, 1}, {2031, 1}}, difficulty = 30, destroy = 'no'},
        [50021] = {item = 7140, alchemylvl = 65, slots = {{7141, 1}, {2015, 1}, {5014, 1}, {2235, 1}, {7439, 1}, {7440, 1}, {7443, 1}, {4845, 1}}, difficulty = 60, destroy = 'no'},
        [50022] = {item = 9971, alchemylvl = 70, slots = {{10552, 1}, {2157, 1}, {2159, 1}, {5906, 1}}, difficulty = 50, destroy = 'no'},
		[50023] = {item = 2284, alchemylvl = 75, slots = {{10523, 1}, {2260, 1}, {10554, 1}, {2151, 1}, {2273, 1}}, difficulty = 30, destroy = 'no'},
		[50024] = {item = 11387, alchemylvl = 80, slots = {{2805, 1}, {2798, 1}, {8582, 1}}, difficulty = 70, destroy = 'no'},
		[50025] = {item = 8980, alchemylvl = 90, slots = {{5941, 1}, {10559, 1}, {2194, 1}, {2377, 1}}, difficulty = 80, destroy = 'no'},
		[50026] = {item = 2184, alchemylvl = 90, slots = {{9942, 1}, {9941, 1}, {9980, 1}, {2445, 1}}, difficulty = 80, destroy = 'no'},
		[50027] = {item = 2352, alchemylvl = 90, slots = {{2177, 1}, {2160, 1}, {2544, 1}, {2544, 1}, {2802, 1}}, difficulty = 80, destroy = 'no'},
		[50028] = {item = 9969, alchemylvl = 100, slots = {{5741, 1}, {2229, 1}, {5669, 1}, {5809, 1}, {2143, 1}}, difficulty = 90, destroy = 'yes'},
		[50029] = {item = 9006, alchemylvl = 110, slots = {{8859, 1}, {2289, 1}, {2807, 1}, {10556, 1}, {2545, 1}, {5879, 1}}, difficulty = 100, destroy = 'yes'},
		[50030] = {item = 2348, alchemylvl = 120, slots = {{2153, 1}, {2154, 1}, {2155, 1}, {2156, 1}, {2158, 1}, {2260, 1}, {2260, 1}, {2600, 1}}, difficulty = 100, destroy = 'yes'}
        }    
		
	  --[CustomSkill]-- By:Athern
function getCustomSkill(cid, storage)
        return getPlayerStorageValue(cid, storage)
end
 
function addCustomSkill(cid, skillName, storage)
        local skillStorage = math.max(10, getPlayerStorageValue(cid, storage))
        local skillTries =  math.max(0, getPlayerStorageValue(cid, storage+1))
 
        doPlayerSetStorageValue(cid, storage, skillStorage+1)
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You advanced in " .. skillName .. ".")
        doPlayerSetStorageValue(cid, storage+1, 0)
end

function addCustomSkillTry(cid, skillName, storage)
        local skillStorage = math.max(10, getPlayerStorageValue(cid, storage))
        local skillTries =  math.max(0, getPlayerStorageValue(cid, storage+1))
 
                doPlayerSetStorageValue(cid, storage+1, skillTries+getConfigInfo("rateSkill"))
 
        if skillTries >= math.floor(20 * math.pow(1.1, (skillStorage-11)) / getConfigInfo("rateSkill")) then
                addCustomSkill(cid, skillName, storage)
        end
end

function getCustomSkillPercent(cid, storage)
        local skillStorage = math.max(10, getPlayerStorageValue(cid, storage))
        local skillTries =  math.max(0, getPlayerStorageValue(cid, storage+1))
        local triesNeeded = math.floor(20 * math.pow(1.1, (skillStorage-11)) / getConfigInfo("rateSkill"))
return math.floor(100*(1-skillTries / triesNeeded))
end
--[/CustomSkill]-- 
	]]></config>
	<action  itemid="2217"  event="script"><![CDATA[
	function onUse(cid, item, toPosition, fromPosition)
        local function burn()
			local Cpos = getCreaturePosition(cid)
			local north = {x = Cpos.x, y = Cpos.y-1, z = Cpos.z}
			local south = {x = Cpos.x, y = Cpos.y+1, z = Cpos.z}
			local west = {x = Cpos.x-1, y = Cpos.y, z = Cpos.z}
			local east = {x = Cpos.x+1, y = Cpos.y, z = Cpos.z}
			if getCreatureLookDirection(cid) == 0 then
				doSendMagicEffect(north, 6)
			elseif getCreatureLookDirection(cid) == 1 then
				doSendMagicEffect(east, 6)
			elseif getCreatureLookDirection(cid) == 2 then
				doSendMagicEffect(south, 6)    
			elseif getCreatureLookDirection(cid) == 3 then
				doSendMagicEffect(west, 6)  
			end
		end
        local learned = getPlayerStorageValue(cid, 50500)
		if learned == -1 then  
            setPlayerStorageValue(cid, 50500, 10)
            doRemoveItem(item.uid)
            doPlayerSendTextMessage(cid, 25, "You have learned Alchemy, then the book burned to ashes after learning its Alchemic Secrets.")
            addEvent(burn, 300, {cid = cid, toPosition = toPosition, fromPosition = fromPosition})
		else
            doPlayerSendCancel(cid, "You already know Alchemy.")
		end
		return true
	end    
	]]></action>
	<action  itemid="1954"  event="script"><![CDATA[
		domodlib("recipeinfo")
		function onUse(cid, item, toPosition, item2, fromPosition)
			k = t[item.actionid]
            if getPlayerStorageValue(cid, item.actionid) == -1 then
                if getCustomSkill(cid, 50500) >= k.alchemylvl then
                    doPlayerSetStorageValue(cid, item.actionid, item.actionid-50000)
                    doPlayerSendTextMessage(cid, 25, "You learned how to make ".. getItemInfo(k.item).article.." "..getItemInfo(k.item).name..".")
                    doSendMagicEffect(getCreaturePosition(cid), 13)
                else
                    doPlayerSendCancel(cid, "You require "..k.alchemylvl.." in Alchemy or you don't know Alchemy.")
                end
            else
                doPlayerSendCancel(cid, "You have already learned this recipe.")
            end
			return true
		end    
	]]></action>
	<action  itemid="1965"  event="script"><![CDATA[
		local skillIDs = {
                {50500, "Alchemy"} -- The first ID is the skill value, the second ID is the name of the skill
        }
		domodlib("recipeinfo")
	function onUse(cid, item, fromPosition, itemEx, toPosition)
        local a = {}
        skill = "Alchemy Level: " .. math.max(10, getCustomSkill(cid, skillIDs[1][1])) .. ". Percent to go: " .. getCustomSkillPercent(cid, skillIDs[1][1]) .. "%\n-------\n\n"
        table.insert(a, skill)
        table.insert(a, "Learned Recipes:\n\n")
		recipe = ""
		for i, k in pairs(t) do
			if getPlayerStorageValue(cid, i) > 0 then
				for i2 = 1, #k.slots do
					test = k.slots[i2]
					recipe = ""..recipe..", "..test[2].. " ".. getItemInfo(test[1]).name .. ""
				end
				recipe = "[" ..getItemInfo(k.item).name.. "]-Alchemy Level: " .. k.alchemylvl .. "\n Ingredients: ".. recipe .. ". \n\n"
				table.insert(a, recipe)
				recipe = ""
			end
		end
		doSetItemText(item.uid, table.concat(a, ""))	
	end
	]]></action>
	<movevent type="AddItem" tileitem="1" itemid="1426" event="script"><![CDATA[		
	function onAddItem(moveItem, tileItem, position, cid) 
		domodlib("recipeinfo")
		if getItemInfo(moveItem.itemid).type == ITEM_TYPE_CONTAINER then  
			container = getTileItemByType(position, 4)
			inContainer = {
							getContainerItem(container.uid, 0),
							getContainerItem(container.uid, 1),
							getContainerItem(container.uid, 2),
							getContainerItem(container.uid, 3),
							getContainerItem(container.uid, 4),
							getContainerItem(container.uid, 5),
							getContainerItem(container.uid, 6),
							getContainerItem(container.uid, 7),
							getContainerItem(container.uid, 8)
						}
			pass = 0
			k = t[inContainer[1].actionid]
			if getPlayerStorageValue(cid, inContainer[1].actionid) == inContainer[1].actionid-50000 then
				for size = #k.slots + 1,2, -1 do
					testin = k.slots[size-1]
					if testin[1] == inContainer[size].itemid then
						if doRemoveItem(inContainer[size].uid, testin[2]) == LUA_NO_ERROR then
							pass = pass + 1
						end
					end
				end
				
				if pass == #k.slots then
					if moveItem.itemid == 6104 then
						chance = k.difficulty-10
					else
						chance = k.difficulty
					end
					if math.random(1, (90 + (getCustomSkill(cid, 50500) / 10))) > chance then
						doPlayerAddItem(cid, k.item,1)
						doSendMagicEffect(position, CONST_ME_HITBYFIRE)
						doPlayerSendTextMessage(cid, 25, "You made ".. getItemInfo(k.item).article.." "..getItemInfo(k.item).name..".")
						gain = (k.difficulty/10)
						for i3=1, gain do
							addCustomSkillTry(cid, "Alchemy", 50500)
						end
						if k.aid then
							local getItem = getPlayerItemById(cid, true, k.item)
							doItemSetAttribute(getItem.uid, "aid", k.aid)
						end
					else
						doPlayerSendCancel(cid, "The mix went wrong.")
						doCreatureAddHealth(cid, -getCreatureMaxHealth(cid)*0.01, CONST_ME_FIREAREA)
						addCustomSkillTry(cid, "Alchemy", 50500)
					end
					if destroy == 'yes' then
						doRemoveItem(container.uid)
					end
				else
					doPlayerSendCancel(cid, "There are no Ingredients or some are missing.")
				end   				
			else
				doPlayerSendCancel(cid, "You haven't learned this recipe yet or the container is empty.")
			end	
		else 
			doPlayerSendCancel(cid, "You must use a container and place the ingredients inside.")
		end	
		return true
	end
	]]></movevent>
</mod>
Extra Details: When making potions, you need to make sure you place them in their respective order.
if destory is set to yes it will also remove the alchemy list and remove the container. EX. all the items in the picture with cracks next to them have the lists destroyed. you can only get the lists from quests.
Description: This MOD is contains all of the other scripts which allows the player to learn
recipes, learn alchemy, get their alchemy skill and read their ingredients book.
[Install [Alchemy MOD 0.3.6] = End]


Demonstration
AlchemyDemo.png


AlchemyDemo2.png

In here as you see the names of the items in their order on the
alchemy book, you have to put them in the same order inside the
alchemic kit to make the recipe work, also the recipe always has
to be in the front(first slot).


AlchemyDemo3.png

After you have the items in their order move the item to the example location(user can define on where to use this), to make
the mix happen, also any container type can be used for alchemy,
but only the Alchemic Kit reduces the difficulty of the mix by
10 points.


Example on how I set it up in my server:
examplealchemylayout.png


Well I hope this helps anyone and if any bugs or question just
ask and I'll do the best I can to help.
 
Last edited:
be sure to report any bugs here i didnt test the script too extensively
 
gonna test it cuz i love this script. will be implement in my cRPG project..

Tests:
1. Alchemy Level: 10. Percent to go: -1.#IND% /??

working with stacked items but i can't see my actual skill level, percent to go and learned recipes. Book do not working till I use it on GM.

[Error - Action Interface] buffer:eek:nUse Desc: [string "loadBuffer"]:17: attempt to concatenate field 'alchemylvl' <a nil value> stack traceback: [string "loadBuffer"]:17: in function <[string "loadBuffer"]:5>

:d
 
Last edited:
gonna test it cuz i love this script. will be implement in my cRPG project..

Tests:
1. Alchemy Level: 10. Percent to go: -1.#IND% /??

working with stacked items but i can't see my actual skill level, percent to go and learned recipes. Book do not working till I use it on GM.

[Error - Action Interface] buffer:eek:nUse Desc: [string "loadBuffer"]:17: attempt to concatenate field 'alchemylvl' <a nil value> stack traceback: [string "loadBuffer"]:17: in function <[string "loadBuffer"]:5>

:d
1. wait till you get to a higher skill level it will go away.
its b/c u have enough tries to go to the next skill level. ((an EX. when u have a high magic rate and u use a spell and the percent stays at 0 and u advance it up every time u use a spell))

2. try it on a new char. i also removed the bug where u windows popped up when u use the book. i tested it and it worked for me. describe how to reproduce the bug

3. explain how to reproduce it. make sure u set an alchemy level for every recipe.


and try everything with a new fresh character
 
First Post Updated! Credits to Soul4Soul for this Update.
Also to user using this system, please specify any bug that you get by telling
us the process on how you got the bug in the first place, if any errors, please
post it, so we can help you better!
I haven't been able to work on much of the script due to a mishap with my
OS getting wiped and losing everything, We have been using Ubuntu and just
recently just got Winblows I mean Windows on my computer, so now I will be
able to script easily.
 
Back
Top