Jump to content
  • [Modding] issues with attaching particles


    Bladestorm Games

    I was working on my mod, where I am attaching the p_onFire particle to an enemy via a buff.

    Seems like after about 1 second (when buff update is triggered?) it will auto remove that particle.

     

    When switching "p_onFire" with "p_electric_shock", the shocking particle lasts the whole duration of the buff, but is not being removed the the buff is removed.

     

    Video example:

    https://youtu.be/raj7Qa0wGDY

     

    Code example:

    Buffs.xml

    <configs>
    	<append xpath="/buffs">
    		<buff name="buffScorchTest" name_key="buffScorchName" description_key="buffScorchDesc" showonhud="true" icon="ui_game_symbol_near_death_trauma" icon_color="255,0,0">
    			<stack_type value="replace"/>
    			<duration value="0"/>
    			<display_value value="varScorchDuration"/>
    			<display_value_format value="time"/>
    			<effect_group>
    				<!-- Duration Handling -->
    				<triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar="varScorchDuration" operation="set" value="3"/>
    				<triggered_effect trigger="onSelfBuffUpdate" action="ModifyCVar" cvar="varScorchDuration" operation="add" value="-1"/>
    				
    				<!-- Particle & FX -->
    				<!-- SWAP TEST: "p_onFire" with "p_electric_shock" also "p_impact_metal_on_organic" -->
    				<triggered_effect trigger="onSelfBuffStart" action="AttachParticleEffectToEntity" particle="p_onFire" parent_transform="Spine1" local_offset="0,-.2,0"/>
    				<triggered_effect trigger="onSelfEnteredGame" action="AttachParticleEffectToEntity" particle="p_onFire" parent_transform="Spine1" local_offset="0,-.2,0"/>
    
    				<triggered_effect trigger="onSelfDied" action="RemoveParticleEffectFromEntity" particle="p_onFire"/>
    
    				<triggered_effect trigger="onSelfBuffFinish" action="RemoveParticleEffectFromEntity" particle="p_onFire"/>
    				<triggered_effect trigger="onSelfBuffRemove" action="RemoveParticleEffectFromEntity" particle="p_onFire"/>
    				<triggered_effect trigger="onSelfLeaveGame" action="RemoveParticleEffectFromEntity" particle="p_onFire"/>
    				
    				<!-- Effect of being Scorched -->
    				<!-- <passive_effect name="HealthChangeOT" operation="base_subtract" value="5"> -->
    				<triggered_effect trigger="onSelfBuffUpdate" action="ModifyStats" stat="Health" operation="add" value="-5"/>
    				
    				
    				<!-- Cleanup Handling :: Scorch -->
    				<triggered_effect trigger="onSelfBuffUpdate" action="RemoveBuff" buff="buffScorch">
    					<requirement name="CVarCompare" cvar="varScorchDuration" operation="LTE" value="0"/>
    				</triggered_effect>
    				<triggered_effect trigger="onSelfBuffRemove" action="ModifyCVar" cvar="varScorchDuration" operation="set" value="0"/>
    			</effect_group>
    		</buff>
    	</append>
    </configs>

     

     

    And for a way to trigger the custom buff:

    items.xml

    <configs>
    	<append xpath="/items/item[@name='meleeWpnBladeT0BoneKnife']">
    		<effect_group>
    			<triggered_effect trigger="onSelfAttackedOther" action="AddBuff" target="other" buff="buffScorchTest"/>
    			<triggered_effect trigger="onSelfEquipStart" action="AddBuff" buff="buffScorch"/>
    		</effect_group>
    	</append>
    </configs>

     


    User Feedback

    Recommended Comments

    Alright, just went back over this. Is the problem that the p_electric_shock is NOT being removed when the zombie dies? If that's the case I'm unable to reproduce in our latest internal build using your provided xml. The particle stops when the zombie dies at the end of the buff.

    The vanilla burning effect has some additional stuff going on in buffs.xml if you search for p_onFire, so that it would fire the particle again on a buff update. The electric shock is set to loop so does not have that limitation.

    If you have any further questions on modding, please feel free to ask in the Modding section of the forums, or you can try the 7 Days to Die Unofficial Modding Discord if that's more your preference.

    Thanks @Bladestorm Games, I look forward to your response. I'll await some clarification before moving forward.

     

    Link to comment
    Share on other sites

    9 hours ago, TSBX said:

    The vanilla burning effect has some additional stuff going on in buffs.xml if you search for p_onFire, so that it would fire the particle again on a buff update. The electric shock is set to loop so does not have that limitation.

     

    Ahhh, I see.
    I thought it worked similar to p_electric_shock, where once attached, it would keep firing the particle.

    Like you said, looking into buffs.xml, I need to add this line of code to my buff:

    <triggered_effect trigger="onSelfBuffUpdate" action="AttachParticleEffectToEntity" particle="p_onFire" shape_mesh="true"/>

     

     

    As for the p_electric_shock test, looking into the code, I had a typo, so when the buff ended, it wasnt removing the p_electric_shock particle.

     

    I've updated the custom buff and noticed 2 issues now.

    First Ill post the code:

    ITEMS.XML (method for deploying the buff)

    Spoiler
    <configs>
    	<append xpath="/items/item[@name='meleeWpnBladeT0BoneKnife']">
    		<effect_group>
    			<triggered_effect trigger="onSelfAttackedOther" action="AddBuff" target="other" buff="buffScorchTest"/>
    			<triggered_effect trigger="onSelfEquipStart" action="AddBuff" buff="buffScorchTest"/>
    		</effect_group>
    	</append>
    </configs>

     

     

    BUFFS.XML

    Spoiler
    <configs>
    	<append xpath="/buffs">
    		<buff name="buffScorchTest" name_key="buffScorchName" description_key="buffScorchDesc" showonhud="true" icon="ui_game_symbol_near_death_trauma" icon_color="255,0,0">
    			<stack_type value="replace"/>
    			<duration value="0"/>
    			<display_value value="varTestDuration"/>
    			<display_value_format value="time"/>
    			<effect_group>
    				<!-- Duration Handling -->
    				<triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar="varTestDuration" operation="set" value="4"/>
    				<triggered_effect trigger="onSelfBuffUpdate" action="ModifyCVar" cvar="varTestDuration" operation="add" value="-1"/>
    				
    				<!-- Particle & FX -->
    					<!-- Start FX -->
    				<triggered_effect trigger="onSelfBuffStart" action="AttachParticleEffectToEntity" particle="p_onFire" parent_transform="Spine1" local_offset="0,0,0"/>
    				<triggered_effect trigger="onSelfEnteredGame" action="AttachParticleEffectToEntity" particle="p_onFire" parent_transform="Spine1" local_offset="0,0,0"/>
    
    					<!-- Maintain FX -->
    				<triggered_effect trigger="onSelfBuffUpdate" action="AttachParticleEffectToEntity" particle="p_onFire" shape_mesh="true"/>
    				
    					<!-- Cleanup FX -->
    				<!-- <triggered_effect trigger="onSelfBuffFinish" action="RemoveParticleEffectFromEntity" particle="p_onFire"/> -->
    				<triggered_effect trigger="onSelfDied" action="RemoveParticleEffectFromEntity" particle="p_onFire"/>
    				<triggered_effect trigger="onSelfBuffRemove" action="RemoveParticleEffectFromEntity" particle="p_onFire"/>
    				<triggered_effect trigger="onSelfLeaveGame" action="RemoveParticleEffectFromEntity" particle="p_onFire"/>
    				
    				<!-- Effect of being Scorched -->
    				<!-- DISABLED FOR TESTING -->
    				<!-- <triggered_effect trigger="onSelfBuffUpdate" action="ModifyStats" stat="Health" operation="add" value="-1"/> -->
    				
    				
    				<!-- Cleanup Handling :: Scorch -->
    				<triggered_effect trigger="onSelfBuffUpdate" action="RemoveBuff" buff="buffScorchTest">
    					<requirement name="CVarCompare" cvar="varTestDuration" operation="LTE" value="0"/>
    				</triggered_effect>
    				<triggered_effect trigger="onSelfBuffRemove" action="ModifyCVar" cvar="varTestDuration" operation="set" value="0"/>
    			</effect_group>
    		</buff>
    	</append>
    </configs>

     

     

    The two issues now are:

    1) Burning Particle / FX seems to "Flicker" (Turn off and back on) some times. Im going to guess this might be because the core game's buffs.xml is "fighting" my buff.xml.

    Looking into the games core buffs.xml file, under the buff "buffStatusCheck01" and "zombieBuffStatusCheck01" we can find this:

    Spoiler
    <triggered_effect trigger="onSelfBuffUpdate" action="RemoveParticleEffectFromEntity" particle="p_onFire">
       <requirement name="!HasBuff" buff="buffIsOnFire"/>
    </triggered_effect>

     

    I'm a bit short on time to do it here, now, but I'll have to add my buff as a requirement check for both "buffStatusCheck01" and "zombieBuffStatusCheck01" to prevent a potential issue there.

    Something like this:

    Spoiler
    <append xpath="/buffs/buff[@name='buffStatusCheck01']/effect_group/triggered_effect[@action='RemoveParticleEffectFromEntity']">
    	<requirement name="!HasBuff" buff="buffScorchTest"/>
    </append>
    <append xpath="/buffs/buff[@name='zombieBuffStatusCheck01']/effect_group/triggered_effect[@action='RemoveParticleEffectFromEntity']">
    	<requirement name="!HasBuff" buff="buffScorchTest"/>
    </append>

     

     

    2) The next issue is sometimes the fire particle persists after the custom buff is over. This makes things odd, because (I think) "buffStatusCheck01" auto removes the fire particle every buff update.

     

    Here is a video that shows the two issues (Sorry for the zombie sounds):

    https://youtu.be/0dnUSCtdWOg
    At 0:06 to 0:09 you can see the "flicker" or turn-off / turn-on of the fire particle.

    At 0:14+ you can see how even though the buff drops off, the fire particle exists.

     

    Link to comment
    Share on other sites

    If you are able to locate an issue with a vanilla reproduction please submit a new report for each individual problem using the template in the linked post below.


    Again, for further assistance on modding the game, please see the above linked resources. There are tons of folks there who are more than happy to answer questions and offer guidance on everything from xml edits to 3d modeling.

    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...