• 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, MoveEvent] Complete baking system (as in real Tibia)!

harry127

Member
Joined
Jul 19, 2009
Messages
435
Reaction score
5
Location
Poland
Hello!
I want to show you my baking system.

In actions/actions.xml, change:
Code:
	<!-- Bread Creating -->
	<action itemid="2692" event="script" value="other/createbread.lua"/>
	<action itemid="2694" event="script" value="other/createbread.lua"/>
to:
Code:
	<!-- Baking -->
	<action itemid="2694" script="other/baking.lua"/> <!--Wheat-->
	<action itemid="2692" script="other/baking.lua"/> <!--Flour-->
	<action itemid="2693" script="other/baking.lua"/> <!--Lump of dough-->
	<action itemid="6277" script="other/baking.lua"/> <!--Lump of cake dough-->
	<action itemid="2566" script="other/baking.lua"/> <!--Kitchen knife-->
	<action itemid="2561" script="other/baking.lua"/> <!--Baking tray-->
	<action itemid="8848" script="other/baking.lua"/> <!--Baking tray (with cookies)-->
	<action itemid="8846" script="other/baking.lua"/> <!--Lump of chocolate dough-->

Add to actions/actions.xml:
Code:
<action itemid="6280" event="script" value="other/blewoutcandle.lua"/>

Delete file: actions/scripts/other/createbread.lua.
Create file: actions/scripts/other/baking.lua and write inside:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local liquidContainers = {1775, 2005}
	local ovens = {1786, 1787, 1788, 1789, 1790, 1791, 1792, 1793, 6356, 6357, 6358, 6359, 6360, 6361, 6362, 6363}
	local lumpsOfChocolateDough = getPlayerItemCount(cid, 6277) + getPlayerItemCount(cid, 6574)
	if item.itemid == 2692 and isInArray(liquidContainers, itemEx.itemid) == TRUE and itemEx.type == 1 then
		doChangeTypeItem(item.uid, item.type - 1)
		doPlayerAddItem(cid, 2693, 1)
		doChangeTypeItem(itemEx.uid, item.type - item.type)
	elseif item.itemid == 2694 and itemEx.itemid == 1381 then
		doChangeTypeItem(item.uid, item.type - 1)
		doPlayerAddItem(cid, 2692, 1)
	elseif item.itemid == 2693 and isInArray(ovens, itemEx.itemid) == TRUE then
		doChangeTypeItem(item.uid, item.type - 1)
		doCreateItem(2689, 1, toPosition)
	elseif item.itemid == 2692 and isInArray(liquidContainers, itemEx.itemid) == TRUE and itemEx.type == 6 then
		doChangeTypeItem(item.uid, item.type - 1)
		doPlayerAddItem(cid, 6277, 1)
		doChangeTypeItem(itemEx.uid, itemEx.type - itemEx.type)
	elseif item.itemid == 6277 and isInArray(ovens, itemEx.itemid) == TRUE then
		doChangeTypeItem(item.uid, item.type - 1)
		doCreateItem(6278, 1, toPosition)
	elseif item.itemid == 2566 and (itemEx.itemid == 2679 or itemEx.itemid == 2680) and getPlayerItemCount(cid, 6278) > 0 then
		doRemoveItem(itemEx.uid, 1)
		doPlayerRemoveItem(cid, 6278, 1)
		doPlayerAddItem(cid, 6279, 1)
	elseif item.itemid == 6277 and itemEx.itemid == 2561 then
		doRemoveItem(item.uid, 1)
		doTransformItem(itemEx.uid, 8848)
	elseif item.itemid == 8848 and isInArray(ovens, itemEx.itemid) == TRUE then
		doTransformItem(item.uid, 2561)
		doCreateItem(2687, 12, toPosition)
	elseif item.itemid == 6277 and itemEx.itemid == 6574 then
		doRemoveItem(itemEx.uid, 1)
		doChangeTypeItem(item.uid, item.type - 1)
		if (getPlayerItemCount(cid, 6277) + getPlayerItemCount(cid, 6574)) ~= lumpsOfChocolateDough then
			doPlayerAddItem(cid, 8846, 1)
		else
			doCreateItem(8846, 1, toPosition)
		end
	elseif item.itemid == 8846 and isInArray(ovens, itemEx.itemid) == TRUE then
		doChangeTypeItem(item.uid, item.type - 1)
		doCreateItem(8847, 1, toPosition)	
	else
		return FALSE
	end
	return TRUE
