Redbeard_Actual

Manipulating class CfgCraftingRecipes via Custom Script.

24 posts in this topic

I have been reading on the BIS and other forums to get a better general idea of how to manipulate config classes.

So far I have relearned a lot of what I already understood. But my curiosity has not been sated.

I get how to edit the classes directly. I get how to add classes I have written with an include command.

I still have not figured out if I can take it a step further. What I need to know, is whether I can manipulate these classes with SQF files.

For example, is it possible to check a players UID/PID (for which I know how to write the code), then add classes to the CfgCraftingRecipes class if the player UID/PID matches one of the stored UID/PID's?

I'm trying to limit some of the custom crafting I am writing to my donators.

Any pointers or links to information will be most greatly received.

Share this post


Link to post
Share on other sites

Short answer is no. But there's a better way.

Create new class of crafting recipes, that inherits from "CfgCraftingRecipes" for players that are allowed to use them.

Edited by Mezo
  • Like 1

Share this post


Link to post
Share on other sites
Advertisement
19 minutes ago, Mezo said:

Short answer is no. But there's a better way.

Create new class of crafting recipes, that inherits from "CfgCraftingRecipes" for players that are allowed to use them.

Could you point me to anything that may kick me in the right direction?

I am unsure how to restrict the new crafting recipes to just selected players.

Share this post


Link to post
Share on other sites

Let's say you have an array of donator UID in an array.

DONATORS = []; // Array must be global and contain a lit of UID's for your donators.

if ((getPlayerUID player) in DONATORS) then 
{
	_config = (missionConfigFile >> "CfgDonatorCraftingRecipes"); //Replacing The normal config if the player's id is in your list.
};

Basically, find wherever it checks the recipe and run the above right under wherever the config path is defined. No reason why that shouldn't work :)

Obviously that isn't the full code, but it's a rough idea.

Edited by Mezo
  • Like 1

Share this post


Link to post
Share on other sites
41 minutes ago, Mezo said:

Let's say you have an array of donator UID in an array.


DONATORS = []; // Array must be global and contain a lit of UID's for your donators.

if ((getPlayerUID player) in DONATORS) then 
{
	_config = (missionConfigFile >> "CfgDonatorCraftingRecipes"); //Replacing The normal config if the player's id is in your list.
};

Basically, find wherever it checks the recipe and run the above right under wherever the config path is defined. No reason why that shouldn't work :)

Obviously that isn't the full code, but it's a rough idea.

Thanks matey, This is somewhat along the lines that I was thinking. You have been a great help in clearing my frantic little mind with a bit of help. Cheers!

Share this post


Link to post
Share on other sites

I had a good long look at the code this morning for crafting. Figured I could  use CfgExileCustomCode to overwrite the code.

That was a rabbit hole I should have avoided. I see all the places where the configs are called. But I'll be damned if I can figure out how all the files interact. Looks like I would have to edit 3 or 4 files. And I'm still unsure any of the edits would work.

Share this post


Link to post
Share on other sites
2 minutes ago, Metalman10 said:

ill see if i can make something for you..

This is a case of having an interesting Idea. Then blood hounding it until my head hurts. I'm slowly understanding how the rile structure works and I understand how to replace the functions using CfgExileCustomCode.

I think I need to sleep or play or something to distract myself.

As always though, any help is always greeted with gratitude.

Share this post


Link to post
Share on other sites

That looks like it should work.

Getting it into all the places it has to go is going to be the trick. Four or Five functions use the same config for different things. One of them gets a list of all the recipes, one gets a list of what recipes are show when you open the crafting menu on an item, one is accessed when you actually click to craft the item and on and on and on.

Figuring this out is going to be the magic.

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.