Project Zomboid

Project Zomboid

Craft Sheets!
25 Comments
intnox 6 Jun, 2024 @ 9:35am 
------- custom made for tailoring ---------

function Recipe.OnGiveXP.Tailoring10(recipe, ingredients, result, player)
player:getXp():AddXP(Perks.Tailoring, 10);
end

-- On recipe add this

OnGiveXP:Recipe.OnGiveXP.Tailoring10,

-- to add 10 exp for what your recipe is doing to tailoring
intnox 6 Jun, 2024 @ 9:34am 
function Recipe.OnGiveXP.Blacksmith25(recipe, ingredients, result, player)
player:getXp():AddXP(Perks.Blacksmith, 25);
end

-- on recipe add for example to invoke the one that gives 10 MetalWelding

OnGiveXP:Recipe.OnGiveXP.MetalWelding10,

-- to call that existing fuction.
intnox 6 Jun, 2024 @ 9:34am 
function Recipe.OnGiveXP.MetalWelding10(recipe, ingredients, result, player)
player:getXp():AddXP(Perks.MetalWelding, 10);
end

function Recipe.OnGiveXP.MetalWelding15(recipe, ingredients, result, player)
player:getXp():AddXP(Perks.MetalWelding, 15);
end

function Recipe.OnGiveXP.MetalWelding20(recipe, ingredients, result, player)
player:getXp():AddXP(Perks.MetalWelding, 20);
end

function Recipe.OnGiveXP.MetalWelding25(recipe, ingredients, result, player)
player:getXp():AddXP(Perks.MetalWelding, 25);
end

function Recipe.OnGiveXP.Blacksmith10(recipe, ingredients, result, player)
player:getXp():AddXP(Perks.Blacksmith, 10);
end

function Recipe.OnGiveXP.Blacksmith15(recipe, ingredients, result, player)
player:getXp():AddXP(Perks.Blacksmith, 15);
end

function Recipe.OnGiveXP.Blacksmith20(recipe, ingredients, result, player)
player:getXp():AddXP(Perks.Blacksmith, 20);
end
intnox 6 Jun, 2024 @ 9:33am 
@meepmerp same happened to me, sharing some existing functions as of 41.78.

----------- these exist by default

function Recipe.OnGiveXP.DismantleElectronics(recipe, ingredients, result, player)
player:getXp():AddXP(Perks.Electricity, 2);
end

function Recipe.OnGiveXP.None(recipe, ingredients, result, player)
end

function Recipe.OnGiveXP.SawLogs(recipe, ingredients, result, player)
if player:getPerkLevel(Perks.Woodwork) <= 3 then
player:getXp():AddXP(Perks.Woodwork, 3);
else
player:getXp():AddXP(Perks.Woodwork, 1);
end
end

function Recipe.OnGiveXP.WoodWork5(recipe, ingredients, result, player)
player:getXp():AddXP(Perks.Woodwork, 5);
end

function Recipe.OnGiveXP.Cooking3(recipe, ingredients, result, player)
player:getXp():AddXP(Perks.Cooking, 3);
end

function Recipe.OnGiveXP.Cooking10(recipe, ingredients, result, player)
player:getXp():AddXP(Perks.Cooking, 10);
end
KoXz 20 May, 2024 @ 4:38am 
can't add this to multiplayer
KoXz 19 May, 2024 @ 7:47am 
update pls
Zefiruz 11 Jan, 2024 @ 12:10pm 
Mods que deberían ser vanilla.
Gato 9 Nov, 2023 @ 5:17pm 
When do you think you can update the mod? it would be awesome because of the possibilities.
meepmerp 29 Jul, 2023 @ 3:19am 
Hello, this modpage is a top google search result for OnGiveXP so if anyone else is here looking for answers, here's what you need:

Inside the recipe block next to the usual stuff like Result, Time, etc, add this:
"OnGiveXP:Recipe.OnGiveXP.YOURFUNCTIONNAMEHERE,"


Then create a .lua file with a custom name in media/lua/server in your mod folders. Inside put:

"require 'recipecode';

function Recipe.OnGiveXP.YOURFUNCTIONNAMEHERE(recipe, ingredients, result, player)
player:getXp():AddXP(Perks.Tailoring, 2);
end"

Adjust the number at the end to increase the exp amount.

Happy modding!
Shooterism  [author] 9 May, 2022 @ 1:38am 
MagicRam3n, sorry for the late response, I'll try to update the mod soon to add the changes Adam.Podstavka suggested, so I'll add that in as well (hopefully soon, it is a super simple mod, but life has been interesting).

And who knows, maybe I'll eventually make sheets be more of a resource rather than a simple tool to cover windows :p.
pgames-food 8 May, 2022 @ 6:18pm 
or better yet, get some mods that let you make them into fuel, or harvest them for resources :)
LarryVinceZ(Zikunn) 8 May, 2022 @ 4:45pm 
Good! Can I use these sheets to cover dead bodies in my yard? :)
MagicRam3n 4 Feb, 2022 @ 2:21pm 
Translations:

Recipes_EN = {
Recipe_Make_Sheet = "Make Sheet",
}



Traditional Chinese (CH) ANSI encoding

Recipes_CH = {
Recipe_Make_Sheet = "製作床單",
}


Simplified Chinese (CN)

Recipes_CN = {
Recipe_Make_Sheet = "制作床单",
}
Adamos 22 Jan, 2022 @ 10:47am 
Shooterism, this should work for granting XP in your code:
OnGiveXP:Recipe.OnGiveXP.Tailoring5,

(instead of your current code: OnGiveXP:Give5TailoringXP,)

I've tested it and it works for me. And thank you for a nice mod! It helped me create mine for sturdy sticks recipe without utilizin a saw :)
Shooterism  [author] 17 Dec, 2021 @ 3:58am 
I'll take a look once I get the time, thanks for the heads up!
Stellar Harbour 17 Dec, 2021 @ 3:48am 
Give5TailoringXP no more works
Bluewave101 8 Feb, 2021 @ 5:02pm 
its work 41 build?
pgames-food 10 Dec, 2020 @ 12:21am 
i think if someone with low tailoring skill, tried to stitch 4 ripped sheets together again, they probably would end up with the size of the sheet being a bit less than 4 sheets, since they would have the sheets overlapping a bit where each piece is joined together, so it kind of makes sense that it costs a bit more than what you get from ripping a sheet :)
Shooterism  [author] 9 Dec, 2020 @ 4:06am 
I do get where you're coming from. Realistically, it's completely nonsensical xD
Copper Boltwire 9 Dec, 2020 @ 4:04am 
Right, didn't consider that, makes sense, sorta :D
Shooterism  [author] 9 Dec, 2020 @ 3:58am 
I initially wanted to make it be 4 ripped sheets to make one, but you get quite a lot of ripped sheets from just one zombie if you get lucky with the clothing, so I wanted to balance it a little that way. I opted to use a somewhat high sheet cost with a somewhat low thread requirement because of that reason.
Copper Boltwire 9 Dec, 2020 @ 3:49am 
does not make sense that it costs 8 ripped sheets when you only get 4 from ripping it apart.
3lackrose 7 Dec, 2020 @ 1:33pm 
Nice, sounds useful!
Chløe 6 Dec, 2020 @ 12:25pm 
Amazing
pgames-food 6 Dec, 2020 @ 12:22pm 
thanks this will be useful