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

How do Buffs work in xml? Does this buff work?

NeonScorpion

New member
hello, i'm pretty new to coding and moding. I picked it up and have had a lot of fun learning how to change the game. I'm working on making a Dead Island style Weapon Modification system as a personal project to cut my teeth on. I am currently making the different variations of weapons and the different levels of modifications that can be applied to them. I am making 4 levels of a fire modification to put on weapons, I made this code but I still don't quite understand what some of it means so i copied it blindly. I tested the weapon out in game but because I'm unable to see health I have no idea if its actually doing damage or works at all. the particle effects spawn but I have no idea if the fire is actually damaging the zombie.

Here is the code I have for the beginner fire mod. A quick basic, for dummies breakdown of what each part of the code does and if I need to modify it to get what I'm looking for would be great. Its supposed to set zombies on fire and do 10 damage a second for 5 seconds, for a total of 50 damage (I dont know if thats a lot/too weak). Please let me know if anything needs to change to complete that goal and why so I know what I'm doing with the other 3 modifications. Thanks!

Code:
<buff id="weaponFire" mutex="cannotBreath,drowning,extinguishFireBuff" debuffif="+water > 1" duration="5" stack="reset" ffcheck="true" actions="debuff(burningSmall);attach(ParticleEffects/p_onFire, @impact);damage(0,1,0,1);damage(0,3,0,0)" icon="ui_game_symbol_fire" name_key="weaponFire" description_key="weaponFireDesc" tooltip_key="burningTooltip" cures="canBoiledWater,bottledWater,goldenRodTea,redTea">
<modify id="0" stat="health" amount="-10" rate="1" duration="5"/>
</buff>
Moderator note: one thread per topic, please

 
Last edited by a moderator:
I will see if I can break this down for you a bit :D

buff id: This is just the name of the buff you want it to have and you call it using this name from other XML files or this one.

mutex: Short for 'mutually exclusive'. It says "if you have any of these buffs, this one can't fire"

debuffif: This means that if you meet any of the following conditions, the buff will end. So this one says to debuff the weaponFire buff if +water > 0, where +water is the amount of time the entity has been wet (I think).

duration: The amount of time that the buff will last.

stack: This has a few states but essentially this tells the buff what to do if multiple of the same buff are applied. I could probably best explain it with scenarios.

Scenario: You fire a bullet that triggers the bulletFire buff on a zombie. 3 seconds later, you fire another round and the same bulletFire buff is applied again.

The following stack states would apply best in this case:

stack="reset": The reset will cancel the first bulletFire buff and start a second one. The total burn time will be 8 seconds.

stack="extend": The extend will essentially add 5 seconds to the duration and the bulletFire buff will last for a total of 10 seconds.

ffcheck: I'm really not sure about this one.

actions: This is where you can specify the buff to change other buff variables, debuff some buffs, do damage, attach particle effects. This is documented in the XML on all the different actions, see the very top of the buff file.

icon: This will be the icon that displays if you have the buff. The one that's currently set is ui_game_symbol_burning but you can change it to another symbol. There is a thread here that has all of them if you want to see them all. You can also make and import your own, but that's for another time.

name_key: This is used by the localization.txt file to change your buff name into something more readable. Your best bet is to do

Code:
name_key="bulletFire"
and then in your localization.txt add the following on a newline:

Code:
bulletFire,buffs,buff,EnChanged,"Incendary Round Burning",,,,
description_key: This is used by the localization.txt file to add a description for the buff. Your best bet is to do

Code:
description_key="bulletFireDesc"
and then in your localization.txt add the following on a newline:

Code:
bulletFireDesc,buffs,buff,EnChanged,"You've been shot with an incendiary round and taking burning damage. Better extinguish yourself fast!",,,,
tooltip_key: This is used by the localization.txt file to display the tooltip that shows just above the hotbar when you get the buff. The best bet is

Code:
tooltip_key="bulletFireTooltip"
and then in your localization.txt add the following on a newline:

Code:
bulletFireTooltip,buffs,buff,EnChanged,"You're on fire! Better extinguish yourself fast!",,,,
cures: This states which items can be used to cure the buffs and it will populate the list of cures in the character window when you highlight over the buff. However you also need to add the appropriate debuffs into the items.xml file (this only displays cures, but does not actually make that item cure you, as far as I know)

Now for this bit:

<modify id="0" stat="health" amount="-10" rate="1" duration="5"/>

This essentially says: Take the health parameter on the entity, and reduce it by 10 points every second for 5 seconds.

Other parameters are available as well, such as stamina, movement speed... Have a play around. :D

As for whether the damage is being done: Yes it will be. If you can see the flame particles, it's working :D Try shooting once and let the buff expire and then repeat until the zombie dies, you may see it just fall over on its own and that would indicate that the buff is working :D

 
Back
Top