[Build Jam] Dungeon Master - Elemental Damage System

INFORMATION

Package Name: Elemental Damage System

Package Description:
A framework for setting up elemental damage types. This involves damage sources that inflict elemental damage; and damage targets that can have modifiers for specific elements to determine strength/weakness towards different elements

Creator: cykocys

IMPORTANT

This package expects the healthScript to be on the Player. Alternatively a custom solution will also work so long as it implements the OnDamage() function.

Some level of comfort with calling a function from code or through triggers is requred to make use of this package.

There are future plans to implement Status Effects to this system. Such as being able to apply a Burning effect that damages a player over time for a certain duration

INITIAL SET UP

Add EDSPlayer template to your Player template
image


Add EDSUser template to your User template
image

SETTING UP ELEMENTAL MODIFIERS

To define strengths and weakness to elements add an EDSelementModRule script to the EDSUser
You can define if a user is completely Immune to an element therefore ignoring all damage and effects (coming soon). You can also define a Damage Multiplier. Increase this to increase damage taken from an element, decrease it to reduce damage.

For instance: Setting the multiplier to 0.5 would cause the user to only take half the damage of the source. Setting it to 2.0 would cause double damage.

SETTING UP A DAMAGE SOURCE

To inflict elemental damage add an EDSsource script to the source entity. A few parameters are available to adjust the type of damage and the amount. Flat damage is a raw number value where is Percentage damage is calculated as a percentage of the target’s total HP
image

DOING DAMAGE TO A TARGET

To inflict damage on a target call DoDamage(target)
on the EDSsource script by passing it the target you’d like to inflict the damage on. A valid target would be a Player that has the EDSPlayer template on them.

You can obtain the target however you like. Through trigger events, rayCasts or any other means. This is entirely up to you.

An Example of causing elemental damage to a Player that enters a trigger

MORE ADVANCED USERS

Element modifiers can be modified at run time. This opens up the door to mechanics that can change a players resistance or weakness towards an element. Perhaps equipment that makes the more resistant to an element.

To change the resistance for an element at run-time; on the User call :

SetElementMods(element, hasImmunity, multiplier)

element - string, should be the name of the element
hasImmnity - boolean
multiplier - number

SetElementMods() exists on the EDSelementModTable script and is part of the EDSuser template (script folder)

1 Like