• If you have a mod, tool or prefab, please use the Resources section. Click Mods at the top of the forums.

Need help creating a super tree mod

nightmarepv

New member
Hello I would like to create a mod allowing me to create a special seed which would transform into a special tree with 2000 hp and which would bring in 6000 wood, to make this tree you would need 1000 wood.


Code:
Currently I did this but it doesn't work.

Files : Blocks.xml



<?xml version="1.0" encoding="UTF-8"?>
<configs>
    <append xpath="/blocks">
        <block name="customSpecialTree" shape="TreeShape">
            <property name="Class" value="Tree"/>
            <property name="Extends" value="blockTree"/>
            <drop event="Harvest" name="resourceWood" count="6000"/>
            <property name="MaxDamage" value="2000"/>
            <property name="Material" value="Wood"/>
            <property name="HarvestTool" value="Axe"/>
            <property name="GrowthStages" value="3"/>
        </block>
    </append>
</configs>

Files : Items.xml

<?xml version="1.0" encoding="UTF-8"?>
<configs>
    <append xpath="/items">
        <item name="customSpecialTreeSeed" category="Resources">
            <property name="Extends" value="plantSeeds"/>
            <property name="PlantGrowingBlock" value="customSpecialTree"/>
            <effect_group>
                <triggered_effect trigger="onSelfPrimaryActionEnd" action="PlantGrowing"/>
            </effect_group>
        </item>
    </append>
</configs>

Files Recipes.xml


 

<?xml version="1.0" encoding="UTF-8"?>
<configs>
    <append xpath="/recipes">
        <recipe name="customSpecialTreeSeed">
            <ingredient name="resourceWood" count="1000"/>
            <craft_area name="workbench"/>
            <craft_time value="10"/>
            <count value="1"/>
        </recipe>
    </append>
</configs>

But it doesn't work. I obviously created a mod info folder in the previous folder here just in case




<?xml version="1.0" encoding="UTF-8" ?>
<xml>

    <Name value="Special Tree Mod"/>
    <Description value="Adds a custom tree and seed that can be crafted and harvested for wood."/>
    <Author value="YourName"/>
    <Version value="1.0"/>
    <GameVersion value="Alpha 20.0"/>

</xml>

Code:
Thank you very much for your help in advance.
 
Hello I would like to create a mod allowing me to create a special seed which would transform into a special tree with 2000 hp and which would bring in 6000 wood, to make this tree you would need 1000 wood.


Code:
Currently I did this but it doesn't work.

Files : Blocks.xml



<?xml version="1.0" encoding="UTF-8"?>
<configs>
    <append xpath="/blocks">
        <block name="customSpecialTree" shape="TreeShape">
            <property name="Class" value="Tree"/>
            <property name="Extends" value="blockTree"/>
            <drop event="Harvest" name="resourceWood" count="6000"/>
            <property name="MaxDamage" value="2000"/>
            <property name="Material" value="Wood"/>
            <property name="HarvestTool" value="Axe"/>
            <property name="GrowthStages" value="3"/>
        </block>
    </append>
</configs>

Files : Items.xml

<?xml version="1.0" encoding="UTF-8"?>
<configs>
    <append xpath="/items">
        <item name="customSpecialTreeSeed" category="Resources">
            <property name="Extends" value="plantSeeds"/>
            <property name="PlantGrowingBlock" value="customSpecialTree"/>
            <effect_group>
                <triggered_effect trigger="onSelfPrimaryActionEnd" action="PlantGrowing"/>
            </effect_group>
        </item>
    </append>
</configs>

Files Recipes.xml


 

<?xml version="1.0" encoding="UTF-8"?>
<configs>
    <append xpath="/recipes">
        <recipe name="customSpecialTreeSeed">
            <ingredient name="resourceWood" count="1000"/>
            <craft_area name="workbench"/>
            <craft_time value="10"/>
            <count value="1"/>
        </recipe>
    </append>
</configs>

But it doesn't work. I obviously created a mod info folder in the previous folder here just in case




<?xml version="1.0" encoding="UTF-8" ?>
<xml>

    <Name value="Special Tree Mod"/>
    <Description value="Adds a custom tree and seed that can be crafted and harvested for wood."/>
    <Author value="YourName"/>
    <Version value="1.0"/>
    <GameVersion value="Alpha 20.0"/>

</xml>

Thank you very much for your help in advance.

You will have better luck asking in the Mods Discussions and Requests forum.  But just one very quick note... your GameVersion isn't valid.  A20 should be Alpha.20.0.X (where X is whatever "b" version you're using, though it should work for X to be 0 or 999.  If you're on a different A20 version like A20.6, then you'd use Alpha.20.6.X (same rule for X).  Also, Name value cannot have spaces.  DisplayName value can have spaces, though you didn't include it.  Take a look at the instruction for creating a mod_info file in the Mods forum or take a look at another mod's mod_info file.

 
Where is your model property line?  If you are making custom blocks, you need to reference what model goes with the new block xml code.

Code:
            <property name="Model" value="Entities/Crafting/sodaVendingMachinePrefab"/>
 
nightmarepv said:
I don't understand what you mean.
I started modding not too long ago.

However, thank you for your help.



You haven't really stated what is the problem (just that you have one).  We can only guess what your problem is based on the code provided.

For any new custom blocks you make in the blocks.xml file, they need to be reference to a 3D model that the game will insert for that new block.  In your code example, you are not tying it to any 3D model so the game doesn't have anything to render when you plant the seed.  So block customSpecialTree exists in the xml code, but the game has nothing to associate to it in the world when it is looking for models.

For example, in A21/1.0 I have a trader mod I created where the trader's vending machines have a different reset period / items list compared to vending machines found out in the world.  In order to do that, I created some custom blocks that had different trader ID numbers in them.  I also associated the vending machine models (i used the existing ones, I did not create new ones) in the block code so the game had something to render when it created the POIs.  I used property name=Model and provided the link to the model in the files.

 
Back
Top