end

--Made by Freewolny

Create file: actions/scripts/other/blewoutcandle.lua and write inside:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	doTransformItem(item.uid, 6279)
	doCreatureSay(cid, getPlayerName(cid) .. " blew out the candle.", TALKTYPE_ORANGE_1)
	doSendMagicEffect(fromPosition, CONST_ME_POFF)
	return TRUE
end

--Made by Freewolny

Remove from movements/movements.xml:
Code:
<!-- Create bread movements -->
	<movevent type="AddItem" tileitem="1" itemid="1786" event="script" value="dough.lua"/>
	<movevent type="AddItem" tileitem="1" itemid="1788" event="script" value="dough.lua"/>
	<movevent type="AddItem" tileitem="1" itemid="1790" event="script" value="dough.lua"/>
	<movevent type="AddItem" tileitem="1" itemid="1792" event="script" value="dough.lua"/>

Add to movements/movements.xml:
Code:
<movevent type="AddItem" tileitem="1" itemid="6279" event="script" value="partycake.lua"/>

Remove file: movements/scripts/dough.lua
Create file: movements/scripts/partycake.lua and write inside:
Code:
function onAddItem(moveitem, tileitem, pos)
	if moveitem.itemid == 2048 then
		doRemoveItem(tileitem.uid, 1)
		doRemoveItem(moveitem.uid, 1)
		doCreateItem(6280, 1, pos)
	end
end

--Made by Freewolny

How to make (by tibia.wikia.net):
- bread
- cake
- decorated cake
- party cake
- cookies
- chocolate cake

Description by me:
Bunch_of_Wheat.gif
Bunch of wheat:
Use
Scythe.gif
scythe with wheat field.

Flour.gif
Flour:
Use bunch of wheat with
Millstone.gif
millstone.

Lump_of_Dough.gif
Lump of dough:
Use flour with
Bucket.gif
bucket or
Trough.gif
trough of water.

Bread.gif
Bread:
Use lump of dough with
Oven.gif
oven.

Lump_of_Cake_Dough.gif
Lump of cake dough:
Use flour with bucket or trough of milk.

Cake.gif
Cake:
Use lump of cake dough with oven.

Decorated_Cake.gif
Decorated cake:
Take the cake and use
Kitchen_Knife.gif
kitchen knife with
Cherry.gif
cherry or
Strawberry.gif
strawberry.

Party_Cake.gif
Party cake:
Put used-up
Candlestick.gif
candlestick on decorated cake.

Baking_Tray_%28With_Dough%29.gif
Baking tray (with dough):
Use lump of cake dough with
Baking_Tray.gif
baking tray.

Cookie.gif
Cookies (12):
Use baking tray (with dough) with oven.

Lump_of_Chocolate_Dough.gif
Lump of chocolate dough:
Use lump of cake dough with
Bar_of_Chocolate.gif
bar of chocolate.

Chocolate_Cake.gif
Chocolate cake:
Use lump of chocolate dough with oven.

Note: in code you can see:
Code:
--Made by Freewolny
It's my nick!

If you wanna show it in other forum, send a message to me.

Please, leave a comment! :)
 
Last edited:
Nice work on the thread, explaining everything.
And the script is alright :thumbup:
 
Harry... It could be scripted better... But, you are new here... and i am soo shocked that you have posted a script at beginning of your journey called "lua".

Great Script, i will centraily use that.

Thanks //QuaS~
 
Harry... It could be scripted better... But, you are new here... and i am soo shocked that you have posted a script at beginning of your journey called "lua".

Great Script, i will centraily use that.

Thanks //QuaS~

I have lot of scripts (by me, of course)... For example: cart system (100% by me)... But I create my OTServ and... I think you understand. :p
 
Nice, usefull for sure hehe i'll use it on my ot. Rep.
__________________
klekSu.png

You are welcome on kleksoria.com!
Please visit new open tibia forum with it's own ots list. otservers.net!
 
Last edited:
Great detailed work on the "how to" part, Ill +Rep you specially for that :p Must've taken a while.

Script can probably be shortened and optimized but still good job mate, keep it up :thumbup:
 
woooh, great! I was searching this! great script, it works :D
 
Back
Top