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

Best code to use

AaronG85

Refugee
What would be the best code to use to add an item to a new group? or add one to a group if that vanilla item doesn't have a group?

 
Adding to an existing group:

<insertAfter xpath="/lootcontainers/lootgroup[@name='modMeleeT1']/item[@name='modFuelTankSmall']">

<item name="modDyeBlack"/>

</insertAfter >




Adding a new group

<insertAfter xpath="/lootcontainers/lootgroup[@name='dyes']">

<lootgroup name="dyesNew">

<item name="modDyeBlack"/>

</lootgroup>

</insertAfter >




You can also use insertBefore

 
Last edited by a moderator:
Adding to an existing group:

Adding a new group

You can also use insertBefore


I'm doing something wrong here, I'm trying to add the dyes into the CFChemicals group so they show up in the chemistry station menu?

Code:
	<insertAfter xpath="/lootcontainers/lootgroup[@name='dyes']/item[@name='Group']">

		<lootgroup name="CFChemicals">
			<item name="modDyeBlack"/>
			<item name="modDyeBlue"/>
			<item name="modDyeBrown"/>
			<item name="modDyeGreen"/>
			<item name="modDyePink"/>
			<item name="modDyePurple"/>
			<item name="modDyeRed"/>
			<item name="modDyeWhite"/>
			<item name="modDyeYellow"/>
		</lootgroup>

	</insertAfter >
 
Since you are inserting a new group, rmove the /item[....] after 'dyes']  What it is looking for is a item group inside of lootgroup "dyes" instead of creating a new group after the dyes group.

It should be 

Code:
[COLOR=#e8bd89]<insertAfter[/COLOR][COLOR=#ebe7e3] [/COLOR][COLOR=#df897a]xpath[/COLOR][COLOR=#d9b180]=[/COLOR][COLOR=#7ea9c4]"/lootcontainers/lootgroup[@name='dyes']"[/COLOR][COLOR=#e8bd89]>[/COLOR]
 
Back
Top