Jump to content

XPath Modding Explanation Thread


sphereii

Recommended Posts

On 8/12/2021 at 6:17 PM, McKeighan said:

Hi All - 

This part as been stumping me for a bit. I thought I had it, but then it turns out I had been fooling myself and I really had just been removing the attribute itself and not the values of the attribute, which is what i'm after. 

Here's a bit of what I'm wanting to do.

@ lvl 1 in skill in GreaseMonkey, everyone has the ability to create wheels, bike chassis, and bike handlebars. 
@ lvl 2 in skill, this expands to everyone can now create a bar battery, make gas, and engineer a minibike chassis and minibike handlebars.  

(and so on and so forth).

For this exercise, what I wanted to do was say... yaaaaah. NO,  INSTEAD, all you can do is find the chassis/handlebars for the minibike in loot or on vendors to purchase. The schematic to learn how to make the chassis and handlebars doesn't even exist.... and oh yeah - you have to be skill lvl 1 to even understand how to assemble a minibike now. So unskilled players can no longer just luck into finding all the parts in the world and just make a minibike out of their magic backpacks.

This is the code I had been playing with, with some success, but of course, there's things I'm just not getting as to why it's not exactly working. 

So what's the correct way to do it? Just using <remove xpath="/.... etc... "  ????
Would this also explain why it's not being removed from the traders.xml or the loot.xml?

Did anyone answer your question?

 

One thing I noticed (and I am new to this so I just learned myself) is progression file.  You might want to do to the following instead

 

<set xpath="/progression/perks/perk[@name='perkGreaseMonkey']/effect_group/passive_effect[@name='RecipeTagUnlocked'][@tags='carBattery,ammoGasCan,vehicleMinibikeChassis,vehicleMinibikeHandlebars']/@tags">carBattery</set>

 

That changes what can be unlocked via perk points.  So now if someone buys that perk, the only recipe they unlock is car batteries.  Leave the tags in so you can reference them later on.

 

To set requirement on level, I think you need to do it in the recipes file and add the level requirement (not sure on this).

 

        <level_requirements level="2"><requirement name="ProgressionLevel" progression_name="attPerception" operation="GTE" value="3" desc_key="reqPerceptionLevel03"/></level_requirements>

 

This is from the procession file and sets a level requirement to unlock specific perks.  Progression name might be changed to the perk name and value is the level of the perk (so 2 for minibikes).  This is all theory in my head as I haven't tried the set level to craft

Link to comment
Share on other sites

  • 4 weeks later...
  • 4 weeks later...

Hey i try to give a few guns other ammo with the xpath

 

not sure if this is the right setup

 

	 <set xpath="items/item[@name='gunRifleT3SniperRifle']/property[@name='Magazine_items' and @value='ammo762mmBulletBall,ammo762mmBulletHP,ammo762mmBulletAP']/@value">,50 Caliber Ammo</set>

 

will this work or is there some kind of error ? :D

 

Link to comment
Share on other sites

8 hours ago, Lord Neophyte said:

Hey i try to give a few guns other ammo with the xpath

 

not sure if this is the right setup

 

	 <set xpath="items/item[@name='gunRifleT3SniperRifle']/property[@name='Magazine_items' and @value='ammo762mmBulletBall,ammo762mmBulletHP,ammo762mmBulletAP']/@value">,50 Caliber Ammo</set>

 

will this work or is there some kind of error ? :D

 

