Hey I am having no luck with this, somebody out there has to know how to do this efficiently.
I’m wanting to change the color of a Niagara effect on spawn based on element so I can minimize Niagara files and not overload the database with a million different colored effects. To do this I’m referencing damage types. What I need is some sort of if:then of some sort of permanency and organization. If: DamageType = fire, then return LinearColorFire, input that to Niagara value Particle.color. That sort of thing. The problem I’m having is the if:then variables. I feel like Maps could be used for this? But I can’t quite figure out how.
Part of the issue is I’m not sure how to ASK the question, so forum searching, google, even chat GPT have served me poorly.
I mean I can build a tall “=Class” branch chain but there has to be a better way using Maps, Arrays, Sets, Structs, a data table… something.
I need: a query of (class) DamageType variable, to determine LinearColor variable. That’s it.
I have both variables. I just need A to determine B.
it looks like you’re trying to use a single input class to trigger some particular output Color. You’re performing a check in order from top to bottom. I mean you’re right there with the what you want to do, you want to either use a map (which can take a key:value pair and store it in an array of key:value pairs) or a DataTable (Stores an array of structs of various data types to be referenced by row, column or name).
Maps: can be created using the Editor by adding a variable of the desired Key type, this is the key to recalling information and cannot be a Boolean value, as those are only ever true/false:
This is useful you want this simple pair relationship like what you’ve got up top. If the list is going to be long or include more than two components, consider using DataTables.
For what we’ve got here, using a Map should suffice: