About adding Blueprint Components during gameplay
Is there a way to add blueprint component form class, just like when you spawn an actor blueprint?
If there isn't is it something that i can expect to be added in a later version of the engine? (Also being able to properly use exposed variables with blueprint components would be nice.)
If both are out of the question, maybe someone have a suggestion for how i can handle this?:
What I'm using it for is; when a character in the game is affected by something, such as poison or is bleeding I add a blueprint component that will constantly deal damage to the player, the reason why I spawn a blueprint component is because one character can be affected by several damage over time events at one time so using a function doesn't work, that's why I went with blueprint components. I kinda want to hear opinions, is there a smarter way to handle this and similar scenarios?
asked Jan 23 '16 at 05:42 PM in Blueprint Scripting
By damaging the actor/player, all you are doing is manipulating data. You don't want to be spawning individual objects just to do this, it is highly inefficient.
-You might want to, for example, have 2 arrays (or a Map if you are working with C++)
-one array holds a value of "seconds remaining for this Damage-over-time", one holds a "value of damage tick" -Then every certain amount of time (every 1 second for example), decrease all values in the Time array by 1 and apply damage = the sum of all values of the second array
-When the value in the first array gets to 0, delete it that index from both arrays so that the damage corresponding to that entry will no longer be added
-On new damage applications you can either modify existing entries or add an entirely new entry to have DoTs stack
Let me know if you need more help
Follow this question
Once you sign in you will be able to subscribe for any updates here