Should have a slash in front (before items).  You also should have /property[@class="Action0'] between item[@name] and property[@name='Magazine_items'

 

Also, are you trying to replace the ammo with 50 cal or add it as an option?

 

If replacing, remove the comma

 

If adding, you should use append instead of set.

 

Another point, the spaces in your item could cause issues (50 Caliber Ammo).  Best thing to do is to id the ammo as ammo50Caliber (order not critical but eliminate the spaces in the ID).

 

This is how I would do it

 

<set xpath="/items/item[@name='gunRifleT3SniperRifle']/property[@class='Action0']/property[@name='Magazine_items']/@value">ammo50Cal</set>

 

Edited by BFT2020 (see edit history)
Link to comment
Share on other sites

  • 3 weeks later...

Hello, this is a great thread. I am learning a lot.

 

I am trying to make a modification and need some help. I am using the Undead Legacy mod by Subquake. His mod has action skills that gain exp when using those skills. What I want to to do is make it so when using Grandpa's Learning Elixir, the bonus to exp is also given to the exp gained when using those skills.

 

Here is the code for the buff from Grandpa's Learning Elixir.

 

<buff name="buffDrunkGrandpasLearningElixir" name_key="buffDrunkGrandpasLearningElixirName" description_key="buffDrunkGrandpasLearningElixirDesc" tooltip_key="buffDrunkGrandpasLearningElixirTooltip" icon="ui_game_symbol_beer">
		<stack_type value="replace"/><duration value="0"/>
		<display_value value=".buffGrandpasLearningElixirDisplay"/><display_value_format value="time"/>
		<effect_group>
			<triggered_effect trigger="onSelfBuffUpdate" action="ModifyCVar" cvar="$buffGrandpasLearningElixirDuration" operation="subtract" value="@$MetabolismDuration"/>
			<triggered_effect trigger="onSelfBuffUpdate" action="ModifyCVar" cvar=".buffGrandpasLearningElixirDisplay" operation="set" value="@$buffGrandpasLearningElixirDuration"/>
			<triggered_effect trigger="onSelfBuffUpdate" action="ModifyCVar" cvar=".buffGrandpasLearningElixirDisplay" operation="divide" value="@$MetabolismDuration"/>
		</effect_group>
		<effect_group>
			<triggered_effect trigger="onSelfBuffUpdate" action="RemoveBuff" buff="buffDrunkGrandpasLearningElixir">
				<requirement name="CVarCompare" cvar="$buffGrandpasLearningElixirDuration" operation="LTE" value="0"/>
			</triggered_effect>
			<triggered_effect trigger="onSelfBuffRemove" action="ModifyCVar" cvar=".buffGrandpasLearningElixirDisplay" operation="set" value="0"/>
			<triggered_effect trigger="onSelfBuffRemove" action="ModifyCVar" cvar="$buffGrandpasLearningElixirDuration" operation="set" value="0"/>
		</effect_group>
		<effect_group>
			<passive_effect name="PlayerExpGain" operation="perc_add" value=".2"/>
		</effect_group>
	</buff>

 

Here is the code for one of the action skills.

 

<perk name="actionPerkShockers" name_key="actionPerkShockers" parent="actionSkillIntellect" icon="symbol_stun_baton" max_level="100" base_skill_point_cost="0">
	<effect_group name="Perk Bonus">
		<requirement name="ItemHasTags" tags="perkElectrocutioner"/>
		<passive_effect name="DamageModifier" operation="perc_add" level="1,100" value="0.005,0.5" tags="head"/>
		<passive_effect name="DismemberChance" operation="base_add" level="1,100" value=".0025,.25"/>
		<passive_effect name="BlockDamage" operation="perc_add" level="1,100" value=".0025,.25"/>
		<passive_effect name="EntityDamage" operation="perc_add" level="1,100" value=".0025,.25"/>
	</effect_group>
	<effect_group name="Initialize">
		<triggered_effect trigger="onSelfEnteredGame" action="ModifyCVar" cvar="$actionPerkShockersNext" operation="set" value="100">
			<requirement name="CVarCompare" operation="LT" value="1" cvar="$actionPerkShockersNext"/>
		</triggered_effect>
	</effect_group>
	<effect_group name="Level Up">
		<requirement name="ItemHasTags" tags="perkElectrocutioner"/>
		<triggered_effect trigger="onSelfKilledOther" action="ULM_SkillUp,UndeadLegacy" skill="actionPerkShockers" attribute="attIntellect" add_xp="8"/>
		<triggered_effect trigger="onSelfDamagedOther" action="ULM_SkillUp,UndeadLegacy" skill="actionPerkShockers" attribute="attIntellect" add_xp="2">
			<requirement name="IsAlive" target="other"/>
		</triggered_effect>
	</effect_group></perk>

 

I am assuming that I would place the code in the Grandpa's Learning Elixir buff after <passive_effect name="PlayerExpGain line and target both add_xp lines in the action skill.

 

Any help with how to write the code is much appreciated,

 

Thanks

 

Link to comment
Share on other sites

Sorry if this has been asked or answered before, but is there any way to see the xml file during runtime after all the xpath changes have been applied.  Or is there a tool that will let you compare all the different changes and overwrites between different modlets or xpath commands.  I imagine it'd look something like FO4edit with how each record is edited and the last mod to change it wins.  Is there anything out there that exists like that so you can see the final state of something like entitygroups.xml after all the xpath modifiers have been applied?

Link to comment
Share on other sites

  • 1 month later...
On 10/12/2020 at 9:59 PM, PrimalCarnage said:

Just figured I would pop back into the thread to let you guys know, I got the display properties working for my new shades!  It doesn't list all the stats, but it shows me the important ones so I can tell which pair will be better.  The only thing left to confirm is that they are dropping in game.  Since I fixed the issues with that block of code I haven't really seen many glasses drop, maybe 2 or 3 total, so we're still testing that.

On a side note, anyone have any ideas how I can maybe use creative to spawn in a loot container that has a chance of dropping eyewear?  Or know a way that I can maybe force them to spawn so I can verify that they drop?

What you did to have them display the information? I got it in the game but can't have them display anything.

Link to comment
Share on other sites

  • 7 months later...
7 hours ago, LastTugBoat243 said:

How do I hide or blacklist certain recipes or Items from the game?

I want to make a mod that adds a new recipe for an already existing item in the game. But I want to hide the current one first. How would I go about doing that?

 

"<remove xpath="">". See first page of this thread for the syntax.

 

Link to comment
Share on other sites

  • 1 month later...
On 8/24/2019 at 9:04 PM, moriakGG said:

Hi,

 

I have a question regarding the xpath command remove. Is it possible to remove only a part of a string in an attribute?

 

For example, Advanced Engineering skill level 2 teaches these recipes:

 

gunPistol,gunPumpShotgun,gunHuntingRifle,spotlightPlayer,speaker,pressureplate,pressureplateLong,electrictimerrelay,motionsensor,cementMixer,ammoDartSteel,dartTrap

 

<passive_effect name="RecipeTagUnlocked" operation="base_set" value="1" level="2,5" tags="gunPistol,gunPumpShotgun,gunHuntingRifle,spotlightPlayer,speaker,pressureplate,pressureplateLong,electrictimerrelay,motionsensor,cementMixer,ammoDartSteel,dartTrap" />
 

...

 

Hey folks,

 

I'm trying to find out if this is possible yet, or if a dynamic workaround has been found? I appreciate I can "hardcode" the new list but would prefer not to.

 

A lot to dig through in here, I'll keep reading but anyone able to tell me?

 

Edited by RyanFaeScotland (see edit history)
Link to comment
Share on other sites

  • 4 months later...

Alpha 21 has introduced a new xpath hook for us to use: <csv />

 

The existing xpath hooks remain unchanged.

 

<csv allows us to better manipulate some values stored in lists.

Structure:

<csv
    xpath="//XML/path/to/the/attribute/values"
    delim="" 
        Single character that defines how the list is seperated. 
        For examples:
            delim=","  <!-- This is default if ommitted -->
            delim=":"
            delim="\n" <!-- this indicates it's seperated by a new line -->
    op="add" / op="remove"
        Add or remove from the list.
        
    >Values to add or remove</csv> <!-- Wild cards may be used ( * ) on the remove operation. -->


    
        
For example, if you wanted to remove the keystoneBlock ( Land Claim block ) from the starting list, you would have previously had to do a <set on it to replace the entire line.

 

XML:

    <property name="ItemsOnEnterGame.GameModeSurvival" value="drinkJarBoiledWater,foodCanChili,medicalFirstAidBandage,meleeToolTorch,keystoneBlock,noteDuke01"/>
    <property name="ItemsOnEnterGame.GameModeSurvivalSP" value="drinkJarBoiledWater,foodCanChili,medicalFirstAidBandage,meleeToolTorch,keystoneBlock"/>
    <property name="ItemsOnEnterGame.GameModeSurvivalMP" value="drinkJarBoiledWater,foodCanChili,medicalFirstAidBandage,meleeToolTorch,keystoneBlock"/>

 

Old <set:

 <set xpath="/entity_classes/entity_class[@name='playerMale']/property[starts-with(@name, 'ItemsOnEnterGame')]/@value" >drinkJarBoiledWater,foodCanChili,medicalFirstAidBandage,meleeToolTorch,noteDuke01</set>

 

New <csv: 

   <!-- Removes the keystoneBlock, and the extra comma -->
    <csv xpath="/entity_classes/entity_class[@name='playerMale']/property[starts-with(@name, 'ItemsOnEnterGame')]/@value" delim="," op="remove" >keystoneBlock</csv>

    <!-- Add a pipe rifle to the starting list -->
    <!-- You can still use <append to add to this list, but you will need to add in the comma yourself. -->
    <csv xpath="/entity_classes/entity_class[@name='playerMale']/property[starts-with(@name, 'ItemsOnEnterGame')]/@value" delim="," op="add" >gunRifleT0PipeRifle</csv>

 

This can also be used to manipulate other lists, such as Tags:

    <property name="Tags" value="entity,player,human"/>

    <csv xpath="/entity_classes/entity_class[@name='playerMale']/property[@name='Tags']/@value" delim="," op="add" >zombie</csv>
    <csv xpath="/entity_classes/entity_class[@name='playerMale']/property[@name='Tags']/@value" delim="," op="remove" >entity</csv>


Entitygroups.xml has seen some changes for A21. 

 

You may still use set, append, and the other xpaths to add new / remove entire groups. 

 

Entitygroups does not have an attribute or sub-nodes in which to add or remove entities from the list, so we cannot use the other xpath commands.

Instead, these are defined in the "text" area of the XML, and you would use the special xpath keyword: text() instead of the traditional @value.

 

Example:

    <entitygroup name="ZombiesAll">
        zombieBoe
        zombieJoe
        zombieSteve
        <!-- snipped /modified for brevity and example -->
        zombieBiker, .3
        zombieBikerFeral, .3
        zombieBiker
        zombieFatHawaiian, .3
    </entitygroup>

 

However, to manipulate an existing group, you will need to use <csv, with a delimiter of new line ( "\n" ).

 

    <!-- Remove the zombieTomClark from the ZombiesAll -->
    <csv xpath="/entitygroups/entitygroup[@name='ZombiesAll']/text()" delim="\n" op="remove" >zombieJoe</csv>
    
    <!-- Remove the zombieBiker, using a wild card -->
    <!-- This would hit zombieBikerFeral, and any zombieBiker with a probability. -->
    <csv xpath="/entitygroups/entitygroup[@name='ZombiesAll']/text()" delim="\n" op="remove" >zombieBiker*</csv>
    
    <!-- To add to an existing group, spread it over multiple lines -->
    <csv xpath="/entitygroups/entitygroup[@name='ZombiesAll']/text()" delim="\n" op="add" >
        zombieFatHawaiian2, .3
        zombieFatHawaiian3, .3
        zombieFatHawaiian4, .3
        zombieFatHawaiian5, .3
    </csv>


 

Link to comment
Share on other sites

15 hours ago, sphereii said:

Alpha 21 has introduced a new xpath hook for us to use: <csv />

 

The existing xpath hooks remain unchanged.

 

<csv allows us to better manipulate some values stored in lists.

Structure:

<csv
    xpath="//XML/path/to/the/attribute/values"
    delim="" 
        Single character that defines how the list is seperated. 
        For examples:
            delim=","  <!-- This is default if ommitted -->
            delim=":"
            delim="\n" <!-- this indicates it's seperated by a new line -->
    op="add" / op="remove"
        Add or remove from the list.
        
    >Values to add or remove</csv> <!-- Wild cards may be used ( * ) on the remove operation. -->


    
        
For example, if you wanted to remove the keystoneBlock ( Land Claim block ) from the starting list, you would have previously had to do a <set on it to replace the entire line.

 

XML:

    <property name="ItemsOnEnterGame.GameModeSurvival" value="drinkJarBoiledWater,foodCanChili,medicalFirstAidBandage,meleeToolTorch,keystoneBlock,noteDuke01"/>
    <property name="ItemsOnEnterGame.GameModeSurvivalSP" value="drinkJarBoiledWater,foodCanChili,medicalFirstAidBandage,meleeToolTorch,keystoneBlock"/>
    <property name="ItemsOnEnterGame.GameModeSurvivalMP" value="drinkJarBoiledWater,foodCanChili,medicalFirstAidBandage,meleeToolTorch,keystoneBlock"/>

 

Old <set:

 <set xpath="/entity_classes/entity_class[@name='playerMale']/property[starts-with(@name, 'ItemsOnEnterGame')]/@value" >drinkJarBoiledWater,foodCanChili,medicalFirstAidBandage,meleeToolTorch,noteDuke01</set>

 

New <csv: 

   <!-- Removes the keystoneBlock, and the extra comma -->
    <csv xpath="/entity_classes/entity_class[@name='playerMale']/property[starts-with(@name, 'ItemsOnEnterGame')]/@value" delim="," op="remove" >keystoneBlock</csv>

    <!-- Add a pipe rifle to the starting list -->
    <!-- You can still use <append to add to this list, but you will need to add in the comma yourself. -->
    <csv xpath="/entity_classes/entity_class[@name='playerMale']/property[starts-with(@name, 'ItemsOnEnterGame')]/@value" delim="," op="add" >gunRifleT0PipeRifle</csv>

 

This can also be used to manipulate other lists, such as Tags:

    <property name="Tags" value="entity,player,human"/>

    <csv xpath="/entity_classes/entity_class[@name='playerMale']/property[@name='Tags']/@value" delim="," op="add" >zombie</csv>
    <csv xpath="/entity_classes/entity_class[@name='playerMale']/property[@name='Tags']/@value" delim="," op="remove" >entity</csv>


Entitygroups.xml has seen some changes for A21. 

 

You may still use set, append, and the other xpaths to add new / remove entire groups. 

 

Entitygroups does not have an attribute or sub-nodes in which to add or remove entities from the list, so we cannot use the other xpath commands.

Instead, these are defined in the "text" area of the XML, and you would use the special xpath keyword: text() instead of the traditional @value.

 

Example:

    <entitygroup name="ZombiesAll">
        zombieBoe
        zombieJoe
        zombieSteve
        <!-- snipped /modified for brevity and example -->
        zombieBiker, .3
        zombieBikerFeral, .3
        zombieBiker
        zombieFatHawaiian, .3
    </entitygroup>

 

However, to manipulate an existing group, you will need to use <csv, with a delimiter of new line ( "\n" ).

 

    <!-- Remove the zombieTomClark from the ZombiesAll -->
    <csv xpath="/entitygroups/entitygroup[@name='ZombiesAll']/text()" delim="\n" op="remove" >zombieJoe</csv>
    
    <!-- Remove the zombieBiker, using a wild card -->
    <!-- This would hit zombieBikerFeral, and any zombieBiker with a probability. -->
    <csv xpath="/entitygroups/entitygroup[@name='ZombiesAll']/text()" delim="\n" op="remove" >zombieBiker*</csv>
    
    <!-- To add to an existing group, spread it over multiple lines -->
    <csv xpath="/entitygroups/entitygroup[@name='ZombiesAll']/text()" delim="\n" op="add" >
        zombieFatHawaiian2, .3
        zombieFatHawaiian3, .3
        zombieFatHawaiian4, .3
        zombieFatHawaiian5, .3
    </csv>


 

Hi all -

I have a player who needs a specific entity removed from the game (the snake) - I've used your example, and here's what I came up with but can't get it to work:

 

<csv xpath="/entitygroups/entitygroup[@name='Snakegroup']/text()" delim="\n" op="remove" >animalSnake</csv>
<csv xpath="/entitygroups/entitygroup[@name='Snakegroup']/text()" delim="\n" op="add" >zombieJoe</csv>
 

What have I missed? The snakes remain in the game.

 

Thanks to anyone who can help with this (and thanks especially to u/sphereii for posting this initially).

 

Link to comment
Share on other sites

On 6/13/2023 at 9:04 AM, nanaandbobo said:

Hi all -

I have a player who needs a specific entity removed from the game (the snake) - I've used your example, and here's what I came up with but can't get it to work:

 

<csv xpath="/entitygroups/entitygroup[@name='Snakegroup']/text()" delim="\n" op="remove" >animalSnake</csv>
<csv xpath="/entitygroups/entitygroup[@name='Snakegroup']/text()" delim="\n" op="add" >zombieJoe</csv>
 

What have I missed? The snakes remain in the game.

 

Thanks to anyone who can help with this (and thanks especially to u/sphereii for posting this initially).

 

try  "SnakeGroup" with a capital G in Group.

Link to comment
Share on other sites

On 6/13/2023 at 8:04 AM, nanaandbobo said:

Hi all -

I have a player who needs a specific entity removed from the game (the snake) - I've used your example, and here's what I came up with but can't get it to work:

 

<csv xpath="/entitygroups/entitygroup[@name='Snakegroup']/text()" delim="\n" op="remove" >animalSnake</csv>
<csv xpath="/entitygroups/entitygroup[@name='Snakegroup']/text()" delim="\n" op="add" >zombieJoe</csv>
 

What have I missed? The snakes remain in the game.

 

Thanks to anyone who can help with this (and thanks especially to u/sphereii for posting this initially).

 

 

FYI I did create a modlet awhile back for someone

 

Replaced the snake with the coyote model

Link to comment
Share on other sites

Thank you for introducing some <csv /> for entity groups. Without which, an update to a server side zombies mod would still be on the workbench.

I wonder if it's possible to introduce some more 'complex' integrations (at least for me) for what would have previously been:
 

    <insertAfter xpath="/entitygroups/entitygroup[ starts-with(@name, 'scoutHordeStageGS')]/entity[@name='zombieArleneRadiated']">
        <entity name="zombieSMGArlene" prob="0.9"/>
    </insertAfter>

 

and with an additional condition for the purpose of feeding into a group only when that entity appears since there is a habit to have them as placemarkers with prob 0.:

 

    <insertAfter xpath="/entitygroups/entitygroup[ starts-with(@name, 'ZombieGhostTownGroupGS')]/entity[@name='zombieArleneRadiated' and not(@prob='0')]">
        <entity name="zombieSMGArlenePLUS" prob="0.2"/>
    </insertAfter>
Link to comment
Share on other sites

7 hours ago, arramus said:

Thank you for introducing some <csv /> for entity groups. Without which, an update to a server side zombies mod would still be on the workbench.

I wonder if it's possible to introduce some more 'complex' integrations (at least for me) for what would have previously been:
 

    <insertAfter xpath="/entitygroups/entitygroup[ starts-with(@name, 'scoutHordeStageGS')]/entity[@name='zombieArleneRadiated']">
        <entity name="zombieSMGArlene" prob="0.9"/>
    </insertAfter>

 

and with an additional condition for the purpose of feeding into a group only when that entity appears since there is a habit to have them as placemarkers with prob 0.:

 

    <insertAfter xpath="/entitygroups/entitygroup[ starts-with(@name, 'ZombieGhostTownGroupGS')]/entity[@name='zombieArleneRadiated' and not(@prob='0')]">
        <entity name="zombieSMGArlenePLUS" prob="0.2"/>
    </insertAfter>

 

The tricky part is that the text() of the entitygroups node is treated as a solid text, and contains new lines. This limits the usage of starts-with / ends-with, and leaves us with contains(). From previous tutorials, we've talked about the power, and danger, of contains, since "meow" can be found in "homeowner". This needs to be as precise as possible.

 

<csv xpath="/entitygroups/entitygroup[ 
            	starts-with(@name, 'ZombieGhostTownGroupGS') 
            	and contains(text(), 'zombieArleneRadiated')
            ]">
  zombieSMGArlenePLUS, 0.2
