By LadylexUK (Feb 2015)
Copied from ProjectSpark.com
Fiery Sword with damage over time
There was a discussion back in Dec 2013 about how to apply Damage over time from wounds inflicted with a fiery sword. A solution was put forward by Grimatoma which didn’t quite work when I tested it, but here is my adaptation of his Kode which does work.
When you hit an enemy with your fiery sword they will catch fire and their health will decrease over a time of your choosing.
First make your fiery sword. I placed a fire effect as an attachment (centre socket) to a standard sword using Character Studio. Renamed as Fiery sword.
…WHEN [attack hit][enemies] DO
…/…WHEN DO [it][numvar:duration][=] // how long you want him to burn
…/…WHEN DO [it][numvar:damage][=] // how much damage the burn will inflict per second
…/…WHEN DO [it][boolvar:burning][=][true] // tells the enemy he is on fire
In all enemy brains
…WHEN [duration timer][numvar:duration] DO
…/…WHEN DO [play fx][Burning Aura][on][me]
…/…WHEN [countdown timer][loop] DO [damage][me][numvar:damage][without hit reaction]
…WHEN [countdown timer][numvar:duration] DO [boolvar:burning][=][false] // without this you cannot get a second damage loop
Here’s a little visual effect you may want to add.
as a child line to the duration timer
…/…WHEN [timer seconds remaining][equals] DO [solid color][=][black]
This will turn your enemy completely black as if burnt, 2 seconds before they stop burning the first time you hit them.