7 Days to Die

7 Days to Die

View Stats:
JoeSloeMoe Oct 1, 2023 @ 2:40pm
How to count zombie kills
I'm trying to set something up where, after a certain number of zombie kills, the player gets a small rewards I tried setting a starter quest to kill x number of zombies but cant get it to work.

As far as I can tell there are no objective types for "kill Zombie'. I notice in DF he is using "ZombieKill" but I believe that been added in code. (have an xml only mod project going). I also considered adding a buff but am still trying to understand the buffDeadEye code, which is counting successive kills.

Does anyone know how I might track the number of Zombie kills either explicitly through a quest or in the background (e,g dont know if I can create an Event that fires at X number of kills)
Could also maybe use Player level rather than zombie kills.
Cheers
Last edited by JoeSloeMoe; Oct 1, 2023 @ 2:57pm
< >
Showing 1-6 of 6 comments
JoeSloeMoe Oct 1, 2023 @ 3:19pm 
Am thinking I can use this maybe:
Add this to a perk
<triggered_effect trigger="onSelfKilledOther" action="AddBuff" buff="buffCountKills"/>
then assign the perk in the startup quest
buffCountKills - counts to X then gives the bundle then quits
James Oct 1, 2023 @ 7:50pm 
If I'm understanding this right....wouldn't this objective type work?

<objective type="ZombieKill" id="quest- [ADD ZOMBIE NAMES]" value="x" />

I've never tried but in theory (or in my mind rather) it should.

If you are trying to chain into other quest (i.e part 1 is to kill 100 zombies, part 2 is kill 500, etc) you could add phase="x" after value.

You can also make it so the quests start after the basic survival in quests.xml if you wish (which would probably be more ideal).

<insertAfter xpath="/quests/quest[@id='quest_whiteRiverCitizen1']/reward[@type='Exp']" >
<reward type="Quest" id="(INSERT YOUR QUEST NAME HERE)">
<property name="chainquest" value="false"/> </reward>
</insertAfter>
JoeSloeMoe Oct 1, 2023 @ 9:23pm 
Thanks for the reply. I get the following error when using the ZombieKill type:
>>No objective class 'ZombieKill found!
So I dont seem to be able to define a quest to track number of zombie kills.

I can track the number of kills using a buff in buffs.xml
<triggered_effect trigger="onSelfKilledOther" action="ModifyCVar" cvar="$buffKillZomiesChangedDuration" operation="subtract" value="1" />

So I can count down the number of kills . But I cant give myself a reward from the buff. The line:
<reward type="Item" id="resourceZombieKillsBundle" value="1" />
Doesnt do anytthing
I have tested the resourceZombieKillsBundle, so its a valid resource.

Anyone know how to give the player a resource outside of a quest?
JoeSloeMoe Oct 1, 2023 @ 10:57pm 
If anyone is interested, I figured out how to monitor the killcount and then give a reward after x kills:

//I created a Buff called 'buffKillZomiesCount' that updates (or counts down in this case) a var for each zombie kill using
'onSelfKilledOther' - code is:
<effect_group>
<triggered_effect trigger="onSelfKilledOther" action="ModifyCVar" cvar="$buffKillZomiesCountDuration" operation="subtract" value="1" >
<requirement name="EntityTagCompare" target="other" tags="walker,crawler,spider,zombie,feral,radiated"/>
</triggered_effect>
</effect_group>

//Then when the count gets to 0 I call an Event
<triggered_effect trigger="onSelfBuffUpdate" action="CallGameEvent" event="action_give_KillZombieReward">

<requirement name="CVarCompare" cvar="$buffKillZomiesCountDuration" operation="LTE" value="0"/>
</triggered_effect>


//in game events.xml I created an event with the main action being giving out the reward:
<append xpath="/gameevents">
<action_sequence name="action_give_KillZombieReward">
<action class="AddItems">
<property name="added_items" value="myRewardBundle"/>
<property name="added_item_counts" value="1"/>
</action>
</action_sequence>
</append>

//need to confirm I can add the buff on new start (quest_BasicSurvival1) using:
<property name="add_buffs" value="buffKillZomiesCount" /> or similar
Last edited by JoeSloeMoe; Oct 2, 2023 @ 12:09am
James Oct 2, 2023 @ 6:03am 
Glad you got it worked out. Kudos for posting how you did it, just in case anyone else goes searching for it. I think we all at some point went searching for something and the OP just says "got it work" without explaining what they did it. :steamthumbsup:
JoeSloeMoe Oct 2, 2023 @ 5:19pm 
Edited as there was a better way to add the buff to the player at startup:
In my buffs.xml file I added the following:
<append xpath="/buffs/buff[starts-with(@name, 'buffStatusCheck01')]">
<effect_group>
<triggered_effect trigger="onSelfBuffUpdate" action="AddBuff" buff="buffKillZomiesChanged">
<requirement name="!HasBuff" buff="buffGameEventController"/>
</triggered_effect>
</effect_group>
</append>
This will add the buff to the player on first spawn and on respawn after death correctly.
The buff: buffStatusCheck01 is a system buff that runs on initialisation
Last edited by JoeSloeMoe; Oct 3, 2023 @ 7:05pm
< >
Showing 1-6 of 6 comments
Per page: 1530 50

Date Posted: Oct 1, 2023 @ 2:40pm
Posts: 6