</csv>

 

Now, as an exercise, I wanted to see if we could target things very specifically. Let's say we wanted to add the zombieSMGArlenePLUS (which sounds terrifying), to each zombieArleneRadiated that did not have a probability of .7. This may not ever occur, so the information is just an example.

 

<csv xpath="/entitygroups/entitygroup[ 
            	starts-with(@name, 'ZombieGhostTownGroupGS') 
            	and contains(text(), 'zombieArleneRadiated') 
            	and not( contains(text(), 'zombieArleneRadiated, .7' ))
            ]">
  zombieSMGArlenePLUS, 0.2
</csv>

 

That assumes the formatting is correct, in that the probability is added to the line with a , a space, followed by a number.

 

Reminder that the "not" is a function of xpath, so it must contain the (  ) around the condition.: ie:   not ( blah = blah )

 

Using the above syntax, you could swap out the not conditions with zombieBoeRadiated.

 

<csv xpath="/entitygroups/entitygroup[ 
            	starts-with(@name, 'ZombieGhostTownGroupGS') 
            	and contains(text(), 'zombieArleneRadiated') 
            	and not( contains(text(), 'zombieBoeRadiated' ))
            ]">
  zombieSMGArlenePLUS, 0.2
</csv>

 

ZombieSMGArlenePlus would not be added to any group that contains zombieArleneRadiated and zombieBoeRadiated. She would, however, be added to any entitygroup with a zombieArleneRadiated.

 

