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

How can I make the buff trigger when the task is activated?

Survive Playing

New member
Hi all! Please give me a code example, how can I make the buff trigger when the task is activated?

For example, you activate the task to bring, and the poison buff is triggered.

 
Example assignment

Code:
<quest id="DVDWrongTurn">
		<property name="name_key" value="DVDWrong_Turn"/>
		<property name="subtitle_key" value="Destroy_zombie_cannibals_subtitle"/>
		<property name="description_key" value="DVDWrongTurn_Desc"/>
		<property name="icon" value="server_feral"/>
        <property name="repeatable" value="true"/>
		<property name="category_key" value="challenge"/>
		<property name="offer_key" value="DVDWrongTurn_offer"/>
		<property name="difficulty_tier" value="0"/>
		<property name="shareable" value="true"/>

        <objective type="RandomPOIGoto">
			<property name="phase" value="1"/>						
			<property name="nav_object" value="quest"/>
			<property name="poi_tier" value="1"/>
		</objective>

        <objective type="RallyPoint">
			<property name="phase" value="2"/>
			<property name="nav_object" value="rally"/>
		</objective>

		<objective type="ClearSleepers">
			<property name="phase" value="3"/>
			<property name="nav_object" value="sleeper_volume"/>
		</objective>

		<objective type="POIStayWithin">
			<property name="phase" value="3"/>
			<property name="radius" value="25"/>
		</objective>

		<action type="UnlockPOI" >
			<property name="phase" value="4"/>
		</action>

        <reward type="Exp" value="500"/>
		<reward type="Item" id="casinoCoin" value="500"/>
    </quest>
 
Last edited by a moderator:
It sounds like you want a quest action that will add (and possibly remove) a buff. Vanilla does not have those actions.

However, there is an action that will add an action sequence from gameevents.xml. It's the "GameEvent" action type, and the action sequence is specified in the "event" attribute value.

So, you could make your own action sequence that adds the buff you want. This is done with the "AddBuff" action, there are many examples in gameevents.xml.

Action sequences aren't "removed," so if you need the buff to be removed by the quest (and not just run out on its own, or be "cured" by a quest reward item, or whatever), then you'll need a second action sequence that removes the buff. This is done with the "RemoveBuff" action.

Another option is to use SphereII's SCore mod (which is more like a set of C# classes for other modders to use, and powers a whole lot of things, like food spoilage, NPCs, etc.). It has a new quest action called "GiveBuffSDX". But it doesn't seem to have any custom quest action to remove a buff, so if you still need to do that, then you'll need to use an action sequence.

There might be other ways to do it, but I can't think of any.

 
It sounds like you want a quest action that will add (and possibly remove) a buff. Vanilla does not have those actions.

However, there is an action that will add an action sequence from gameevents.xml. It's the "GameEvent" action type, and the action sequence is specified in the "event" attribute value.

So, you could make your own action sequence that adds the buff you want. This is done with the "AddBuff" action, there are many examples in gameevents.xml.

Action sequences aren't "removed," so if you need the buff to be removed by the quest (and not just run out on its own, or be "cured" by a quest reward item, or whatever), then you'll need a second action sequence that removes the buff. This is done with the "RemoveBuff" action.

Another option is to use SphereII's SCore mod (which is more like a set of C# classes for other modders to use, and powers a whole lot of things, like food spoilage, NPCs, etc.). It has a new quest action called "GiveBuffSDX". But it doesn't seem to have any custom quest action to remove a buff, so if you still need to do that, then you'll need to use an action sequence.

There might be other ways to do it, but I can't think of any.
Thanks for the answer. I'll try to do as you wrote and post the results here.

 
It sounds like you want a quest action that will add (and possibly remove) a buff. Vanilla does not have those actions.

However, there is an action that will add an action sequence from gameevents.xml. It's the "GameEvent" action type, and the action sequence is specified in the "event" attribute value.

So, you could make your own action sequence that adds the buff you want. This is done with the "AddBuff" action, there are many examples in gameevents.xml.

Action sequences aren't "removed," so if you need the buff to be removed by the quest (and not just run out on its own, or be "cured" by a quest reward item, or whatever), then you'll need a second action sequence that removes the buff. This is done with the "RemoveBuff" action.

Another option is to use SphereII's SCore mod (which is more like a set of C# classes for other modders to use, and powers a whole lot of things, like food spoilage, NPCs, etc.). It has a new quest action called "GiveBuffSDX". But it doesn't seem to have any custom quest action to remove a buff, so if you still need to do that, then you'll need to use an action sequence.

There might be other ways to do it, but I can't think of any.
I did as you advised. Everything works great.

added a new buff to the game

<buff name="buffInfectionPlague" name_key="buffInfectionPlagueName" description_key="buffInfectionPlagueDesc" showonhud="true" icon="SignPlague" icon_color="255,0,0" icon_blink="true">
<stack_type value="ignore"/>
<duration value="0"/>
<update_rate value="1"/>

<effect_group>
<passive_effect name="HealthChangeOT" operation="base_subtract" value="1">
<requirement name="RandomRoll" seed_type="Random" min_max="0,100" operation="LTE" value="5"/>
</passive_effect>
</effect_group>
</buff>


added an event in the game

<append xpath="/gameevents">

<action_sequence name="InfectionPlague">
<property name="allow_user_trigger" value="false" />
<property name="action_type" value="Game" />

<action class="AddBuff">
<property name="buff_name" value="buffInfectionPlague"/>
</action>
</action_sequence>

</append>


added event activation to the task

<quest id="Note1PlagueDoctor">
<property name="name_key" value="Note1Plague_Doctor"/>
<property name="subtitle_key" value="Note1PlagueDoctor_subtitle"/>
<property name="description_key" value="Note1PlagueDoctor_Desc"/>
<property name="icon" value="server_feral"/>
<property name="repeatable" value="true"/>
<property name="category_key" value="challenge"/>
<property name="offer_key" value="Note1PlagueDoctor_offer"/>
<property name="difficulty_tier" value="0"/>
<property name="shareable" value="false"/>

<objective type="RandomPOIGoto">
<property name="phase" value="1"/>
<property name="nav_object" value="quest"/>
<property name="poi_tier" value="1"/>
</objective>

<objective type="RallyPoint">
<property name="phase" value="2"/>
<property name="nav_object" value="rally"/>
<property name="activate_event" value="InfectionPlague"/>
</objective>

<objective type="ClearSleepers">
<property name="phase" value="3"/>
<property name="nav_object" value="sleeper_volume"/>
</objective>

<objective type="POIStayWithin">
<property name="phase" value="3"/>
<property name="radius" value="25"/>
</objective>

<action type="UnlockPOI" >
<property name="phase" value="4"/>
</action>

<reward type="Exp" value="500"/>
<reward type="Item" id="casinoCoin" value="500"/>
<reward type="Item" id="BagPlagueDoctor2"/>
</quest>


Now by activating the task my character becomes infected with the plague. If you are interested in what I did and what came out of it - link to my mod https://7daystodiemods.com/plague-doctor/

 
Back
Top