Jump to content

Prefab as a Block/Item


dalves69

Recommended Posts

I am very new to modding, but was looking to make a mod that would include a Basic Crafting Table. This would be used, similar to the workbench, but would be required to build basic items (Wood Frames, Ladders, Hatches, Flagstone Blocks, etc). I made a Prefab using the Prefab Editor that was just a Saw Horse and a Wood Plate on top, like a table. I was wondering if there is a way for me to assign a Prefab as a Block or Item. So I could build it in game and then use it as a Crafting Table? I currently have the Saw Horse as the Workbench, but I have to manually add the wood plate to it after placing it to make it look like a workbench.

Link to comment
Share on other sites

Moved this topic, "Mods" is only for listing actual mods, not for discussion. Probably happened to your post on Monday as well if you posted it in "Mods".

 

Assigning a prefab as a Block or Item? That sounds wrong in more than one way. Is your problem that your workbench is made out of 2 blocks which already exist as buildable blocks in the game?

 

 

 

 

 

 

Link to comment
Share on other sites

Hi, thanks for the help, as I don't post on forums often.

 

Yes, I'm trying to make a Basic Crafting Bench that uses the Saw Horse as the base, and the Catwalk (with no railings) as the top. I have it set that combining a Saw Horse and a Catwalk will create the Basic Crafting Bench. However, I have only figured out how to choose a single item to place in the world. So with now I'm using the Saw Horse block. If there is a way for me to place the Saw Horse block in the world and have it include the Catwalk Block on top, that would be ideal.

Link to comment
Share on other sites

There are things in 7d2d that occupy more than one block, for example the workbench. So it might be a good idea to check out the workbench (and the chemstation) and identify the xml that makes them occupy more blocks.

If you go that route, you would also need to create a suitable image and import it into the game. Either check out how other modders do this by dissecting a mod, hope for an answer in this thread (I can't, I only did some xml editing) or look for a tutorial in "Tutorial & Guides".

 

If you really want the Saw Horse and Catwalk, I'm sure combining those with a graphics program would be trivial compared to the rest of the tasks.

 

The game already has an image of a https://7daystodie.gamepedia.com/Table_Saw in the game, used in some POIs. And it was even an active workstation for a while, but removed since it was largely ignored by players. Why not use this icon? You probably can find out its internal name in the creative menue

 

 

Link to comment
Share on other sites

Hi, Thanks for your help.

 

I am using a combination of the Saw Horse and Catwalk Icons that I edited, to show as a combined item for crafting. So that part was easy. When I was fooling around with making it a workstation, I did see some XML coding for the current workbench that shows it taking up two block. I thought I may be able to do that with my Craft Bench, but would have it reserve the two block spaces vertically. I just wasn't sure if I could have the block information for the Craft Bench reference 2 vanilla blocks and stack them on top of each other automatically. I may have to try experimenting with this and see if I can get it to work.

 

Thanks again...

Link to comment
Share on other sites

2 hours ago, dalves69 said:

Hi, Thanks for your help.

 

I am using a combination of the Saw Horse and Catwalk Icons that I edited, to show as a combined item for crafting. So that part was easy. When I was fooling around with making it a workstation, I did see some XML coding for the current workbench that shows it taking up two block. I thought I may be able to do that with my Craft Bench, but would have it reserve the two block spaces vertically. I just wasn't sure if I could have the block information for the Craft Bench reference 2 vanilla blocks and stack them on top of each other automatically. I may have to try experimenting with this and see if I can get it to work.

 

Thanks again...

Since this "referning 2 vanilla blocks automatically" has (to my knowledge) never been used anywhere in vanilla the chance that it is working is very low. For any functionality you can do in XML some programmer had to write lines and lines of code. This usually happens because some designer wants a functionality and "pushes" the programmer to do it. Your only hope is that the functionality to place an item as a block (which must be VERY OLD code) was so easy to generalize to more than one block that the programmer thought it a good idea at the time to add the more generalized lines, but subsequently it was never used (at least not in A15 and newer)

 

Possible but improbable. But it doesn't hurt to try.

 

 

Link to comment
Share on other sites

So what you're describing is doable, but not with vanilla XML as far as I know. What you could do is extract the models and textures for those blocks, set them up in Unity in the configuration you want, export them as a single prefab (Unity prefab, not 7 Days to Die prefab) and then use the MultiBlockDim property in the xml to tell the game it's a single block, but taking up multiple blocks worth of space. If you need some guidance on all that, you're welcome to join the Unofficial Modding Discord, the link should be pinned in the Mods section of the forums.

Hope this helps!

Link to comment
Share on other sites

There is a trick when you use the bottom block on which another block grows in a millisecond.

If your blocks are placed one above the other and do not require rotation this will suit you.

 

Check the block with" GrowOnTop".

 

Link to comment
Share on other sites

Thanks for the help and info. I may try the "GrowOnTop" option and see if that works. That may be the quickest solution.

 

I also need to learn some more about XML in 7DTD. There are instances where I'm looking to replaced a block, item, or recipe with a new one and don't want to just add a new one. With my new crafting bench, I was adding some different woodframe recipes using "Stone Fragments" as makeshift nails. Unless I went into the main 7DTD XML files and used "<!--  -->" on the existing item, I would have duplicates when adding my mod. (The original woodframe recipe and my custom one)

 

Still very new to all this and have some stuff to iron out.

Link to comment
Share on other sites

6 hours ago, dalves69 said:

Thanks for the help and info. I may try the "GrowOnTop" option and see if that works. That may be the quickest solution.

 

I also need to learn some more about XML in 7DTD. There are instances where I'm looking to replaced a block, item, or recipe with a new one and don't want to just add a new one. With my new crafting bench, I was adding some different woodframe recipes using "Stone Fragments" as makeshift nails. Unless I went into the main 7DTD XML files and used "<!--  -->" on the existing item, I would have duplicates when adding my mod. (The original woodframe recipe and my custom one)

 

Still very new to all this and have some stuff to iron out.

 

If you want to modify existing XML, then you're better off using XPath. It's also handy because you don't modify the vanilla XML (so easier to revert, won't get overwritten by updates, etc).

 

SphereII wrote a very good tutorial about it:

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...