Changing zombieBoeRadiated to zombieBoe would open up the search a lot more, and reduce her spawning, since it'd match zombieBoeRadiated, zombieBoe, and zombieBoeFeral. 

 

The contains( text() calls re-parse the entire node looking for the target, so the entities do not need to be directly below or above them, just inside the same text() itself.

Link to comment
Share on other sites

Great info on the new system.  But I am struggling to make some code work with the new system for entity groups

 

Here is my original code that worked GREAT!!

 

    <append xpath="/entitygroups/entitygroup[descendant::entity[@name='animalDoe' and not(@prob='1')]]">
        <entity name="animalIceburgBabyDeer" />
    </append>
    <append xpath="/entitygroups/entitygroup[descendant::entity[@name='animalDoe' and @prob='1']]">
        <entity name="animalIceburgBabyDeer" prob="1" />
    </append>

 

this basically searched the entire entity groups and placed a new entry when it found a match..

 

Trying to figure out how to keep that functionality because it kept the size of the mod file MUCH smaller and maintenance was much easier.

 

Tired this (which I didn't think would work):

    <csv xpath="/entitygroups/entitygroup[@name='*' 
        and contains(text(), 'animalDoe')
        and not(contains(text(), ',')
        ]">
        animalIceburgBabyDeer"
    </csv>
    <csv xpath="/entitygroups/entitygroup[@name='*' 
        and contains(text(), 'animalDoe, 15')
        ]">
        animalIceburgBabyDeer"
    </csv>
 

I don't think the "*" can work there, and with the error I got, I am pretty sure I am right.

 

got this error:

2023-06-18T12:07:37 9190.435 EXC XML.Patch (/Iceburg/csv, line 5 at pos 3): XPath evaluation failed: '/entitygroups/entitygroup[@name='*'    and contains(text(), 'animalDoe')   and not(contains(text(), ',')   ]' has an invalid token.

 

Any help appreciated...

 

 

Link to comment
Share on other sites

On 6/18/2023 at 2:15 PM, Iceburg71 said:

Great info on the new system.  But I am struggling to make some code work with the new system for entity groups

 

Here is my original code that worked GREAT!!

 

    <append xpath="/entitygroups/entitygroup[descendant::entity[@name='animalDoe' and not(@prob='1')]]">
        <entity name="animalIceburgBabyDeer" />
    </append>
    <append xpath="/entitygroups/entitygroup[descendant::entity[@name='animalDoe' and @prob='1']]">
        <entity name="animalIceburgBabyDeer" prob="1" />
    </append>

 

this basically searched the entire entity groups and placed a new entry when it found a match..

 

Trying to figure out how to keep that functionality because it kept the size of the mod file MUCH smaller and maintenance was much easier.

 

Tired this (which I didn't think would work):

    <csv xpath="/entitygroups/entitygroup[@name='*' 
        and contains(text(), 'animalDoe')
        and not(contains(text(), ',')
        ]">
        animalIceburgBabyDeer"
    </csv>
    <csv xpath="/entitygroups/entitygroup[@name='*' 
        and contains(text(), 'animalDoe, 15')
        ]">
        animalIceburgBabyDeer"
    </csv>
 

I don't think the "*" can work there, and with the error I got, I am pretty sure I am right.

 

got this error:

2023-06-18T12:07:37 9190.435 EXC XML.Patch (/Iceburg/csv, line 5 at pos 3): XPath evaluation failed: '/entitygroups/entitygroup[@name='*'    and contains(text(), 'animalDoe')   and not(contains(text(), ',')   ]' has an invalid token.

 

Any help appreciated...

 

 

 

The reason this doesn't work:

 

 <csv xpath="/entitygroups/entitygroup[@name='*' 
        and contains(text(), 'animalDoe')
        and not(contains(text(), ',')
        ]">
        animalIceburgBabyDeer"
    </csv>

 

is because the text() searches all of the entries in, so if it finds a , anywhere, it'll fail to append.

 

Are you trying to add the BabyDear to the same entry as animalDoe, that has a probability?

 

If so, you'd want something like this:

 

 <csv xpath="/entitygroups/entitygroup[@name='*' 
        and contains(text(), 'animalDoe,')
        ]">
        animalIceburgBabyDeer"
    </csv>

 

Link to comment
Share on other sites

Yeah, I get the naming in the "contains" part.  I just threw that together and see if it would even work.  My issue is how do i search for "animalDoe" in ALL of the groups?  I think the * is the invalid token error I am getting, thus not letting anything work.  Because it is an error and not a warning.

 

thanks

 

Link to comment
Share on other sites

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
×
×
  • Create New...